commit f85ab165ce2f9868c43940822d74dbc5972a45ea
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Tue Jul 17 19:27:23 2012 -0300
Add all the generated classes as automatically generated qtscript extensions
RouterStatus is a QObject now.
---
src/torcontrol/RouterStatus.cpp | 38 ++
src/torcontrol/RouterStatus.h | 9 +-
src/vidalia/CMakeLists.txt | 22 +
.../plugin/extensions/VidaliaExtensionsInit.cpp | 51 ++-
.../plugin/extensions/qtscript_BootstrapStatus.cpp | 393 ++++++++++++++
src/vidalia/plugin/extensions/qtscript_Circuit.cpp | 542 +++++++++++++++++++
.../plugin/extensions/qtscript_ControlCommand.cpp | 206 +++++++
.../extensions/qtscript_ControlConnection.cpp | 344 ++++++++++++
.../plugin/extensions/qtscript_ControlMethod.cpp | 199 +++++++
.../plugin/extensions/qtscript_ControlReply.cpp | 199 +++++++
.../plugin/extensions/qtscript_ControlSocket.cpp | 278 ++++++++++
.../plugin/extensions/qtscript_ReplyLine.cpp | 215 ++++++++
.../extensions/qtscript_RouterDescriptor.cpp | 561 ++++++++++++++++++++
.../plugin/extensions/qtscript_RouterStatus.cpp | 344 ++++++++++++
.../extensions/qtscript_SendCommandEvent.cpp | 134 +++++
src/vidalia/plugin/extensions/qtscript_Stream.cpp | 413 ++++++++++++++
.../plugin/extensions/qtscript_TorControl.cpp | 119 ++++-
.../plugin/extensions/qtscript_TorEvents.cpp | 297 +++++++++++
.../plugin/extensions/qtscript_TorProcess.cpp | 232 ++++++++
.../plugin/extensions/qtscript_TorSignal.cpp | 196 +++++++
.../extensions/qtscriptshell_ControlConnection.cpp | 95 ++++
.../extensions/qtscriptshell_ControlConnection.h | 23 +
.../extensions/qtscriptshell_ControlMethod.cpp | 13 +
.../extensions/qtscriptshell_ControlMethod.h | 18 +
.../extensions/qtscriptshell_ControlSocket.cpp | 94 ++++
.../extensions/qtscriptshell_ControlSocket.h | 23 +
.../plugin/extensions/qtscriptshell_TorControl.cpp | 99 ++++
.../plugin/extensions/qtscriptshell_TorControl.h | 23 +
.../plugin/extensions/qtscriptshell_TorEvents.cpp | 100 ++++
.../plugin/extensions/qtscriptshell_TorEvents.h | 23 +
.../plugin/extensions/qtscriptshell_TorProcess.cpp | 306 +++++++++++
.../plugin/extensions/qtscriptshell_TorProcess.h | 40 ++
.../plugin/extensions/qtscriptshell_TorSignal.cpp | 13 +
.../plugin/extensions/qtscriptshell_TorSignal.h | 18 +
34 files changed, 5658 insertions(+), 22 deletions(-)
diff --git a/src/torcontrol/RouterStatus.cpp b/src/torcontrol/RouterStatus.cpp
index 49e6cb1..d750a3f 100644
--- a/src/torcontrol/RouterStatus.cpp
+++ b/src/torcontrol/RouterStatus.cpp
@@ -22,6 +22,43 @@
#define TIME_FORMAT "yyyy-MM-dd HH:mm:ss"
+RouterStatus::RouterStatus()
+ : QObject()
+{}
+
+RouterStatus::RouterStatus(const RouterStatus &rs)
+{
+ _valid = rs._valid;
+ _name = rs._name;
+ _id = rs._id;
+ _digest = rs._digest;
+ _published = rs._published;
+ _ipAddress = rs._ipAddress;
+ _orPort = rs._orPort;
+ _dirPort = rs._dirPort;
+ _flags = rs._flags;
+ _bandwidth = rs._bandwidth;
+}
+
+RouterStatus::~RouterStatus() {}
+
+RouterStatus &
+RouterStatus::operator=(const RouterStatus &rs)
+{
+ _valid = rs._valid;
+ _name = rs._name;
+ _id = rs._id;
+ _digest = rs._digest;
+ _published = rs._published;
+ _ipAddress = rs._ipAddress;
+ _orPort = rs._orPort;
+ _dirPort = rs._dirPort;
+ _flags = rs._flags;
+ _bandwidth = rs._bandwidth;
+
+ return *this;
+}
+
/** Constructor. Parses <b>status</b> for router status information. The given
* string should match the router status entry format from Tor's dir-spec.txt.
* The currently recognized lines are:
@@ -34,6 +71,7 @@
*
* */
RouterStatus::RouterStatus(const QStringList &status)
+ : QObject()
{
bool ok;
diff --git a/src/torcontrol/RouterStatus.h b/src/torcontrol/RouterStatus.h
index ee136b1..d0da655 100644
--- a/src/torcontrol/RouterStatus.h
+++ b/src/torcontrol/RouterStatus.h
@@ -22,7 +22,7 @@
#include <QDateTime>
-class RouterStatus
+class RouterStatus : public QObject
{
public:
/** Possible router status flags. */
@@ -45,7 +45,14 @@ public:
Q_DECLARE_FLAGS(Flags, Flag)
/** Constructor. */
+ RouterStatus();
+ RouterStatus(const RouterStatus &rs);
+ /** Constructor. */
RouterStatus(const QStringList &status);
+ /** Destructor */
+ ~RouterStatus();
+
+ RouterStatus &operator=(const RouterStatus &other);
/** Returns the router's hexadecimal-encoded router identity key digest. */
QString id() const { return _id; }
diff --git a/src/vidalia/CMakeLists.txt b/src/vidalia/CMakeLists.txt
index 312191d..58d846d 100644
--- a/src/vidalia/CMakeLists.txt
+++ b/src/vidalia/CMakeLists.txt
@@ -94,7 +94,29 @@ set(vidalia_SRCS ${vidalia_SRCS}
plugin/prototypes/TorrcPrototype.cpp
plugin/extensions/VidaliaExtensions.cpp
plugin/extensions/VidaliaExtensionsInit.cpp
+ plugin/extensions/qtscript_BootstrapStatus.cpp
+ plugin/extensions/qtscript_Circuit.cpp
+ plugin/extensions/qtscript_ControlCommand.cpp
+ plugin/extensions/qtscript_ControlConnection.cpp
+ plugin/extensions/qtscript_ControlMethod.cpp
+ plugin/extensions/qtscript_ControlReply.cpp
+ plugin/extensions/qtscript_ControlSocket.cpp
+ plugin/extensions/qtscript_ReplyLine.cpp
+ plugin/extensions/qtscript_RouterDescriptor.cpp
+ plugin/extensions/qtscript_RouterStatus.cpp
+ plugin/extensions/qtscript_SendCommandEvent.cpp
+ plugin/extensions/qtscript_Stream.cpp
plugin/extensions/qtscript_TorControl.cpp
+ plugin/extensions/qtscript_TorEvents.cpp
+ plugin/extensions/qtscript_TorProcess.cpp
+ plugin/extensions/qtscript_TorSignal.cpp
+ plugin/extensions/qtscriptshell_ControlConnection.cpp
+ plugin/extensions/qtscriptshell_ControlMethod.cpp
+ plugin/extensions/qtscriptshell_ControlSocket.cpp
+ plugin/extensions/qtscriptshell_TorControl.cpp
+ plugin/extensions/qtscriptshell_TorEvents.cpp
+ plugin/extensions/qtscriptshell_TorProcess.cpp
+ plugin/extensions/qtscriptshell_TorSignal.cpp
)
qt4_wrap_cpp(vidalia_SRCS
plugin/PluginEngine.h
diff --git a/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp b/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp
index 0dd4887..75b75d6 100644
--- a/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp
+++ b/src/vidalia/plugin/extensions/VidaliaExtensionsInit.cpp
@@ -1,17 +1,62 @@
#include <QtScript/QScriptValue>
#include <QtScript/QScriptEngine>
-const int classCount = 1;
+const int classCount = 16;
QScriptValue qtscript_create_TorControl_class(QScriptEngine *engine);
+QScriptValue qtscript_create_Circuit_class(QScriptEngine *engine);
+QScriptValue qtscript_create_RouterDescriptor_class(QScriptEngine *engine);
+QScriptValue qtscript_create_BootstrapStatus_class(QScriptEngine *engine);
+QScriptValue qtscript_create_TorSignal_class(QScriptEngine *engine);
+QScriptValue qtscript_create_ControlCommand_class(QScriptEngine *engine);
+QScriptValue qtscript_create_ControlMethod_class(QScriptEngine *engine);
+QScriptValue qtscript_create_ReplyLine_class(QScriptEngine *engine);
+QScriptValue qtscript_create_Stream_class(QScriptEngine *engine);
+QScriptValue qtscript_create_ControlReply_class(QScriptEngine *engine);
+QScriptValue qtscript_create_RouterStatus_class(QScriptEngine *engine);
+QScriptValue qtscript_create_ControlConnection_class(QScriptEngine *engine);
+QScriptValue qtscript_create_TorEvents_class(QScriptEngine *engine);
+QScriptValue qtscript_create_ControlSocket_class(QScriptEngine *engine);
+QScriptValue qtscript_create_SendCommandEvent_class(QScriptEngine *engine);
+QScriptValue qtscript_create_TorProcess_class(QScriptEngine *engine);
static const char * const vidalia_class_names[] = {
- "TorControl"
+ "Circuit"
+ , "RouterDescriptor"
+ , "BootstrapStatus"
+ , "TorSignal"
+ , "ControlCommand"
+ , "ControlMethod"
+ , "ReplyLine"
+ , "Stream"
+ , "ControlReply"
+ , "RouterStatus"
+ , "ControlConnection"
+ , "TorControl"
+ , "TorEvents"
+ , "ControlSocket"
+ , "SendCommandEvent"
+ , "TorProcess"
};
typedef QScriptValue (*QtBindingCreator)(QScriptEngine *engine);
static const QtBindingCreator vidalia_class_functions[] = {
- qtscript_create_TorControl_class
+ qtscript_create_Circuit_class
+ , qtscript_create_RouterDescriptor_class
+ , qtscript_create_BootstrapStatus_class
+ , qtscript_create_TorSignal_class
+ , qtscript_create_ControlCommand_class
+ , qtscript_create_ControlMethod_class
+ , qtscript_create_ReplyLine_class
+ , qtscript_create_Stream_class
+ , qtscript_create_ControlReply_class
+ , qtscript_create_RouterStatus_class
+ , qtscript_create_ControlConnection_class
+ , qtscript_create_TorControl_class
+ , qtscript_create_TorEvents_class
+ , qtscript_create_ControlSocket_class
+ , qtscript_create_SendCommandEvent_class
+ , qtscript_create_TorProcess_class
};
void vidalia_initialize_bindings(QScriptValue &extensionObject)
diff --git a/src/vidalia/plugin/extensions/qtscript_BootstrapStatus.cpp b/src/vidalia/plugin/extensions/qtscript_BootstrapStatus.cpp
new file mode 100644
index 0000000..f9e0ad4
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_BootstrapStatus.cpp
@@ -0,0 +1,393 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <BootstrapStatus.h>
+#include <QVariant>
+
+static const char * const qtscript_BootstrapStatus_function_names[] = {
+ "BootstrapStatus"
+ // static
+ , "actionFromString"
+ , "statusFromString"
+ // prototype
+ , "description"
+ , "isValid"
+ , "percentComplete"
+ , "recommendedAction"
+ , "status"
+ , "warning"
+ , "toString"
+};
+
+static const char * const qtscript_BootstrapStatus_function_signatures[] = {
+ ""
+ // static
+ , "String str"
+ , "String tag"
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static const int qtscript_BootstrapStatus_function_lengths[] = {
+ 0
+ // static
+ , 1
+ , 1
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_BootstrapStatus_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("BootstrapStatus::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(BootstrapStatus*)
+Q_DECLARE_METATYPE(BootstrapStatus::Recommendation)
+Q_DECLARE_METATYPE(BootstrapStatus::Status)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// BootstrapStatus::Recommendation
+//
+
+static const BootstrapStatus::Recommendation qtscript_BootstrapStatus_Recommendation_values[] = {
+ BootstrapStatus::UnrecognizedRecommendation
+ , BootstrapStatus::RecommendIgnore
+ , BootstrapStatus::RecommendWarn
+};
+
+static const char * const qtscript_BootstrapStatus_Recommendation_keys[] = {
+ "UnrecognizedRecommendation"
+ , "RecommendIgnore"
+ , "RecommendWarn"
+};
+
+static QString qtscript_BootstrapStatus_Recommendation_toStringHelper(BootstrapStatus::Recommendation value)
+{
+ if ((value >= BootstrapStatus::UnrecognizedRecommendation) && (value <= BootstrapStatus::RecommendWarn))
+ return qtscript_BootstrapStatus_Recommendation_keys[static_cast<int>(value)-static_cast<int>(BootstrapStatus::UnrecognizedRecommendation)];
+ return QString();
+}
+
+static QScriptValue qtscript_BootstrapStatus_Recommendation_toScriptValue(QScriptEngine *engine, const BootstrapStatus::Recommendation &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("BootstrapStatus"));
+ return clazz.property(qtscript_BootstrapStatus_Recommendation_toStringHelper(value));
+}
+
+static void qtscript_BootstrapStatus_Recommendation_fromScriptValue(const QScriptValue &value, BootstrapStatus::Recommendation &out)
+{
+ out = qvariant_cast<BootstrapStatus::Recommendation>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_BootstrapStatus_Recommendation(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= BootstrapStatus::UnrecognizedRecommendation) && (arg <= BootstrapStatus::RecommendWarn))
+ return qScriptValueFromValue(engine, static_cast<BootstrapStatus::Recommendation>(arg));
+ return context->throwError(QString::fromLatin1("Recommendation(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_BootstrapStatus_Recommendation_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ BootstrapStatus::Recommendation value = qscriptvalue_cast<BootstrapStatus::Recommendation>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_BootstrapStatus_Recommendation_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ BootstrapStatus::Recommendation value = qscriptvalue_cast<BootstrapStatus::Recommendation>(context->thisObject());
+ return QScriptValue(engine, qtscript_BootstrapStatus_Recommendation_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_BootstrapStatus_Recommendation_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_BootstrapStatus_Recommendation,
+ qtscript_BootstrapStatus_Recommendation_valueOf, qtscript_BootstrapStatus_Recommendation_toString);
+ qScriptRegisterMetaType<BootstrapStatus::Recommendation>(engine, qtscript_BootstrapStatus_Recommendation_toScriptValue,
+ qtscript_BootstrapStatus_Recommendation_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_BootstrapStatus_Recommendation_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_BootstrapStatus_Recommendation_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// BootstrapStatus::Status
+//
+
+static const BootstrapStatus::Status qtscript_BootstrapStatus_Status_values[] = {
+ BootstrapStatus::UnrecognizedStatus
+ , BootstrapStatus::ConnectingToDirMirror
+ , BootstrapStatus::HandshakingWithDirMirror
+ , BootstrapStatus::CreatingOneHopCircuit
+ , BootstrapStatus::RequestingNetworkStatus
+ , BootstrapStatus::LoadingNetworkStatus
+ , BootstrapStatus::LoadingAuthorityCertificates
+ , BootstrapStatus::RequestingDescriptors
+ , BootstrapStatus::LoadingDescriptors
+ , BootstrapStatus::ConnectingToEntryGuard
+ , BootstrapStatus::HandshakingWithEntryGuard
+ , BootstrapStatus::EstablishingCircuit
+ , BootstrapStatus::BootstrappingDone
+};
+
+static const char * const qtscript_BootstrapStatus_Status_keys[] = {
+ "UnrecognizedStatus"
+ , "ConnectingToDirMirror"
+ , "HandshakingWithDirMirror"
+ , "CreatingOneHopCircuit"
+ , "RequestingNetworkStatus"
+ , "LoadingNetworkStatus"
+ , "LoadingAuthorityCertificates"
+ , "RequestingDescriptors"
+ , "LoadingDescriptors"
+ , "ConnectingToEntryGuard"
+ , "HandshakingWithEntryGuard"
+ , "EstablishingCircuit"
+ , "BootstrappingDone"
+};
+
+static QString qtscript_BootstrapStatus_Status_toStringHelper(BootstrapStatus::Status value)
+{
+ if ((value >= BootstrapStatus::UnrecognizedStatus) && (value <= BootstrapStatus::BootstrappingDone))
+ return qtscript_BootstrapStatus_Status_keys[static_cast<int>(value)-static_cast<int>(BootstrapStatus::UnrecognizedStatus)];
+ return QString();
+}
+
+static QScriptValue qtscript_BootstrapStatus_Status_toScriptValue(QScriptEngine *engine, const BootstrapStatus::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("BootstrapStatus"));
+ return clazz.property(qtscript_BootstrapStatus_Status_toStringHelper(value));
+}
+
+static void qtscript_BootstrapStatus_Status_fromScriptValue(const QScriptValue &value, BootstrapStatus::Status &out)
+{
+ out = qvariant_cast<BootstrapStatus::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_BootstrapStatus_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= BootstrapStatus::UnrecognizedStatus) && (arg <= BootstrapStatus::BootstrappingDone))
+ return qScriptValueFromValue(engine, static_cast<BootstrapStatus::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_BootstrapStatus_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ BootstrapStatus::Status value = qscriptvalue_cast<BootstrapStatus::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_BootstrapStatus_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ BootstrapStatus::Status value = qscriptvalue_cast<BootstrapStatus::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_BootstrapStatus_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_BootstrapStatus_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_BootstrapStatus_Status,
+ qtscript_BootstrapStatus_Status_valueOf, qtscript_BootstrapStatus_Status_toString);
+ qScriptRegisterMetaType<BootstrapStatus::Status>(engine, qtscript_BootstrapStatus_Status_toScriptValue,
+ qtscript_BootstrapStatus_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 13; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_BootstrapStatus_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_BootstrapStatus_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// BootstrapStatus
+//
+
+static QScriptValue qtscript_BootstrapStatus_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 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ BootstrapStatus* _q_self = qscriptvalue_cast<BootstrapStatus*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("BootstrapStatus.%0(): this object is not a BootstrapStatus")
+ .arg(qtscript_BootstrapStatus_function_names[_id+3]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->description();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->percentComplete();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ BootstrapStatus::Recommendation _q_result = _q_self->recommendedAction();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ BootstrapStatus::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->warning();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("BootstrapStatus");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_BootstrapStatus_throw_ambiguity_error_helper(context,
+ qtscript_BootstrapStatus_function_names[_id+3],
+ qtscript_BootstrapStatus_function_signatures[_id+3]);
+}
+
+static QScriptValue qtscript_BootstrapStatus_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("BootstrapStatus(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ BootstrapStatus* _q_cpp_result = new BootstrapStatus();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ BootstrapStatus::Recommendation _q_result = BootstrapStatus::actionFromString(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ BootstrapStatus::Status _q_result = BootstrapStatus::statusFromString(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_BootstrapStatus_throw_ambiguity_error_helper(context,
+ qtscript_BootstrapStatus_function_names[_id],
+ qtscript_BootstrapStatus_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_BootstrapStatus_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<BootstrapStatus*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((BootstrapStatus*)0));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_BootstrapStatus_prototype_call, qtscript_BootstrapStatus_function_lengths[i+3]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_BootstrapStatus_function_names[i+3]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<BootstrapStatus*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_BootstrapStatus_static_call, proto, qtscript_BootstrapStatus_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_BootstrapStatus_static_call,
+ qtscript_BootstrapStatus_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_BootstrapStatus_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Recommendation"),
+ qtscript_create_BootstrapStatus_Recommendation_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_BootstrapStatus_Status_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_Circuit.cpp b/src/vidalia/plugin/extensions/qtscript_Circuit.cpp
new file mode 100644
index 0000000..f7a15ee
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_Circuit.cpp
@@ -0,0 +1,542 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <Circuit.h>
+#include <QVariant>
+#include <qstringlist.h>
+
+static const char * const qtscript_Circuit_function_names[] = {
+ "Circuit"
+ // static
+ , "isValidCircuitId"
+ , "toStatus"
+ , "tr"
+ , "trUtf8"
+ // prototype
+ , "id"
+ , "isValid"
+ , "length"
+ , "purpose"
+ , "routerIDs"
+ , "routerNames"
+ , "status"
+ , "statusString"
+ , "toString"
+};
+
+static const char * const qtscript_Circuit_function_signatures[] = {
+ "\nString circuit"
+ // static
+ , "String circId"
+ , "String strStatus"
+ , "char sourceText, char disambiguation\nchar sourceText, char disambiguation, int n"
+ , "char sourceText, char disambiguation\nchar sourceText, char disambiguation, int n"
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static const int qtscript_Circuit_function_lengths[] = {
+ 1
+ // static
+ , 1
+ , 1
+ , 3
+ , 3
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_Circuit_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("Circuit::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(Circuit*)
+Q_DECLARE_METATYPE(Circuit::Purpose)
+Q_DECLARE_METATYPE(Circuit::BuildFlag)
+Q_DECLARE_METATYPE(Circuit::Status)
+Q_DECLARE_METATYPE(char*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// Circuit::Purpose
+//
+
+static const Circuit::Purpose qtscript_Circuit_Purpose_values[] = {
+ Circuit::General
+ , Circuit::HsClientIntro
+ , Circuit::HsClientRend
+ , Circuit::HsServiceIntro
+ , Circuit::HsServiceRend
+ , Circuit::Testing
+ , Circuit::Controller
+};
+
+static const char * const qtscript_Circuit_Purpose_keys[] = {
+ "General"
+ , "HsClientIntro"
+ , "HsClientRend"
+ , "HsServiceIntro"
+ , "HsServiceRend"
+ , "Testing"
+ , "Controller"
+};
+
+static QString qtscript_Circuit_Purpose_toStringHelper(Circuit::Purpose value)
+{
+ if ((value >= Circuit::General) && (value <= Circuit::Controller))
+ return qtscript_Circuit_Purpose_keys[static_cast<int>(value)-static_cast<int>(Circuit::General)];
+ return QString();
+}
+
+static QScriptValue qtscript_Circuit_Purpose_toScriptValue(QScriptEngine *engine, const Circuit::Purpose &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Circuit"));
+ return clazz.property(qtscript_Circuit_Purpose_toStringHelper(value));
+}
+
+static void qtscript_Circuit_Purpose_fromScriptValue(const QScriptValue &value, Circuit::Purpose &out)
+{
+ out = qvariant_cast<Circuit::Purpose>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Circuit_Purpose(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Circuit::General) && (arg <= Circuit::Controller))
+ return qScriptValueFromValue(engine, static_cast<Circuit::Purpose>(arg));
+ return context->throwError(QString::fromLatin1("Purpose(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Circuit_Purpose_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Circuit::Purpose value = qscriptvalue_cast<Circuit::Purpose>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Circuit_Purpose_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Circuit::Purpose value = qscriptvalue_cast<Circuit::Purpose>(context->thisObject());
+ return QScriptValue(engine, qtscript_Circuit_Purpose_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Circuit_Purpose_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Circuit_Purpose,
+ qtscript_Circuit_Purpose_valueOf, qtscript_Circuit_Purpose_toString);
+ qScriptRegisterMetaType<Circuit::Purpose>(engine, qtscript_Circuit_Purpose_toScriptValue,
+ qtscript_Circuit_Purpose_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 7; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Circuit_Purpose_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Circuit_Purpose_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Circuit::BuildFlag
+//
+
+static const Circuit::BuildFlag qtscript_Circuit_BuildFlag_values[] = {
+ Circuit::None
+ , Circuit::OneHopTunnel
+ , Circuit::IsInternal
+ , Circuit::NeedCapacity
+ , Circuit::NeedUptime
+};
+
+static const char * const qtscript_Circuit_BuildFlag_keys[] = {
+ "None"
+ , "OneHopTunnel"
+ , "IsInternal"
+ , "NeedCapacity"
+ , "NeedUptime"
+};
+
+static QString qtscript_Circuit_BuildFlag_toStringHelper(Circuit::BuildFlag value)
+{
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_Circuit_BuildFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_Circuit_BuildFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Circuit_BuildFlag_toScriptValue(QScriptEngine *engine, const Circuit::BuildFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Circuit"));
+ return clazz.property(qtscript_Circuit_BuildFlag_toStringHelper(value));
+}
+
+static void qtscript_Circuit_BuildFlag_fromScriptValue(const QScriptValue &value, Circuit::BuildFlag &out)
+{
+ out = qvariant_cast<Circuit::BuildFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Circuit_BuildFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_Circuit_BuildFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Circuit::BuildFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("BuildFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Circuit_BuildFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Circuit::BuildFlag value = qscriptvalue_cast<Circuit::BuildFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Circuit_BuildFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Circuit::BuildFlag value = qscriptvalue_cast<Circuit::BuildFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Circuit_BuildFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Circuit_BuildFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Circuit_BuildFlag,
+ qtscript_Circuit_BuildFlag_valueOf, qtscript_Circuit_BuildFlag_toString);
+ qScriptRegisterMetaType<Circuit::BuildFlag>(engine, qtscript_Circuit_BuildFlag_toScriptValue,
+ qtscript_Circuit_BuildFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Circuit_BuildFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Circuit_BuildFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Circuit::Status
+//
+
+static const Circuit::Status qtscript_Circuit_Status_values[] = {
+ Circuit::Unknown
+ , Circuit::Launched
+ , Circuit::Built
+ , Circuit::Extended
+ , Circuit::Failed
+ , Circuit::Closed
+};
+
+static const char * const qtscript_Circuit_Status_keys[] = {
+ "Unknown"
+ , "Launched"
+ , "Built"
+ , "Extended"
+ , "Failed"
+ , "Closed"
+};
+
+static QString qtscript_Circuit_Status_toStringHelper(Circuit::Status value)
+{
+ if ((value >= Circuit::Unknown) && (value <= Circuit::Closed))
+ return qtscript_Circuit_Status_keys[static_cast<int>(value)-static_cast<int>(Circuit::Unknown)];
+ return QString();
+}
+
+static QScriptValue qtscript_Circuit_Status_toScriptValue(QScriptEngine *engine, const Circuit::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Circuit"));
+ return clazz.property(qtscript_Circuit_Status_toStringHelper(value));
+}
+
+static void qtscript_Circuit_Status_fromScriptValue(const QScriptValue &value, Circuit::Status &out)
+{
+ out = qvariant_cast<Circuit::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Circuit_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Circuit::Unknown) && (arg <= Circuit::Closed))
+ return qScriptValueFromValue(engine, static_cast<Circuit::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Circuit_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Circuit::Status value = qscriptvalue_cast<Circuit::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Circuit_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Circuit::Status value = qscriptvalue_cast<Circuit::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_Circuit_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Circuit_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Circuit_Status,
+ qtscript_Circuit_Status_valueOf, qtscript_Circuit_Status_toString);
+ qScriptRegisterMetaType<Circuit::Status>(engine, qtscript_Circuit_Status_toScriptValue,
+ qtscript_Circuit_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Circuit_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Circuit_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Circuit
+//
+
+static QScriptValue qtscript_Circuit_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 + 8;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ Circuit* _q_self = qscriptvalue_cast<Circuit*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Circuit.%0(): this object is not a Circuit")
+ .arg(qtscript_Circuit_function_names[_id+5]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->id();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ uint _q_result = _q_self->length();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ Circuit::Purpose _q_result = _q_self->purpose();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->routerIDs();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->routerNames();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ Circuit::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->statusString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8: {
+ QString result = QString::fromLatin1("Circuit");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_Circuit_throw_ambiguity_error_helper(context,
+ qtscript_Circuit_function_names[_id+5],
+ qtscript_Circuit_function_signatures[_id+5]);
+}
+
+static QScriptValue qtscript_Circuit_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("Circuit(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ Circuit* _q_cpp_result = new Circuit();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ Circuit* _q_cpp_result = new Circuit(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = Circuit::isValidCircuitId(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ Circuit::Status _q_result = Circuit::toStatus(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QString _q_result = Circuit::tr(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = Circuit::tr(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = Circuit::tr(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QString _q_result = Circuit::trUtf8(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = Circuit::trUtf8(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = Circuit::trUtf8(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_Circuit_throw_ambiguity_error_helper(context,
+ qtscript_Circuit_function_names[_id],
+ qtscript_Circuit_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_Circuit_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<Circuit*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((Circuit*)0));
+ for (int i = 0; i < 9; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_Circuit_prototype_call, qtscript_Circuit_function_lengths[i+5]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_Circuit_function_names[i+5]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<Circuit*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_Circuit_static_call, proto, qtscript_Circuit_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_Circuit_static_call,
+ qtscript_Circuit_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_Circuit_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Purpose"),
+ qtscript_create_Circuit_Purpose_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("BuildFlag"),
+ qtscript_create_Circuit_BuildFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_Circuit_Status_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_ControlCommand.cpp b/src/vidalia/plugin/extensions/qtscript_ControlCommand.cpp
new file mode 100644
index 0000000..c0e11e4
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_ControlCommand.cpp
@@ -0,0 +1,206 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <ControlCommand.h>
+#include <QVariant>
+#include <qstringlist.h>
+
+static const char * const qtscript_ControlCommand_function_names[] = {
+ "ControlCommand"
+ // static
+ // prototype
+ , "addArgument"
+ , "addArguments"
+ , "appendData"
+ , "keyword"
+ , "setKeyword"
+ , "toString"
+};
+
+static const char * const qtscript_ControlCommand_function_signatures[] = {
+ "\nString keyword\nString keyword, String arg\nString keyword, List args"
+ // static
+ // prototype
+ , "String arg"
+ , "List args"
+ , "String data"
+ , ""
+ , "String keyword"
+ , ""
+};
+
+static const int qtscript_ControlCommand_function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 0
+};
+
+static QScriptValue qtscript_ControlCommand_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("ControlCommand::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(ControlCommand*)
+
+//
+// ControlCommand
+//
+
+static QScriptValue qtscript_ControlCommand_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 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ ControlCommand* _q_self = qscriptvalue_cast<ControlCommand*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ControlCommand.%0(): this object is not a ControlCommand")
+ .arg(qtscript_ControlCommand_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->addArgument(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->addArguments(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->appendData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->keyword();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setKeyword(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlCommand_throw_ambiguity_error_helper(context,
+ qtscript_ControlCommand_function_names[_id+1],
+ qtscript_ControlCommand_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_ControlCommand_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("ControlCommand(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ ControlCommand* _q_cpp_result = new ControlCommand();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ ControlCommand* _q_cpp_result = new ControlCommand(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ ControlCommand* _q_cpp_result = new ControlCommand(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _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);
+ ControlCommand* _q_cpp_result = new ControlCommand(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlCommand_throw_ambiguity_error_helper(context,
+ qtscript_ControlCommand_function_names[_id],
+ qtscript_ControlCommand_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_ControlCommand_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<ControlCommand*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((ControlCommand*)0));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ControlCommand_prototype_call, qtscript_ControlCommand_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_ControlCommand_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<ControlCommand*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_ControlCommand_static_call, proto, qtscript_ControlCommand_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_ControlConnection.cpp b/src/vidalia/plugin/extensions/qtscript_ControlConnection.cpp
new file mode 100644
index 0000000..6ed844c
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_ControlConnection.cpp
@@ -0,0 +1,344 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <ControlConnection.h>
+#include <ControlCommand.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <TorEvents.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_ControlConnection.h"
+
+static const char * const qtscript_ControlConnection_function_names[] = {
+ "ControlConnection"
+ // static
+ // prototype
+ , "cancelConnect"
+ , "connect"
+ , "disconnect"
+ , "isConnected"
+ , "send"
+ , "status"
+ , "toString"
+};
+
+static const char * const qtscript_ControlConnection_function_signatures[] = {
+ "Method method, TorEvents events"
+ // static
+ // prototype
+ , ""
+ , "QHostAddress addr, unsigned short port\nString addr"
+ , ""
+ , ""
+ , "ControlCommand cmd, ControlReply reply, String errmsg\nControlCommand cmd, String errmsg"
+ , ""
+""
+};
+
+static const int qtscript_ControlConnection_function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 2
+ , 0
+ , 0
+ , 3
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_ControlConnection_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("ControlConnection::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(ControlConnection*)
+Q_DECLARE_METATYPE(QtScriptShell_ControlConnection*)
+Q_DECLARE_METATYPE(ControlConnection::Status)
+Q_DECLARE_METATYPE(QHostAddress)
+Q_DECLARE_METATYPE(ControlCommand)
+Q_DECLARE_METATYPE(ControlReply)
+Q_DECLARE_METATYPE(QString*)
+Q_DECLARE_METATYPE(ControlMethod::Method)
+Q_DECLARE_METATYPE(TorEvents*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// ControlConnection::Status
+//
+
+static const ControlConnection::Status qtscript_ControlConnection_Status_values[] = {
+ ControlConnection::Unset
+ , ControlConnection::Disconnected
+ , ControlConnection::Disconnecting
+ , ControlConnection::Connecting
+ , ControlConnection::Connected
+};
+
+static const char * const qtscript_ControlConnection_Status_keys[] = {
+ "Unset"
+ , "Disconnected"
+ , "Disconnecting"
+ , "Connecting"
+ , "Connected"
+};
+
+static QString qtscript_ControlConnection_Status_toStringHelper(ControlConnection::Status value)
+{
+ if ((value >= ControlConnection::Unset) && (value <= ControlConnection::Connected))
+ return qtscript_ControlConnection_Status_keys[static_cast<int>(value)-static_cast<int>(ControlConnection::Unset)];
+ return QString();
+}
+
+static QScriptValue qtscript_ControlConnection_Status_toScriptValue(QScriptEngine *engine, const ControlConnection::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("ControlConnection"));
+ return clazz.property(qtscript_ControlConnection_Status_toStringHelper(value));
+}
+
+static void qtscript_ControlConnection_Status_fromScriptValue(const QScriptValue &value, ControlConnection::Status &out)
+{
+ out = qvariant_cast<ControlConnection::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_ControlConnection_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= ControlConnection::Unset) && (arg <= ControlConnection::Connected))
+ return qScriptValueFromValue(engine, static_cast<ControlConnection::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_ControlConnection_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ ControlConnection::Status value = qscriptvalue_cast<ControlConnection::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_ControlConnection_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ ControlConnection::Status value = qscriptvalue_cast<ControlConnection::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_ControlConnection_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_ControlConnection_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_ControlConnection_Status,
+ qtscript_ControlConnection_Status_valueOf, qtscript_ControlConnection_Status_toString);
+ qScriptRegisterMetaType<ControlConnection::Status>(engine, qtscript_ControlConnection_Status_toScriptValue,
+ qtscript_ControlConnection_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_ControlConnection_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_ControlConnection_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// ControlConnection
+//
+
+static QScriptValue qtscript_ControlConnection_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 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ ControlConnection* _q_self = qscriptvalue_cast<ControlConnection*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ControlConnection.%0(): this object is not a ControlConnection")
+ .arg(qtscript_ControlConnection_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->cancelConnect();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ 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 2:
+ if (context->argumentCount() == 0) {
+ _q_self->disconnect();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isConnected();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ ControlCommand _q_arg0 = qscriptvalue_cast<ControlCommand>(context->argument(0));
+ bool _q_result = _q_self->send(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<ControlCommand>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<ControlReply>() == context->argument(1).toVariant().userType())) {
+ ControlCommand _q_arg0 = qscriptvalue_cast<ControlCommand>(context->argument(0));
+ ControlReply _q_arg1 = qscriptvalue_cast<ControlReply>(context->argument(1));
+ bool _q_result = _q_self->send(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<ControlCommand>() == context->argument(0).toVariant().userType())
+ && qscriptvalue_cast<QString*>(context->argument(1))) {
+ ControlCommand _q_arg0 = qscriptvalue_cast<ControlCommand>(context->argument(0));
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->send(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ ControlCommand _q_arg0 = qscriptvalue_cast<ControlCommand>(context->argument(0));
+ ControlReply _q_arg1 = qscriptvalue_cast<ControlReply>(context->argument(1));
+ QString* _q_arg2 = qscriptvalue_cast<QString*>(context->argument(2));
+ bool _q_result = _q_self->send(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ ControlConnection::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("ControlConnection");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlConnection_throw_ambiguity_error_helper(context,
+ qtscript_ControlConnection_function_names[_id+1],
+ qtscript_ControlConnection_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_ControlConnection_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("ControlConnection(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ ControlMethod::Method _q_arg0 = qscriptvalue_cast<ControlMethod::Method>(context->argument(0));
+ QtScriptShell_ControlConnection* _q_cpp_result = new QtScriptShell_ControlConnection(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (ControlConnection*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ ControlMethod::Method _q_arg0 = qscriptvalue_cast<ControlMethod::Method>(context->argument(0));
+ TorEvents* _q_arg1 = qscriptvalue_cast<TorEvents*>(context->argument(1));
+ QtScriptShell_ControlConnection* _q_cpp_result = new QtScriptShell_ControlConnection(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (ControlConnection*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlConnection_throw_ambiguity_error_helper(context,
+ qtscript_ControlConnection_function_names[_id],
+ qtscript_ControlConnection_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_ControlConnection_toScriptValue(QScriptEngine *engine, ControlConnection* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_ControlConnection_fromScriptValue(const QScriptValue &value, ControlConnection* &out)
+{
+ out = qobject_cast<ControlConnection*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_ControlConnection_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<ControlConnection*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((ControlConnection*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ControlConnection_prototype_call, qtscript_ControlConnection_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_ControlConnection_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<ControlConnection*>(engine, qtscript_ControlConnection_toScriptValue,
+ qtscript_ControlConnection_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_ControlConnection_static_call, proto, qtscript_ControlConnection_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_ControlConnection_Status_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_ControlMethod.cpp b/src/vidalia/plugin/extensions/qtscript_ControlMethod.cpp
new file mode 100644
index 0000000..883217f
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_ControlMethod.cpp
@@ -0,0 +1,199 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <ControlMethod.h>
+#include <QVariant>
+
+#include "qtscriptshell_ControlMethod.h"
+
+static const char * const qtscript_ControlMethod_function_names[] = {
+ "ControlMethod"
+ // static
+ , "fromString"
+ , "toString"
+ // prototype
+};
+
+static const char * const qtscript_ControlMethod_function_signatures[] = {
+ ""
+ // static
+ , "String method"
+ , "Method method"
+ // prototype
+};
+
+static const int qtscript_ControlMethod_function_lengths[] = {
+ 0
+ // static
+ , 1
+ , 1
+ // prototype
+};
+
+static QScriptValue qtscript_ControlMethod_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("ControlMethod::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(ControlMethod*)
+Q_DECLARE_METATYPE(QtScriptShell_ControlMethod*)
+Q_DECLARE_METATYPE(ControlMethod::Method)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// ControlMethod::Method
+//
+
+static const ControlMethod::Method qtscript_ControlMethod_Method_values[] = {
+ ControlMethod::Port
+ , ControlMethod::Socket
+};
+
+static const char * const qtscript_ControlMethod_Method_keys[] = {
+ "Port"
+ , "Socket"
+};
+
+static QString qtscript_ControlMethod_Method_toStringHelper(ControlMethod::Method value)
+{
+ if ((value >= ControlMethod::Port) && (value <= ControlMethod::Socket))
+ return qtscript_ControlMethod_Method_keys[static_cast<int>(value)-static_cast<int>(ControlMethod::Port)];
+ return QString();
+}
+
+static QScriptValue qtscript_ControlMethod_Method_toScriptValue(QScriptEngine *engine, const ControlMethod::Method &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("ControlMethod"));
+ return clazz.property(qtscript_ControlMethod_Method_toStringHelper(value));
+}
+
+static void qtscript_ControlMethod_Method_fromScriptValue(const QScriptValue &value, ControlMethod::Method &out)
+{
+ out = qvariant_cast<ControlMethod::Method>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_ControlMethod_Method(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= ControlMethod::Port) && (arg <= ControlMethod::Socket))
+ return qScriptValueFromValue(engine, static_cast<ControlMethod::Method>(arg));
+ return context->throwError(QString::fromLatin1("Method(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_ControlMethod_Method_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ ControlMethod::Method value = qscriptvalue_cast<ControlMethod::Method>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_ControlMethod_Method_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ ControlMethod::Method value = qscriptvalue_cast<ControlMethod::Method>(context->thisObject());
+ return QScriptValue(engine, qtscript_ControlMethod_Method_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_ControlMethod_Method_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_ControlMethod_Method,
+ qtscript_ControlMethod_Method_valueOf, qtscript_ControlMethod_Method_toString);
+ qScriptRegisterMetaType<ControlMethod::Method>(engine, qtscript_ControlMethod_Method_toScriptValue,
+ qtscript_ControlMethod_Method_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_ControlMethod_Method_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_ControlMethod_Method_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// ControlMethod
+//
+
+static QScriptValue qtscript_ControlMethod_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("ControlMethod(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_ControlMethod* _q_cpp_result = new QtScriptShell_ControlMethod();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((ControlMethod*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ ControlMethod::Method _q_result = ControlMethod::fromString(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ ControlMethod::Method _q_arg0 = qscriptvalue_cast<ControlMethod::Method>(context->argument(0));
+ QString _q_result = ControlMethod::toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlMethod_throw_ambiguity_error_helper(context,
+ qtscript_ControlMethod_function_names[_id],
+ qtscript_ControlMethod_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_ControlMethod_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<ControlMethod*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((ControlMethod*)0));
+
+ engine->setDefaultPrototype(qMetaTypeId<ControlMethod*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_ControlMethod_static_call, proto, qtscript_ControlMethod_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ControlMethod_static_call,
+ qtscript_ControlMethod_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_ControlMethod_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Method"),
+ qtscript_create_ControlMethod_Method_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_ControlReply.cpp b/src/vidalia/plugin/extensions/qtscript_ControlReply.cpp
new file mode 100644
index 0000000..4244f26
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_ControlReply.cpp
@@ -0,0 +1,199 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <ControlReply.h>
+#include <QVariant>
+#include <ReplyLine.h>
+#include <qlist.h>
+#include <qstringlist.h>
+
+static const char * const qtscript_ControlReply_function_names[] = {
+ "ControlReply"
+ // static
+ // prototype
+ , "appendLine"
+ , "getData"
+ , "getLine"
+ , "getLines"
+ , "getMessage"
+ , "getStatus"
+ , "toString"
+};
+
+static const char * const qtscript_ControlReply_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , "ReplyLine line"
+ , ""
+ , "int idx"
+ , ""
+ , ""
+ , ""
+ , ""
+};
+
+static const int qtscript_ControlReply_function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 1
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_ControlReply_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("ControlReply::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(ControlReply*)
+Q_DECLARE_METATYPE(ReplyLine)
+Q_DECLARE_METATYPE(QList<ReplyLine>)
+
+//
+// ControlReply
+//
+
+static QScriptValue qtscript_ControlReply_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 + 7;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ ControlReply* _q_self = qscriptvalue_cast<ControlReply*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ControlReply.%0(): this object is not a ControlReply")
+ .arg(qtscript_ControlReply_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ ReplyLine _q_arg0 = qscriptvalue_cast<ReplyLine>(context->argument(0));
+ _q_self->appendLine(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->getData();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ ReplyLine _q_result = _q_self->getLine();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ ReplyLine _q_result = _q_self->getLine(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QList<ReplyLine> _q_result = _q_self->getLines();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->getMessage();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->getStatus();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlReply_throw_ambiguity_error_helper(context,
+ qtscript_ControlReply_function_names[_id+1],
+ qtscript_ControlReply_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_ControlReply_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("ControlReply(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ ControlReply* _q_cpp_result = new ControlReply();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlReply_throw_ambiguity_error_helper(context,
+ qtscript_ControlReply_function_names[_id],
+ qtscript_ControlReply_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_ControlReply_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<ControlReply*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((ControlReply*)0));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ControlReply_prototype_call, qtscript_ControlReply_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_ControlReply_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<ControlReply*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_ControlReply_static_call, proto, qtscript_ControlReply_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_ControlSocket.cpp b/src/vidalia/plugin/extensions/qtscript_ControlSocket.cpp
new file mode 100644
index 0000000..3d5ff1e
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_ControlSocket.cpp
@@ -0,0 +1,278 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <ControlSocket.h>
+#include <ControlCommand.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_ControlSocket.h"
+
+static const char * const qtscript_ControlSocket_function_names[] = {
+ "ControlSocket"
+ // static
+ , "toString"
+ // prototype
+ , "canReadLine"
+ , "connectToHost"
+ , "connectToServer"
+ , "disconnectFromHost"
+ , "disconnectFromServer"
+ , "getMethod"
+ , "isConnected"
+ , "readReply"
+ , "sendCommand"
+};
+
+static const char * const qtscript_ControlSocket_function_signatures[] = {
+ "Method method"
+ // static
+ , "SocketError error"
+ // prototype
+ , ""
+ , "QHostAddress address, unsigned short port"
+ , "String name"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "ControlReply reply, String errmsg"
+ , "ControlCommand cmd, String errmsg"
+};
+
+static const int qtscript_ControlSocket_function_lengths[] = {
+ 1
+ // static
+ , 1
+ // prototype
+ , 0
+ , 2
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 2
+ , 2
+};
+
+static QScriptValue qtscript_ControlSocket_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("ControlSocket::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(ControlSocket*)
+Q_DECLARE_METATYPE(QtScriptShell_ControlSocket*)
+Q_DECLARE_METATYPE(QHostAddress)
+Q_DECLARE_METATYPE(ControlMethod::Method)
+Q_DECLARE_METATYPE(ControlReply)
+Q_DECLARE_METATYPE(QString*)
+Q_DECLARE_METATYPE(ControlCommand)
+Q_DECLARE_METATYPE(QAbstractSocket::SocketError)
+
+//
+// ControlSocket
+//
+
+static QScriptValue qtscript_ControlSocket_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 + 9;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ ControlSocket* _q_self = qscriptvalue_cast<ControlSocket*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ControlSocket.%0(): this object is not a ControlSocket")
+ .arg(qtscript_ControlSocket_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->canReadLine();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ 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->connectToHost(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->connectToServer(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ _q_self->disconnectFromHost();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ _q_self->disconnectFromServer();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ ControlMethod::Method _q_result = _q_self->getMethod();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isConnected();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ ControlReply _q_arg0 = qscriptvalue_cast<ControlReply>(context->argument(0));
+ bool _q_result = _q_self->readReply(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ ControlReply _q_arg0 = qscriptvalue_cast<ControlReply>(context->argument(0));
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->readReply(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ ControlCommand _q_arg0 = qscriptvalue_cast<ControlCommand>(context->argument(0));
+ bool _q_result = _q_self->sendCommand(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ ControlCommand _q_arg0 = qscriptvalue_cast<ControlCommand>(context->argument(0));
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ bool _q_result = _q_self->sendCommand(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlSocket_throw_ambiguity_error_helper(context,
+ qtscript_ControlSocket_function_names[_id+2],
+ qtscript_ControlSocket_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_ControlSocket_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("ControlSocket(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_ControlSocket* _q_cpp_result = new QtScriptShell_ControlSocket();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (ControlSocket*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ ControlMethod::Method _q_arg0 = qscriptvalue_cast<ControlMethod::Method>(context->argument(0));
+ QtScriptShell_ControlSocket* _q_cpp_result = new QtScriptShell_ControlSocket(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (ControlSocket*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QAbstractSocket::SocketError _q_arg0 = qscriptvalue_cast<QAbstractSocket::SocketError>(context->argument(0));
+ QString _q_result = ControlSocket::toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ControlSocket_throw_ambiguity_error_helper(context,
+ qtscript_ControlSocket_function_names[_id],
+ qtscript_ControlSocket_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_ControlSocket_toScriptValue(QScriptEngine *engine, ControlSocket* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_ControlSocket_fromScriptValue(const QScriptValue &value, ControlSocket* &out)
+{
+ out = qobject_cast<ControlSocket*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_ControlSocket_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<ControlSocket*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((ControlSocket*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 9; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ControlSocket_prototype_call, qtscript_ControlSocket_function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_ControlSocket_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<ControlSocket*>(engine, qtscript_ControlSocket_toScriptValue,
+ qtscript_ControlSocket_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_ControlSocket_static_call, proto, qtscript_ControlSocket_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ControlSocket_static_call,
+ qtscript_ControlSocket_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_ControlSocket_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_ReplyLine.cpp b/src/vidalia/plugin/extensions/qtscript_ReplyLine.cpp
new file mode 100644
index 0000000..d27efc5
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_ReplyLine.cpp
@@ -0,0 +1,215 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <ReplyLine.h>
+#include <QVariant>
+#include <qstringlist.h>
+
+static const char * const qtscript_ReplyLine_function_names[] = {
+ "ReplyLine"
+ // static
+ // prototype
+ , "appendData"
+ , "getData"
+ , "getMessage"
+ , "getStatus"
+ , "hasData"
+ , "setMessage"
+ , "setStatus"
+ , "toString"
+};
+
+static const char * const qtscript_ReplyLine_function_signatures[] = {
+ "\nString status, String message\nString status, String message, String data"
+ // static
+ // prototype
+ , "String data"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String msg"
+ , "String status"
+ , ""
+};
+
+static const int qtscript_ReplyLine_function_lengths[] = {
+ 3
+ // static
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+};
+
+static QScriptValue qtscript_ReplyLine_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("ReplyLine::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(ReplyLine*)
+
+//
+// ReplyLine
+//
+
+static QScriptValue qtscript_ReplyLine_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 + 8;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ ReplyLine* _q_self = qscriptvalue_cast<ReplyLine*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ReplyLine.%0(): this object is not a ReplyLine")
+ .arg(qtscript_ReplyLine_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->appendData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->getData();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->getMessage();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->getStatus();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasData();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setMessage(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setStatus(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ReplyLine_throw_ambiguity_error_helper(context,
+ qtscript_ReplyLine_function_names[_id+1],
+ qtscript_ReplyLine_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_ReplyLine_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("ReplyLine(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ ReplyLine* _q_cpp_result = new ReplyLine();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ ReplyLine* _q_cpp_result = new ReplyLine(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ ReplyLine* _q_cpp_result = new ReplyLine(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_ReplyLine_throw_ambiguity_error_helper(context,
+ qtscript_ReplyLine_function_names[_id],
+ qtscript_ReplyLine_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_ReplyLine_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<ReplyLine*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((ReplyLine*)0));
+ for (int i = 0; i < 8; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_ReplyLine_prototype_call, qtscript_ReplyLine_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_ReplyLine_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<ReplyLine*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_ReplyLine_static_call, proto, qtscript_ReplyLine_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_RouterDescriptor.cpp b/src/vidalia/plugin/extensions/qtscript_RouterDescriptor.cpp
new file mode 100644
index 0000000..4a480ab
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_RouterDescriptor.cpp
@@ -0,0 +1,561 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <RouterDescriptor.h>
+#include <QVariant>
+#include <RouterDescriptor.h>
+#include <RouterStatus.h>
+#include <TorControl.h>
+#include <qdatetime.h>
+#include <qhostaddress.h>
+#include <qstringlist.h>
+
+static const char * const qtscript_RouterDescriptor_function_names[] = {
+ "RouterDescriptor"
+ // static
+ , "fromTorControl"
+ , "tr"
+ , "trUtf8"
+ // prototype
+ , "appendRouterStatusInfo"
+ , "averageBandwidth"
+ , "burstBandwidth"
+ , "contact"
+ , "dirPort"
+ , "exitPolicy"
+ , "family"
+ , "fingerprint"
+ , "hibernating"
+ , "id"
+ , "ip"
+ , "isEmpty"
+ , "location"
+ , "name"
+ , "observedBandwidth"
+ , "offline"
+ , "onionKey"
+ , "online"
+ , "orPort"
+ , "platform"
+ , "published"
+ , "setLocation"
+ , "setOffline"
+ , "status"
+ , "uptime"
+ , "toString"
+};
+
+static const char * const qtscript_RouterDescriptor_function_signatures[] = {
+ "List descriptor, bool microdesc\nbool microdesc"
+ // static
+ , "TorControl tc"
+ , "char sourceText, char disambiguation\nchar sourceText, char disambiguation, int n"
+ , "char sourceText, char disambiguation\nchar sourceText, char disambiguation, int n"
+ // prototype
+ , "RouterStatus rs"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String location"
+ , "bool offline"
+ , ""
+ , ""
+""
+};
+
+static const int qtscript_RouterDescriptor_function_lengths[] = {
+ 2
+ // static
+ , 1
+ , 3
+ , 3
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_RouterDescriptor_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("RouterDescriptor::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(RouterDescriptor*)
+Q_DECLARE_METATYPE(RouterDescriptor::RouterStatusEnum)
+Q_DECLARE_METATYPE(RouterStatus)
+Q_DECLARE_METATYPE(QHostAddress)
+Q_DECLARE_METATYPE(TorControl*)
+Q_DECLARE_METATYPE(char*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// RouterDescriptor::RouterStatusEnum
+//
+
+static const RouterDescriptor::RouterStatusEnum qtscript_RouterDescriptor_RouterStatusEnum_values[] = {
+ RouterDescriptor::Online
+ , RouterDescriptor::Hibernating
+ , RouterDescriptor::Offline
+};
+
+static const char * const qtscript_RouterDescriptor_RouterStatusEnum_keys[] = {
+ "Online"
+ , "Hibernating"
+ , "Offline"
+};
+
+static QString qtscript_RouterDescriptor_RouterStatusEnum_toStringHelper(RouterDescriptor::RouterStatusEnum value)
+{
+ if ((value >= RouterDescriptor::Online) && (value <= RouterDescriptor::Offline))
+ return qtscript_RouterDescriptor_RouterStatusEnum_keys[static_cast<int>(value)-static_cast<int>(RouterDescriptor::Online)];
+ return QString();
+}
+
+static QScriptValue qtscript_RouterDescriptor_RouterStatusEnum_toScriptValue(QScriptEngine *engine, const RouterDescriptor::RouterStatusEnum &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("RouterDescriptor"));
+ return clazz.property(qtscript_RouterDescriptor_RouterStatusEnum_toStringHelper(value));
+}
+
+static void qtscript_RouterDescriptor_RouterStatusEnum_fromScriptValue(const QScriptValue &value, RouterDescriptor::RouterStatusEnum &out)
+{
+ out = qvariant_cast<RouterDescriptor::RouterStatusEnum>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_RouterDescriptor_RouterStatusEnum(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= RouterDescriptor::Online) && (arg <= RouterDescriptor::Offline))
+ return qScriptValueFromValue(engine, static_cast<RouterDescriptor::RouterStatusEnum>(arg));
+ return context->throwError(QString::fromLatin1("RouterStatusEnum(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_RouterDescriptor_RouterStatusEnum_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ RouterDescriptor::RouterStatusEnum value = qscriptvalue_cast<RouterDescriptor::RouterStatusEnum>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_RouterDescriptor_RouterStatusEnum_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ RouterDescriptor::RouterStatusEnum value = qscriptvalue_cast<RouterDescriptor::RouterStatusEnum>(context->thisObject());
+ return QScriptValue(engine, qtscript_RouterDescriptor_RouterStatusEnum_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_RouterDescriptor_RouterStatusEnum_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_RouterDescriptor_RouterStatusEnum,
+ qtscript_RouterDescriptor_RouterStatusEnum_valueOf, qtscript_RouterDescriptor_RouterStatusEnum_toString);
+ qScriptRegisterMetaType<RouterDescriptor::RouterStatusEnum>(engine, qtscript_RouterDescriptor_RouterStatusEnum_toScriptValue,
+ qtscript_RouterDescriptor_RouterStatusEnum_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_RouterDescriptor_RouterStatusEnum_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_RouterDescriptor_RouterStatusEnum_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// RouterDescriptor
+//
+
+static QScriptValue qtscript_RouterDescriptor_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 + 25;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ RouterDescriptor* _q_self = qscriptvalue_cast<RouterDescriptor*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("RouterDescriptor.%0(): this object is not a RouterDescriptor")
+ .arg(qtscript_RouterDescriptor_function_names[_id+4]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ RouterStatus _q_arg0 = qscriptvalue_cast<RouterStatus>(context->argument(0));
+ _q_self->appendRouterStatusInfo(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ unsigned long long _q_result = _q_self->averageBandwidth();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ unsigned long long _q_result = _q_self->burstBandwidth();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->contact();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ unsigned short _q_result = _q_self->dirPort();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->exitPolicy();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->family();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fingerprint();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hibernating();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->id();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QHostAddress _q_result = _q_self->ip();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->location();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->name();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ unsigned long long _q_result = _q_self->observedBandwidth();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->offline();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->onionKey();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->online();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ unsigned short _q_result = _q_self->orPort();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->platform();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ QDateTime _q_result = _q_self->published();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setLocation(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setOffline(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->status();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ unsigned long long _q_result = _q_self->uptime();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25: {
+ QString result = QString::fromLatin1("RouterDescriptor");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_RouterDescriptor_throw_ambiguity_error_helper(context,
+ qtscript_RouterDescriptor_function_names[_id+4],
+ qtscript_RouterDescriptor_function_signatures[_id+4]);
+}
+
+static QScriptValue qtscript_RouterDescriptor_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("RouterDescriptor(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ RouterDescriptor* _q_cpp_result = new RouterDescriptor();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ RouterDescriptor* _q_cpp_result = new RouterDescriptor(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isBoolean()) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ RouterDescriptor* _q_cpp_result = new RouterDescriptor(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ bool _q_arg1 = context->argument(1).toBoolean();
+ RouterDescriptor* _q_cpp_result = new RouterDescriptor(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ TorControl* _q_arg0 = qscriptvalue_cast<TorControl*>(context->argument(0));
+ RouterDescriptor* _q_result = RouterDescriptor::fromTorControl(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QString _q_result = RouterDescriptor::tr(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = RouterDescriptor::tr(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = RouterDescriptor::tr(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QString _q_result = RouterDescriptor::trUtf8(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = RouterDescriptor::trUtf8(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = RouterDescriptor::trUtf8(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_RouterDescriptor_throw_ambiguity_error_helper(context,
+ qtscript_RouterDescriptor_function_names[_id],
+ qtscript_RouterDescriptor_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_RouterDescriptor_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<RouterDescriptor*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((RouterDescriptor*)0));
+ for (int i = 0; i < 26; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_RouterDescriptor_prototype_call, qtscript_RouterDescriptor_function_lengths[i+4]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_RouterDescriptor_function_names[i+4]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<RouterDescriptor*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_RouterDescriptor_static_call, proto, qtscript_RouterDescriptor_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_RouterDescriptor_static_call,
+ qtscript_RouterDescriptor_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_RouterDescriptor_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("RouterStatusEnum"),
+ qtscript_create_RouterDescriptor_RouterStatusEnum_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_RouterStatus.cpp b/src/vidalia/plugin/extensions/qtscript_RouterStatus.cpp
new file mode 100644
index 0000000..864b44b
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_RouterStatus.cpp
@@ -0,0 +1,344 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <RouterStatus.h>
+#include <QVariant>
+#include <qdatetime.h>
+#include <qhostaddress.h>
+#include <qstringlist.h>
+
+static const char * const qtscript_RouterStatus_function_names[] = {
+ "RouterStatus"
+ // static
+ // prototype
+ , "bandwidth"
+ , "descriptorDigest"
+ , "dirPort"
+ , "id"
+ , "ipAddress"
+ , "isRunning"
+ , "isValid"
+ , "name"
+ , "orPort"
+ , "published"
+ , "toString"
+};
+
+static const char * const qtscript_RouterStatus_function_signatures[] = {
+ "List status"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static const int qtscript_RouterStatus_function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_RouterStatus_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("RouterStatus::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(RouterStatus*)
+Q_DECLARE_METATYPE(RouterStatus::Flag)
+Q_DECLARE_METATYPE(QHostAddress)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// RouterStatus::Flag
+//
+
+static const RouterStatus::Flag qtscript_RouterStatus_Flag_values[] = {
+ RouterStatus::Unknown
+ , RouterStatus::Authority
+ , RouterStatus::BadExit
+ , RouterStatus::BadDirectory
+ , RouterStatus::Exit
+ , RouterStatus::Fast
+ , RouterStatus::Guard
+ , RouterStatus::HSDir
+ , RouterStatus::Named
+ , RouterStatus::Stable
+ , RouterStatus::Running
+ , RouterStatus::Valid
+ , RouterStatus::V2Dir
+ , RouterStatus::V3Dir
+};
+
+static const char * const qtscript_RouterStatus_Flag_keys[] = {
+ "Unknown"
+ , "Authority"
+ , "BadExit"
+ , "BadDirectory"
+ , "Exit"
+ , "Fast"
+ , "Guard"
+ , "HSDir"
+ , "Named"
+ , "Stable"
+ , "Running"
+ , "Valid"
+ , "V2Dir"
+ , "V3Dir"
+};
+
+static QString qtscript_RouterStatus_Flag_toStringHelper(RouterStatus::Flag value)
+{
+ for (int i = 0; i < 14; ++i) {
+ if (qtscript_RouterStatus_Flag_values[i] == value)
+ return QString::fromLatin1(qtscript_RouterStatus_Flag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_RouterStatus_Flag_toScriptValue(QScriptEngine *engine, const RouterStatus::Flag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("RouterStatus"));
+ return clazz.property(qtscript_RouterStatus_Flag_toStringHelper(value));
+}
+
+static void qtscript_RouterStatus_Flag_fromScriptValue(const QScriptValue &value, RouterStatus::Flag &out)
+{
+ out = qvariant_cast<RouterStatus::Flag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_RouterStatus_Flag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 14; ++i) {
+ if (qtscript_RouterStatus_Flag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<RouterStatus::Flag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Flag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_RouterStatus_Flag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ RouterStatus::Flag value = qscriptvalue_cast<RouterStatus::Flag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_RouterStatus_Flag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ RouterStatus::Flag value = qscriptvalue_cast<RouterStatus::Flag>(context->thisObject());
+ return QScriptValue(engine, qtscript_RouterStatus_Flag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_RouterStatus_Flag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_RouterStatus_Flag,
+ qtscript_RouterStatus_Flag_valueOf, qtscript_RouterStatus_Flag_toString);
+ qScriptRegisterMetaType<RouterStatus::Flag>(engine, qtscript_RouterStatus_Flag_toScriptValue,
+ qtscript_RouterStatus_Flag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 14; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_RouterStatus_Flag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_RouterStatus_Flag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// RouterStatus
+//
+
+static QScriptValue qtscript_RouterStatus_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 + 10;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ RouterStatus* _q_self = qscriptvalue_cast<RouterStatus*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("RouterStatus.%0(): this object is not a RouterStatus")
+ .arg(qtscript_RouterStatus_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ unsigned long long _q_result = _q_self->bandwidth();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->descriptorDigest();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ unsigned short _q_result = _q_self->dirPort();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->id();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QHostAddress _q_result = _q_self->ipAddress();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRunning();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->name();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ unsigned short _q_result = _q_self->orPort();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QDateTime _q_result = _q_self->published();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10: {
+ QString result = QString::fromLatin1("RouterStatus");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_RouterStatus_throw_ambiguity_error_helper(context,
+ qtscript_RouterStatus_function_names[_id+1],
+ qtscript_RouterStatus_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_RouterStatus_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("RouterStatus(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ RouterStatus* _q_cpp_result = new RouterStatus(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_RouterStatus_throw_ambiguity_error_helper(context,
+ qtscript_RouterStatus_function_names[_id],
+ qtscript_RouterStatus_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_RouterStatus_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<RouterStatus*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((RouterStatus*)0));
+ for (int i = 0; i < 11; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_RouterStatus_prototype_call, qtscript_RouterStatus_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_RouterStatus_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<RouterStatus*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_RouterStatus_static_call, proto, qtscript_RouterStatus_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("Flag"),
+ qtscript_create_RouterStatus_Flag_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_SendCommandEvent.cpp b/src/vidalia/plugin/extensions/qtscript_SendCommandEvent.cpp
new file mode 100644
index 0000000..5969562
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_SendCommandEvent.cpp
@@ -0,0 +1,134 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <SendCommandEvent.h>
+#include <ControlCommand.h>
+#include <QVariant>
+
+static const char * const qtscript_SendCommandEvent_function_names[] = {
+ "SendCommandEvent"
+ // static
+ // prototype
+ , "command"
+ , "toString"
+};
+
+static const char * const qtscript_SendCommandEvent_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , ""
+""
+};
+
+static const int qtscript_SendCommandEvent_function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_SendCommandEvent_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("SendCommandEvent::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(SendCommandEvent*)
+Q_DECLARE_METATYPE(ControlCommand)
+Q_DECLARE_METATYPE(QEvent*)
+
+//
+// SendCommandEvent
+//
+
+static QScriptValue qtscript_SendCommandEvent_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 + 1;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ SendCommandEvent* _q_self = qscriptvalue_cast<SendCommandEvent*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("SendCommandEvent.%0(): this object is not a SendCommandEvent")
+ .arg(qtscript_SendCommandEvent_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ ControlCommand _q_result = _q_self->command();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1: {
+ QString result = QString::fromLatin1("SendCommandEvent");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_SendCommandEvent_throw_ambiguity_error_helper(context,
+ qtscript_SendCommandEvent_function_names[_id+1],
+ qtscript_SendCommandEvent_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_SendCommandEvent_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("SendCommandEvent cannot be constructed"));
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_SendCommandEvent_throw_ambiguity_error_helper(context,
+ qtscript_SendCommandEvent_function_names[_id],
+ qtscript_SendCommandEvent_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_SendCommandEvent_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<SendCommandEvent*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((SendCommandEvent*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QEvent*>()));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_SendCommandEvent_prototype_call, qtscript_SendCommandEvent_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_SendCommandEvent_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<SendCommandEvent*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_SendCommandEvent_static_call, proto, qtscript_SendCommandEvent_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_Stream.cpp b/src/vidalia/plugin/extensions/qtscript_Stream.cpp
new file mode 100644
index 0000000..20b63a1
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_Stream.cpp
@@ -0,0 +1,413 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <Stream.h>
+#include <QVariant>
+#include <Stream.h>
+
+static const char * const qtscript_Stream_function_names[] = {
+ "Stream"
+ // static
+ , "fromString"
+ , "isValidStreamId"
+ , "toStatus"
+ , "tr"
+ , "trUtf8"
+ // prototype
+ , "circuitId"
+ , "id"
+ , "isValid"
+ , "status"
+ , "statusString"
+ , "target"
+ , "targetAddress"
+ , "targetPort"
+ , "toString"
+};
+
+static const char * const qtscript_Stream_function_signatures[] = {
+ "\nString streamId, Status status, String circuitId, String address, unsigned short port\nString streamId, Status status, String circuitId, String target"
+ // static
+ , "String stream"
+ , "String streamId"
+ , "String strStatus"
+ , "char sourceText, char disambiguation\nchar sourceText, char disambiguation, int n"
+ , "char sourceText, char disambiguation\nchar sourceText, char disambiguation, int n"
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static const int qtscript_Stream_function_lengths[] = {
+ 5
+ // static
+ , 1
+ , 1
+ , 1
+ , 3
+ , 3
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+};
+
+static QScriptValue qtscript_Stream_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("Stream::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(Stream*)
+Q_DECLARE_METATYPE(Stream::Status)
+Q_DECLARE_METATYPE(char*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// Stream::Status
+//
+
+static const Stream::Status qtscript_Stream_Status_values[] = {
+ Stream::Unknown
+ , Stream::New
+ , Stream::NewResolve
+ , Stream::SentConnect
+ , Stream::SentResolve
+ , Stream::Succeeded
+ , Stream::Failed
+ , Stream::Closed
+ , Stream::Detached
+ , Stream::Remap
+};
+
+static const char * const qtscript_Stream_Status_keys[] = {
+ "Unknown"
+ , "New"
+ , "NewResolve"
+ , "SentConnect"
+ , "SentResolve"
+ , "Succeeded"
+ , "Failed"
+ , "Closed"
+ , "Detached"
+ , "Remap"
+};
+
+static QString qtscript_Stream_Status_toStringHelper(Stream::Status value)
+{
+ if ((value >= Stream::Unknown) && (value <= Stream::Remap))
+ return qtscript_Stream_Status_keys[static_cast<int>(value)-static_cast<int>(Stream::Unknown)];
+ return QString();
+}
+
+static QScriptValue qtscript_Stream_Status_toScriptValue(QScriptEngine *engine, const Stream::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Stream"));
+ return clazz.property(qtscript_Stream_Status_toStringHelper(value));
+}
+
+static void qtscript_Stream_Status_fromScriptValue(const QScriptValue &value, Stream::Status &out)
+{
+ out = qvariant_cast<Stream::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Stream_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Stream::Unknown) && (arg <= Stream::Remap))
+ return qScriptValueFromValue(engine, static_cast<Stream::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Stream_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Stream::Status value = qscriptvalue_cast<Stream::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Stream_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Stream::Status value = qscriptvalue_cast<Stream::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_Stream_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Stream_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Stream_Status,
+ qtscript_Stream_Status_valueOf, qtscript_Stream_Status_toString);
+ qScriptRegisterMetaType<Stream::Status>(engine, qtscript_Stream_Status_toScriptValue,
+ qtscript_Stream_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 10; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Stream_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Stream_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Stream
+//
+
+static QScriptValue qtscript_Stream_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 + 8;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ Stream* _q_self = qscriptvalue_cast<Stream*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Stream.%0(): this object is not a Stream")
+ .arg(qtscript_Stream_function_names[_id+6]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->circuitId();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->id();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ Stream::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->statusString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->target();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->targetAddress();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ unsigned short _q_result = _q_self->targetPort();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8: {
+ QString result = QString::fromLatin1("Stream");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_Stream_throw_ambiguity_error_helper(context,
+ qtscript_Stream_function_names[_id+6],
+ qtscript_Stream_function_signatures[_id+6]);
+}
+
+static QScriptValue qtscript_Stream_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("Stream(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ Stream* _q_cpp_result = new Stream();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 4) {
+ QString _q_arg0 = context->argument(0).toString();
+ Stream::Status _q_arg1 = qscriptvalue_cast<Stream::Status>(context->argument(1));
+ QString _q_arg2 = context->argument(2).toString();
+ QString _q_arg3 = context->argument(3).toString();
+ Stream* _q_cpp_result = new Stream(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 5) {
+ QString _q_arg0 = context->argument(0).toString();
+ Stream::Status _q_arg1 = qscriptvalue_cast<Stream::Status>(context->argument(1));
+ QString _q_arg2 = context->argument(2).toString();
+ QString _q_arg3 = context->argument(3).toString();
+ unsigned short _q_arg4 = qscriptvalue_cast<unsigned short>(context->argument(4));
+ Stream* _q_cpp_result = new Stream(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ Stream _q_result = Stream::fromString(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = Stream::isValidStreamId(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ Stream::Status _q_result = Stream::toStatus(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QString _q_result = Stream::tr(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = Stream::tr(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = Stream::tr(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QString _q_result = Stream::trUtf8(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = Stream::trUtf8(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = Stream::trUtf8(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_Stream_throw_ambiguity_error_helper(context,
+ qtscript_Stream_function_names[_id],
+ qtscript_Stream_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_Stream_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<Stream*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((Stream*)0));
+ for (int i = 0; i < 9; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_Stream_prototype_call, qtscript_Stream_function_lengths[i+6]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_Stream_function_names[i+6]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<Stream*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_Stream_static_call, proto, qtscript_Stream_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 5; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_Stream_static_call,
+ qtscript_Stream_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_Stream_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_Stream_Status_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_TorControl.cpp b/src/vidalia/plugin/extensions/qtscript_TorControl.cpp
index 67a3a7a..b0ce6e9 100644
--- a/src/vidalia/plugin/extensions/qtscript_TorControl.cpp
+++ b/src/vidalia/plugin/extensions/qtscript_TorControl.cpp
@@ -6,7 +6,12 @@
#include <qmetaobject.h>
#include <TorControl.h>
+#include <BootstrapStatus.h>
+#include <Circuit.h>
+#include <ControlCommand.h>
+#include <ControlReply.h>
#include <QVariant>
+#include <Stream.h>
#include <qbytearray.h>
#include <qcoreevent.h>
#include <qdatetime.h>
@@ -15,6 +20,8 @@
#include <qobject.h>
#include <qstringlist.h>
+#include "qtscriptshell_TorControl.h"
+
static const char * const qtscript_TorControl_function_names[] = {
"TorControl"
// static
@@ -45,6 +52,7 @@ static const char * const qtscript_TorControl_function_names[] = {
, "loadConf"
, "resetConf"
, "saveConf"
+ , "setConf"
, "setEvents"
, "shouldContinue"
, "start"
@@ -55,10 +63,10 @@ static const char * const qtscript_TorControl_function_names[] = {
};
static const char * const qtscript_TorControl_function_signatures[] = {
- ""
+ "Method method"
// static
// prototype
- , "QByteArray cookie, String errmsg\nString password, String errmsg"
+ , "QByteArray cookie, bool safe, String errmsg\nString password, String errmsg"
, ""
, ""
, "QHostAddress address, unsigned short port\nString path"
@@ -84,6 +92,7 @@ static const char * const qtscript_TorControl_function_signatures[] = {
, "String contents, String errmsg"
, "String key, String errmsg\nList keys, String errmsg"
, "String errmsg"
+ , "String key, String value, String errmsg, ControlReply reply\nString keyAndValue, String errmsg, ControlReply reply"
, "String errmsg"
, "String errmsg"
, "String tor, List args"
@@ -94,10 +103,10 @@ static const char * const qtscript_TorControl_function_signatures[] = {
};
static const int qtscript_TorControl_function_lengths[] = {
- 0
+ 1
// static
// prototype
- , 2
+ , 3
, 0
, 0
, 2
@@ -123,6 +132,7 @@ static const int qtscript_TorControl_function_lengths[] = {
, 2
, 2
, 1
+ , 4
, 1
, 1
, 2
@@ -144,6 +154,7 @@ static QScriptValue qtscript_TorControl_throw_ambiguity_error_helper(
}
Q_DECLARE_METATYPE(TorControl*)
+Q_DECLARE_METATYPE(QtScriptShell_TorControl*)
Q_DECLARE_METATYPE(QString*)
Q_DECLARE_METATYPE(QHostAddress)
Q_DECLARE_METATYPE(int*)
@@ -173,6 +184,8 @@ struct QMetaTypeId< QHash<QString,QString> > \
} \
};
Q_DECLARE_METATYPE(QList<unsigned short>)
+Q_DECLARE_METATYPE(ControlReply*)
+Q_DECLARE_METATYPE(ControlMethod::Method)
//
// TorControl
@@ -188,7 +201,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
if (context->callee().isFunction())
_id = context->callee().data().toUInt32();
else
- _id = 0xBABE0000 + 32;
+ _id = 0xBABE0000 + 33;
#endif
Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
_id &= 0x0000FFFF;
@@ -218,10 +231,10 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
if (context->argumentCount() == 2) {
if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())
- && qscriptvalue_cast<QString*>(context->argument(1))) {
+ && context->argument(1).isBoolean()) {
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, false, _q_arg1);
+ bool _q_arg1 = context->argument(1).toBoolean();
+ 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))) {
@@ -231,6 +244,13 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
return QScriptValue(context->engine(), _q_result);
}
}
+ if (context->argumentCount() == 3) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_arg1 = context->argument(1).toBoolean();
+ QString* _q_arg2 = qscriptvalue_cast<QString*>(context->argument(2));
+ bool _q_result = _q_self->authenticate(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
break;
case 1:
@@ -575,6 +595,56 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
break;
case 26:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->setConf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = _q_self->setConf(_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->setConf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ if (context->argument(0).isString()
+ && context->argument(1).isString()
+ && qscriptvalue_cast<QString*>(context->argument(2))) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString* _q_arg2 = qscriptvalue_cast<QString*>(context->argument(2));
+ bool _q_result = _q_self->setConf(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && qscriptvalue_cast<QString*>(context->argument(1))
+ && qscriptvalue_cast<ControlReply*>(context->argument(2))) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString* _q_arg1 = qscriptvalue_cast<QString*>(context->argument(1));
+ ControlReply* _q_arg2 = qscriptvalue_cast<ControlReply*>(context->argument(2));
+ bool _q_result = _q_self->setConf(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 4) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString* _q_arg2 = qscriptvalue_cast<QString*>(context->argument(2));
+ ControlReply* _q_arg3 = qscriptvalue_cast<ControlReply*>(context->argument(3));
+ bool _q_result = _q_self->setConf(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
if (context->argumentCount() == 0) {
bool _q_result = _q_self->setEvents();
return QScriptValue(context->engine(), _q_result);
@@ -586,7 +656,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
break;
- case 27:
+ case 28:
if (context->argumentCount() == 0) {
bool _q_result = _q_self->shouldContinue();
return QScriptValue(context->engine(), _q_result);
@@ -598,7 +668,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
break;
- case 28:
+ case 29:
if (context->argumentCount() == 2) {
QString _q_arg0 = context->argument(0).toString();
QStringList _q_arg1;
@@ -608,7 +678,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
break;
- case 29:
+ case 30:
if (context->argumentCount() == 0) {
bool _q_result = _q_self->stop();
return QScriptValue(context->engine(), _q_result);
@@ -620,7 +690,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
break;
- case 30:
+ case 31:
if (context->argumentCount() == 1) {
QString* _q_arg0 = qscriptvalue_cast<QString*>(context->argument(0));
bool _q_result = _q_self->takeOwnership(_q_arg0);
@@ -628,7 +698,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
break;
- case 31:
+ case 32:
if (context->argumentCount() == 0) {
bool _q_result = _q_self->useMicrodescriptors();
return QScriptValue(context->engine(), _q_result);
@@ -640,7 +710,7 @@ static QScriptValue qtscript_TorControl_prototype_call(QScriptContext *context,
}
break;
- case 32: {
+ case 33: {
QString result = QString::fromLatin1("TorControl");
return QScriptValue(context->engine(), result);
}
@@ -660,8 +730,21 @@ static QScriptValue qtscript_TorControl_static_call(QScriptContext *context, QSc
_id &= 0x0000FFFF;
switch (_id) {
case 0:
- return context->throwError(QScriptContext::TypeError,
- QString::fromLatin1("TorControl cannot be constructed"));
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("TorControl(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_TorControl* _q_cpp_result = new QtScriptShell_TorControl();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (TorControl*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ ControlMethod::Method _q_arg0 = qscriptvalue_cast<ControlMethod::Method>(context->argument(0));
+ QtScriptShell_TorControl* _q_cpp_result = new QtScriptShell_TorControl(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (TorControl*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
break;
default:
@@ -687,14 +770,14 @@ 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) {
+ for (int i = 0; i < 34; ++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,
+ qScriptRegisterMetaType<TorControl*>(engine, qtscript_TorControl_toScriptValue,
qtscript_TorControl_fromScriptValue, proto);
QScriptValue ctor = engine->newFunction(qtscript_TorControl_static_call, proto, qtscript_TorControl_function_lengths[0]);
diff --git a/src/vidalia/plugin/extensions/qtscript_TorEvents.cpp b/src/vidalia/plugin/extensions/qtscript_TorEvents.cpp
new file mode 100644
index 0000000..74c647a
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_TorEvents.cpp
@@ -0,0 +1,297 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <TorEvents.h>
+#include <BootstrapStatus.h>
+#include <Circuit.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <ReplyLine.h>
+#include <Stream.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatetime.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qpair.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_TorEvents.h"
+
+static const char * const qtscript_TorEvents_function_names[] = {
+ "TorEvents"
+ // static
+ , "toString"
+ // prototype
+ , "handleEvent"
+};
+
+static const char * const qtscript_TorEvents_function_signatures[] = {
+ "QObject parent"
+ // static
+ , "Event e"
+ // prototype
+ , "ControlReply reply"
+};
+
+static const int qtscript_TorEvents_function_lengths[] = {
+ 1
+ // static
+ , 1
+ // prototype
+ , 1
+};
+
+static QScriptValue qtscript_TorEvents_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("TorEvents::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(TorEvents*)
+Q_DECLARE_METATYPE(QtScriptShell_TorEvents*)
+Q_DECLARE_METATYPE(TorEvents::Event)
+Q_DECLARE_METATYPE(ControlReply)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// TorEvents::Event
+//
+
+static const TorEvents::Event qtscript_TorEvents_Event_values[] = {
+ TorEvents::Unknown
+ , TorEvents::Bandwidth
+ , TorEvents::LogDebug
+ , TorEvents::LogInfo
+ , TorEvents::LogNotice
+ , TorEvents::LogWarn
+ , TorEvents::LogError
+ , TorEvents::CircuitStatus
+ , TorEvents::StreamStatus
+ , TorEvents::OrConnStatus
+ , TorEvents::NewDescriptor
+ , TorEvents::AddressMap
+ , TorEvents::GeneralStatus
+ , TorEvents::ClientStatus
+ , TorEvents::ServerStatus
+ , TorEvents::NewConsensus
+ , TorEvents::StreamBandwidth
+};
+
+static const char * const qtscript_TorEvents_Event_keys[] = {
+ "Unknown"
+ , "Bandwidth"
+ , "LogDebug"
+ , "LogInfo"
+ , "LogNotice"
+ , "LogWarn"
+ , "LogError"
+ , "CircuitStatus"
+ , "StreamStatus"
+ , "OrConnStatus"
+ , "NewDescriptor"
+ , "AddressMap"
+ , "GeneralStatus"
+ , "ClientStatus"
+ , "ServerStatus"
+ , "NewConsensus"
+ , "StreamBandwidth"
+};
+
+static QString qtscript_TorEvents_Event_toStringHelper(TorEvents::Event value)
+{
+ if ((value >= TorEvents::Unknown) && (value <= TorEvents::StreamBandwidth))
+ return qtscript_TorEvents_Event_keys[static_cast<int>(value)-static_cast<int>(TorEvents::Unknown)];
+ return QString();
+}
+
+static QScriptValue qtscript_TorEvents_Event_toScriptValue(QScriptEngine *engine, const TorEvents::Event &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("TorEvents"));
+ return clazz.property(qtscript_TorEvents_Event_toStringHelper(value));
+}
+
+static void qtscript_TorEvents_Event_fromScriptValue(const QScriptValue &value, TorEvents::Event &out)
+{
+ out = qvariant_cast<TorEvents::Event>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_TorEvents_Event(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= TorEvents::Unknown) && (arg <= TorEvents::StreamBandwidth))
+ return qScriptValueFromValue(engine, static_cast<TorEvents::Event>(arg));
+ return context->throwError(QString::fromLatin1("Event(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_TorEvents_Event_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ TorEvents::Event value = qscriptvalue_cast<TorEvents::Event>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_TorEvents_Event_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ TorEvents::Event value = qscriptvalue_cast<TorEvents::Event>(context->thisObject());
+ return QScriptValue(engine, qtscript_TorEvents_Event_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_TorEvents_Event_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_TorEvents_Event,
+ qtscript_TorEvents_Event_valueOf, qtscript_TorEvents_Event_toString);
+ qScriptRegisterMetaType<TorEvents::Event>(engine, qtscript_TorEvents_Event_toScriptValue,
+ qtscript_TorEvents_Event_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 17; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_TorEvents_Event_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_TorEvents_Event_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// TorEvents
+//
+
+static QScriptValue qtscript_TorEvents_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 + 1;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ TorEvents* _q_self = qscriptvalue_cast<TorEvents*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("TorEvents.%0(): this object is not a TorEvents")
+ .arg(qtscript_TorEvents_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ ControlReply _q_arg0 = qscriptvalue_cast<ControlReply>(context->argument(0));
+ _q_self->handleEvent(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorEvents_throw_ambiguity_error_helper(context,
+ qtscript_TorEvents_function_names[_id+2],
+ qtscript_TorEvents_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_TorEvents_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("TorEvents(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_TorEvents* _q_cpp_result = new QtScriptShell_TorEvents();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (TorEvents*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_TorEvents* _q_cpp_result = new QtScriptShell_TorEvents(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (TorEvents*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ TorEvents::Event _q_arg0 = qscriptvalue_cast<TorEvents::Event>(context->argument(0));
+ QString _q_result = TorEvents::toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorEvents_throw_ambiguity_error_helper(context,
+ qtscript_TorEvents_function_names[_id],
+ qtscript_TorEvents_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_TorEvents_toScriptValue(QScriptEngine *engine, TorEvents* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_TorEvents_fromScriptValue(const QScriptValue &value, TorEvents* &out)
+{
+ out = qobject_cast<TorEvents*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_TorEvents_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<TorEvents*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((TorEvents*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_TorEvents_prototype_call, qtscript_TorEvents_function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_TorEvents_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<TorEvents*>(engine, qtscript_TorEvents_toScriptValue,
+ qtscript_TorEvents_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_TorEvents_static_call, proto, qtscript_TorEvents_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_TorEvents_static_call,
+ qtscript_TorEvents_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_TorEvents_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Event"),
+ qtscript_create_TorEvents_Event_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_TorProcess.cpp b/src/vidalia/plugin/extensions/qtscript_TorProcess.cpp
new file mode 100644
index 0000000..21f008f
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_TorProcess.cpp
@@ -0,0 +1,232 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <TorProcess.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_TorProcess.h"
+
+static const char * const qtscript_TorProcess_function_names[] = {
+ "TorProcess"
+ // static
+ , "version"
+ // prototype
+ , "closeStdout"
+ , "openStdout"
+ , "pid"
+ , "start"
+ , "stop"
+ , "toString"
+};
+
+static const char * const qtscript_TorProcess_function_signatures[] = {
+ "QObject parent"
+ // static
+ , "String exe"
+ // prototype
+ , ""
+ , ""
+ , ""
+ , "String app, List args"
+ , "String errmsg"
+""
+};
+
+static const int qtscript_TorProcess_function_lengths[] = {
+ 1
+ // static
+ , 1
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 2
+ , 1
+ , 0
+};
+
+static QScriptValue qtscript_TorProcess_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("TorProcess::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(TorProcess*)
+Q_DECLARE_METATYPE(QtScriptShell_TorProcess*)
+Q_DECLARE_METATYPE(QString*)
+Q_DECLARE_METATYPE(QProcess*)
+
+//
+// TorProcess
+//
+
+static QScriptValue qtscript_TorProcess_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 + 5;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ TorProcess* _q_self = qscriptvalue_cast<TorProcess*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("TorProcess.%0(): this object is not a TorProcess")
+ .arg(qtscript_TorProcess_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->closeStdout();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->openStdout();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ unsigned long long _q_result = _q_self->pid();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ 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 4:
+ 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 5: {
+ QString result = QString::fromLatin1("TorProcess");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorProcess_throw_ambiguity_error_helper(context,
+ qtscript_TorProcess_function_names[_id+2],
+ qtscript_TorProcess_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_TorProcess_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("TorProcess(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_TorProcess* _q_cpp_result = new QtScriptShell_TorProcess();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (TorProcess*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_TorProcess* _q_cpp_result = new QtScriptShell_TorProcess(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (TorProcess*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = TorProcess::version(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorProcess_throw_ambiguity_error_helper(context,
+ qtscript_TorProcess_function_names[_id],
+ qtscript_TorProcess_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_TorProcess_toScriptValue(QScriptEngine *engine, TorProcess* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_TorProcess_fromScriptValue(const QScriptValue &value, TorProcess* &out)
+{
+ out = qobject_cast<TorProcess*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_TorProcess_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<TorProcess*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((TorProcess*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QProcess*>()));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_TorProcess_prototype_call, qtscript_TorProcess_function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_TorProcess_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<TorProcess*>(engine, qtscript_TorProcess_toScriptValue,
+ qtscript_TorProcess_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_TorProcess_static_call, proto, qtscript_TorProcess_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_TorProcess_static_call,
+ qtscript_TorProcess_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_TorProcess_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscript_TorSignal.cpp b/src/vidalia/plugin/extensions/qtscript_TorSignal.cpp
new file mode 100644
index 0000000..595c412
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscript_TorSignal.cpp
@@ -0,0 +1,196 @@
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <TorSignal.h>
+#include <QVariant>
+
+#include "qtscriptshell_TorSignal.h"
+
+static const char * const qtscript_TorSignal_function_names[] = {
+ "TorSignal"
+ // static
+ , "toString"
+ // prototype
+};
+
+static const char * const qtscript_TorSignal_function_signatures[] = {
+ ""
+ // static
+ , "Signal signal"
+ // prototype
+};
+
+static const int qtscript_TorSignal_function_lengths[] = {
+ 0
+ // static
+ , 1
+ // prototype
+};
+
+static QScriptValue qtscript_TorSignal_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("TorSignal::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(TorSignal*)
+Q_DECLARE_METATYPE(QtScriptShell_TorSignal*)
+Q_DECLARE_METATYPE(TorSignal::Signal)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// TorSignal::Signal
+//
+
+static const TorSignal::Signal qtscript_TorSignal_Signal_values[] = {
+ TorSignal::Reload
+ , TorSignal::Shutdown
+ , TorSignal::Dump
+ , TorSignal::Debug
+ , TorSignal::Halt
+ , TorSignal::NewNym
+};
+
+static const char * const qtscript_TorSignal_Signal_keys[] = {
+ "Reload"
+ , "Shutdown"
+ , "Dump"
+ , "Debug"
+ , "Halt"
+ , "NewNym"
+};
+
+static QString qtscript_TorSignal_Signal_toStringHelper(TorSignal::Signal value)
+{
+ if ((value >= TorSignal::Reload) && (value <= TorSignal::NewNym))
+ return qtscript_TorSignal_Signal_keys[static_cast<int>(value)-static_cast<int>(TorSignal::Reload)];
+ return QString();
+}
+
+static QScriptValue qtscript_TorSignal_Signal_toScriptValue(QScriptEngine *engine, const TorSignal::Signal &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("TorSignal"));
+ return clazz.property(qtscript_TorSignal_Signal_toStringHelper(value));
+}
+
+static void qtscript_TorSignal_Signal_fromScriptValue(const QScriptValue &value, TorSignal::Signal &out)
+{
+ out = qvariant_cast<TorSignal::Signal>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_TorSignal_Signal(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= TorSignal::Reload) && (arg <= TorSignal::NewNym))
+ return qScriptValueFromValue(engine, static_cast<TorSignal::Signal>(arg));
+ return context->throwError(QString::fromLatin1("Signal(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_TorSignal_Signal_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ TorSignal::Signal value = qscriptvalue_cast<TorSignal::Signal>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_TorSignal_Signal_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ TorSignal::Signal value = qscriptvalue_cast<TorSignal::Signal>(context->thisObject());
+ return QScriptValue(engine, qtscript_TorSignal_Signal_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_TorSignal_Signal_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_TorSignal_Signal,
+ qtscript_TorSignal_Signal_valueOf, qtscript_TorSignal_Signal_toString);
+ qScriptRegisterMetaType<TorSignal::Signal>(engine, qtscript_TorSignal_Signal_toScriptValue,
+ qtscript_TorSignal_Signal_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_TorSignal_Signal_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_TorSignal_Signal_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// TorSignal
+//
+
+static QScriptValue qtscript_TorSignal_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("TorSignal(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_TorSignal* _q_cpp_result = new QtScriptShell_TorSignal();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((TorSignal*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ TorSignal::Signal _q_arg0 = qscriptvalue_cast<TorSignal::Signal>(context->argument(0));
+ QString _q_result = TorSignal::toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_TorSignal_throw_ambiguity_error_helper(context,
+ qtscript_TorSignal_function_names[_id],
+ qtscript_TorSignal_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_TorSignal_class(QScriptEngine *engine)
+{
+ engine->setDefaultPrototype(qMetaTypeId<TorSignal*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((TorSignal*)0));
+
+ engine->setDefaultPrototype(qMetaTypeId<TorSignal*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_TorSignal_static_call, proto, qtscript_TorSignal_function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_TorSignal_static_call,
+ qtscript_TorSignal_function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_TorSignal_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Signal"),
+ qtscript_create_TorSignal_Signal_class(engine, ctor));
+ return ctor;
+}
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_ControlConnection.cpp b/src/vidalia/plugin/extensions/qtscriptshell_ControlConnection.cpp
new file mode 100644
index 0000000..139fbeb
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_ControlConnection.cpp
@@ -0,0 +1,95 @@
+#include "qtscriptshell_ControlConnection.h"
+
+#include <QtScript/QScriptEngine>
+#include <ControlCommand.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <TorEvents.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_ControlConnection::QtScriptShell_ControlConnection(ControlMethod::Method method, TorEvents* events)
+ : ControlConnection(method, events) {}
+
+QtScriptShell_ControlConnection::~QtScriptShell_ControlConnection() {}
+
+void QtScriptShell_ControlConnection::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ ControlConnection::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_ControlConnection::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ ControlConnection::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_ControlConnection::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return ControlConnection::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_ControlConnection::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return ControlConnection::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_ControlConnection::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ ControlConnection::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_ControlConnection.h b/src/vidalia/plugin/extensions/qtscriptshell_ControlConnection.h
new file mode 100644
index 0000000..c5c1c5c
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_ControlConnection.h
@@ -0,0 +1,23 @@
+#ifndef QTSCRIPTSHELL_CONTROLCONNECTION_H
+#define QTSCRIPTSHELL_CONTROLCONNECTION_H
+
+#include <ControlConnection.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_ControlConnection : public ControlConnection
+{
+public:
+ QtScriptShell_ControlConnection(ControlMethod::Method method, TorEvents* events = 0);
+ ~QtScriptShell_ControlConnection();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_CONTROLCONNECTION_H
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_ControlMethod.cpp b/src/vidalia/plugin/extensions/qtscriptshell_ControlMethod.cpp
new file mode 100644
index 0000000..085a9be
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_ControlMethod.cpp
@@ -0,0 +1,13 @@
+#include "qtscriptshell_ControlMethod.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_ControlMethod::QtScriptShell_ControlMethod()
+ : ControlMethod() {}
+
+QtScriptShell_ControlMethod::~QtScriptShell_ControlMethod() {}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_ControlMethod.h b/src/vidalia/plugin/extensions/qtscriptshell_ControlMethod.h
new file mode 100644
index 0000000..2cd553b
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_ControlMethod.h
@@ -0,0 +1,18 @@
+#ifndef QTSCRIPTSHELL_CONTROLMETHOD_H
+#define QTSCRIPTSHELL_CONTROLMETHOD_H
+
+#include <ControlMethod.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_ControlMethod : public ControlMethod
+{
+public:
+ QtScriptShell_ControlMethod();
+ ~QtScriptShell_ControlMethod();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_CONTROLMETHOD_H
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_ControlSocket.cpp b/src/vidalia/plugin/extensions/qtscriptshell_ControlSocket.cpp
new file mode 100644
index 0000000..252ae71
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_ControlSocket.cpp
@@ -0,0 +1,94 @@
+#include "qtscriptshell_ControlSocket.h"
+
+#include <QtScript/QScriptEngine>
+#include <ControlCommand.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_ControlSocket::QtScriptShell_ControlSocket(ControlMethod::Method method)
+ : ControlSocket(method) {}
+
+QtScriptShell_ControlSocket::~QtScriptShell_ControlSocket() {}
+
+void QtScriptShell_ControlSocket::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ ControlSocket::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_ControlSocket::customEvent(QEvent* event)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ ControlSocket::customEvent(event);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, event));
+ }
+}
+
+bool QtScriptShell_ControlSocket::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return ControlSocket::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_ControlSocket::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return ControlSocket::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_ControlSocket::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ ControlSocket::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_ControlSocket.h b/src/vidalia/plugin/extensions/qtscriptshell_ControlSocket.h
new file mode 100644
index 0000000..4c8f539
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_ControlSocket.h
@@ -0,0 +1,23 @@
+#ifndef QTSCRIPTSHELL_CONTROLSOCKET_H
+#define QTSCRIPTSHELL_CONTROLSOCKET_H
+
+#include <ControlSocket.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_ControlSocket : public ControlSocket
+{
+public:
+ QtScriptShell_ControlSocket(ControlMethod::Method method = ControlMethod::Port);
+ ~QtScriptShell_ControlSocket();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* event);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_CONTROLSOCKET_H
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorControl.cpp b/src/vidalia/plugin/extensions/qtscriptshell_TorControl.cpp
new file mode 100644
index 0000000..e0de255
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorControl.cpp
@@ -0,0 +1,99 @@
+#include "qtscriptshell_TorControl.h"
+
+#include <QtScript/QScriptEngine>
+#include <BootstrapStatus.h>
+#include <Circuit.h>
+#include <ControlCommand.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <Stream.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatetime.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_TorControl::QtScriptShell_TorControl(ControlMethod::Method method)
+ : TorControl(method) {}
+
+QtScriptShell_TorControl::~QtScriptShell_TorControl() {}
+
+void QtScriptShell_TorControl::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ TorControl::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_TorControl::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ TorControl::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_TorControl::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return TorControl::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_TorControl::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return TorControl::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_TorControl::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ TorControl::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorControl.h b/src/vidalia/plugin/extensions/qtscriptshell_TorControl.h
new file mode 100644
index 0000000..357a025
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorControl.h
@@ -0,0 +1,23 @@
+#ifndef QTSCRIPTSHELL_TORCONTROL_H
+#define QTSCRIPTSHELL_TORCONTROL_H
+
+#include <TorControl.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_TorControl : public TorControl
+{
+public:
+ QtScriptShell_TorControl(ControlMethod::Method method = ControlMethod::Port);
+ ~QtScriptShell_TorControl();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_TORCONTROL_H
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorEvents.cpp b/src/vidalia/plugin/extensions/qtscriptshell_TorEvents.cpp
new file mode 100644
index 0000000..4f8a2f1
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorEvents.cpp
@@ -0,0 +1,100 @@
+#include "qtscriptshell_TorEvents.h"
+
+#include <QtScript/QScriptEngine>
+#include <BootstrapStatus.h>
+#include <Circuit.h>
+#include <ControlReply.h>
+#include <QVariant>
+#include <ReplyLine.h>
+#include <Stream.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatetime.h>
+#include <qhostaddress.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qpair.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_TorEvents::QtScriptShell_TorEvents(QObject* parent)
+ : TorEvents(parent) {}
+
+QtScriptShell_TorEvents::~QtScriptShell_TorEvents() {}
+
+void QtScriptShell_TorEvents::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ TorEvents::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_TorEvents::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ TorEvents::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_TorEvents::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return TorEvents::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_TorEvents::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return TorEvents::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_TorEvents::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ TorEvents::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorEvents.h b/src/vidalia/plugin/extensions/qtscriptshell_TorEvents.h
new file mode 100644
index 0000000..2cd2e95
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorEvents.h
@@ -0,0 +1,23 @@
+#ifndef QTSCRIPTSHELL_TOREVENTS_H
+#define QTSCRIPTSHELL_TOREVENTS_H
+
+#include <TorEvents.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_TorEvents : public TorEvents
+{
+public:
+ QtScriptShell_TorEvents(QObject* parent = 0);
+ ~QtScriptShell_TorEvents();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_TOREVENTS_H
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorProcess.cpp b/src/vidalia/plugin/extensions/qtscriptshell_TorProcess.cpp
new file mode 100644
index 0000000..7d0235c
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorProcess.cpp
@@ -0,0 +1,306 @@
+#include "qtscriptshell_TorProcess.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_TorProcess::QtScriptShell_TorProcess(QObject* parent)
+ : TorProcess(parent) {}
+
+QtScriptShell_TorProcess::~QtScriptShell_TorProcess() {}
+
+bool QtScriptShell_TorProcess::atEnd() const
+{
+ QScriptValue _q_function = __qtscript_self.property("atEnd");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("atEnd") & QScriptValue::QObjectMember)) {
+ return TorProcess::atEnd();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_TorProcess::bytesAvailable() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesAvailable");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesAvailable") & QScriptValue::QObjectMember)) {
+ return TorProcess::bytesAvailable();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_TorProcess::bytesToWrite() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesToWrite");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesToWrite") & QScriptValue::QObjectMember)) {
+ return TorProcess::bytesToWrite();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_TorProcess::canReadLine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("canReadLine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canReadLine") & QScriptValue::QObjectMember)) {
+ return TorProcess::canReadLine();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_TorProcess::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ TorProcess::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_TorProcess::close()
+{
+ QScriptValue _q_function = __qtscript_self.property("close");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("close") & QScriptValue::QObjectMember)) {
+ TorProcess::close();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+void QtScriptShell_TorProcess::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ TorProcess::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_TorProcess::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return TorProcess::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_TorProcess::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return TorProcess::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+bool QtScriptShell_TorProcess::isSequential() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isSequential");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isSequential") & QScriptValue::QObjectMember)) {
+ return TorProcess::isSequential();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_TorProcess::open(QIODevice::OpenMode mode)
+{
+ QScriptValue _q_function = __qtscript_self.property("open");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("open") & QScriptValue::QObjectMember)) {
+ return TorProcess::open(mode);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, mode)));
+ }
+}
+
+qint64 QtScriptShell_TorProcess::pos() const
+{
+ QScriptValue _q_function = __qtscript_self.property("pos");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("pos") & QScriptValue::QObjectMember)) {
+ return TorProcess::pos();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_TorProcess::readData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readData") & QScriptValue::QObjectMember)) {
+ return TorProcess::readData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+qint64 QtScriptShell_TorProcess::readLineData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readLineData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readLineData") & QScriptValue::QObjectMember)) {
+ return TorProcess::readLineData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+bool QtScriptShell_TorProcess::reset()
+{
+ QScriptValue _q_function = __qtscript_self.property("reset");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("reset") & QScriptValue::QObjectMember)) {
+ return TorProcess::reset();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_TorProcess::seek(qint64 pos)
+{
+ QScriptValue _q_function = __qtscript_self.property("seek");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("seek") & QScriptValue::QObjectMember)) {
+ return TorProcess::seek(pos);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, pos)));
+ }
+}
+
+void QtScriptShell_TorProcess::setupChildProcess()
+{
+ QScriptValue _q_function = __qtscript_self.property("setupChildProcess");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setupChildProcess") & QScriptValue::QObjectMember)) {
+ TorProcess::setupChildProcess();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+qint64 QtScriptShell_TorProcess::size() const
+{
+ QScriptValue _q_function = __qtscript_self.property("size");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("size") & QScriptValue::QObjectMember)) {
+ return TorProcess::size();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_TorProcess::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ TorProcess::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_TorProcess::waitForBytesWritten(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForBytesWritten");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForBytesWritten") & QScriptValue::QObjectMember)) {
+ return TorProcess::waitForBytesWritten(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+bool QtScriptShell_TorProcess::waitForReadyRead(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForReadyRead");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForReadyRead") & QScriptValue::QObjectMember)) {
+ return TorProcess::waitForReadyRead(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+qint64 QtScriptShell_TorProcess::writeData(const char* data, qint64 len)
+{
+ QScriptValue _q_function = __qtscript_self.property("writeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("writeData") & QScriptValue::QObjectMember)) {
+ return TorProcess::writeData(data, len);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(data))
+ << qScriptValueFromValue(_q_engine, len)));
+ }
+}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorProcess.h b/src/vidalia/plugin/extensions/qtscriptshell_TorProcess.h
new file mode 100644
index 0000000..34d05cd
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorProcess.h
@@ -0,0 +1,40 @@
+#ifndef QTSCRIPTSHELL_TORPROCESS_H
+#define QTSCRIPTSHELL_TORPROCESS_H
+
+#include <TorProcess.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_TorProcess : public TorProcess
+{
+public:
+ QtScriptShell_TorProcess(QObject* parent = 0);
+ ~QtScriptShell_TorProcess();
+
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ qint64 bytesToWrite() const;
+ bool canReadLine() const;
+ void childEvent(QChildEvent* arg__1);
+ void close();
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ bool isSequential() const;
+ bool open(QIODevice::OpenMode mode);
+ qint64 pos() const;
+ qint64 readData(char* data, qint64 maxlen);
+ qint64 readLineData(char* data, qint64 maxlen);
+ bool reset();
+ bool seek(qint64 pos);
+ void setupChildProcess();
+ qint64 size() const;
+ void timerEvent(QTimerEvent* arg__1);
+ bool waitForBytesWritten(int msecs);
+ bool waitForReadyRead(int msecs);
+ qint64 writeData(const char* data, qint64 len);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_TORPROCESS_H
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorSignal.cpp b/src/vidalia/plugin/extensions/qtscriptshell_TorSignal.cpp
new file mode 100644
index 0000000..27fa1c4
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorSignal.cpp
@@ -0,0 +1,13 @@
+#include "qtscriptshell_TorSignal.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_TorSignal::QtScriptShell_TorSignal()
+ : TorSignal() {}
+
+QtScriptShell_TorSignal::~QtScriptShell_TorSignal() {}
+
diff --git a/src/vidalia/plugin/extensions/qtscriptshell_TorSignal.h b/src/vidalia/plugin/extensions/qtscriptshell_TorSignal.h
new file mode 100644
index 0000000..f62043d
--- /dev/null
+++ b/src/vidalia/plugin/extensions/qtscriptshell_TorSignal.h
@@ -0,0 +1,18 @@
+#ifndef QTSCRIPTSHELL_TORSIGNAL_H
+#define QTSCRIPTSHELL_TORSIGNAL_H
+
+#include <TorSignal.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_TorSignal : public TorSignal
+{
+public:
+ QtScriptShell_TorSignal();
+ ~QtScriptShell_TorSignal();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_TORSIGNAL_H