[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2041: Disable the "Help censored users..." radio button if the use (in trunk: . src/gui/config)
Author: edmanm
Date: 2007-10-19 00:54:09 -0400 (Fri, 19 Oct 2007)
New Revision: 2041
Modified:
trunk/
trunk/src/gui/config/serverpage.cpp
trunk/src/gui/config/serverpage.h
Log:
r2141@lysithea: edmanm | 2007-10-19 00:53:41 -0400
Disable the "Help censored users..." radio button if the user starts a Tor
that does not support bridges. Also, if the user tries to set up a bridge
server while Tor is not running, and then starts a Tor that does not support
bridges, warn them and suggest they upgrade or run a normal relay.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2141] on dc66be73-d13e-47ba-a267-8dc7cda68c65
Modified: trunk/src/gui/config/serverpage.cpp
===================================================================
--- trunk/src/gui/config/serverpage.cpp 2007-10-19 04:54:00 UTC (rev 2040)
+++ trunk/src/gui/config/serverpage.cpp 2007-10-19 04:54:09 UTC (rev 2041)
@@ -26,8 +26,10 @@
*/
#include <vidalia.h>
-#include <gui/common/vmessagebox.h>
+#include <vmessagebox.h>
+#include <util/html.h>
+#include "configdialog.h"
#include "serverpage.h"
#include "ipvalidator.h"
#include "portvalidator.h"
@@ -99,6 +101,10 @@
this, SLOT(serverModeChanged(bool)));
connect(ui.rdoBridgeMode, SIGNAL(toggled(bool)),
this, SLOT(serverModeChanged(bool)));
+ connect(Vidalia::torControl(), SIGNAL(authenticated()),
+ this, SLOT(onAuthenticated()));
+ connect(Vidalia::torControl(), SIGNAL(disconnected()),
+ this, SLOT(onDisconnected()));
/* Set validators for address, mask and various port number fields */
ui.lineServerNickname->setValidator(new NicknameValidator(this));
@@ -116,6 +122,42 @@
delete _settings;
}
+/** Called when Vidalia has authenticated to Tor. If the user's Tor is not
+ * recent enough, this disables the bridge server option and displays a
+ * warning if the user had previously configured Tor as a bridge. */
+void
+ServerPage::onAuthenticated()
+{
+ quint32 torVersion = Vidalia::torControl()->getTorVersion();
+ if (torVersion < 0x020003) {
+ ui.rdoBridgeMode->setEnabled(false);
+ if (ui.rdoBridgeMode->isChecked()) {
+ int ret = VMessageBox::warning(this,
+ tr("Bridge Support Unavailable"),
+ p(tr("You have configured Tor to act as a bridge server "
+ "for censored users, but your version of Tor does not "
+ "support bridges.")) +
+ p(tr("Please upgrade your Tor software or configure Tor to "
+ "act as a normal relay server.")),
+ VMessageBox::ShowSettings|VMessageBox::Default,
+ VMessageBox::Cancel);
+ if (ret == VMessageBox::ShowSettings) {
+ ConfigDialog *dialog = dynamic_cast<ConfigDialog *>(window());
+ if (dialog)
+ dialog->showWindow(ConfigDialog::Server);
+ }
+ }
+ }
+}
+
+/** Called when Vidalia disconnects from Tor. This method reenables the bridge
+ * server option. */
+void
+ServerPage::onDisconnected()
+{
+ ui.rdoBridgeMode->setEnabled(true);
+}
+
/** Called when the user toggles any one of the server mode radio buttons
* and hides or displays the server configuration tabs appropriately. */
void
Modified: trunk/src/gui/config/serverpage.h
===================================================================
--- trunk/src/gui/config/serverpage.h 2007-10-19 04:54:00 UTC (rev 2040)
+++ trunk/src/gui/config/serverpage.h 2007-10-19 04:54:09 UTC (rev 2041)
@@ -76,6 +76,13 @@
void rateChanged(int rate);
/** Called when the user edits the max or average bandwidth limits. */
void customRateChanged();
+ /** Called when Vidalia has authenticated to Tor. If the user's Tor is not
+ * recent enough, this disables the bridge server option and displays a
+ * warning if the user had previously configured Tor as a bridge. */
+ void onAuthenticated();
+ /** Called when Vidalia disconnects from Tor. This method reenables the
+ * bridge server option. */
+ void onDisconnected();
private:
/** Index values of rate values in the bandwidth limits dropdown box. */