diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-24 12:51:45 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-24 15:56:44 (GMT) |
commit | 8234b6357de00f8355bef5af4b316329d4297033 (patch) | |
tree | f63398ecf29c5117df52e65b0f0cd292e7efd313 | |
parent | 50355ba2db929486e279ccca2e6231ecf188d881 (diff) | |
download | swift-8234b6357de00f8355bef5af4b316329d4297033.zip swift-8234b6357de00f8355bef5af4b316329d4297033.tar.bz2 |
Moved PresenceSender to client.
-rw-r--r-- | Swift/Controllers/MainController.cpp | 10 | ||||
-rw-r--r-- | Swiften/Client/Client.cpp | 6 | ||||
-rw-r--r-- | Swiften/Client/Client.h | 6 |
3 files changed, 14 insertions, 8 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index f6fe40c..111a070 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -101,7 +101,6 @@ MainController::MainController( statusTracker_ = NULL; client_ = NULL; - presenceSender_ = NULL; mucRegistry_ = NULL; vcardManager_ = NULL; avatarManager_ = NULL; @@ -219,8 +218,6 @@ void MainController::resetClient() { vcardManager_ = NULL; delete mucRegistry_; mucRegistry_ = NULL; - delete presenceSender_; - presenceSender_ = NULL; delete client_; client_ = NULL; delete statusTracker_; @@ -262,11 +259,11 @@ void MainController::handleConnected() { bool freshLogin = rosterController_ == NULL; myStatusLooksOnline_ = true; if (freshLogin) { - rosterController_ = new RosterController(jid_, client_->getRoster(), avatarManager_, mainWindowFactory_, nickResolver_, client_->getPresenceOracle(), presenceSender_, eventController_, uiEventStream_, client_->getIQRouter(), settings_); + rosterController_ = new RosterController(jid_, client_->getRoster(), avatarManager_, mainWindowFactory_, nickResolver_, client_->getPresenceOracle(), client_->getPresenceSender(), eventController_, uiEventStream_, client_->getIQRouter(), settings_); rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2)); rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this)); - chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, chatWindowFactory_, nickResolver_, client_->getPresenceOracle(), presenceSender_, uiEventStream_, chatListWindowFactory_, useDelayForLatency_, &timerFactory_, mucRegistry_, entityCapsManager_); + chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, chatWindowFactory_, nickResolver_, client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, chatListWindowFactory_, useDelayForLatency_, &timerFactory_, mucRegistry_, entityCapsManager_); client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1)); chatsManager_->setAvatarManager(avatarManager_); @@ -349,7 +346,7 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) { presence->updatePayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate(vCardPhotoHash_))); } presence->updatePayload(capsInfo_); - presenceSender_->sendPresence(presence); + client_->getPresenceSender()->sendPresence(presence); if (presence->getType() == Presence::Unavailable) { logout(); } @@ -404,7 +401,6 @@ void MainController::performLoginFromCachedCredentials() { client_->setSoftwareVersion(CLIENT_NAME, buildVersion); - presenceSender_ = new PresenceSender(client_->getStanzaChannel()); mucRegistry_ = new MUCRegistry(); vcardManager_ = new VCardManager(jid_, client_->getIQRouter(), getVCardStorageForProfile(jid_)); vcardManager_->onVCardChanged.connect(boost::bind(&MainController::handleVCardReceived, this, _1, _2)); diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp index f1ca207..1b07b65 100644 --- a/Swiften/Client/Client.cpp +++ b/Swiften/Client/Client.cpp @@ -10,6 +10,7 @@ #include "Swiften/Roster/XMPPRosterImpl.h" #include "Swiften/Roster/XMPPRosterController.h" #include "Swiften/Presence/PresenceOracle.h" +#include "Swiften/Presence/PresenceSender.h" namespace Swift { @@ -23,11 +24,14 @@ Client::Client(const JID& jid, const String& password) : CoreClient(jid, passwor presenceOracle = new PresenceOracle(getStanzaChannel()); presenceOracle->onPresenceChange.connect(boost::ref(onPresenceChange)); presenceOracle->onPresenceSubscriptionRequest.connect(boost::ref(onPresenceSubscriptionRequest)); + + presenceSender = new PresenceSender(getStanzaChannel()); } Client::~Client() { - delete presenceOracle; + delete presenceSender; + delete presenceOracle; delete rosterController; delete roster; diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h index 4de630c..590e040 100644 --- a/Swiften/Client/Client.h +++ b/Swiften/Client/Client.h @@ -14,6 +14,7 @@ namespace Swift { class XMPPRosterImpl; class XMPPRosterController; class PresenceOracle; + class PresenceSender; /** * Provides the core functionality for writing XMPP client software. @@ -70,6 +71,10 @@ namespace Swift { return presenceOracle; } + PresenceSender* getPresenceSender() const { + return presenceSender; + } + public: /** * This signal is emitted when a JID changes presence. @@ -86,5 +91,6 @@ namespace Swift { XMPPRosterImpl* roster; XMPPRosterController* rosterController; PresenceOracle* presenceOracle; + PresenceSender* presenceSender; }; } |