[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2177: Let the user know if their Tor is not so cool anymore. (in trunk: . src/gui)
Author: edmanm
Date: 2007-12-05 02:03:34 -0500 (Wed, 05 Dec 2007)
New Revision: 2177
Modified:
trunk/
trunk/src/gui/mainwindow.cpp
trunk/src/gui/mainwindow.h
Log:
r2230@lysithea: edmanm | 2007-12-05 02:03:28 -0500
Let the user know if their Tor is not so cool anymore.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2230] on 0108964c-5b0b-4c9e-969f-e2288315d100
Modified: trunk/src/gui/mainwindow.cpp
===================================================================
--- trunk/src/gui/mainwindow.cpp 2007-12-05 05:09:29 UTC (rev 2176)
+++ trunk/src/gui/mainwindow.cpp 2007-12-05 07:03:34 UTC (rev 2177)
@@ -31,12 +31,14 @@
#include <QtGui>
#include <QTimer>
+#include <QSysInfo>
#include <vidalia.h>
#include <file.h>
#include <html.h>
#include <stringutil.h>
#include <net.h>
-#include <QSysInfo>
+#include <clientstatusevent.h>
+#include <dangerousversionevent.h>
#include "common/vmessagebox.h"
#include "common/animatedpixmap.h"
@@ -148,7 +150,8 @@
connect(_torControl, SIGNAL(authenticated()), this, SLOT(authenticated()));
connect(_torControl, SIGNAL(authenticationFailed(QString)),
this, SLOT(authenticationFailed(QString)));
- _torControl->setEvent(TorEvents::ClientStatus, this, true);
+ _torControl->setEvent(TorEvents::ClientStatus, this, true);
+ _torControl->setEvent(TorEvents::GeneralStatus, this, true);
/* Catch signals when the application is running or shutting down */
connect(vApp, SIGNAL(running()), this, SLOT(running()));
@@ -204,10 +207,22 @@
{
if (event->type() == CustomEventType::ClientStatusEvent) {
ClientStatusEvent *cse = dynamic_cast<ClientStatusEvent *>(event);
+
if (cse && cse->status() == ClientStatusEvent::CircuitEstablished) {
circuitEstablished();
cse->accept();
}
+ } else if (event->type() == CustomEventType::GeneralStatusEvent) {
+ GeneralStatusEvent *gse = dynamic_cast<GeneralStatusEvent *>(event);
+
+ if (gse && gse->status() == GeneralStatusEvent::DangerousTorVersion) {
+ DangerousVersionEvent *dve = dynamic_cast<DangerousVersionEvent *>(gse);
+ if (dve && (dve->reason() == DangerousVersionEvent::OldVersion
+ || dve->reason() == DangerousVersionEvent::UnrecommendedVersion)) {
+ dangerousTorVersion();
+ }
+ gse->accept();
+ }
}
}
@@ -885,7 +900,9 @@
/* Check if Tor has a circuit established */
if (_torControl->circuitEstablished())
circuitEstablished();
-
+ /* Check the status of Tor's version */
+ if (_torControl->getTorVersion() >= 0x020001)
+ checkTorVersion();
}
/** Called when Vidalia fails to authenticate to Tor. The failure reason is
@@ -992,6 +1009,40 @@
updateTorStatus(CircuitEstablished);
}
+/** Checks the status of the current version of Tor to see if it's old,
+ * unrecommended, or obsolete. */
+void
+MainWindow::checkTorVersion()
+{
+ QString status;
+ if (_torControl->getInfo("status/version/current", status)) {
+ if (!status.compare("old", Qt::CaseInsensitive)
+ || !status.compare("unrecommended", Qt::CaseInsensitive)
+ || !status.compare("obsolete", Qt::CaseInsensitive)) {
+ dangerousTorVersion();
+ }
+ }
+}
+
+/** Called when Tor thinks its version if old or unrecommended, and displays a
+ * message notifying the user. */
+void
+MainWindow::dangerousTorVersion()
+{
+ static bool alreadyWarned = false;
+
+ if (!alreadyWarned) {
+ VMessageBox::information(this,
+ tr("Tor Update Available"),
+ p(tr("The currently installed version of Tor is out of date or no longer "
+ "recommended. Please visit the Tor website to download the latest "
+ "version."))
+ + p(tr("Tor website: https://www.torproject.org/")),
+ VMessageBox::Ok);
+ alreadyWarned = true;
+ }
+}
+
/** Creates and displays Vidalia's About dialog. */
void
MainWindow::showAboutDialog()
Modified: trunk/src/gui/mainwindow.h
===================================================================
--- trunk/src/gui/mainwindow.h 2007-12-05 05:09:29 UTC (rev 2176)
+++ trunk/src/gui/mainwindow.h 2007-12-05 07:03:34 UTC (rev 2177)
@@ -30,7 +30,6 @@
#include <QMainWindow>
#include <torcontrol.h>
-#include <circuitestablishedevent.h>
/* QSystemTrayIcon appeared in Qt 4.2, but we need a bugfix to it on Mac
* that won't appear until Qt 4.2.2. */
@@ -160,6 +159,12 @@
QByteArray loadControlCookie(QString cookiePath = QString());
/** Called when Tor has successfully established a circuit. */
void circuitEstablished();
+ /** Checks the status of the current version of Tor to see if it's old,
+ * unrecommended, or obsolete. */
+ void checkTorVersion();
+ /** Called when Tor thinks its version if old or unrecommended, and displays
+ * a message notifying the user. */
+ void dangerousTorVersion();
/** The current status of Tor. */
TorStatus _status;