diff options
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Examples/EchoBot/EchoBot.cpp | 17 | ||||
-rw-r--r-- | Swiften/Examples/EchoBot/SConscript | 13 | ||||
-rw-r--r-- | Swiften/Examples/SConscript | 1 |
3 files changed, 23 insertions, 8 deletions
diff --git a/Swiften/Examples/EchoBot/EchoBot.cpp b/Swiften/Examples/EchoBot/EchoBot.cpp index 9d11c61..1c576c9 100644 --- a/Swiften/Examples/EchoBot/EchoBot.cpp +++ b/Swiften/Examples/EchoBot/EchoBot.cpp @@ -5,9 +5,9 @@ */ #include <boost/bind.hpp> +#include <iostream> #include "Swiften/Client/Client.h" -#include "Swiften/Client/ClientXMLTracer.h" #include "Swiften/EventLoop/SimpleEventLoop.h" #include "Swiften/Queries/Requests/GetRosterRequest.h" @@ -16,16 +16,14 @@ using namespace boost; class EchoBot { public: - EchoBot(const JID& jid, const String& pass) : tracer(0) { + EchoBot(const JID& jid, const String& pass) { client = new Client(jid, pass); - tracer = new ClientXMLTracer(client); client->onConnected.connect(bind(&EchoBot::handleConnected, this)); client->onMessageReceived.connect(bind(&EchoBot::handleMessageReceived, this, _1)); client->connect(); } ~EchoBot() { - delete tracer; delete client; } @@ -36,7 +34,7 @@ class EchoBot { rosterRequest->send(); } - void handleRosterReceived(const optional<Error>& error) { + void handleRosterReceived(const optional<ErrorPayload>& error) { if (error) { std::cerr << "Error receiving roster. Continuing anyway."; } @@ -51,12 +49,15 @@ class EchoBot { private: Client* client; - ClientXMLTracer* tracer; }; -int main(int, char**) { +int main(int argc, char* argv[]) { + if (argc != 3) { + std::cerr << "Usage: " << argv[0] << " <jid> <pass>" << std::endl; + return -1; + } SimpleEventLoop eventLoop; - EchoBot bot(JID("echobot@wonderland.lit"), "mypass"); + EchoBot bot(JID(argv[1]), argv[2]); eventLoop.run(); return 0; } diff --git a/Swiften/Examples/EchoBot/SConscript b/Swiften/Examples/EchoBot/SConscript new file mode 100644 index 0000000..711d8ea --- /dev/null +++ b/Swiften/Examples/EchoBot/SConscript @@ -0,0 +1,13 @@ +Import("env") + +myenv = env.Clone() +myenv.MergeFlags(myenv["SWIFTEN_FLAGS"]) +myenv.MergeFlags(myenv["LIBIDN_FLAGS"]) +myenv.MergeFlags(myenv["BOOST_FLAGS"]) +myenv.MergeFlags(myenv.get("SQLITE_FLAGS", {})) +myenv.MergeFlags(myenv["ZLIB_FLAGS"]) +myenv.MergeFlags(myenv["OPENSSL_FLAGS"]) +myenv.MergeFlags(myenv.get("LIBXML_FLAGS", "")) +myenv.MergeFlags(myenv.get("EXPAT_FLAGS", "")) +myenv.MergeFlags(myenv["PLATFORM_FLAGS"]) +tester = myenv.Program("EchoBot", ["EchoBot.cpp"]) diff --git a/Swiften/Examples/SConscript b/Swiften/Examples/SConscript index 1a06df2..1c95e85 100644 --- a/Swiften/Examples/SConscript +++ b/Swiften/Examples/SConscript @@ -6,4 +6,5 @@ SConscript(dirs = [ "SendMessage", "ConnectivityTest", "LinkLocalTool", + "EchoBot", ]) |