summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-11 14:31:10 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-11 14:31:10 (GMT)
commit92d3b704398453568b331330195b24963416ebe7 (patch)
tree63fecd7d73ffa0e84e70c1bc234e5fc8af71c81b /Swiften/Examples
parentd0313aeb934c66da8e51de804b1183b88d736d33 (diff)
downloadswift-92d3b704398453568b331330195b24963416ebe7.zip
swift-92d3b704398453568b331330195b24963416ebe7.tar.bz2
Use ClientXMLTracer in EchoBot.
Diffstat (limited to 'Swiften/Examples')
-rw-r--r--Swiften/Examples/EchoBot/EchoBot.cpp15
1 files changed, 12 insertions, 3 deletions
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 <boost/bind.hpp>
#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<GetRosterRequest> rosterRequest(new GetRosterRequest(client.get()));
+ shared_ptr<GetRosterRequest> 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* client;
+ ClientXMLTracer* tracer;
};
int main(int, char**) {