[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r4102: Squelch subsequent ACCEPTED_SERVER_DESCRIPTOR events after t (vidalia/trunk/src/vidalia/log)



Author: edmanm
Date: 2009-09-01 20:08:02 -0400 (Tue, 01 Sep 2009)
New Revision: 4102

Modified:
   vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
   vidalia/trunk/src/vidalia/log/StatusEventWidget.h
Log:

Squelch subsequent ACCEPTED_SERVER_DESCRIPTOR events after the first. Also
fix an incorrect image file name and clean up some trailing whitespace.


Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp	2009-09-01 16:23:06 UTC (rev 4101)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp	2009-09-02 00:08:02 UTC (rev 4102)
@@ -47,8 +47,8 @@
   connect(tc, SIGNAL(disconnected()), this, SLOT(disconnected()));
   connect(tc, SIGNAL(dangerousTorVersion(tc::TorVersionStatus, QString,
                                          QStringList)),
-         this, SLOT(dangerousTorVersion(tc::TorVersionStatus, QString,
-                                        QStringList)));
+          this, SLOT(dangerousTorVersion(tc::TorVersionStatus, QString,
+                                         QStringList)));
   connect(tc, SIGNAL(circuitEstablished()), this, SLOT(circuitEstablished()));
   connect(tc, SIGNAL(bug(QString)), this, SLOT(bug(QString)));
   connect(tc, SIGNAL(clockSkewed(int, QString)),
@@ -255,6 +255,8 @@
     tr("Click \"Start Tor\" in the Vidalia Control Panel to restart the Tor "
        "software. If Tor exited unexpectedly, select the \"Advanced\" tab "
        "above for details about any errors encountered."));
+
+  _squelchDescriptorAcceptedEvent = false;
 }
 
 void
@@ -270,7 +272,7 @@
     icon = addBadgeToPixmap(":/images/48x48/tor-logo.png",
                             ":/images/32x32/security-medium.png");
 
-    description = 
+    description =
       tr("You are currently running version \"%1\" of the Tor software, which "
          "is no longer recommended. Please upgrade to the most recent version "
          "of the software, which may contain important security, reliability "
@@ -330,14 +332,14 @@
                                   ":/images/48x48/dialog-warning.png");
 
   if (skew < 0) {
-    description = 
+    description =
       tr("Tor has determined that your computer's clock may be set to %1 "
          "seconds in the past compared to the source \"%2\". If your "
          "clock is not correct, Tor will not be able to function. Please "
          "verify your computer displays the correct time.").arg(qAbs(skew))
                                                            .arg(source);
   } else {
-    description = 
+    description =
       tr("Tor has determined th at your computer's clock may be set to %1 "
          "seconds in the future compared to the source \"%2\". If "
          "your clock is not correct, Tor will not be able to function. Please "
@@ -385,7 +387,7 @@
 
   if (type == tc::DangerousSocksTypeError) {
     icon  = addBadgeToPixmap(icon, ":/images/32x32/security-medium.png");
-    
+
     title = tr("Potentially Dangerous Connection!");
     description =
       tr("One of your applications established a connection through Tor "
@@ -417,11 +419,11 @@
   addNotification(icon, title, description);
 }
 
-void 
+void
 StatusEventWidget::externalAddressChanged(const QHostAddress &ip,
                                           const QString &hostname)
 {
-  QString hostString = hostname.isEmpty() ? QString() 
+  QString hostString = hostname.isEmpty() ? QString()
                                           : QString(" (%1)").arg(hostname);
 
   addNotification(QPixmap(":/images/48x48/applications-internet.png"),
@@ -515,19 +517,19 @@
   if (reachable) {
     icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-ok-apply.png");
     title = tr("Directory Port Reachability Test Successful!");
-    description = 
+    description =
       tr("Your relay's directory port is reachable from the Tor network!");
   } else {
     icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-warning.png");
     title = tr("Directory Port Reachability Test Failed");
-    description = 
+    description =
       tr("Your relay's directory port is not reachable by other Tor clients. "
          "This can happen if you are behind a router or firewall that requires "
          "you to set up port forwarding. If %1:%2 is not your correct IP "
          "address and directory port, please check your relay's configuration.")
                                                 .arg(ip.toString()).arg(port);
   }
-  
+
   addNotification(icon, title, description);
 }
 
@@ -537,7 +539,7 @@
                                             const QString &reason)
 {
   QPixmap icon =
-    addBadgeToPixmap(":/images/48x48/preferences-system-networking.png",
+    addBadgeToPixmap(":/images/48x48/preferences-system-network-sharing.png",
                      ":/images/32x32/dialog-warning.png");
 
   addNotification(icon,
@@ -551,8 +553,15 @@
 StatusEventWidget::serverDescriptorAccepted(const QHostAddress &ip,
                                             quint16 port)
 {
+  Q_UNUSED(ip);
+  Q_UNUSED(port);
+
+  if (_squelchDescriptorAcceptedEvent)
+    return;
+   _squelchDescriptorAcceptedEvent = true;
+
   QPixmap icon =
-    addBadgeToPixmap(":/images/48x48/preferences-system-networking.png",
+    addBadgeToPixmap(":/images/48x48/preferences-system-network-sharing.png",
                      ":/images/32x32/dialog-ok-apply.png");
 
   addNotification(icon,

Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.h
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.h	2009-09-01 16:23:06 UTC (rev 4101)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.h	2009-09-02 00:08:02 UTC (rev 4102)
@@ -214,6 +214,13 @@
    * \sa setMaximumItemCount()
    */
   int _maximumItemCount;
+
+  /** Tor sends a ACCEPTED_SERVER_DESCRIPTOR event every time it manages to
+   * upload the user's relay's descriptor to a directory authority. So we
+   * squelch any such events after the first to avoid blasting the user with
+   * "Hey, your relay is working!" messages.
+   */
+  bool _squelchDescriptorAcceptedEvent;
 };
 
 #endif