Re: [T(A)ILS-dev] About bridges support

Delete this message

Reply to this message
Author: anonym
Date:  
To: The T(A)ILS public development discussion list
Subject: Re: [T(A)ILS-dev] About bridges support
Since we've chosen the Vidalia approach to configure bridges, and since
we're already applying patches and building our own Vidalia, I've
written a small patch which adds a "-bridgeconf" commandline argument to
Vidalia. What it does is to simply make the network configuration
settings page (where bridges are configures) appear on start.

It's just a start, so there are some things TODO, but I feel it's very
important to guide our users this way. Thoughts?

Cheers!
diff -Naur vidalia-0.2.10.old/src/vidalia/MainWindow.cpp vidalia-0.2.10/src/vidalia/MainWindow.cpp
--- vidalia-0.2.10.old/src/vidalia/MainWindow.cpp    2010-08-26 18:55:53.000000000 +0200
+++ vidalia-0.2.10/src/vidalia/MainWindow.cpp    2011-02-04 02:20:31.007808000 +0100
@@ -212,6 +212,13 @@
   ui.chkShowOnStartup->setChecked(settings.showMainWindowAtStart());
   if (ui.chkShowOnStartup->isChecked())
     show(); 
+
+  /* TODO: don't do this if a valid bridge is present */
+  if (Vidalia::showBridgeConfOnStart()) {
+    showConfigDialog(ConfigDialog::Network);
+    showBridgeHelpMessageBox();
+  }
+
   /* Optimistically hope that the tray icon gets added. */
   _trayIcon.show();
 }
@@ -1722,6 +1729,22 @@
   showConfigDialog(ConfigDialog::Server);
 }


+/** Displays a help message explaining how to get and setup bridges. */
+void
+MainWindow::showBridgeHelpMessageBox()
+{
+  QString bridgeHelp;
+  QTextStream out(&bridgeHelp);
+
+  /* TODO: Insert instructions for how to get a bridge below, and how to add
+           then using the network configuration page. */
+  out << "Bridges are good!" << endl;
+  out << "Yes, get a bridge!" << endl;
+
+  VMessageBox::information(0, 
+    tr("Vidalia Bridge Help"), bridgeHelp, VMessageBox::Ok);
+}
+
 /** Called when the user selects the "New Identity" action from the menu. */
 void
 MainWindow::newIdentity()
diff -Naur vidalia-0.2.10.old/src/vidalia/MainWindow.h vidalia-0.2.10/src/vidalia/MainWindow.h
--- vidalia-0.2.10.old/src/vidalia/MainWindow.h    2010-02-25 05:03:32.000000000 +0100
+++ vidalia-0.2.10/src/vidalia/MainWindow.h    2011-02-04 02:20:23.249808000 +0100
@@ -113,6 +113,8 @@
   void showConfigDialog(ConfigDialog::Page page = ConfigDialog::General);
   /** Displays the Configuration dialog, set to the Server page. */
   void showServerConfigDialog();
+  /** Displays a help message explaining how to get and setup bridges. */
+  void showBridgeHelpMessageBox();
   /** Called when the "show on startup" checkbox is toggled. */
   void toggleShowOnStartup(bool checked);
   /** Called when the web browser or IM client have stopped */
diff -Naur vidalia-0.2.10.old/src/vidalia/Vidalia.cpp vidalia-0.2.10/src/vidalia/Vidalia.cpp
--- vidalia-0.2.10.old/src/vidalia/Vidalia.cpp    2010-08-26 19:30:56.000000000 +0200
+++ vidalia-0.2.10/src/vidalia/Vidalia.cpp    2011-02-04 02:27:45.144808000 +0100
@@ -41,14 +41,15 @@
 #include <stdlib.h>


 /* Available command-line arguments. */
-#define ARG_LANGUAGE   "lang"     /**< Argument specifying language.    */
-#define ARG_GUISTYLE   "style"    /**< Argument specfying GUI style.    */
-#define ARG_RESET      "reset"    /**< Reset Vidalia's saved settings.  */
-#define ARG_HELP       "help"     /**< Display usage informatino.       */
-#define ARG_DATADIR    "datadir"  /**< Directory to use for data files. */
-#define ARG_PIDFILE    "pidfile"  /**< Location and name of our pidfile.*/
-#define ARG_LOGFILE    "logfile"  /**< Location of our logfile.         */
-#define ARG_LOGLEVEL   "loglevel" /**< Log verbosity.                   */
+#define ARG_LANGUAGE   "lang"       /**< Argument specifying language.    */
+#define ARG_GUISTYLE   "style"      /**< Argument specfying GUI style.    */
+#define ARG_RESET      "reset"      /**< Reset Vidalia's saved settings.  */
+#define ARG_HELP       "help"       /**< Display usage informatino.       */
+#define ARG_DATADIR    "datadir"    /**< Directory to use for data files. */
+#define ARG_PIDFILE    "pidfile"    /**< Location and name of our pidfile.*/
+#define ARG_LOGFILE    "logfile"    /**< Location of our logfile.         */
+#define ARG_LOGLEVEL   "loglevel"   /**< Log verbosity.                   */
+#define ARG_BRIDGECONF "bridgeconf" /**< Display network conf on start.   */
 #define ARG_READ_PASSWORD_FROM_STDIN  \
   "read-password-from-stdin" /**< Read password from stdin. */


@@ -59,7 +60,7 @@
 TorControl* Vidalia::_torControl = 0;  /**< Main TorControl object.          */
 Log Vidalia::_log;
 QList<QTranslator *> Vidalia::_translators;
-
+bool Vidalia::_showBridgeConfOnStart = 0;


/** Catches debugging messages from Qt and sends them to Vidalia's logs. If Qt
* emits a QtFatalMsg, we will write the message to the log and then abort().
@@ -125,6 +126,9 @@
/* Set the GUI style appropriately. */
setStyle(_args.value(ARG_GUISTYLE));

+  if (_args.contains(ARG_BRIDGECONF))
+    _showBridgeConfOnStart = 1;
+
   /* Creates a TorControl object, used to talk to Tor. */
   _torControl = new TorControl();


@@ -218,6 +222,8 @@
   out << trow(tcol("-"ARG_LANGUAGE" &lt;language&gt;") + 
               tcol(tr("Sets Vidalia's language.") +
                    "<br>[" + LanguageSupport::languageCodes().join("|") + "]"));
+  out << trow(tcol("-"ARG_BRIDGECONF) + 
+              tcol(tr("Shows the bridge configuration dialog to the user immediately after Vidalia has started.")));
   out << "</table>";


   VMessageBox::information(0, 
diff -Naur vidalia-0.2.10.old/src/vidalia/Vidalia.h vidalia-0.2.10/src/vidalia/Vidalia.h
--- vidalia-0.2.10.old/src/vidalia/Vidalia.h    2009-06-25 04:56:47.000000000 +0200
+++ vidalia-0.2.10/src/vidalia/Vidalia.h    2011-02-04 01:57:57.122808000 +0100
@@ -74,6 +74,9 @@


/** Returns Vidalia's main TorControl object. */
static TorControl* torControl() { return _torControl; }
+
+ /** Returns true iff we should show the network config page on start */
+ static bool showBridgeConfOnStart() { return _showBridgeConfOnStart; }

   /** Returns the location Vidalia uses for its data files. */
   static QString dataDirectory();
@@ -158,6 +161,7 @@
   static TorControl* _torControl;      /**< Vidalia's main TorControl object.*/
   static Log _log; /**< Logs debugging messages to file or stdout. */
   static QList<QTranslator *> _translators; /**< List of installed translators. */
+  static bool _showBridgeConfOnStart;
 };


#endif