diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-03-21 22:33:09 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-03-22 14:54:54 (GMT) |
commit | f5c2750f56c78d115bb9e8a7c5d50316da98b6d5 (patch) | |
tree | 661c761e7ebb526e1d71848c127046605e036729 /Swift/Controllers/Chat | |
parent | 37a3ff6afe96c39bbf075d05da72e5f2c684dfa4 (diff) | |
download | swift-contrib-f5c2750f56c78d115bb9e8a7c5d50316da98b6d5.zip swift-contrib-f5c2750f56c78d115bb9e8a7c5d50316da98b6d5.tar.bz2 |
Lots of plumbing for event view.
This isn't ready yet, but clicking on a message in the event view will now cause the chat to pop up, and the plumbing is there for doing something with subscription requests - I just don't, yet.
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 12 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.h | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 5009588..250f02d 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -7,6 +7,7 @@ #include "Swift/Controllers/Chat/ChatController.h" #include "Swift/Controllers/EventController.h" #include "Swift/Controllers/Chat/MUCController.h" +#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h" #include "Swiften/Presence/PresenceSender.h" #include "Swiften/Elements/ChatState.h" @@ -15,7 +16,7 @@ namespace Swift { typedef std::pair<JID, ChatController*> JIDChatControllerPair; typedef std::pair<JID, MUCController*> JIDMUCControllerPair; -ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender) : jid_(jid) { +ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender, UIEventStream* uiEventStream) : jid_(jid) { eventController_ = eventController; stanzaChannel_ = stanzaChannel; iqRouter_ = iqRouter; @@ -26,7 +27,9 @@ ChatsManager::ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRo avatarManager_ = NULL; serverDiscoInfo_ = serverDiscoInfo; presenceSender_ = presenceSender; + uiEventStream_ = uiEventStream; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1, _2)); + uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); } ChatsManager::~ChatsManager() { @@ -39,6 +42,13 @@ ChatsManager::~ChatsManager() { } +void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) { + boost::shared_ptr<RequestChatUIEvent> chatEvent = boost::dynamic_pointer_cast<RequestChatUIEvent>(event); + if (chatEvent) { + handleChatRequest(chatEvent->getContact()); + } +} + /** * If a resource goes offline, release bound chatdialog to that resource. */ diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index dd80d95..04d9330 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h @@ -10,6 +10,7 @@ #include "Swiften/Elements/Presence.h" #include "Swiften/JID/JID.h" #include "Swiften/MUC/MUCRegistry.h" +#include "Swift/Controllers/UIEvents/UIEventStream.h" namespace Swift { class EventController; @@ -23,9 +24,10 @@ namespace Swift { class StanzaChannel; class IQRouter; class PresenceSender; + class ChatsManager : public MUCRegistry { public: - ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender); + ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender, UIEventStream* uiEventStream); ~ChatsManager(); void setAvatarManager(AvatarManager* avatarManager); void setEnabled(bool enabled); @@ -36,6 +38,7 @@ namespace Swift { private: void rebindControllerJID(const JID& from, const JID& to); void handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> lastPresence); + void handleUIEvent(boost::shared_ptr<UIEvent> event); ChatController* getChatController(const JID &contact); virtual bool isMUC(const JID& muc) const; @@ -51,6 +54,7 @@ namespace Swift { PresenceOracle* presenceOracle_; AvatarManager* avatarManager_; PresenceSender* presenceSender_; + UIEventStream* uiEventStream_; boost::shared_ptr<DiscoInfo> serverDiscoInfo_; }; } |