summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-11-28 21:44:26 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-12-24 13:43:44 (GMT)
commitf08d7dc30a1242ea5a148377c5593188a8fb1317 (patch)
treef55fd5175d21c804528c5f531c08880621274e71 /Swift/Controllers/ChatsManager.h
parent39209e6b419af417d3db011d7fd29433e88c8b3a (diff)
downloadswift-f08d7dc30a1242ea5a148377c5593188a8fb1317.zip
swift-f08d7dc30a1242ea5a148377c5593188a8fb1317.tar.bz2
Extract the Chat dialog management from MainController into ChatsManager.
There is a single unit test so far - but that's more than was there before, so I'm pushing. Expect more unit tests shortly. Resolves: #139
Diffstat (limited to 'Swift/Controllers/ChatsManager.h')
-rw-r--r--Swift/Controllers/ChatsManager.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/Swift/Controllers/ChatsManager.h b/Swift/Controllers/ChatsManager.h
new file mode 100644
index 0000000..e897e59
--- /dev/null
+++ b/Swift/Controllers/ChatsManager.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <map>
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swiften/Base/String.h"
+#include "Swiften/Elements/DiscoInfo.h"
+#include "Swiften/Elements/Message.h"
+#include "Swiften/JID/JID.h"
+#include "Swiften/MUC/MUCRegistry.h"
+
+namespace Swift {
+ class EventController;
+ class ChatController;
+ class MUCController;
+ class ChatWindowFactory;
+ class TreeWidgetFactory;
+ class NickResolver;
+ class PresenceOracle;
+ class AvatarManager;
+ 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();
+ void setAvatarManager(AvatarManager* avatarManager);
+ void setEnabled(bool enabled);
+ void setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info);
+ void handleIncomingMessage(boost::shared_ptr<Message> message);
+ void handleChatRequest(const String& contact);
+ void handleJoinMUCRequest(const JID& muc, const String& nick);
+ private:
+ void handleChatControllerJIDChanged(const JID& from, const JID& to);
+ ChatController* getChatController(const JID &contact);
+ virtual bool isMUC(const JID& muc) const;
+
+ std::map<JID, MUCController*> mucControllers_;
+ std::map<JID, ChatController*> chatControllers_;
+ EventController* eventController_;
+ JID jid_;
+ StanzaChannel* stanzaChannel_;
+ IQRouter* iqRouter_;;
+ ChatWindowFactory* chatWindowFactory_;
+ TreeWidgetFactory* treeWidgetFactory_;
+ NickResolver* nickResolver_;
+ PresenceOracle* presenceOracle_;
+ AvatarManager* avatarManager_;
+ PresenceSender* presenceSender_;
+ boost::shared_ptr<DiscoInfo> serverDiscoInfo_;
+ };
+}