[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2780: Reorg the bootstrap status event stuff into a new BootstrapS (in vidalia/trunk/src: torcontrol vidalia)
Author: edmanm
Date: 2008-06-21 17:48:32 -0400 (Sat, 21 Jun 2008)
New Revision: 2780
Removed:
vidalia/trunk/src/torcontrol/bootstrapstatusevent.cpp
vidalia/trunk/src/torcontrol/statusevent.cpp
Modified:
vidalia/trunk/src/torcontrol/CMakeLists.txt
vidalia/trunk/src/torcontrol/bootstrapstatusevent.h
vidalia/trunk/src/torcontrol/circuitestablishedevent.h
vidalia/trunk/src/torcontrol/clientstatusevent.cpp
vidalia/trunk/src/torcontrol/clientstatusevent.h
vidalia/trunk/src/torcontrol/dangerousversionevent.h
vidalia/trunk/src/torcontrol/generalstatusevent.h
vidalia/trunk/src/torcontrol/serverstatusevent.h
vidalia/trunk/src/torcontrol/statusevent.h
vidalia/trunk/src/torcontrol/tcglobal.cpp
vidalia/trunk/src/torcontrol/tcglobal.h
vidalia/trunk/src/torcontrol/torcontrol.cpp
vidalia/trunk/src/torcontrol/torcontrol.h
vidalia/trunk/src/torcontrol/torevents.cpp
vidalia/trunk/src/torcontrol/torevents.h
vidalia/trunk/src/torcontrol/unrecognizedclientstatusevent.h
vidalia/trunk/src/torcontrol/unrecognizedgeneralstatusevent.h
vidalia/trunk/src/torcontrol/unrecognizedserverstatusevent.h
vidalia/trunk/src/vidalia/mainwindow.cpp
vidalia/trunk/src/vidalia/mainwindow.h
Log:
Reorg the bootstrap status event stuff into a new BootstrapStatus class
(BootstrapStatusEvent now contains a BootstrapStatus object). Add a method to
send a 'getinfo status/bootstrap-phase' command that returns a BootstrapStatus
object. Call that method after we've authenticated to the Tor software so the
progress bar can take a hop, skip, and a jump to wherever we are in the
bootstrapping process.
Modified: vidalia/trunk/src/torcontrol/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/torcontrol/CMakeLists.txt 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/CMakeLists.txt 2008-06-21 21:48:32 UTC (rev 2780)
@@ -13,7 +13,7 @@
set(torcontrol_SRCS
addressmap.cpp
- bootstrapstatusevent.cpp
+ bootstrapstatus.cpp
circuit.cpp
clientstatusevent.cpp
controlcommand.cpp
@@ -29,7 +29,6 @@
routerdescriptor.cpp
routerstatus.cpp
serverstatusevent.cpp
- statusevent.cpp
stream.cpp
tcglobal.cpp
torcontrol.cpp
Deleted: vidalia/trunk/src/torcontrol/bootstrapstatusevent.cpp
Modified: vidalia/trunk/src/torcontrol/bootstrapstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/bootstrapstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/bootstrapstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -20,110 +20,50 @@
#include <QEvent>
#include <QString>
#include "clientstatusevent.h"
-#include "tcglobal.h"
+#include "bootstrapstatus.h"
class BootstrapStatusEvent : public ClientStatusEvent
{
public:
- /** Currently enumerated bootstrapping states defined by Tor's control
- * protocol (Tor >= 0.2.1.0-alpha-dev. */
- enum BootstrapStatus {
- UnrecognizedStatus,
- ConnectingToDirMirror,
- HandshakingWithDirMirror,
- CreatingOneHopCircuit,
- RequestingNetworkStatus,
- LoadingNetworkStatus,
- LoadingAuthorityCertificates,
- RequestingDescriptors,
- LoadingDescriptors,
- ConnectingToEntryGuard,
- HandshakingWithEntryGuard,
- EstablishingCircuit,
- BootstrappingDone
- };
- /** Actions the Tor software might recommend controllers take in response to
- * a bootstrap status problem event. */
- enum Recommendation {
- UnrecognizedRecommendation,
- RecommendIgnore,
- RecommendWarn
- };
-
/** Constructor. */
- BootstrapStatusEvent(StatusEvent::Severity severity,
- BootstrapStatus status, int percentComplete,
- const QString &description,
- const QString &warning = QString(),
- tc::ConnectionStatusReason reason = tc::UnrecognizedReason,
- Recommendation action = UnrecognizedRecommendation);
+ BootstrapStatusEvent(const BootstrapStatus &status)
+ : ClientStatusEvent(status.severity(), ClientStatusEvent::Bootstrap),
+ _bootstrapStatus(status) {}
/** Returns the BootstrapStatus enum value indicated by this bootstrap
* status event. */
- BootstrapStatus status() const { return _status; }
+ BootstrapStatus status() const { return _bootstrapStatus; }
/** Returns an integer between 0 and 100 representing an estimate of how
* much of Tor's bootstrapping process it has completed. */
- int percentComplete() const { return _percentComplete; }
+ int percentComplete() const { return status().percentComplete(); }
/** Returns a description of Tor's current bootstrapping status. */
- QString description() const { return _description; }
+ QString description() const { return status().description(); }
/** Returns a description of the most recent error Tor encountered while
* attempting to bootstrap, if this event's severity is 'warn'. Otherwise,
* this returns a default-constructed QString. */
- QString warning() const { return _warning; }
+ QString warning() const { return status().warning(); }
/** Returns a ConnectionStatusReason enum value describing the most recent
* error Tor encountered while attempting to bootstrap, if this event's
* severity is 'warn'. Otherwise, this simply returns
* tc::UnrecognizedReason. */
- tc::ConnectionStatusReason reason() const { return _reason; }
+ tc::ConnectionStatusReason reason() const { return status().reason(); }
/** Returns the action that the Tor software recommended be taken in
* response to this bootstrap status event. */
- Recommendation recommendedAction() const { return _action; }
+ BootstrapStatus::Recommendation recommendedAction() const {
+ return status().recommendedAction();
+ }
- /** Converts a string TAG value to a BootstrapStatus enum value. */
- static BootstrapStatus statusFromString(const QString &tag);
- /** Converts a string RECOMMENDATION value to a RecommendAction enum
- * value. */
- static Recommendation actionFromString(const QString &str);
-
private:
/** Current bootstrapping status value.
* \sa status
*/
- BootstrapStatus _status;
-
- /** Approximate percentage of Tor's bootstrapping process that is complete.
- * \sa percentComplete
- */
- int _percentComplete;
-
- /** Description of Tor's current bootstrapping status.
- * \sa description
- */
- QString _description;
-
- /** Description of the most recent error Tor encountered while attempting to
- * bootstrap.
- * \sa warning
- */
- QString _warning;
-
- /** ConnectionStatusReason enum value describing the most recent error Tor
- * encountered while attempting to bootstrap.
- * \sa reason
- */
- tc::ConnectionStatusReason _reason;
-
- /** Recommendation enum value describing Tor's suggested response to this
- * bootstrap status event.
- * \sa recommendedAction
- */
- Recommendation _action;
+ BootstrapStatus _bootstrapStatus;
};
#endif
Modified: vidalia/trunk/src/torcontrol/circuitestablishedevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/circuitestablishedevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/circuitestablishedevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -24,7 +24,7 @@
{
public:
/** Constructor. */
- CircuitEstablishedEvent(StatusEvent::Severity severity)
+ CircuitEstablishedEvent(tc::Severity severity)
: ClientStatusEvent(severity, ClientStatusEvent::CircuitEstablished) {}
};
Modified: vidalia/trunk/src/torcontrol/clientstatusevent.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/clientstatusevent.cpp 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/clientstatusevent.cpp 2008-06-21 21:48:32 UTC (rev 2780)
@@ -37,7 +37,7 @@
if (!str.compare("SOCKS_BAD_HOSTNAME", Qt::CaseInsensitive))
return SocksBadHostname;
if (!str.compare("BOOTSTRAP", Qt::CaseInsensitive))
- return BootstrapStatus;
+ return Bootstrap;
return UnrecognizedStatus;
}
Modified: vidalia/trunk/src/torcontrol/clientstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/clientstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/clientstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -26,7 +26,7 @@
/** Tor client status event type. */
enum Status {
UnrecognizedStatus,
- BootstrapStatus,
+ Bootstrap,
CircuitEstablished,
CircuitNotEstablished,
NotEnoughDirectoryInfo,
@@ -37,7 +37,7 @@
};
/** Constructor. */
- ClientStatusEvent(StatusEvent::Severity severity, Status status)
+ ClientStatusEvent(tc::Severity severity, Status status)
: StatusEvent((QEvent::Type)CustomEventType::ClientStatusEvent, severity),
_status(status) {}
Modified: vidalia/trunk/src/torcontrol/dangerousversionevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/dangerousversionevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/dangerousversionevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -35,7 +35,7 @@
};
/** Constructor. */
- DangerousVersionEvent(StatusEvent::Severity severity, Reason reason,
+ DangerousVersionEvent(tc::Severity severity, Reason reason,
const QString ¤tVersion,
const QStringList &recommendedVersions)
: GeneralStatusEvent(severity, GeneralStatusEvent::DangerousTorVersion),
Modified: vidalia/trunk/src/torcontrol/generalstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/generalstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/generalstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -36,7 +36,7 @@
};
/** Constructor */
- GeneralStatusEvent(StatusEvent::Severity severity, Status status)
+ GeneralStatusEvent(tc::Severity severity, Status status)
: StatusEvent((QEvent::Type)CustomEventType::ServerStatusEvent, severity),
_status(status) {}
Modified: vidalia/trunk/src/torcontrol/serverstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/serverstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/serverstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -40,7 +40,7 @@
};
/** Constructor */
- ServerStatusEvent(StatusEvent::Severity severity, Status status)
+ ServerStatusEvent(tc::Severity severity, Status status)
: StatusEvent((QEvent::Type)CustomEventType::ServerStatusEvent, severity),
_status(status) {}
Deleted: vidalia/trunk/src/torcontrol/statusevent.cpp
Modified: vidalia/trunk/src/torcontrol/statusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/statusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/statusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -20,31 +20,24 @@
#include <QEvent>
#include <QString>
#include "eventtype.h"
+#include "tcglobal.h"
class StatusEvent : public QEvent
{
public:
- /** Satus event severity values. */
- enum Severity {
- SeverityUnknown, /**< An unrecognized status event severity. */
- SeverityNotice, /**< A not-so-bad status event. */
- SeverityWarn, /**< An important, but non-fatal status event. */
- SeverityError /**< A critical status event. */
- };
-
/** Constructor */
- StatusEvent(QEvent::Type type, Severity severity)
+ StatusEvent(QEvent::Type type, tc::Severity severity)
: QEvent(type), _severity(severity) {}
/** Returns the severity of this status event. */
- Severity severity() const { return _severity; }
+ tc::Severity severity() const { return _severity; }
/** Returns a StatusEvent::Severity enum value for the severity represented
* by <b>str</b>. */
- static Severity severityFromString(const QString &str);
+ static tc::Severity severityFromString(const QString &str);
private:
- Severity _severity; /**< Severity of this status event. */
+ tc::Severity _severity; /**< Severity of this status event. */
};
#endif
Modified: vidalia/trunk/src/torcontrol/tcglobal.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/tcglobal.cpp 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/tcglobal.cpp 2008-06-21 21:48:32 UTC (rev 2780)
@@ -53,7 +53,7 @@
/** Converts <b>str</b> to a ConnectionStatusReason enum value. */
ConnectionStatusReason
-connectionStatusReason(const QString &str)
+toConnectionStatusReason(const QString &str)
{
if (str.isEmpty())
return UnrecognizedReason;
@@ -78,5 +78,22 @@
return UnrecognizedReason;
}
+/** DOCDOC */
+Severity
+toSeverity(const QString &str)
+{
+ if (!str.compare("DEBUG", Qt::CaseInsensitive))
+ return SeverityDebug;
+ if (!str.compare("INFO", Qt::CaseInsensitive))
+ return SeverityInfo;
+ if (!str.compare("NOTICE", Qt::CaseInsensitive))
+ return SeverityNotice;
+ if (!str.compare("WARN", Qt::CaseInsensitive))
+ return SeverityWarn;
+ if (!str.compare("ERR", Qt::CaseInsensitive))
+ return SeverityError;
+ return UnrecognizedSeverity;
}
+}
+
Modified: vidalia/trunk/src/torcontrol/tcglobal.h
===================================================================
--- vidalia/trunk/src/torcontrol/tcglobal.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/tcglobal.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -66,9 +66,21 @@
NoRouteToHost,
ResourceLimitReached
};
-
+ /** Severity values used in log message and status events. */
+ enum Severity {
+ UnrecognizedSeverity, /**< An unrecognized severity value. */
+ SeverityDebug, /**< Hyper-verbose events used for debugging. */
+ SeverityInfo, /**< Verbose events that can occur frequently. */
+ SeverityNotice, /**< A not-so-bad event. */
+ SeverityWarn, /**< An important, but non-fatal event. */
+ SeverityError /**< A critical event. */
+ };
+
+ /** Converts <b>str</b> to a Severity enum value. */
+ Severity toSeverity(const QString &str);
+
/** Converts <b>str</b> to a ConnectionStatusReason enum value. */
- ConnectionStatusReason connectionStatusReason(const QString &str);
+ ConnectionStatusReason toConnectionStatusReason(const QString &str);
/** Creates a new message using <b>fmt</b> and a severity level of
* QtDebugMsg. */
Modified: vidalia/trunk/src/torcontrol/torcontrol.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/torcontrol.cpp 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/torcontrol.cpp 2008-06-21 21:48:32 UTC (rev 2780)
@@ -344,6 +344,25 @@
return send(cmd, errmsg);
}
+BootstrapStatus
+TorControl::bootstrapStatus(QString *errmsg)
+{
+ QString str = getInfo("status/bootstrap-phase").toString();
+ if (!str.isEmpty()) {
+ tc::Severity severity = tc::toSeverity(str.section(' ', 1, 1));
+ QHash<QString,QString> args = string_parse_keyvals(str);
+ return BootstrapStatus(severity,
+ BootstrapStatus::statusFromString(args.value("TAG")),
+ args.value("PROGRESS").toInt(),
+ args.value("SUMMARY"),
+ args.value("WARNING"),
+ tc::toConnectionStatusReason(args.value("REASON")),
+ BootstrapStatus::actionFromString(
+ args.value("RECOMMENDATION")));
+ }
+ return BootstrapStatus();
+}
+
/** Returns true if Tor either has an open circuit or (on Tor >=
* 0.2.0.1-alpha) has previously decided it's able to establish a circuit. */
bool
Modified: vidalia/trunk/src/torcontrol/torcontrol.h
===================================================================
--- vidalia/trunk/src/torcontrol/torcontrol.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/torcontrol.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -29,6 +29,7 @@
#include "torsignal.h"
#include "routerdescriptor.h"
#include "routerstatus.h"
+#include "bootstrapstatus.h"
#include "addressmap.h"
#include "protocolinfo.h"
@@ -74,7 +75,10 @@
/** Sends a PROTOCOLINFO command to Tor and parses the response. */
ProtocolInfo protocolInfo(QString *errmsg = 0);
-
+
+ /** Returns the Tor software's current bootstrap phase and status. */
+ BootstrapStatus bootstrapStatus(QString *errmsg = 0);
+
/** Returns true if Tor either has an open circuit or (on Tor >=
* 0.2.0.1-alpha) has previously decided it's able to establish a circuit. */
bool circuitEstablished();
Modified: vidalia/trunk/src/torcontrol/torevents.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/torevents.cpp 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/torevents.cpp 2008-06-21 21:48:32 UTC (rev 2780)
@@ -375,11 +375,11 @@
TorEvents::handleStatusEvent(TorEvent type, const ReplyLine &line)
{
QString status;
- StatusEvent::Severity severity;
+ tc::Severity severity;
QHash<QString,QString> args;
QString msg = line.getMessage();
- severity = StatusEvent::severityFromString(msg.section(' ', 1, 1));
+ severity = tc::toSeverity(msg.section(' ', 1, 1));
status = msg.section(' ', 2, 2);
args = string_parse_keyvals(msg.section(' ', 3));
switch (type) {
@@ -394,7 +394,7 @@
/** Parses and posts a Tor client status event. */
void
-TorEvents::dispatchClientStatusEvent(StatusEvent::Severity severity,
+TorEvents::dispatchClientStatusEvent(tc::Severity severity,
const QString &action,
const QHash<QString,QString> &args)
{
@@ -406,15 +406,16 @@
case ClientStatusEvent::CircuitEstablished:
event = new CircuitEstablishedEvent(severity); break;
- case ClientStatusEvent::BootstrapStatus:
- event = new BootstrapStatusEvent(severity,
- BootstrapStatusEvent::statusFromString(args.value("TAG")),
+ case ClientStatusEvent::Bootstrap:
+ event = new BootstrapStatusEvent(BootstrapStatus(severity,
+ BootstrapStatus::statusFromString(args.value("TAG")),
args.value("PROGRESS").toInt(),
args.value("SUMMARY"),
args.value("WARNING"),
- tc::connectionStatusReason(args.value("REASON")),
- BootstrapStatusEvent::actionFromString(
- args.value("RECOMMENDATION")));
+ tc::toConnectionStatusReason(args.value("REASON")),
+ BootstrapStatus::actionFromString(
+ args.value("RECOMMENDATION"))));
+
break;
default:
@@ -425,7 +426,7 @@
/** Parses and posts a Tor server status event. */
void
-TorEvents::dispatchServerStatusEvent(StatusEvent::Severity severity,
+TorEvents::dispatchServerStatusEvent(tc::Severity severity,
const QString &action,
const QHash<QString,QString> &args)
{
@@ -442,7 +443,7 @@
/** Parses and posts a general Tor status event. */
void
-TorEvents::dispatchGeneralStatusEvent(StatusEvent::Severity severity,
+TorEvents::dispatchGeneralStatusEvent(tc::Severity severity,
const QString &action,
const QHash<QString,QString> &args)
{
Modified: vidalia/trunk/src/torcontrol/torevents.h
===================================================================
--- vidalia/trunk/src/torcontrol/torevents.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/torevents.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -106,15 +106,15 @@
void handleStatusEvent(TorEvent type, const ReplyLine &line);
/** Parses and posts a Tor client status event. */
- void dispatchClientStatusEvent(StatusEvent::Severity severity,
+ void dispatchClientStatusEvent(tc::Severity severity,
const QString &action,
const QHash<QString,QString> &args);
/** Parses and posts a Tor server status event. */
- void dispatchServerStatusEvent(StatusEvent::Severity severity,
+ void dispatchServerStatusEvent(tc::Severity severity,
const QString &action,
const QHash<QString,QString> &args);
/** Parses and posts a general Tor status event. */
- void dispatchGeneralStatusEvent(StatusEvent::Severity severity,
+ void dispatchGeneralStatusEvent(tc::Severity severity,
const QString &action,
const QHash<QString,QString> &args);
};
Modified: vidalia/trunk/src/torcontrol/unrecognizedclientstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/unrecognizedclientstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/unrecognizedclientstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -27,7 +27,7 @@
/** Constructor. <b>statusString</b> is the unrecognized client status value
* string and <b>args</b> is the (possibly empty) list of status event
* arguments. */
- UnrecognizedClientStatusEvent(StatusEvent::Severity severity,
+ UnrecognizedClientStatusEvent(tc::Severity severity,
const QString &statusString,
const QHash<QString,QString> &args)
: ClientStatusEvent(severity, ClientStatusEvent::UnrecognizedStatus),
Modified: vidalia/trunk/src/torcontrol/unrecognizedgeneralstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/unrecognizedgeneralstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/unrecognizedgeneralstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -27,7 +27,7 @@
/** Constructor. <b>statusString</b> is the unrecognized general status
* string and <b>args</b> is the (possibly empty) list of status event
* arguments. */
- UnrecognizedGeneralStatusEvent(StatusEvent::Severity severity,
+ UnrecognizedGeneralStatusEvent(tc::Severity severity,
const QString &statusString,
const QHash<QString,QString> &args)
: GeneralStatusEvent(severity, GeneralStatusEvent::UnrecognizedStatus),
Modified: vidalia/trunk/src/torcontrol/unrecognizedserverstatusevent.h
===================================================================
--- vidalia/trunk/src/torcontrol/unrecognizedserverstatusevent.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/torcontrol/unrecognizedserverstatusevent.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -27,7 +27,7 @@
/** Constructor. <b>statusString</b> is the unrecognized server status value
* string we and <b>args</b> is the (possibly empty) list of status event
* arguments. */
- UnrecognizedServerStatusEvent(StatusEvent::Severity severity,
+ UnrecognizedServerStatusEvent(tc::Severity severity,
const QString &statusString,
const QHash<QString,QString> &args)
: ServerStatusEvent(severity, ServerStatusEvent::UnrecognizedStatus),
Modified: vidalia/trunk/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/trunk/src/vidalia/mainwindow.cpp 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/vidalia/mainwindow.cpp 2008-06-21 21:48:32 UTC (rev 2780)
@@ -201,10 +201,10 @@
if (cse->status() == ClientStatusEvent::CircuitEstablished) {
circuitEstablished();
cse->accept();
- } else if (cse->status() == ClientStatusEvent::BootstrapStatus) {
+ } else if (cse->status() == ClientStatusEvent::Bootstrap) {
BootstrapStatusEvent *bse = dynamic_cast<BootstrapStatusEvent *>(cse);
if (bse)
- bootstrapStatusChanged(bse);
+ bootstrapStatusChanged(bse->status());
cse->accept();
}
} else if (event->type() == CustomEventType::GeneralStatusEvent) {
@@ -522,44 +522,44 @@
/** Called when Tor's bootstrapping status changes. <b>bse</b> represents
* Tor's current estimate of its bootstrapping progress. */
void
-MainWindow::bootstrapStatusChanged(const BootstrapStatusEvent *bse)
+MainWindow::bootstrapStatusChanged(const BootstrapStatus &bs)
{
- int percentComplete = STARTUP_PROGRESS_BOOTSTRAPPING + bse->percentComplete();
- bool warn = (bse->severity() == StatusEvent::SeverityWarn &&
- bse->recommendedAction() != BootstrapStatusEvent::RecommendIgnore);
+ int percentComplete = STARTUP_PROGRESS_BOOTSTRAPPING + bs.percentComplete();
+ bool warn = (bs.severity() == tc::SeverityWarn &&
+ bs.recommendedAction() != BootstrapStatus::RecommendIgnore);
QString description;
- switch (bse->status()) {
- case BootstrapStatusEvent::ConnectingToDirMirror:
+ switch (bs.status()) {
+ case BootstrapStatus::ConnectingToDirMirror:
description = tr("Connecting to a relay directory");
break;
- case BootstrapStatusEvent::HandshakingWithDirMirror:
- case BootstrapStatusEvent::CreatingOneHopCircuit:
+ case BootstrapStatus::HandshakingWithDirMirror:
+ case BootstrapStatus::CreatingOneHopCircuit:
description = tr("Establishing an encrypted directory connection");
break;
- case BootstrapStatusEvent::RequestingNetworkStatus:
+ case BootstrapStatus::RequestingNetworkStatus:
description = tr("Retrieving network status");
break;
- case BootstrapStatusEvent::LoadingNetworkStatus:
+ case BootstrapStatus::LoadingNetworkStatus:
description = tr("Loading network status");
break;
- case BootstrapStatusEvent::LoadingAuthorityCertificates:
+ case BootstrapStatus::LoadingAuthorityCertificates:
description = tr("Loading authority certificates");
break;
- case BootstrapStatusEvent::RequestingDescriptors:
+ case BootstrapStatus::RequestingDescriptors:
description = tr("Requesting relay information");
break;
- case BootstrapStatusEvent::LoadingDescriptors:
+ case BootstrapStatus::LoadingDescriptors:
description = tr("Loading relay information");
break;
- case BootstrapStatusEvent::ConnectingToEntryGuard:
+ case BootstrapStatus::ConnectingToEntryGuard:
description = tr("Connecting to the Tor network");
break;
- case BootstrapStatusEvent::HandshakingWithEntryGuard:
- case BootstrapStatusEvent::EstablishingCircuit:
+ case BootstrapStatus::HandshakingWithEntryGuard:
+ case BootstrapStatus::EstablishingCircuit:
description = tr("Establishing a Tor circuit");
break;
- case BootstrapStatusEvent::BootstrappingDone:
+ case BootstrapStatus::BootstrappingDone:
description = tr("Connected to the Tor network!");
warn = false; /* probably false anyway */
break;
@@ -569,7 +569,7 @@
if (warn) {
QString reason;
/* Is it really a good idea to translate these? */
- switch (bse->reason()) {
+ switch (bs.reason()) {
case tc::MiscellaneousReason:
reason = tr("miscellaneous");
break;
@@ -1122,6 +1122,11 @@
/* Check the status of Tor's version */
if (_torControl->getTorVersion() >= 0x020001)
checkTorVersion();
+ if (_torControl->getTorVersion() >= 0x020102) {
+ BootstrapStatus status = _torControl->bootstrapStatus();
+ if (status.isValid())
+ bootstrapStatusChanged(status);
+ }
}
/** Called when Vidalia fails to authenticate to Tor. The failure reason is
Modified: vidalia/trunk/src/vidalia/mainwindow.h
===================================================================
--- vidalia/trunk/src/vidalia/mainwindow.h 2008-06-21 18:34:32 UTC (rev 2779)
+++ vidalia/trunk/src/vidalia/mainwindow.h 2008-06-21 21:48:32 UTC (rev 2780)
@@ -165,7 +165,7 @@
void dangerousTorVersion();
/** Called when Tor's bootstrapping status changes. <b>bse</b> represents
* Tor's current estimate of its bootstrapping progress. */
- void bootstrapStatusChanged(const BootstrapStatusEvent *bse);
+ void bootstrapStatusChanged(const BootstrapStatus &bs);
/** Sets the visibility of the startup status description and progress bar
* to <b>visible</b>. */
void setStartupProgressVisible(bool visible);