tor-commits
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2012
- 17 participants
- 880 discussions

14 Jun '12
commit e9196cc4da936db58191a7f7086678b842b2377f
Merge: 3b624db 39723db
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Thu Jun 14 19:46:08 2012 -0300
Merge branch '5554_adv_page_warning' into alpha
changes/bug5554 | 3 +++
src/vidalia/config/AdvancedPage.ui | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
1
0

[vidalia/alpha] fixed compilation warning when generating ui_AdvancedPage.h
by chiiph@torproject.org 14 Jun '12
by chiiph@torproject.org 14 Jun '12
14 Jun '12
commit 39723dbc53d733c87ccc973d5b3b892ef94f58d5
Author: Sebastian Baginski <sebthestampede(a)gmail.com>
Date: Fri Apr 6 01:36:54 2012 +0200
fixed compilation warning when generating ui_AdvancedPage.h
---
changes/bug5554 | 3 +++
src/vidalia/config/AdvancedPage.ui | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/changes/bug5554 b/changes/bug5554
new file mode 100644
index 0000000..7164d7e
--- /dev/null
+++ b/changes/bug5554
@@ -0,0 +1,…
[View More]3 @@
+ Internal cleanups and improvements:
+ o Fixed compile time warning when generating ui_AdvancedPage.h.
+ Fixes bug 5554.
\ No newline at end of file
diff --git a/src/vidalia/config/AdvancedPage.ui b/src/vidalia/config/AdvancedPage.ui
index 65fcc4a..7237d8f 100644
--- a/src/vidalia/config/AdvancedPage.ui
+++ b/src/vidalia/config/AdvancedPage.ui
@@ -30,7 +30,7 @@
</property>
<layout class="QVBoxLayout">
<item>
- <layout class="QGridLayout">
+ <layout class="QGridLayout" name="grid_layout_1">
<property name="horizontalSpacing">
<number>0</number>
</property>
[View Less]
1
0

14 Jun '12
commit d5392a787b6eff16629a360029879523e95c50ef
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Wed Jun 13 11:50:24 2012 -0300
Add another check for the control reply parsing
---
src/torcontrol/ControlSocket.cpp | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/torcontrol/ControlSocket.cpp b/src/torcontrol/ControlSocket.cpp
index fd5f31e..69dd2d8 100644
--- a/src/torcontrol/ControlSocket.cpp
+++ b/src/torcontrol/ControlSocket.cpp
@@ -283,7 +…
[View More]283,14 @@ ControlSocket::readReply(ControlReply &reply, QString *errmsg)
}
/* Parse the status and message */
- ReplyLine replyLine(line.mid(0, 3), line.mid(4));
+ QString status = line.mid(0,3);
+ bool ok = false;
+ status.toInt(&ok);
+ if (!ok) {
+ return err(errmsg, QString("Malformed control reply: %1").arg(line));
+ }
+
+ ReplyLine replyLine(status, line.mid(4));
c = line.at(3);
/* If the reply line contains data, then parse out the data up until the
[View Less]
1
0

14 Jun '12
commit f40e5d403c143c7c2361ef3489e426351607ed31
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Wed Jun 13 11:32:47 2012 -0300
Be backward compatible for DisableNetwork
---
src/vidalia/MainWindow.cpp | 3 +++
src/vidalia/config/TorSettings.cpp | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 02a41da..73e4d41 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/…
[View More]MainWindow.cpp
@@ -165,6 +165,9 @@ MainWindow::~MainWindow()
void
MainWindow::enableNetwork()
{
+ quint32 torVersion = Vidalia::torControl()->getTorVersion();
+ if (torVersion < 0x00020309)
+ return;
TorSettings tor_settings(_torControl);
tor_settings.setDisableNetwork(false);
QString errmsg;
diff --git a/src/vidalia/config/TorSettings.cpp b/src/vidalia/config/TorSettings.cpp
index c1dcb1a..25de975 100644
--- a/src/vidalia/config/TorSettings.cpp
+++ b/src/vidalia/config/TorSettings.cpp
@@ -166,8 +166,10 @@ TorSettings::apply(QString *errmsg)
torrc->setValue(TOR_ARG_HASHED_PASSWORD, "");
}
- torrc->setValue(SETTING_DISABLE_NETWORK,
- volatileValue(SETTING_DISABLE_NETWORK).toBool() ? "1" : "0");
+ quint32 torVersion = Vidalia::torControl()->getTorVersion();
+ if (torVersion >= 0x00020309)
+ torrc->setValue(SETTING_DISABLE_NETWORK,
+ volatileValue(SETTING_DISABLE_NETWORK).toBool() ? "1" : "0");
QString exitNodes = volatileValue(SETTING_EXITNODES).toString();
[View Less]
1
0

[vidalia/alpha] Migrate from a hand made TorControl prototype to an extension
by chiiph@torproject.org 14 Jun '12
by chiiph@torproject.org 14 Jun '12
14 Jun '12
commit fd6260a279be96d9e8315312b7543902432ed75b
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Wed Jun 13 13:50:41 2012 -0300
Migrate from a hand made TorControl prototype to an extension
qtscript_TorControl is equivalent to TorControlPrototype only that it
was generated by qtscriptgenerator
---
changes/migrateToExtensions | 3 +
src/vidalia/CMakeLists.txt | 6 +-
src/vidalia/plugin/PluginEngine.cpp …
[View More] | 5 +-
src/vidalia/plugin/PluginEngine.h | 1 -
.../plugin/extensions/VidaliaExtensions.cpp | 26 +
src/vidalia/plugin/extensions/VidaliaExtensions.h | 17 +
.../plugin/extensions/VidaliaExtensionsInit.cpp | 25 +
.../plugin/extensions/qtscript_TorControl.cpp | 704 ++++++++++++++++++++
.../plugin/prototypes/TorControlPrototype.cpp | 379 -----------
.../plugin/prototypes/TorControlPrototype.h | 356 ----------
10 files changed, 783 insertions(+), 739 deletions(-)
diff --git a/changes/migrateToExtensions b/changes/migrateToExtensions
new file mode 100644
index 0000000..36c6a3b
--- /dev/null
+++ b/changes/migrateToExtensions
@@ -0,0 +1,3 @@
+ Internal cleanups and improvements:
+ o Migrate from the hand made TorControl prototype for QtScript to an
+ automatically generated equivalent with qtscriptgenerator.
diff --git a/src/vidalia/CMakeLists.txt b/src/vidalia/CMakeLists.txt
index 23b5464..312191d 100644
--- a/src/vidalia/CMakeLists.txt
+++ b/src/vidalia/CMakeLists.txt
@@ -23,6 +23,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/network
${CMAKE_CURRENT_SOURCE_DIR}/plugin
${CMAKE_CURRENT_SOURCE_DIR}/plugin/prototypes
+ ${CMAKE_CURRENT_SOURCE_DIR}/plugin/extensions
${MARBLE_INCLUDE_DIR}
)
@@ -90,8 +91,10 @@ set(vidalia_SRCS ${vidalia_SRCS}
plugin/DebugDialog.cpp
plugin/prototypes/VidaliaTabPrototype.cpp
plugin/prototypes/HelperProcessPrototype.cpp
- plugin/prototypes/TorControlPrototype.cpp
plugin/prototypes/TorrcPrototype.cpp
+ plugin/extensions/VidaliaExtensions.cpp
+ plugin/extensions/VidaliaExtensionsInit.cpp
+ plugin/extensions/qtscript_TorControl.cpp
)
qt4_wrap_cpp(vidalia_SRCS
plugin/PluginEngine.h
@@ -99,7 +102,6 @@ qt4_wrap_cpp(vidalia_SRCS
plugin/DebugDialog.h
plugin/prototypes/VidaliaTabPrototype.h
plugin/prototypes/HelperProcessPrototype.h
- plugin/prototypes/TorControlPrototype.h
plugin/prototypes/TorrcPrototype.h
)
diff --git a/src/vidalia/plugin/PluginEngine.cpp b/src/vidalia/plugin/PluginEngine.cpp
index c20424c..93d50c0 100644
--- a/src/vidalia/plugin/PluginEngine.cpp
+++ b/src/vidalia/plugin/PluginEngine.cpp
@@ -19,17 +19,20 @@
#include "DebugDialog.h"
#include "Vidalia.h"
+#include "VidaliaExtensions.h"
#include <unistd.h>
PluginEngine::PluginEngine(QObject *parent)
: QScriptEngine(parent)
{
+ VidaliaExtensions ve;
+ ve.initialize("vidalia", this);
+
ADD_PROTOTYPE(VidaliaTabPrototype)
MAKE_CREATABLE(VidaliaTabPrototype)
ADD_PROTOTYPE(HelperProcessPrototype)
MAKE_CREATABLE(HelperProcessPrototype)
- ADD_PROTOTYPE(TorControlPrototype)
ADD_PROTOTYPE(TorrcPrototype)
globalObject().setProperty("torControl", newQObject(Vidalia::torControl()));
diff --git a/src/vidalia/plugin/PluginEngine.h b/src/vidalia/plugin/PluginEngine.h
index 83a3d6f..b8b65aa 100644
--- a/src/vidalia/plugin/PluginEngine.h
+++ b/src/vidalia/plugin/PluginEngine.h
@@ -21,7 +21,6 @@
#include "VidaliaTabPrototype.h"
#include "HelperProcessPrototype.h"
-#include "TorControlPrototype.h"
#include "TorrcPrototype.h"
class PluginWrapper;
diff --git a/src/vidalia/plugin/extensions/VidaliaExtensions.cpp b/src/vidalia/plugin/extensions/VidaliaExtensions.cpp
new file mode 100644
index 0000000..7bb85f6
--- /dev/null
+++ b/src/vidalia/plugin/extensions/VidaliaExtensions.cpp
@@ -0,0 +1,26 @@
+#include <QtScript/QScriptExtensionPlugin>
+#include <QtScript/QScriptValue>
+#include <QtScript/QScriptEngine>
+
+#include <QDebug>
+
+#include "VidaliaExtensions.h"
+
+void vidalia_initialize_bindings(QScriptValue &);
+
+QStringList VidaliaExtensions::keys() const
+{
+ return QStringList() << "vidalia";
+}
+
+void VidaliaExtensions::initialize(const QString &key, QScriptEngine *engine)
+{
+ if (key == QLatin1String("vidalia")) {
+ QScriptValue extensionObject = engine->globalObject();
+ vidalia_initialize_bindings(extensionObject);
+ } else {
+ Q_ASSERT_X(false, "vidalia::initialize", qPrintable(key));
+ }
+}
+
+Q_EXPORT_PLUGIN2(vidalia_extensions, VidaliaExtensions)
diff --git a/src/vidalia/plugin/extensions/VidaliaExtensions.h b/src/vidalia/plugin/extensions/VidaliaExtensions.h
new file mode 100644
index 0000000..b3e9ed3
--- /dev/null
+++ b/src/vidalia/plugin/extensions/VidaliaExtensions.h
@@ -0,0 +1,17 @@
+#ifndef VIDALIAEXTENSIONS_H
+#define VIDALIAEXTENSIONS_H
+
+#include <QtCore>
+#include <QtScript/QScriptExtensionPlugin>
+#include <QtScript/QScriptValue>
+#include <QtScript/QScriptEngine>
+
+class VidaliaExtensions : public QScriptExtensionPlugin
+{
+public:
+ void initialize(const QString &key, QScriptEngine *engine);
+ QStringList keys() const;
+};
+
+
+#endif // VIDALIAEXTENSIONS_H
diff --git a/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp b/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp
new file mode 100644
index 0000000..0dd4887
--- /dev/null
+++ b/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp
@@ -0,0 +1,25 @@
+#include <QtScript/QScriptValue>
+#include <QtScript/QScriptEngine>
+
+const int classCount = 1;
+
+QScriptValue qtscript_create_TorControl_class(QScriptEngine *engine);
+
+static const char * const vidalia_class_names[] = {
+ "TorControl"
+};
+
+typedef QScriptValue (*QtBindingCreator)(QScriptEngine *engine);
+static const QtBindingCreator vidalia_class_functions[] = {
+ qtscript_create_TorControl_class
+};
+
+void vidalia_initialize_bindings(QScriptValue &extensionObject)
+{
+ QScriptEngine *engine = extensionObject.engine();
+ for (int i = 0; i < classCount; ++i) {
+ extensionObject.setProperty(vidalia_class_names[i],
+ vidalia_class_functions[i](engine),
+ QScriptValue::SkipInEnumeration);
+ }
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_TorControl.cpp b/src/vidalia/plugin/extensions/qtscript_TorControl.cpp
new file mode 100644
index 0000000..97cb237
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_TorControl.cpp
@@ -0,0 +1,704 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <TorControl.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatetime.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+
+static const char * const qtscript_TorControl_function_names[] = {
+ "TorControl"
+ // static
+ // prototype
+ , "authenticate"
+ , "clearErrState"
+ , "closeTorStdout"
+ , "connect"
+ , "disconnect"
+ , "finished"
+ , "getConf"
+ , "getDescriptorAnnotations"
+ , "getHiddenServiceConf"
+ , "getInfo"
+ , "getRouterDescriptorText"
+ , "getSocksAddress"
+ , "getSocksAddressList"
+ , "getSocksPort"
+ , "getSocksPortList"
+ , "getTorVersion"
+ , "getTorVersionString"
+ , "ipToCountry"
+ , "isAuthenticated"
+ , "isCircuitEstablished"
+ , "isConnected"
+ , "isRunning"
+ , "isVidaliaRunningTor"
+ , "loadConf"
+ , "resetConf"
+ , "saveConf"
+ , "setEvents"
+ , "shouldContinue"
+ , "start"
+ , "stop"
+ , "takeOwnership"
+ , "useMicrodescriptors"
+ , "toString"
+};
+
+static const char * const qtscript_TorControl_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , "QByteArray cookie, String errmsg\nString password, String errmsg"
+ , ""
+ , ""
+ , "QHostAddress address, unsigned short port\nString path"
+ , ""
+ , "int exitCode, ExitStatus exitStatus"
+ , "HashMap map, String errmsg\nString key, List value, String errmsg\nString key, String errmsg\nList keys, String errmsg"
+ , "String id, String errmsg"
+ , "String key, String errmsg"
+ , "String key, String errmsg\nList keys, String errmsg"
+ , "String id, String errmsg"
+ , "String errmsg"
+ , "String errmsg"
+ , "String errmsg"
+ , "String errmsg"
+ , ""
+ , ""
+ , "QHostAddress ip, String errmsg"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String contents, String errmsg"
+ , "String key, String errmsg\nList keys, String errmsg"
+ , "String errmsg"
+ , "String errmsg"
+ , "String errmsg"
+ , "String tor, List args"
+ , "String errmsg"
+ , "String errmsg"
+ , "String errmsg"
+""
+};
+
+static const int qtscript_TorControl_function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 2
+ , 0
+ , 0
+ , 2
+ , 0
+ , 2
+ , 3
+ , 2
+ , 2
+ , 2
+ , 2
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 2
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 2
+ , 2
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 0
+};
+
+static QScriptValue qtscript_TorControl_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("TorControl::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(TorControl*)
+Q_DECLARE_METATYPE(QString*)
+Q_DECLARE_METATYPE(QHostAddress)
+Q_DECLARE_METATYPE(int*)
+Q_DECLARE_METATYPE(QProcess::ExitStatus*)
+template <> \
+struct QMetaTypeId< QHash<QString,QStringList> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QHash<QString,QStringList> >("QHash<QString,QStringList>"); \
+ return metatype_id; \
+ } \
+};
+template <> \
+struct QMetaTypeId< QHash<QString,QString> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QHash<QString,QString> >("QHash<QString,QString>"); \
+ return metatype_id; \
+ } \
+};
+Q_DECLARE_METATYPE(QList<unsigned short>)
+
+//
+// TorControl
+//
+
+static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 32;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ TorControl* _q_self = qscriptvalue_cast<TorControl*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("TorControl.%0(): this object is not a TorControl")
+ .arg(qtscript_TorControl_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->authenticate();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_result = _q_self->authenticate(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->authenticate(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->authenticate(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->authenticate(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->clearErrState();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ _q_self->closeTorStdout();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->connect(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QHostAddress _q_arg0 = qscriptvalue_cast<QHostAddress>(context->argument(0));
+ unsigned short _q_arg1 = qscriptvalue_cast<unsigned short>(context->argument(1));
+ _q_self->connect(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ _q_self->disconnect();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 2) {
+ int* _q_arg0 = qscriptvalue_cast<int*>(context->argument(0));
+ QProcess::ExitStatus* _q_arg1 = qscriptvalue_cast<QProcess::ExitStatus*>(context->argument(1));
+ bool _q_result = _q_self->finished(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QHash<QString,QStringList> >() == context->argument(0).toVariant().userType())) {
+ QHash<QString,QStringList> _q_arg0 = qscriptvalue_cast<QHash<QString,QStringList> >(context->argument(0));
+ bool _q_result = _q_self->getConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QVariant _q_result = _q_self->getConf(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QMap<QString,QVariant> _q_result = _q_self->getConf(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QHash<QString,QStringList> >() == context->argument(0).toVariant().userType())
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QHash<QString,QStringList> _q_arg0 = qscriptvalue_cast<QHash<QString,QStringList> >(context->argument(0));
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->getConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isArray()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ bool _q_result = _q_self->getConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QVariant _q_result = _q_self->getConf(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QMap<QString,QVariant> _q_result = _q_self->getConf(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QString* _q_arg2 = qscriptvalue_cast<QString*>(context->argument(2));
+ bool _q_result = _q_self->getConf(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QHash<QString,QString> _q_result = _q_self->getDescriptorAnnotations(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QHash<QString,QString> _q_result = _q_self->getDescriptorAnnotations(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->getHiddenServiceConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QString _q_result = _q_self->getHiddenServiceConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QVariant _q_result = _q_self->getInfo(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QMap<QString,QVariant> _q_result = _q_self->getInfo(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QVariant _q_result = _q_self->getInfo(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QMap<QString,QVariant> _q_result = _q_self->getInfo(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_result = _q_self->getRouterDescriptorText(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QStringList _q_result = _q_self->getRouterDescriptorText(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QHostAddress _q_result = _q_self->getSocksAddress();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ QHostAddress _q_result = _q_self->getSocksAddress(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->getSocksAddressList();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ QStringList _q_result = _q_self->getSocksAddressList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ unsigned short _q_result = _q_self->getSocksPort();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ unsigned short _q_result = _q_self->getSocksPort(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QList<unsigned short> _q_result = _q_self->getSocksPortList();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ QList<unsigned short> _q_result = _q_self->getSocksPortList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ uint _q_result = _q_self->getTorVersion();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->getTorVersionString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QHostAddress _q_arg0 = qscriptvalue_cast<QHostAddress>(context->argument(0));
+ QString _q_result = _q_self->ipToCountry(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QHostAddress _q_arg0 = qscriptvalue_cast<QHostAddress>(context->argument(0));
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ QString _q_result = _q_self->ipToCountry(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isAuthenticated();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isCircuitEstablished();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isConnected();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRunning();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isVidaliaRunningTor();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->loadConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->loadConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 1) {
+ if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->resetConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ bool _q_result = _q_self->resetConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->resetConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->resetConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->saveConf();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ bool _q_result = _q_self->saveConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->setEvents();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ bool _q_result = _q_self->setEvents(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->shouldContinue();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ bool _q_result = _q_self->shouldContinue(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ _q_self->start(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->stop();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ bool _q_result = _q_self->stop(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ bool _q_result = _q_self->takeOwnership(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->useMicrodescriptors();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
+ bool _q_result = _q_self->useMicrodescriptors(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 32: {
+ QString result = QString::fromLatin1("TorControl");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorControl_throw_ambiguity_error_helper(context,
+ qtscript_TorControl_function_names[_id+1],
+ qtscript_TorControl_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_TorControl_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("TorControl cannot be constructed"));
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorControl_throw_ambiguity_error_helper(context,
+ qtscript_TorControl_function_names[_id],
+ qtscript_TorControl_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_TorControl_toScriptValue(QScriptEngine *engine, TorControl* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_TorControl_fromScriptValue(const QScriptValue &value, TorControl* &out)
+{
+ out = qobject_cast<TorControl*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_TorControl_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<TorControl*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((TorControl*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 33; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_TorControl_prototype_call, qtscript_TorControl_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_TorControl_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<TorControl*>(engine, qtscript_TorControl_toScriptValue,
+ qtscript_TorControl_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_TorControl_static_call, proto, qtscript_TorControl_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/prototypes/TorControlPrototype.cpp b/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
deleted file mode 100644
index ec7799e..0000000
--- a/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
-** This file is part of Vidalia, and is subject to the license terms in the
-** LICENSE file, found in the top level directory of this distribution. If you
-** did not receive the LICENSE file with this file, you may obtain it from the
-** Vidalia source package distributed by the Vidalia Project at
-** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
-** except according to the terms described in the LICENSE file.
-*/
-
-/*
-** \file TorControlPrototype.cpp
-** \brief Prototype for TorControl class
-*/
-
-#include "TorControlPrototype.h"
-#include "prototypemacros.h"
-
-TorControlPrototype::TorControlPrototype()
- : QObject(), QScriptable() {}
-
-int
-TorControlPrototype::metaTypeId() {
- return qMetaTypeId<TorControl *>();
-}
-
-QString
-TorControlPrototype::name() {
- return QString("TorControl");
-}
-
-DEF_TYPE0(TorControl, void,
- start(const QString &tor, const QStringList &args),
- start(tor, args))
-
-DEF_TYPE1(TorControl, bool,
- stop(),
- stop(&errmsg))
-
-DEF_TYPE0(TorControl, bool,
- isRunning(),
- isRunning())
-
-DEF_TYPE0(TorControl, bool,
- isVidaliaRunningTor(),
- isVidaliaRunningTor())
-
-DEF_TYPE0(TorControl, void,
- closeTorStdout(),
- closeTorStdout())
-
-DEF_TYPE0(TorControl, void,
- connect(const QHostAddress &address, quint16 port),
- connect(address, port))
-
-DEF_TYPE0(TorControl, void,
- connect(const QString &path),
- connect(path))
-
-DEF_TYPE0(TorControl, void,
- disconnect(),
- disconnect())
-
-DEF_TYPE0(TorControl, bool,
- isConnected(),
- isConnected())
-
-DEF_TYPE1(TorControl, bool,
- authenticate(const QByteArray cookie),
- authenticate(cookie, &errmsg))
-
-DEF_TYPE1(TorControl, bool,
- authenticate(const QString &password),
- authenticate(password, &errmsg))
-
-// TODO: make a QVariant for this two
-//QVariant
-//TorControlPrototype::protocolInfo()
-//{
-// ProtocolInfo info;
-// QString errmsg;
-
-// GET_AND_CALL(TorControl *, protocolInfo(&errmsg), info)
-
-// return MERGE2(info, errmsg);
-//}
-
-//BootstrapStatus
-//TorControlPrototype::bootstrapStatus(QString *errmsg)
-//{
-// BootstrapStatus status;
-// QString errmsg;
-
-// GET_AND_CALL(TorControl *, protocolInfo(&errmsg), status)
-
-// return MERGE2(status, errmsg);
-//}
-
-DEF_TYPE0(TorControl, bool,
- isCircuitEstablished(),
- isCircuitEstablished())
-
-DEF_TYPE1(TorControl, bool,
- getInfo(QHash<QString,QString> &map),
- getInfo(map, &errmsg))
-
-// TODO: this one may be useless
-//QVariant
-//TorControlPrototype::getInfo(QString key)
-//{
-// TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-// QString val, *errmsg = new QString();
-// bool res = false;
-// QList<QVariant> vals;
-
-// if(obj)
-// res = obj->getInfo(key, val, errmsg);
-
-// vals.append(QVariant(res));
-// vals.append(QVariant(val));
-// vals.append(QVariant(*errmsg));
-
-// return QVariant(vals);
-//}
-
-// TODO: There is no StringList, this may be useless
-//DEF_TYPE1(TorControl, QVariantMap,
-// getInfo(const QStringList &keys),
-// getInfo(keys, &errmsg))
-
-DEF_TYPE1(TorControl, QVariant,
- getInfo(const QString &key),
- getInfo(key, &errmsg))
-
-DEF_TYPE1(TorControl, bool,
- signal(TorSignal::Signal sig),
- signal(sig, &errmsg))
-
-// TODO: QVariant don't like QHostAddress
-//DEF_TYPE1(TorControl, QHostAddress,
-// getSocksAddress(),
-// getSocksAddress(&errmsg))
-
-// TODO: make it a QVariant(QList<QVariant>() << QVariant(QString) <<
-// QVariant(QString) ...
-QStringList
-TorControlPrototype::getSocksAddressList(QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getSocksAddressList(errmsg);
-}
-
-DEF_TYPE1(TorControl, quint16,
- getSocksPort(),
- getSocksPort(&errmsg))
-
-// TODO: same as getSocksAddressList but with quint16
-QList<quint16>
-TorControlPrototype::getSocksPortList(QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getSocksPortList(errmsg);
-}
-
-DEF_TYPE0(TorControl, QString,
- getTorVersionString(),
- getTorVersionString())
-
-DEF_TYPE0(TorControl, quint32,
- getTorVersion(),
- getTorVersion())
-
-DEF_TYPE1(TorControl, bool,
- setEvent(TorEvents::Event e, bool add, bool set),
- setEvent(e, add, set, &errmsg))
-
-DEF_TYPE1(TorControl, bool,
- setEvents(),
- setEvents(&errmsg))
-
-DEF_TYPE1(TorControl, bool,
- setConf(QHash<QString,QString> map),
- setConf(map, &errmsg))
-
-DEF_TYPE1(TorControl, bool,
- setConf(QString key, QString value),
- setConf(key, value, &errmsg))
-
-DEF_TYPE1(TorControl, bool,
- setConf(QString keyAndValue),
- setConf(keyAndValue, &errmsg))
-
-// TODO: macros don't like template variables
-// do this one by hand
-//DEF_TYPE2(TorControl, bool, QHash<QString,QString>,
-// getConf(QHash<QString,QString> &map),
-// getConf(map, &errmsg))
-bool
-TorControlPrototype::getConf(QHash<QString,QString> &map, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getConf(map, errmsg);
-}
-
-// TODO: this one too
-bool
-TorControlPrototype::getConf(QHash<QString,QStringList> &map, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getConf(map, errmsg);
-}
-
-DEF_TYPE2(TorControl, bool, QString,
- getConf(QString key),
- getConf(key, ans, &errmsg))
-
-// TODO: same as the last one with StringList
-bool
-TorControlPrototype::getConf(QString key, QStringList &value, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getConf(key, value, errmsg);
-}
-
-// TODO: idem
-QVariantMap
-TorControlPrototype::getConf(const QStringList &keys, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getConf(keys, errmsg);
-}
-
-// TODO: possibly useless
-//QVariant
-//TorControlPrototype::getConf(const QString &key, QString *errmsg)
-//{
-// TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
-// if(obj)
-// return obj->getConf(key, errmsg);
-//}
-
-DEF_TYPE1(TorControl, QString,
- getHiddenServiceConf(const QString &key),
- getHiddenServiceConf(key, &errmsg))
-
-DEF_TYPE1(TorControl, bool,
- saveConf(),
- saveConf(&errmsg))
-
-// TODO: another stringlist one
-bool
-TorControlPrototype::resetConf(QStringList keys, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->resetConf(keys, errmsg);
-}
-
-DEF_TYPE1(TorControl, bool,
- resetConf(QString key),
- resetConf(key, &errmsg))
-
-// TODO: you know
-QStringList
-TorControlPrototype::getRouterDescriptorText(const QString &id, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getRouterDescriptorText(id, errmsg);
-}
-
-// TODO: QVariantize RouterDescriptor
-RouterDescriptor
-TorControlPrototype::getRouterDescriptor(const QString &id, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getRouterDescriptor(id, errmsg);
-}
-
-// TODO: QVariantize RouterStatus
-RouterStatus
-TorControlPrototype::getRouterStatus(const QString &id, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getRouterStatus(id, errmsg);
-}
-
-// TODO: QVariantize NetworkStatus
-NetworkStatus
-TorControlPrototype::getNetworkStatus(QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getNetworkStatus(errmsg);
-}
-
-// TODO: QVariantize DescriptorAnnotations
-DescriptorAnnotations
-TorControlPrototype::getDescriptorAnnotations(const QString &id, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getDescriptorAnnotations(id, errmsg);
-}
-
-// TODO: QVariantize CircuitList
-CircuitList
-TorControlPrototype::getCircuits(QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getCircuits(errmsg);
-}
-
-// TODO: QVariantize StreamList
-StreamList
-TorControlPrototype::getStreams(QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getStreams(errmsg);
-}
-
-// TODO: QVariantize AddressMap
-AddressMap
-TorControlPrototype::getAddressMap(AddressMap::AddressMapType type, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->getAddressMap(type, errmsg);
-}
-
-DEF_TYPE1(TorControl, QString,
- ipToCountry(const QHostAddress &ip),
- ipToCountry(ip, &errmsg))
-
-// TODO: migrate CircuitId
-bool
-TorControlPrototype::closeCircuit(const CircuitId &circId, bool ifUnused, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->closeCircuit(circId, ifUnused, errmsg);
-}
-
-// TODO: migrate StreamId
-bool
-TorControlPrototype::closeStream(const StreamId &streamId, QString *errmsg)
-{
- TorControl *obj = qscriptvalue_cast<TorControl *>(thisObject());
-
- if(obj)
- return obj->closeStream(streamId, errmsg);
-}
diff --git a/src/vidalia/plugin/prototypes/TorControlPrototype.h b/src/vidalia/plugin/prototypes/TorControlPrototype.h
deleted file mode 100644
index 071b90b..0000000
--- a/src/vidalia/plugin/prototypes/TorControlPrototype.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
-** This file is part of Vidalia, and is subject to the license terms in the
-** LICENSE file, found in the top level directory of this distribution. If you
-** did not receive the LICENSE file with this file, you may obtain it from the
-** Vidalia source package distributed by the Vidalia Project at
-** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
-** except according to the terms described in the LICENSE file.
-*/
-
-/*
-** \file TorControlPrototype.h
-** \brief Prototype for TorControl class
-*/
-
-#ifndef _TORCONTROLPROTO_H
-#define _TORCONTROLPROTO_H
-
-#include <QtGui>
-#include <QtScript>
-
-#include "TorControl.h"
-#include "ProtocolInfo.h"
-
-class TorControlPrototype : public QObject, QScriptable
-{
- Q_OBJECT
-
-public:
- TorControlPrototype();
-
- static int metaTypeId();
- static QString name();
-
- /** Start the Tor process */
- Q_INVOKABLE void start(const QString &tor, const QStringList &args);
- /** Stop the Tor process */
- Q_INVOKABLE QVariant stop();
- /** Detect if the Tor process is running */
- Q_INVOKABLE bool isRunning();
- /** Detects if the Tor process is running under Vidalia. */
- Q_INVOKABLE bool isVidaliaRunningTor();
- /** Stops reading log messages from the Tor process's stdout. This has no
- * effect if isVidaliaRunningTor() is false. */
- Q_INVOKABLE void closeTorStdout();
-
- /** Connect to Tor's control socket */
- Q_INVOKABLE void connect(const QHostAddress &address, quint16 port);
- Q_INVOKABLE void connect(const QString &path);
- /** Disconnect from Tor's control socket */
- Q_INVOKABLE void disconnect();
- /** Check if we're connected to Tor's control socket */
- Q_INVOKABLE bool isConnected();
- /** Sends an authentication cookie to Tor. */
- Q_INVOKABLE QVariant authenticate(const QByteArray cookie);
- /** Sends an authentication password to Tor. */
- Q_INVOKABLE QVariant authenticate(const QString &password = QString());
-
- /** Sends a PROTOCOLINFO command to Tor and parses the response. */
-// Q_INVOKABLE QVariant protocolInfo();
-
- /** Returns the Tor software's current bootstrap phase and status. */
-// Q_INVOKABLE 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. */
- Q_INVOKABLE bool isCircuitEstablished();
-
- /** Sends a GETINFO message to Tor based on the given keys */
- Q_INVOKABLE QVariant getInfo(QHash<QString,QString> &map);
- /** Sends a GETINFO message for a single info value to Tor */
-// Q_INVOKABLE QVariant getInfo(QString key);
-
- /** Sends a GETINFO message to Tor using the given list of <b>keys</b> and
- * returns a QVariantMap containing the specified keys and their values as
- * returned by Tor. Returns a default constructed QVariantMap on failure. */
-// Q_INVOKABLE QVariantMap getInfo(const QStringList &keys, QString *errmsg = 0);
- /** Sends a GETINFO message to Tor with a single <b>key</b> and returns a
- * QVariant containing the value returned by Tor. Returns a default
- * constructed QVariant on failure. */
- Q_INVOKABLE QVariant getInfo(const QString &key);
-
- /** Sends a signal to Tor */
- Q_INVOKABLE QVariant signal(TorSignal::Signal sig);
-
- /** Returns an address on which Tor is listening for application
- * requests. If none are available, a null QHostAddress is returned. */
-// Q_INVOKABLE QVariant getSocksAddress();
- /** Returns a (possibly empty) list of all currently configured
- * SocksListenAddress entries. */
- Q_INVOKABLE QStringList getSocksAddressList(QString *errmsg = 0);
- /** Returns a valid SOCKS port for Tor, or 0 if Tor is not accepting
- * application requests. */
- Q_INVOKABLE QVariant getSocksPort();
- /** Returns a list of all currently configured SOCKS ports. If Tor is not
- * accepting any application connections, an empty list will be returned. */
- Q_INVOKABLE QList<quint16> getSocksPortList(QString *errmsg = 0);
-
- /** Returns Tor's version as a string. */
- Q_INVOKABLE QString getTorVersionString();
- /** Returns Tor's version as a numeric value. */
- Q_INVOKABLE quint32 getTorVersion();
-
- /** Sets an event and its handler. If add is true, then the event is added,
- * otherwise it is removed. If set is true, then the given event will be
- * registered with Tor. */
- Q_INVOKABLE QVariant setEvent(TorEvents::Event e, bool add = true, bool set = true);
- /** Register events of interest with Tor */
- Q_INVOKABLE QVariant setEvents();
-
- /** Sets each configuration key in <b>map</b> to the value associated with its key. */
- Q_INVOKABLE QVariant setConf(QHash<QString,QString> map);
- /** Sets a single configuration key to the given value. */
- Q_INVOKABLE QVariant setConf(QString key, QString value);
- /** Sets a single configuration string that is formatted <key=escaped value>. */
- Q_INVOKABLE QVariant setConf(QString keyAndValue);
- /** Gets values for a set of configuration keys, each of which has a single
- * value. */
- Q_INVOKABLE bool getConf(QHash<QString,QString> &map, QString *errmsg);
- /** Gets a set of configuration keyvalues and stores them in <b>map</b>. */
- Q_INVOKABLE bool getConf(QHash<QString,QStringList> &map, QString *errmsg = 0);
- /** Gets a single configuration value for <b>key</b>. */
- Q_INVOKABLE QVariant getConf(QString key);
- /** Gets a list of configuration values for <b>key</b>. */
- Q_INVOKABLE bool getConf(QString key, QStringList &value, QString *errmsg = 0);
-
- /** Sends a GETCONF message to Tor using the given list of <b>keys</b> and
- * returns a QVariantMap containing the specified keys and their values as
- * returned by Tor. Returns a default constructed QVariantMap on failure. */
- Q_INVOKABLE QVariantMap getConf(const QStringList &keys, QString *errmsg = 0);
- /** Sends a GETCONF message to Tor with a single <b>key</b> and returns a
- * QVariant containing the value returned by Tor. Returns a default
- * constructed QVariant on failure. */
-// Q_INVOKABLE QVariant getConf(const QString &key, QString *errmsg = 0);
- /** Sends a GETCONF message to Tor with the single key and returns a QString
- * containing the value returned by Tor */
- Q_INVOKABLE QVariant getHiddenServiceConf(const QString &key);
-
- /** Asks Tor to save the current configuration to its torrc */
- Q_INVOKABLE QVariant saveConf();
- /** Tells Tor to reset the given configuration keys back to defaults. */
- Q_INVOKABLE bool resetConf(QStringList keys, QString *errmsg = 0);
- /** Tells Tor to reset a configuration key back to its default value. */
- Q_INVOKABLE QVariant resetConf(QString key);
-
- /** Returns an unparsed router descriptor for the router whose fingerprint
- * matches <b>id</b>. The returned text can later be parsed by the
- * RouterDescriptor class. If <b>id</b> is invalid, then an empty
- * QStringList is returned. */
- Q_INVOKABLE QStringList getRouterDescriptorText(const QString &id, QString *errmsg = 0);
- /** Returns the descriptor for the router whose fingerprint matches
- * <b>id</b>. If <b>id</b> is invalid or the router's descriptor cannot be
- * parsed, then an invalid RouterDescriptor is returned. */
- Q_INVOKABLE RouterDescriptor getRouterDescriptor(const QString &id, QString *errmsg = 0);
- /** Returns the status of the router whose fingerprint matches <b>id</b>. If
- * <b>id</b> is invalid or the router's status cannot be parsed, then an
- * invalid RouterStatus is returned. */
- Q_INVOKABLE RouterStatus getRouterStatus(const QString &id, QString *errmsg = 0);
- /** Returns a RouterStatus object for every known router in the network. If
- * the network status document cannot be parsed, then an empty NetworkStatus
- * is returned. */
- Q_INVOKABLE NetworkStatus getNetworkStatus(QString *errmsg = 0);
- /** Returns the annotations for the router whose fingerprint matches
- * <b>id</b>. If <b>id</b> is invalid or the router's descriptor cannot be
- * parsed, then an empty DescriptorAnnotations is returned and
- * <b>errmsg</b> is set if it's not NULL. (Tor >= 0.2.0.13-alpha only) */
- Q_INVOKABLE DescriptorAnnotations getDescriptorAnnotations(const QString &id,
- QString *errmsg = 0);
-
- /** Gets a list of current circuits. */
- Q_INVOKABLE CircuitList getCircuits(QString *errmsg = 0);
- /** Gets a list of current streams. */
- Q_INVOKABLE StreamList getStreams(QString *errmsg = 0);
-
- /** Gets a list of address mappings of the type specified by <b>type</b>
- * (defaults to <i>AddressMapAll</i>. */
- Q_INVOKABLE AddressMap getAddressMap(
- AddressMap::AddressMapType type = AddressMap::AddressMapAll,
- QString *errmsg = 0);
-
- /** Gets the ISO-3166 two-letter country code for <b>ip</b> from Tor.
- * Returns a default-constructed QString on failure or if a country code
- * is not known for <b>ip</b>. On failure, <b>errmsg</b> will be set if
- * it's not NULL. */
- Q_INVOKABLE QVariant ipToCountry(const QHostAddress &ip);
-
-public slots:
- /** Closes the circuit specified by <b>circId</b>. If <b>ifUnused</b> is
- * true, then the circuit will not be closed unless it is unused. */
- bool closeCircuit(const CircuitId &circId, bool ifUnused = false,
- QString *errmsg = 0);
- /** Closes the stream specified by <b>streamId</b>. */
- bool closeStream(const StreamId &streamId, QString *errmsg = 0);
-
-signals:
- /** Emitted when the Tor process has started */
- void started();
- /** Emitted when the Tor process fails to start. */
- void startFailed(QString errmsg);
- /** Emitted when the Tor process has stopped */
- void stopped(int exitCode, QProcess::ExitStatus exitStatus);
- /** Emitted when the Tor process has stopped. */
- void stopped();
- /** Emitted when the controller has connected to Tor */
- void connected();
- /** Emitted when the controller failed to connect to Tor. */
- void connectFailed(QString errmsg);
- /** Emitted when the controller has disconnected from Tor */
- void disconnected();
- /** Emitted when the control socket is connected and authenticated. */
- void authenticated();
- /** Emitted when Tor rejects our authentication attempt. */
- void authenticationFailed(QString errmsg);
-
- /** Emitted when Tor writes the message <b>msg</b> to the control port
- * with message severity <b>level</b>.
- */
- void logMessage(tc::Severity level, const QString &msg);
-
- /** Emitted when Tor sends a bandwidth usage update (roughly once every
- * second). <b>bytesReceived</b> is the number of bytes read by Tor over
- * the previous second and <b>bytesWritten</b> is the number of bytes
- * sent over the same interval.
- */
- void bandwidthUpdate(quint64 bytesReceived, quint64 bytesSent);
-
- /** Emitted when the stream status of <b>stream</b> has changed.
- */
- void streamStatusChanged(const Stream &stream);
-
- /** Emitted when the circuit status of <b>circuit</b> has changed.
- */
- void circuitStatusChanged(const Circuit &circuit);
-
- /** Emitted when Tor has mapped the address <b>from</b> to the address
- * <b>to</b>. <b>expires</b> indicates the time at which when the address
- * mapping will no longer be considered valid.
- */
- void addressMapped(const QString &from, const QString &to,
- const QDateTime &expires);
-
- /** Emitted when Tor has received one or more new router descriptors.
- * <b>ids</b> contains a list of digests of the new descriptors.
- */
- void newDescriptors(const QStringList &ids);
-
- /** Indicates Tor has been able to successfully establish one or more
- * circuits.
- */
- void circuitEstablished();
-
- /** Indicates that Tor has decided the user's Tor software <b>version</b>
- * is no longer recommended for some <b>reason</b>. <b>recommended</b> is
- * a list of Tor software versions that are considered current.
- */
- void dangerousTorVersion(tc::TorVersionStatus reason,
- const QString &version,
- const QStringList &recommended);
-
- /** Emitted during Tor's startup process to indicate how far in its
- * bootstrapping process it has progressed. <b>status</b> may indicate
- * the current bootstrapping stage or an error during bootstrapping.
- */
- void bootstrapStatusChanged(const BootstrapStatus &status);
-
- /** Emitted when the user attempts to establish a connection to some
- * destination on port <b>port</b>, which is a port known to use
- * plaintext connections (as determined by Tor's WarnPlaintextPorts and
- * RejectPlaintextPorts torrc options). <b>rejected</b> indicates whether
- * Tor rejected the connection or permitted it to connect anyway.
- */
- void dangerousPort(quint16 port, bool rejected);
-
- /** Emitted when Tor detects a problem with a SOCKS connection from the
- * user, such as a bad hostname, dangerous SOCKS protocol type, or a bad
- * hostname. <b>type</b> indicates the type of error encountered and
- * <b>destination</b> (if non-empty) specifies the attempted connection
- * destination address or hostname.
- */
- void socksError(tc::SocksError type, const QString &destination);
-
- /** Emitted 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);
-
- /** Indicates that Tor has determined the client's clock is potentially
- * skewed by <b>skew</b> seconds relative to <b>source</b>.
- */
- void clockSkewed(int skew, const QString &source);
-
- /** Emitted when Tor has encountered an internal bug. <b>reason</b> is
- * Tor's description of the bug.
- */
- void bug(const QString &reason);
-
- /** Emitted 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();
-
- /** Emitted 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);
-
- /** Emitted 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);
-
- /** Emitted when the directory authority with IP address <b>ip</b> and
- * port <b>port</b> accepted the user's server descriptor.
- */
- void serverDescriptorAccepted(const QHostAddress &ip, quint16 port);
-
- /** Emitted when at least one directory authority has accepted the user's
- * server descriptor.
- */
- void serverDescriptorAccepted();
-};
-
-Q_DECLARE_METATYPE(TorControl *);
-
-#endif
-
-
[View Less]
1
0
commit 43acda47404cd915d364f37008496569c22941f0
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Wed Jun 13 14:45:11 2012 -0300
Fix typo in define
---
src/torcontrol/TorSignal.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/torcontrol/TorSignal.h b/src/torcontrol/TorSignal.h
index 1ab8978..2858a91 100644
--- a/src/torcontrol/TorSignal.h
+++ b/src/torcontrol/TorSignal.h
@@ -14,7 +14,7 @@
*/
#ifndef _TORSIGNAL_H
-#define _TORSGINAL_H
+#define _TORSIGNAL_H
#include <QString>
1
0

[vidalia/alpha] Adds Settings frame to Network Map with optional Relay columns.
by chiiph@torproject.org 14 Jun '12
by chiiph@torproject.org 14 Jun '12
14 Jun '12
commit 84b75ab02f6672434c6824e05b8b83b4040d8b58
Author: Boris Skegin <boris.skegin.de(a)gmail.com>
Date: Sun Apr 22 13:46:17 2012 +0200
Adds Settings frame to Network Map with optional Relay columns.
---
changes/bug2731 | 3 +
src/vidalia/network/NetViewer.cpp | 81 +++++++++++-
src/vidalia/network/NetViewer.h | 10 ++
src/vidalia/network/NetViewer.ui | 216 +++++++++++++++++++++++++++++-
src/vidalia/network/RouterListItem.…
[View More]cpp | 68 ++++++++++
src/vidalia/network/RouterListItem.h | 6 +-
src/vidalia/network/RouterListWidget.cpp | 10 +-
src/vidalia/network/RouterListWidget.h | 9 +-
8 files changed, 390 insertions(+), 13 deletions(-)
diff --git a/changes/bug2731 b/changes/bug2731
new file mode 100644
index 0000000..a7033ac
--- /dev/null
+++ b/changes/bug2731
@@ -0,0 +1,3 @@
+ New features:
+ o Adds Settings frame for Network Map with optional
+ columns for Relay panel. Resolves ticket 2731.
diff --git a/src/vidalia/network/NetViewer.cpp b/src/vidalia/network/NetViewer.cpp
index 9c2cd3b..f0868fe 100644
--- a/src/vidalia/network/NetViewer.cpp
+++ b/src/vidalia/network/NetViewer.cpp
@@ -51,6 +51,20 @@
#define DEFAULT_SPLITTER_MAP QByteArray()
#define DEFAULT_SPLITTER_ROUT QByteArray()
+/* Settings key for IP column */
+#define SETTING_IP_COLUMN "RelayPanel/ShowIPColumn"
+/* Settings key for Bandwidth column */
+#define SETTING_BW_COLUMN "RelayPanel/ShowBandwidthColumn"
+/* Settings key for Uptime column */
+#define SETTING_UPTIME_COLUMN "RelayPanel/ShowUptimeColumn"
+
+/* Default key value for IP column */
+#define DEFAULT_IP_COLUMN false
+/* Default key value for Bandwidth column */
+#define DEFAULT_BW_COLUMN false
+/* Default key value for Uptime column */
+#define DEFAULT_UPTIME_COLUMN false
+
/** Constructor. Loads settings from VidaliaSettings.
* \param parent The parent widget of this NetViewer object.\
*/
@@ -63,6 +77,8 @@ NetViewer::NetViewer(QWidget *parent)
ui.lblConsensus->setVisible(false);
ui.lblOffline->setVisible(false);
+ loadSettings();
+ ui.frmSettings->setVisible(false);
#if defined(Q_WS_MAC)
ui.actionHelp->setShortcut(QString("Ctrl+?"));
#endif
@@ -163,7 +179,10 @@ NetViewer::NetViewer(QWidget *parent)
ui.treeRouterList, SLOT(onRouterSearch(QString)));
connect(ui.treeRouterList, SIGNAL(displayRouterInfo(QString)),
this, SLOT(displayRouterInfo(QString)));
-
+ connect(ui.btnSaveSettings, SIGNAL(clicked()),
+ this, SLOT(saveSettings()));
+ connect(ui.btnCancelSettings, SIGNAL(clicked()),
+ this, SLOT(cancelChanges()));
setupGeoIpResolver();
QToolBar *tb = new QToolBar();
@@ -173,10 +192,11 @@ NetViewer::NetViewer(QWidget *parent)
tb->addAction(ui.actionZoomOut);
tb->addAction(ui.actionZoomToFit);
tb->addAction(ui.actionZoomFullScreen);
+ tb->addAction(ui.actionSettings);
tb->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui.horizontalLayout->addWidget(tb);
-
+
/* Restore the state of each splitter */
ui.spltMain->restoreState(getSetting(SETTING_SPLITTER_MAIN,
DEFAULT_SPLITTER_MAIN)
@@ -619,3 +639,60 @@ NetViewer::linkActivated(const QString &url)
{
emit helpRequested(url);
}
+
+/** Saves the Network Map settings and
+ * then hides the settings frame. */
+void
+NetViewer::saveSettings()
+{
+ ui.treeRouterList->setColumnHidden(RouterListWidget::IPnumberColumn,
+ !(ui.chkShowIP->isChecked()));
+ ui.treeRouterList->setColumnHidden(RouterListWidget::BandwidthColumn,
+ !(ui.chkShowBW->isChecked()));
+ ui.treeRouterList->setColumnHidden(RouterListWidget::UptimeColumn,
+ !(ui.chkShowUptime->isChecked()));
+ saveSetting(SETTING_IP_COLUMN, ui.chkShowIP->isChecked());
+ saveSetting(SETTING_BW_COLUMN, ui.chkShowBW->isChecked());
+ saveSetting(SETTING_UPTIME_COLUMN, ui.chkShowUptime->isChecked());
+}
+
+/** Simply restores the previously saved settings and hides the settings
+ * frame. */
+void
+NetViewer::cancelChanges()
+{
+ /* Hide the settings frame and reset toggle button */
+ ui.actionSettings->toggle();
+ /* Reload the settings */
+ loadSettings();
+}
+
+/** Loads the saved Network Map settings
+ * except Splitter settings. */
+void
+NetViewer::loadSettings()
+{
+ /* Add optional columns to Relay Panel if their setting values are
+ * true, otherwise use default values. */
+ ui.treeRouterList->setColumnHidden(RouterListWidget::IPnumberColumn,
+ !(getSetting(SETTING_IP_COLUMN,
+ DEFAULT_IP_COLUMN).
+ toBool()));
+ ui.chkShowIP->setChecked(getSetting(SETTING_IP_COLUMN,
+ DEFAULT_IP_COLUMN).
+ toBool());
+ ui.treeRouterList->setColumnHidden(RouterListWidget::BandwidthColumn,
+ !(getSetting(SETTING_BW_COLUMN,
+ DEFAULT_BW_COLUMN).
+ toBool()));
+ ui.chkShowBW->setChecked(getSetting(SETTING_BW_COLUMN,
+ DEFAULT_BW_COLUMN).
+ toBool());
+ ui.treeRouterList->setColumnHidden(RouterListWidget::UptimeColumn,
+ !(getSetting(SETTING_UPTIME_COLUMN,
+ DEFAULT_UPTIME_COLUMN).
+ toBool()));
+ ui.chkShowUptime->setChecked(getSetting(SETTING_UPTIME_COLUMN,
+ DEFAULT_UPTIME_COLUMN).
+ toBool());
+}
diff --git a/src/vidalia/network/NetViewer.h b/src/vidalia/network/NetViewer.h
index b4f4ec3..39a3de0 100644
--- a/src/vidalia/network/NetViewer.h
+++ b/src/vidalia/network/NetViewer.h
@@ -118,6 +118,16 @@ private slots:
/** Called when the user clicks on a QLabel containing a hyperlink. */
void linkActivated(const QString &url);
+ /** Saves the Network Map settings and
+ * then hides the settings frame. */
+ void saveSettings();
+ /** Loads the saved Network Map settings
+ * except Splitter settings. */
+ void loadSettings();
+ /** Simply restores the previously saved settings and hides the settings
+ * frame. */
+ void cancelChanges();
+
private:
/** */
void setupGeoIpResolver();
diff --git a/src/vidalia/network/NetViewer.ui b/src/vidalia/network/NetViewer.ui
index c4db045..7994fb9 100644
--- a/src/vidalia/network/NetViewer.ui
+++ b/src/vidalia/network/NetViewer.ui
@@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>740</width>
- <height>614</height>
+ <height>786</height>
</rect>
</property>
<property name="windowTitle">
<string>Network Map</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_10">
+ <layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QSplitter" name="spltMain">
<property name="orientation">
@@ -145,7 +145,7 @@
<bool>true</bool>
</property>
<property name="columnCount">
- <number>3</number>
+ <number>6</number>
</property>
<column>
<property name="text">
@@ -162,6 +162,21 @@
<string>Relay</string>
</property>
</column>
+ <column>
+ <property name="text">
+ <string>IP</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Bandwidth</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Uptime</string>
+ </property>
+ </column>
</widget>
</item>
</layout>
@@ -355,6 +370,164 @@
</widget>
</widget>
</item>
+ <item>
+ <widget class="QFrame" name="frmSettings">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>550</width>
+ <height>140</height>
+ </size>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="visible">
+ <bool>true</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="grpRelayPanel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>110</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Add columns to Relay panel:</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="chkShowIP">
+ <property name="text">
+ <string>IP</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="chkShowBW">
+ <property name="text">
+ <string>Bandwidth</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="chkShowUptime">
+ <property name="text">
+ <string>Uptime</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_10">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnSaveSettings">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>85</width>
+ <height>27</height>
+ </size>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="toolTip">
+ <string>Saves the current Network Map settings</string>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnCancelSettings">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>85</width>
+ <height>27</height>
+ </size>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="toolTip">
+ <string>Cancels changes made to settings</string>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
<action name="actionRefresh">
<property name="enabled">
@@ -485,6 +658,24 @@
<string>Ctrl+F</string>
</property>
</action>
+ <action name="actionSettings">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="icon">
+ <iconset resource="../res/vidalia.qrc">
+ <normaloff>:/images/32x32/preferences-other.png</normaloff>:/images/32x32/preferences-other.png</iconset>
+ </property>
+ <property name="text">
+ <string>Settings</string>
+ </property>
+ <property name="statusTip">
+ <string>Adjust Network Map Settings</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+T</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
@@ -506,5 +697,22 @@
<resources>
<include location="../res/vidalia.qrc"/>
</resources>
- <connections/>
+ <connections>
+ <connection>
+ <sender>actionSettings</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>frmSettings</receiver>
+ <slot>setVisible(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>264</x>
+ <y>424</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
diff --git a/src/vidalia/network/RouterListItem.cpp b/src/vidalia/network/RouterListItem.cpp
index 480d5a8..08ce5f7 100644
--- a/src/vidalia/network/RouterListItem.cpp
+++ b/src/vidalia/network/RouterListItem.cpp
@@ -18,12 +18,16 @@
#include "TorSettings.h"
#include "Vidalia.h"
+#include "stringutil.h"
#include <QHeaderView>
#define STATUS_COLUMN (RouterListWidget::StatusColumn)
#define COUNTRY_COLUMN (RouterListWidget::CountryColumn)
#define NAME_COLUMN (RouterListWidget::NameColumn)
+#define IP_COLUMN (RouterListWidget::IPnumberColumn)
+#define BW_COLUMN (RouterListWidget::BandwidthColumn)
+#define UPTIME_COLUMN (RouterListWidget::UptimeColumn)
#define NONEXIT_COLOR (Qt::white)
#define EXIT_COLOR (QColor::fromRgb(169, 207, 84))
@@ -96,6 +100,20 @@ RouterListItem::update(const RouterDescriptor &rd)
/* Make the new information visible */
setIcon(STATUS_COLUMN, statusIcon);
setText(NAME_COLUMN, _rd->name());
+ setText(IP_COLUMN, _rd->ip().toString());
+ /* We show the observedBandwidth and not the minBandwidth as in
+ * RouterDescriptorView.cpp
+ */
+ setText(BW_COLUMN, string_format_bandwidth(_rd->observedBandwidth()));
+ /* Clf. quint64
+ * RouterInfoDialog::adjustUptime(quint64 uptime, const QDateTime &published)
+ */
+ QDateTime now = QDateTime::currentDateTime().toUTC();
+ if (now < _rd->published())
+ setText(UPTIME_COLUMN, string_format_uptime(_rd->uptime()));
+ else
+ setText(UPTIME_COLUMN, string_format_uptime(_rd->uptime() +
+ (now.toTime_t() - _rd->published().toTime_t())));
setToolTip(NAME_COLUMN, QString(_rd->name() + "\r\n" + _rd->platform()));
}
@@ -116,6 +134,27 @@ RouterListItem::setLocation(const GeoIpRecord &geoip)
_countryCode = geoip.countryCode();
}
+/** Convert IP numbers to quint64 for the comparison operator
+ * filling the dot separated groups with zeroes if necessary.
+ */
+quint64
+RouterListItem::iptoquint64(const RouterListItem *ListItem) const
+{
+ bool ok;
+ quint64 ipNumber;
+ QString ipString;
+ ipString = ListItem->descriptor().ip().toString();
+ QStringList ipList = ipString.split(".", QString::SkipEmptyParts);
+ ipString = "";
+ for (int i = ipList.size()-1; i >= 1; i--) {
+ ipList[i] = ipList[i].rightJustified(3, '0');
+ ipString.prepend(ipList[i]);
+ }
+ ipString.prepend(ipList[0]);
+ ipNumber = ipString.toULongLong(&ok, 10);
+ return(ipNumber);
+}
+
/** Overload the comparison operator. */
bool
RouterListItem::operator<(const QTreeWidgetItem &other) const
@@ -153,6 +192,35 @@ RouterListItem::operator<(const QTreeWidgetItem &other) const
return (a->_statusValue < b->_statusValue);
}
return (a->name().toLower() < b->name().toLower());
+ /* Compare IP numbers based on their quint64 values */
+ case RouterListWidget::IPnumberColumn:
+ if (a->descriptor().ip() == b->descriptor().ip()) {
+ if (order == Qt::AscendingOrder)
+ return (a->_statusValue > b->_statusValue);
+ else
+ return (a->_statusValue < b->_statusValue);
+ }
+ return (iptoquint64(a) < iptoquint64(b));
+ case RouterListWidget::BandwidthColumn:
+ /* Compare bandwidth in bytes */
+ if (a->descriptor().observedBandwidth() ==
+ b->descriptor().observedBandwidth()) {
+ if (order == Qt::AscendingOrder)
+ return (a->_statusValue > b->_statusValue);
+ else
+ return (a->_statusValue < b->_statusValue);
+ }
+ return (a->descriptor().observedBandwidth() <
+ b->descriptor().observedBandwidth());
+ case RouterListWidget::UptimeColumn:
+ /* Compare uptime in seconds */
+ if (a->descriptor().uptime() == b->descriptor().uptime()) {
+ if (order == Qt::AscendingOrder)
+ return (a->_statusValue > b->_statusValue);
+ else
+ return (a->_statusValue < b->_statusValue);
+ }
+ return (a->descriptor().uptime() < b->descriptor().uptime());
default:
break;
}
diff --git a/src/vidalia/network/RouterListItem.h b/src/vidalia/network/RouterListItem.h
index db98364..7f3f9f8 100644
--- a/src/vidalia/network/RouterListItem.h
+++ b/src/vidalia/network/RouterListItem.h
@@ -49,7 +49,10 @@ public:
void setLocation(const GeoIpRecord &geoip);
/** Returns the location information set for this router item. */
GeoIpRecord location() const { return _location; }
-
+ /** Convert IP numbers to quint64 for the comparison operator
+ * filling the dot separated groups with zeroes if necessary.
+ */
+ quint64 iptoquint64(const RouterListItem *ListItem) const;
/** Overload the comparison operator. */
virtual bool operator<(const QTreeWidgetItem &other) const;
@@ -82,4 +85,3 @@ private:
};
#endif
-
diff --git a/src/vidalia/network/RouterListWidget.cpp b/src/vidalia/network/RouterListWidget.cpp
index faa9a3e..eb0d74c 100644
--- a/src/vidalia/network/RouterListWidget.cpp
+++ b/src/vidalia/network/RouterListWidget.cpp
@@ -34,7 +34,10 @@ RouterListWidget::RouterListWidget(QWidget *parent)
/* Create and initialize columns */
setHeaderLabels(QStringList() << QString("")
<< QString("")
- << tr("Relay"));
+ << tr("Relay")
+ << tr("IP")
+ << tr("Bandwidth")
+ << tr("Uptime"));
/* Sort by descending server bandwidth */
sortItems(StatusColumn, Qt::DescendingOrder);
@@ -50,7 +53,10 @@ RouterListWidget::retranslateUi()
{
setHeaderLabels(QStringList() << QString("")
<< QString("")
- << tr("Relay"));
+ << tr("Relay")
+ << tr("IP")
+ << tr("Bandwidth")
+ << tr("Uptime"));
}
/** Called when the user requests a context menu for a router in the list. A
diff --git a/src/vidalia/network/RouterListWidget.h b/src/vidalia/network/RouterListWidget.h
index fddfaa9..6a3b7c1 100644
--- a/src/vidalia/network/RouterListWidget.h
+++ b/src/vidalia/network/RouterListWidget.h
@@ -37,9 +37,12 @@ class RouterListWidget : public QTreeWidget
public:
/** Columns in the list. */
enum Columns {
- StatusColumn = 0, /**< Status column, indicating bandwidth. */
- CountryColumn = 1, /**< Router's country flag. */
- NameColumn = 2, /**< Router's name. */
+ StatusColumn = 0, /**< Status column, indicating bandwidth. */
+ CountryColumn = 1, /**< Router's country flag. */
+ NameColumn = 2, /**< Router's name. */
+ IPnumberColumn = 3, /**< Router's IP. */
+ BandwidthColumn = 4, /**< Router's Bandwidth. */
+ UptimeColumn = 5, /**< Router's Uptime. */
};
/** Default constructor. */
[View Less]
1
0

14 Jun '12
commit d8729acba3141d90b40e30ea107a4938194abb3c
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Thu Jun 14 19:31:44 2012 -0300
Close the netviewer settings also when saving
---
src/vidalia/network/NetViewer.cpp | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/vidalia/network/NetViewer.cpp b/src/vidalia/network/NetViewer.cpp
index f0868fe..12f2081 100644
--- a/src/vidalia/network/NetViewer.cpp
+++ b/src/vidalia/network/NetViewer.cpp
@@ -645,6 +645,…
[View More]8 @@ NetViewer::linkActivated(const QString &url)
void
NetViewer::saveSettings()
{
+ /* Hide the settings frame and reset toggle button */
+ ui.actionSettings->toggle();
ui.treeRouterList->setColumnHidden(RouterListWidget::IPnumberColumn,
!(ui.chkShowIP->isChecked()));
ui.treeRouterList->setColumnHidden(RouterListWidget::BandwidthColumn,
[View Less]
1
0
commit 3b624dbc96abe9e8c2a97880a9a403195ec553dd
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Thu Jun 14 19:34:47 2012 -0300
Fix possible infinite loop
---
src/torcontrol/ControlConnection.cpp | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/torcontrol/ControlConnection.cpp b/src/torcontrol/ControlConnection.cpp
index cb9f737..5f337c4 100644
--- a/src/torcontrol/ControlConnection.cpp
+++ b/src/torcontrol/ControlConnection.cpp
@@ -325,6 +325,9 @…
[View More]@ ControlConnection::onReadyRead()
}
} else {
tc::error("Unable to read control reply: %1").arg(errmsg);
+ if (!isConnected()) {
+ break;
+ }
}
}
}
[View Less]
1
0

14 Jun '12
commit 75706527c16fc62ec7db4e496db76e21c79c664a
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Thu Jun 14 14:58:51 2012 -0400
Document --hush; fix documentation for --quiet.
---
changes/doc_hush | 3 +++
doc/tor.1.txt | 11 +++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/changes/doc_hush b/changes/doc_hush
new file mode 100644
index 0000000..b3a67aa
--- /dev/null
+++ b/changes/doc_hush
@@ -0,0 +1,3 @@
+ o Documentation:
+ - Fix the …
[View More]documentation for the --hush and --quiet command line options,
+ which changed their behavior back in 0.2.3.3-alpha.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 78a33ca..468ed63 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -62,10 +62,13 @@ OPTIONS
**--version**::
Display Tor version and exit.
-**--quiet**::
- Do not start Tor with a console log unless explicitly requested to do so.
- (By default, Tor starts out logging messages at level "notice" or higher to
- the console, until it has parsed its configuration.)
+**--quiet**|**--hush**::
+ Override the default console log. By default, Tor starts out logging
+ messages at level "notice" and higher to the console. It stops doing so
+ after it parses its configuration, if the configuration tells it to log
+ anywhere else. You can override this behavior with the **--hush** option,
+ which tells Tor to only send warnings and errors to the console, or with
+ the **--quiet** option, which tells Tor not to log to the console at all.
Other options can be specified either on the command-line (--option
value), or in the configuration file (option value or option "value").
[View Less]
1
0