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

[vidalia-svn] r4084: Add status event items for the SERVER_STATUS events. Current (in vidalia/trunk/src/vidalia: log res res/48x48)



Author: edmanm
Date: 2009-08-29 01:40:12 -0400 (Sat, 29 Aug 2009)
New Revision: 4084

Added:
   vidalia/trunk/src/vidalia/res/48x48/network-wired.png
Modified:
   vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
   vidalia/trunk/src/vidalia/log/StatusEventWidget.h
   vidalia/trunk/src/vidalia/res/vidalia.qrc
Log:

Add status event items for the SERVER_STATUS events. Currently the
reachability events are more annoying than useful because we seem to get
multiple CHECKING_REACHABILITY and REACHABILITY_FAILED events with the
same severity and no other distinguishing arguments. Also add a couple
convenience overloaded methods so I don't have to wrap qrc URLs in QPixmap
so much.


Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp	2009-08-29 02:05:22 UTC (rev 4083)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp	2009-08-29 05:40:12 UTC (rev 4084)
@@ -50,6 +50,22 @@
           this, SLOT(dangerousPort(quint16, bool)));
   connect(tc, SIGNAL(socksError(tc::SocksError, QString)),
           this, SLOT(socksError(tc::SocksError, QString)));
+  connect(tc, SIGNAL(externalAddressChanged(QHostAddress, QString)),
+          this, SLOT(externalAddressChanged(QHostAddress, QString)));
+  connect(tc, SIGNAL(dnsHijacked()), this, SLOT(dnsHijacked()));
+  connect(tc, SIGNAL(dnsUseless()), this, SLOT(dnsUseless()));
+  connect(tc, SIGNAL(checkingOrPortReachability(QHostAddress, quint16)),
+          this, SLOT(checkingOrPortReachability(QHostAddress, quint16)));
+  connect(tc, SIGNAL(orPortReachabilityFinished(QHostAddress, quint16, bool)),
+          this, SLOT(orPortReachabilityFinished(QHostAddress, quint16, bool)));
+  connect(tc, SIGNAL(checkingDirPortReachability(QHostAddress, quint16)),
+          this, SLOT(checkingDirPortReachability(QHostAddress, quint16)));
+  connect(tc, SIGNAL(dirPortReachabilityFinished(QHostAddress, quint16, bool)),
+          this, SLOT(dirPortReachabilityFinished(QHostAddress, quint16, bool)));
+  connect(tc, SIGNAL(serverDescriptorRejected(QHostAddress, quint16, QString)),
+          this, SLOT(serverDescriptorRejected(QHostAddress, quint16, QString)));
+  connect(tc, SIGNAL(serverDescriptorAccepted()),
+          this, SLOT(serverDescriptorAccepted()));
 
   setItemDelegate(new StatusEventItemDelegate(this));
 }
@@ -132,12 +148,26 @@
   return out;
 }
 
+QPixmap
+StatusEventWidget::addBadgeToPixmap(const QPixmap &pixmap,
+                                    const QString &badge)
+{
+  return StatusEventWidget::addBadgeToPixmap(pixmap, QPixmap(badge));
+}
+
+QPixmap
+StatusEventWidget::addBadgeToPixmap(const QString &pixmap,
+                                    const QString &badge)
+{
+  return StatusEventWidget::addBadgeToPixmap(QPixmap(pixmap), QPixmap(badge));
+}
+
 void
 StatusEventWidget::authenticated()
 {
   QString version = Vidalia::torControl()->getTorVersionString();
-  QPixmap icon = addBadgeToPixmap(QPixmap(":/images/48x48/tor-logo.png"),
-                                  QPixmap(":/images/32x32/dialog-ok-apply.png"));
+  QPixmap icon = addBadgeToPixmap(":/images/48x48/tor-logo.png",
+                                  ":/images/32x32/dialog-ok-apply.png");
   addNotification(icon,
     tr("The Tor Software is Running"),
     tr("You are currently running version \"%1\" of the Tor software.")
@@ -147,8 +177,8 @@
 void
 StatusEventWidget::disconnected()
 {
-  QPixmap icon = addBadgeToPixmap(QPixmap(":/images/48x48/tor-logo.png"),
-                                  QPixmap(":/images/32x32/edit-delete.png"));
+  QPixmap icon = addBadgeToPixmap(":/images/48x48/tor-logo.png",
+                                  ":/images/32x32/edit-delete.png");
 
   addNotification(icon,
     tr("The Tor Software is not Running"),
@@ -167,8 +197,8 @@
   QPixmap icon;
 
   if (reason == tc::UnrecommendedTorVersion) {
-    icon = addBadgeToPixmap(QPixmap(":/images/48x48/tor-logo.png"),
-                            QPixmap(":/images/32x32/security-medium.png"));
+    icon = addBadgeToPixmap(":/images/48x48/tor-logo.png",
+                            ":/images/32x32/security-medium.png");
 
     description = 
       tr("You are currently running version \"%1\" of the Tor software, which "
@@ -176,8 +206,8 @@
          "of the software, which may contain important security, reliability "
          "and performance fixes.").arg(version);
   } else if (reason == tc::ObsoleteTorVersion) {
-    icon = addBadgeToPixmap(QPixmap(":/images/48x48/tor-logo.png"),
-                            QPixmap(":/images/32x32/security-low.png"));
+    icon = addBadgeToPixmap(":/images/48x48/tor-logo.png",
+                            ":/images/32x32/security-low.png");
 
     description =
       tr("You are currently running version \"%1\" of the Tor software, which "
@@ -202,9 +232,8 @@
 void
 StatusEventWidget::bug(const QString &description)
 {
-  QString bugsUrl = "https://bugs.torproject.org/";;
-  QPixmap icon = addBadgeToPixmap(QPixmap(":/images/48x48/tor-logo.png"),
-                                  QPixmap(":/images/32x32/script-error.png"));
+  QPixmap icon = addBadgeToPixmap(":/images/48x48/tor-logo.png",
+                                  ":/images/32x32/script-error.png");
   addNotification(icon,
     tr("Tor Software Error"),
     tr("The Tor software encountered an internal bug. Please report the "
@@ -227,8 +256,8 @@
   }
 
   QString description;
-  QPixmap icon = addBadgeToPixmap(QPixmap(":/images/48x48/chronometer.png"),
-                                  QPixmap(":/images/48x48/dialog-warning.png"));
+  QPixmap icon = addBadgeToPixmap(":/images/48x48/chronometer.png",
+                                  ":/images/48x48/dialog-warning.png");
 
   if (skew < 0) {
     description = 
@@ -256,8 +285,8 @@
   QString description;
 
   if (rejected) {
-    icon = addBadgeToPixmap(QPixmap(":/images/48x48/applications-internet.png"),
-                            QPixmap(":/images/32x32/security-low.png"));
+    icon = addBadgeToPixmap(":/images/48x48/applications-internet.png",
+                            ":/images/32x32/security-low.png");
 
     description =
       tr("One of the applications on your computer may have attempted to "
@@ -266,8 +295,8 @@
          "recommended. For your protection, Tor has automatically closed this "
          "connection.");
   } else {
-    icon = addBadgeToPixmap(QPixmap(":/images/48x48/applications-internet.png"),
-                            QPixmap(":/images/32x32/security-medium.png"));
+    icon = addBadgeToPixmap(":/images/48x48/applications-internet.png",
+                            ":/images/32x32/security-medium.png");
     description =
       tr("One of the applications on your computer may have attempted to "
          "make an unencrypted connection through Tor to port %1. Sending "
@@ -285,10 +314,9 @@
   QPixmap icon = QPixmap(":/images/48x48/applications-internet.png");
 
   if (type == tc::DangerousSocksTypeError) {
-    icon  = addBadgeToPixmap(icon,
-                             QPixmap(":/images/32x32/security-medium.png"));
+    icon  = addBadgeToPixmap(icon, ":/images/32x32/security-medium.png");
+    
     title = tr("Potentially Dangerous Connection!");
-
     description =
       tr("One of your applications established a connection through Tor "
          "to \"%1\" using a protocol that may leak information about your "
@@ -296,18 +324,16 @@
          "only SOCKS4a or SOCKS5 with remote hostname resolution.")
                                                             .arg(destination);
   } else if (type == tc::UnknownSocksProtocolError) {
-    icon = addBadgeToPixmap(icon,
-                            QPixmap(":/images/32x32/dialog-warning.png"));
+    icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-warning.png");
+
     title = tr("Unknown SOCKS Protocol");
-
     description =
       tr("One of your applications tried to establish a connection through "
          "Tor using a protocol that Tor does not understand. Please ensure "
          "you configure your applications to use only SOCKS4a or SOCKS5 with "
          "remote hostname resolution.");
   } else if (type == tc::BadSocksHostnameError) {
-    icon = addBadgeToPixmap(icon,
-                            QPixmap(":/images/32x32/dialog-warning.png"));
+    icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-warning.png");
 
     title = tr("Invalid Destination Hostname");
     description =
@@ -321,3 +347,148 @@
   addNotification(icon, title, description);
 }
 
+void 
+StatusEventWidget::externalAddressChanged(const QHostAddress &ip,
+                                          const QString &hostname)
+{
+  QString hostString = hostname.isEmpty() ? QString() 
+                                          : QString(" (%1)").arg(hostname);
+
+  addNotification(QPixmap(":/images/48x48/applications-internet.png"),
+    tr("External IP Address Changed"),
+    tr("Tor has determined your relay's public IP address is currently %1%2. "
+       "If that is not correct, please consider setting the 'Address' option "
+       "in your relay's configuration.").arg(ip.toString()).arg(hostString));
+}
+
+void
+StatusEventWidget::dnsHijacked()
+{
+  QPixmap icon = addBadgeToPixmap(":/images/48x48/applications-internet.png",
+                                  ":/images/32x32/dialog-warning.png");
+  addNotification(icon,
+    tr("DNS Hijacking Detected"),
+    tr("Tor detected that your DNS provider is providing false responses for "
+       "domains that do not exist. Some ISPs and other DNS providers, such as "
+       "OpenDNS, are known to do this in order to display their own search or "
+       "advertising pages."));
+}
+
+void
+StatusEventWidget::dnsUseless()
+{
+  QPixmap icon = addBadgeToPixmap(":/images/48x48/applications-internet.png",
+                                  ":/images/32x32/edit-delete.png");
+  addNotification(icon,
+    tr("DNS Hijacking Detected"),
+    tr("Tor detected that your DNS provider is providing false responses for "
+       "well known domains. Since clients rely on Tor network relays to "
+       "provide accurate DNS repsonses, your relay will not be configured as "
+       "an exit relay."));
+}
+
+void
+StatusEventWidget::checkingOrPortReachability(const QHostAddress &ip,
+                                              quint16 port)
+{
+  addNotification(QPixmap(":/images/48x48/network-wired.png"),
+    tr("Checking Server Port Reachability"),
+    tr("Tor is trying to determine if your relay's server port is reachable "
+       "from the Tor network by connecting to itself at %1:%2. This test "
+       "could take several minutes.").arg(ip.toString()).arg(port));
+}
+
+void
+StatusEventWidget::orPortReachabilityFinished(const QHostAddress &ip,
+                                              quint16 port,
+                                              bool reachable)
+{
+  QString title, description;
+  QPixmap icon = QPixmap(":/images/48x48/network-wired.png");
+  if (reachable) {
+    icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-ok-apply.png");
+    title = tr("Server Port Reachability Test Successful!");
+    description =
+      tr("Your relay's server port is reachable from the Tor network!");
+  } else {
+    icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-warning.png");
+    title = tr("Server Port Reachability Test Failed");
+    description =
+      tr("Your relay's server 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 server port, please check your relay's configuration.")
+                                                .arg(ip.toString()).arg(port);
+  }
+
+  addNotification(icon, title, description);
+}
+
+void
+StatusEventWidget::checkingDirPortReachability(const QHostAddress &ip,
+                                               quint16 port)
+{
+  addNotification(QPixmap(":/images/48x48/network-wired.png"),
+    tr("Checking Directory Port Reachability"),
+    tr("Tor is trying to determine if your relay's directory port is reachable "
+       "from the Tor network by connecting to itself at %1:%2. This test "
+       "could take several minutes.").arg(ip.toString()).arg(port));
+}
+
+void
+StatusEventWidget::dirPortReachabilityFinished(const QHostAddress &ip,
+                                               quint16 port,
+                                               bool reachable)
+{
+  QString title, description;
+  QPixmap icon = QPixmap(":/images/48x48/network-wired.png");
+  if (reachable) {
+    icon = addBadgeToPixmap(icon, ":/images/32x32/dialog-ok-apply.png");
+    title = tr("Directory Port Reachability Test Successful!");
+    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 = 
+      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);
+}
+
+void
+StatusEventWidget::serverDescriptorRejected(const QHostAddress &ip,
+                                            quint16 port,
+                                            const QString &reason)
+{
+  QPixmap icon =
+    addBadgeToPixmap(":/images/48x48/preferences-system-networking.png",
+                     ":/images/32x32/dialog-warning.png");
+
+  addNotification(icon,
+    tr("Relay Descriptor Rejected"),
+    tr("Your relay's descriptor, which enables clients to connect to your "
+       "relay, was rejected by the directory server at %1:%2. The reason "
+       "given was: %3").arg(ip.toString()).arg(port).arg(reason));
+}
+
+void
+StatusEventWidget::serverDescriptorAccepted()
+{
+  QPixmap icon =
+  addBadgeToPixmap(":/images/48x48/preferences-system-networking.png",
+                   ":/images/32x32/dialog-ok-apply.png");
+
+  addNotification(icon,
+    tr("Your Relay is Online"),
+    tr("Your relay is now online and available for Tor clients to use. You "
+       "should see an increase in network traffic shown by the Bandwidth "
+       "Graph within a few hours as more clients learn about your relay. "
+       "Thank you for contributing to the Tor network!"));
+}
+

Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.h
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.h	2009-08-29 02:05:22 UTC (rev 4083)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.h	2009-08-29 05:40:12 UTC (rev 4084)
@@ -99,6 +99,60 @@
    */
   void socksError(tc::SocksError type, const QString &destination);
 
+  /** Called when Tor decides the client's external IP address has changed
+   * to <b>ip</b>. If <b>hostname</b> is non-empty, Tor obtained the new
+   * value for <b>ip</b> by resolving <b>hostname</b>. 
+   */
+  void externalAddressChanged(const QHostAddress &ip, const QString &hostname);
+
+  /** Called when Tor determines that the user's DNS provider is providing
+   * an address for non-existent domains when it should really be saying
+   * "NXDOMAIN".
+   */
+  void dnsHijacked();
+  
+  /** Called when Tor determines that the user's DNS provider is providing
+   * a hijacked address even for well-known websites.
+   */
+  void dnsUseless();
+  
+  /** Indicates Tor has started testing the reachability of its OR port 
+   * using the IP address <b>ip</b> and port <b>port</b>.
+   */
+  void checkingOrPortReachability(const QHostAddress &ip, quint16 port);
+  
+  /** Tor has completed testing the reachability of its OR port using
+   * the IP address <b>ip</b> and port <b>port</b>. If the user's OR port
+   * was reachable, <b>reachable</b> will be set to true.
+   */
+  void orPortReachabilityFinished(const QHostAddress &ip, quint16 port,
+                                  bool reachable);
+  
+  /** Indicates Tor has started testing the reachability of its directory
+   * port using the IP address <b>ip</b> and port <b>port</b>.
+   */
+  void checkingDirPortReachability(const QHostAddress &ip, quint16 port);
+  
+  /** Tor has completed testing the reachability of its directory port using
+   * the IP address <b>ip</b> and port <b>port</b>. If the user's directory
+   * port was reachable, <b>reachable</b> will be set to true.
+   */
+  void dirPortReachabilityFinished(const QHostAddress &ip, quint16 port,
+                                   bool reachable);
+  
+  /** Called when the directory authority with IP address <b>ip</b> and
+   * port <b>port</b> rejected the user's server descriptor. <b>reason</b>
+   * describes why the descriptor was rejected (e.g., malformed, skewed
+   * clock, etc.).
+   */
+  void serverDescriptorRejected(const QHostAddress &ip, quint16 port,
+                                const QString &reason);
+
+  /** Called when at least one directory authority has accepted the user's
+   * server descriptor.
+   */
+  void serverDescriptorAccepted();
+
 private:
   /** Adds a new status event notification item to the widget. The item will
    * be drawn using the specified <b>icon</b>, short event <b>title</b>,
@@ -117,6 +171,20 @@
   static QPixmap addBadgeToPixmap(const QPixmap &pixmap,
                                   const QPixmap &badge);
 
+  /** Overloaded method provided for convenience. Constructs QPixmap objects
+   * from the Qt resource URLs <b>pixmap</b> and <b>badge</b>.
+   * \sa addBadgeToPixmap(QPixmap, QPixmap)
+   */
+  static QPixmap addBadgeToPixmap(const QString &pixmap,
+                                  const QString &badge);
+
+  /** Overloaded method provided for convenience. Constructs a QPixmap object
+   * for the Qt resource URL <b>badge</b>, and applies it to <b>pixmap</b>.
+   * \sa addBadgeToPixmap(QPixmap, QPixmap)
+   */
+  static QPixmap addBadgeToPixmap(const QPixmap &pixmap,
+                                  const QString &badge);
+
   /** Maximum number of event notifications contained in the StatusEventWidget
    * at any given time.
    * \sa setMaximumItemCount()

Added: vidalia/trunk/src/vidalia/res/48x48/network-wired.png
===================================================================
(Binary files differ)


Property changes on: vidalia/trunk/src/vidalia/res/48x48/network-wired.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: vidalia/trunk/src/vidalia/res/vidalia.qrc
===================================================================
--- vidalia/trunk/src/vidalia/res/vidalia.qrc	2009-08-29 02:05:22 UTC (rev 4083)
+++ vidalia/trunk/src/vidalia/res/vidalia.qrc	2009-08-29 05:40:12 UTC (rev 4084)
@@ -100,6 +100,7 @@
         <file>48x48/media-playback-stop.png</file>
         <file>48x48/modem.png</file>
         <file>48x48/network-connect.png</file>
+        <file>48x48/network-wired.png</file>
         <file>48x48/network-workgroup.png</file>
         <file>48x48/preferences-system-network-sharing.png</file>
         <file>48x48/tor-logo.png</file>