From 3b7107fb14663c4e83d4829c6ddec7af84c796bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Wed, 22 Jul 2009 20:16:49 +0200 Subject: Remove TuneBot example. diff --git a/Swiften/Examples/Makefile.inc b/Swiften/Examples/Makefile.inc index 15aebae..3c485e2 100644 --- a/Swiften/Examples/Makefile.inc +++ b/Swiften/Examples/Makefile.inc @@ -1,5 +1,4 @@ include Swiften/Examples/EchoBot/Makefile.inc -include Swiften/Examples/TuneBot/Makefile.inc .PHONY: examples examples: $(EXAMPLES_TARGETS) diff --git a/Swiften/Examples/TuneBot/Makefile.inc b/Swiften/Examples/TuneBot/Makefile.inc deleted file mode 100644 index 4a73dff..0000000 --- a/Swiften/Examples/TuneBot/Makefile.inc +++ /dev/null @@ -1,11 +0,0 @@ -TUNEBOT_TARGET = Swiften/Examples/TuneBot/TuneBot -TUNEBOT_SOURCES += \ - Swiften/Examples/TuneBot/TuneBot.cpp -TUNEBOT_OBJECTS = \ - $(TUNEBOT_SOURCES:.cpp=.o) - -CLEANFILES += $(TUNEBOT_OBJECTS) $(TUNEBOT_TARGET) -EXAMPLES_TARGETS += $(TUNEBOT_TARGET) - -$(TUNEBOT_TARGET): $(SWIFTEN_TARGET) $(TUNEBOT_OBJECTS) - $(QUIET_LINK)$(CXX) -o $(TUNEBOT_TARGET) $(TUNEBOT_OBJECTS) $(LDFLAGS) $(SWIFTEN_TARGET) $(LIBS) diff --git a/Swiften/Examples/TuneBot/TuneBot.cpp b/Swiften/Examples/TuneBot/TuneBot.cpp deleted file mode 100644 index d842798..0000000 --- a/Swiften/Examples/TuneBot/TuneBot.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include - -#include "Swiften/Client/Client.h" -#include "Swiften/EventLoop/SimpleEventLoop.h" -#include "Swiften/EventLoop/MainEventLoop.h" -#include "Swiften/Queries/Requests/GetRosterRequest.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Elements/CapsInfo.h" -#include "Swiften/Queries/Responders/DiscoInfoResponder.h" -#include "Swiften/Disco/CapsInfoGenerator.h" - -using namespace Swift; -using namespace boost; - -class TuneBot { - public: - TuneBot(const JID& jid, const String& password) { - client_ = new Client(jid, password); - router_ = new IQRouter(client_); - - DiscoInfo discoInfo; - discoInfo.addIdentity(DiscoInfo::Identity("TuneBot", "client", "bot")); - discoInfo.addFeature("http://jabber.org/protocol/tune+notify"); - capsInfo_ = boost::shared_ptr(new CapsInfo(CapsInfoGenerator("http://el-tramo.be/tunebot").generateCapsInfo(discoInfo))); - discoResponder_ = new DiscoInfoResponder(router_); - discoResponder_->setDiscoInfo(discoInfo); - discoResponder_->setDiscoInfo(capsInfo_->getNode() + "#" + capsInfo_->getVersion(), discoInfo); - - client_->onConnected.connect(bind(&TuneBot::handleSessionStarted, this)); - client_->onMessageReceived.connect(bind(&TuneBot::handleMessage, this, _1)); - client_->connect(); - } - - void handleSessionStarted() { - boost::shared_ptr rosterRequest(new GetRosterRequest(router_)); - rosterRequest->onResponse.connect(bind(&TuneBot::handleRosterReceived, this, _1)); - rosterRequest->send(); - } - - void handleRosterReceived(shared_ptr) { - boost::shared_ptr presence(new Presence()); - presence->addPayload(capsInfo_); - presence->setPriority(-1); - client_->sendPresence(presence); - } - - void handleMessage(shared_ptr message) { - // TODO - } - - private: - Client* client_; - IQRouter* router_; - DiscoInfoResponder* discoResponder_; - boost::shared_ptr capsInfo_; -}; - - -int main(int argc, char* argv[]) { - if (argc != 3) { - std::cerr << "Usage: " << argv[0] << " " << std::endl; - return -1; - } - - SimpleEventLoop eventLoop; - - TuneBot bot(JID(argv[1]), argv[2]); - eventLoop.run(); -} -- cgit v0.10.2-6-g49f6