diff options
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/Client.cpp | 21 | ||||
-rw-r--r-- | Swiften/Client/Client.h | 23 |
2 files changed, 33 insertions, 11 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp index 45eeeff..7dbcb70 100644 --- a/Swiften/Client/Client.cpp +++ b/Swiften/Client/Client.cpp @@ -10,8 +10,10 @@ #include "Swiften/Roster/XMPPRosterImpl.h" #include "Swiften/Roster/XMPPRosterController.h" #include "Swiften/Presence/PresenceOracle.h" -#include "Swiften/Presence/PresenceSender.h" +#include "Swiften/Presence/StanzaChannelPresenceSender.h" +#include "Swiften/Presence/DirectedPresenceSender.h" #include "Swiften/MUC/MUCRegistry.h" +#include "Swiften/MUC/MUCManager.h" #include "Swiften/Client/MemoryStorages.h" #include "Swiften/VCards/VCardManager.h" #include "Swiften/VCards/VCardManager.h" @@ -19,6 +21,7 @@ #include "Swiften/Disco/CapsManager.h" #include "Swiften/Disco/EntityCapsManager.h" #include "Swiften/Client/NickResolver.h" +#include "Swiften/Presence/SubscriptionManager.h" namespace Swift { @@ -31,13 +34,16 @@ Client::Client(EventLoop* eventLoop, const JID& jid, const String& password, Sto roster = new XMPPRosterImpl(); rosterController = new XMPPRosterController(getIQRouter(), roster); + subscriptionManager = new SubscriptionManager(getStanzaChannel()); + presenceOracle = new PresenceOracle(getStanzaChannel()); presenceOracle->onPresenceChange.connect(boost::ref(onPresenceChange)); - presenceOracle->onPresenceSubscriptionRequest.connect(boost::ref(onPresenceSubscriptionRequest)); - presenceSender = new PresenceSender(getStanzaChannel()); + stanzaChannelPresenceSender = new StanzaChannelPresenceSender(getStanzaChannel()); + directedPresenceSender = new DirectedPresenceSender(stanzaChannelPresenceSender); mucRegistry = new MUCRegistry(); + mucManager = new MUCManager(getStanzaChannel(), getIQRouter(), directedPresenceSender, mucRegistry); vcardManager = new VCardManager(jid, getIQRouter(), getStorages()->getVCardStorage()); avatarManager = new AvatarManagerImpl(vcardManager, getStanzaChannel(), getStorages()->getAvatarStorage(), mucRegistry); @@ -55,11 +61,14 @@ Client::~Client() { delete avatarManager; delete vcardManager; + delete mucManager; delete mucRegistry; - delete presenceSender; + delete directedPresenceSender; + delete stanzaChannelPresenceSender; delete presenceOracle; + delete subscriptionManager; delete rosterController; delete roster; @@ -81,7 +90,6 @@ void Client::requestRoster() { rosterController->requestRoster(); } - Presence::ref Client::getLastPresence(const JID& jid) const { return presenceOracle->getLastPresence(jid); } @@ -97,5 +105,8 @@ Storages* Client::getStorages() const { return memoryStorages; } +PresenceSender* Client::getPresenceSender() const { + return directedPresenceSender; +} } diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h index 7e11df9..adfd549 100644 --- a/Swiften/Client/Client.h +++ b/Swiften/Client/Client.h @@ -12,9 +12,12 @@ namespace Swift { class SoftwareVersionResponder; class XMPPRoster; class XMPPRosterImpl; + class MUCManager; class XMPPRosterController; class PresenceOracle; class PresenceSender; + class DirectedPresenceSender; + class StanzaChannelPresenceSender; class MUCRegistry; class Storages; class MemoryStorages; @@ -23,6 +26,7 @@ namespace Swift { class CapsManager; class EntityCapsManager; class NickResolver; + class SubscriptionManager; /** * Provides the core functionality for writing XMPP client software. @@ -88,8 +92,10 @@ namespace Swift { return presenceOracle; } - PresenceSender* getPresenceSender() const { - return presenceSender; + PresenceSender* getPresenceSender() const; + + MUCManager* getMUCManager() const { + return mucManager; } MUCRegistry* getMUCRegistry() const { @@ -112,15 +118,17 @@ namespace Swift { return nickResolver; } + SubscriptionManager* getSubscriptionManager() const { + return subscriptionManager; + } + public: /** * This signal is emitted when a JID changes presence. */ boost::signal<void (Presence::ref)> onPresenceChange; - /** - * This signal is emitted when a presence subscription request is received. - */ + boost::signal<void (const JID&, const String&)> onPresenceSubscriptionRequest; private: @@ -133,12 +141,15 @@ namespace Swift { XMPPRosterImpl* roster; XMPPRosterController* rosterController; PresenceOracle* presenceOracle; - PresenceSender* presenceSender; + DirectedPresenceSender* directedPresenceSender; + StanzaChannelPresenceSender* stanzaChannelPresenceSender; MUCRegistry* mucRegistry; VCardManager* vcardManager; AvatarManager* avatarManager; CapsManager* capsManager; EntityCapsManager* entityCapsManager; NickResolver* nickResolver; + SubscriptionManager* subscriptionManager; + MUCManager* mucManager; }; } |