aboutsummaryrefslogtreecommitdiff
path: root/examples/example_5_rpcInterface
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-12-13 08:19:18 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-12-13 08:19:18 +0000
commitadcf0f03c09495330848c1f9c96b921aaa71ce80 (patch)
tree3fb16956a5b7aeb8894d8cbea0fa973793a94c45 /examples/example_5_rpcInterface
parentab4a7c55293df690605c43a14c5ca35c00b585d4 (diff)
downloadqxmpp-adcf0f03c09495330848c1f9c96b921aaa71ce80.tar.gz
update RPC interface example to load QXmppRpcManager
Diffstat (limited to 'examples/example_5_rpcInterface')
-rw-r--r--examples/example_5_rpcInterface/main.cpp18
-rw-r--r--examples/example_5_rpcInterface/rpcClient.cpp38
-rw-r--r--examples/example_5_rpcInterface/rpcClient.h40
3 files changed, 14 insertions, 82 deletions
diff --git a/examples/example_5_rpcInterface/main.cpp b/examples/example_5_rpcInterface/main.cpp
index bc493b53..6e1fc578 100644
--- a/examples/example_5_rpcInterface/main.cpp
+++ b/examples/example_5_rpcInterface/main.cpp
@@ -1,8 +1,9 @@
/*
* Copyright (C) 2008-2010 The QXmpp developers
*
- * Author:
+ * Authors:
* Manjeet Dahiya
+ * Jeremy Lainé
*
* Source:
* http://code.google.com/p/qxmpp
@@ -21,10 +22,13 @@
*
*/
+#include <QCoreApplication>
-#include <QtCore/QCoreApplication>
-#include "rpcClient.h"
+#include "QXmppClient.h"
#include "QXmppLogger.h"
+#include "QXmppRpcManager.h"
+
+#include "remoteinterface.h"
int main(int argc, char *argv[])
{
@@ -32,7 +36,13 @@ int main(int argc, char *argv[])
QXmppLogger::getLogger()->setLoggingType(QXmppLogger::StdoutLogging);
- rpcClient client;
+ QXmppClient client;
+
+ // add RPC extension and register interface
+ QXmppRpcManager *manager = new QXmppRpcManager;
+ client.addExtension(manager);
+ manager->addInvokableInterface(new RemoteInterface(&client));
+
client.connectToServer("qxmpp.test1@gmail.com", "qxmpp123");
return a.exec();
}
diff --git a/examples/example_5_rpcInterface/rpcClient.cpp b/examples/example_5_rpcInterface/rpcClient.cpp
deleted file mode 100644
index 60dd75ea..00000000
--- a/examples/example_5_rpcInterface/rpcClient.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008-2010 The QXmpp developers
- *
- * Author:
- * Ian Reinhart Geiser
- *
- * Source:
- * http://code.google.com/p/qxmpp
- *
- * This file is a part of QXmpp library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- */
-
-
-#include "rpcClient.h"
-#include "remoteinterface.h"
-
-rpcClient::rpcClient(QObject *parent)
- : QXmppClient(parent)
-{
- addInvokableInterface( new RemoteInterface(this) );
-}
-
-rpcClient::~rpcClient()
-{
-
-}
-
diff --git a/examples/example_5_rpcInterface/rpcClient.h b/examples/example_5_rpcInterface/rpcClient.h
deleted file mode 100644
index 22eda459..00000000
--- a/examples/example_5_rpcInterface/rpcClient.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2008-2010 The QXmpp developers
- *
- * Author:
- * Ian Reinhart Geiser
- *
- * Source:
- * http://code.google.com/p/qxmpp
- *
- * This file is a part of QXmpp library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- */
-
-
-#ifndef RPCCLIENT_H
-#define RPCCLIENT_H
-
-#include "QXmppClient.h"
-
-class rpcClient : public QXmppClient
-{
- Q_OBJECT
-
-public:
- rpcClient(QObject *parent = 0);
- ~rpcClient();
-
-};
-
-#endif // RPCCLIENT_H