[tor-commits] [vidalia/alpha] Adds a tray icon notification for the clock skewed problem

chiiph at torproject.org chiiph at torproject.org
Mon Jan 23 16:45:42 UTC 2012


commit 51f6a7714958ca5d636e9ede9c84d6cebc5157e6
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Thu Jan 19 15:43:35 2012 -0300

    Adds a tray icon notification for the clock skewed problem
---
 src/vidalia/MainWindow.cpp |   23 +++++++++++++++++++++++
 src/vidalia/MainWindow.h   |    3 +++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 183e78f..09b70ac 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -264,6 +264,27 @@ MainWindow::createTrayMenu()
   return menu;
 }
 
+/** Called when tor detects a problem with the system clock */
+void
+MainWindow::clockSkewed(int skew, const QString &source)
+{
+  if (source.startsWith("OR:", Qt::CaseInsensitive)) {
+    // Tor versions 0.2.1.19 and earlier, and 0.2.2.1 and earlier, throw
+    // this message a little too liberally in this case.
+    quint32 torVersion = Vidalia::torControl()->getTorVersion();
+    if (torVersion <= 0x00020113)
+      return;
+    QString str = Vidalia::torControl()->getTorVersionString();
+    if (str.startsWith("0.2.2.") && torVersion <= 0x00020201)
+      return;
+  }
+
+  _trayIcon.showMessage(tr("Your clock is wrong"),
+                        tr("Your computer's clock is wrong, tor may not work as "
+                           "expected. Please check the Message Log for more information."));
+}
+
+
 /** Creates a tray icon with a context menu and adds it to the system
  * notification area. On Mac, we also set up an application menubar. */
 void
@@ -385,6 +406,8 @@ MainWindow::createConnections()
   connect(_torControl, SIGNAL(authenticated()), this, SLOT(authenticated()));
   connect(_torControl, SIGNAL(authenticationFailed(QString)),
           this, SLOT(authenticationFailed(QString)));
+  connect(_torControl, SIGNAL(clockSkewed(int, QString)),
+          this, SLOT(clockSkewed(int, QString)));
 
   _torControl->setEvent(TorEvents::GeneralStatus);
   connect(_torControl, SIGNAL(dangerousTorVersion(tc::TorVersionStatus,
diff --git a/src/vidalia/MainWindow.h b/src/vidalia/MainWindow.h
index 834d6c1..5ffa794 100644
--- a/src/vidalia/MainWindow.h
+++ b/src/vidalia/MainWindow.h
@@ -159,6 +159,9 @@ private slots:
   /** Called when trying to close a tab that has been detached */
   void handleAttachedClose();
 
+  /** Called when tor detects a problem with the system clock */
+  void clockSkewed(int skew, const QString &source);
+
 #if defined(USE_AUTOUPDATE)
   /** Called when the user clicks the 'Check Now' button in the General
    * settings page. */





More information about the tor-commits mailing list