From 92d3b704398453568b331330195b24963416ebe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 11 Jul 2009 16:31:10 +0200 Subject: Use ClientXMLTracer in EchoBot. diff --git a/Swiften/Examples/EchoBot/EchoBot.cpp b/Swiften/Examples/EchoBot/EchoBot.cpp index 526e6b0..872d901 100644 --- a/Swiften/Examples/EchoBot/EchoBot.cpp +++ b/Swiften/Examples/EchoBot/EchoBot.cpp @@ -1,6 +1,7 @@ #include #include "Swiften/Client/Client.h" +#include "Swiften/Client/ClientXMLTracer.h" #include "Swiften/EventLoop/SimpleEventLoop.h" #include "Swiften/Queries/Requests/GetRosterRequest.h" @@ -9,15 +10,22 @@ using namespace boost; class EchoBot { public: - EchoBot(const JID& jid, const String& pass) : client(new Client(jid, pass)) { + EchoBot(const JID& jid, const String& pass) : tracer(0) { + 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; + } + private: void handleConnected() { - shared_ptr rosterRequest(new GetRosterRequest(client.get())); + shared_ptr rosterRequest(new GetRosterRequest(client)); rosterRequest->onResponse.connect(bind(&EchoBot::handleRosterReceived, this, _2)); rosterRequest->send(); } @@ -36,7 +44,8 @@ class EchoBot { } private: - std::auto_ptr client; + Client* client; + ClientXMLTracer* tracer; }; int main(int, char**) { -- cgit v0.10.2-6-g49f6