summaryrefslogtreecommitdiffstats
blob: f3d96e135ae2f445c2011754d2e1d4ebd349639d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef SWIFTEN_RosterController_H
#define SWIFTEN_RosterController_H

#include "Swiften/JID/JID.h"
#include "Swiften/Base/String.h"
#include "Swiften/Elements/Presence.h"
#include "Swiften/Roster/UserRosterAction.h"
#include "Swiften/Avatars/AvatarManager.h"

#include <boost/signals.hpp>
#include <boost/shared_ptr.hpp>

namespace Swift {
	class IQRouter;
	class Roster;
	class XMPPRoster;
	class MainWindow;
	class MainWindowFactory;
	class TreeWidgetFactory;
	class OfflineRosterFilter;
	class NickResolver;

	class RosterController {
		public:
			RosterController(const JID& jid, boost::shared_ptr<XMPPRoster> xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, TreeWidgetFactory* treeWidgetFactory, NickResolver* nickResolver);
			~RosterController();
			void showRosterWindow();
			MainWindow* getWindow() {return mainWindow_;};
			void setAvatarManager(AvatarManager* avatarManager);
			void setNickResolver(NickResolver* nickResolver);
			boost::signal<void (const JID&)> onStartChatRequest;
			boost::signal<void (const JID&, const String&)> onJoinMUCRequest;
			boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
			boost::signal<void ()> onSignOutRequest;
			void handleIncomingPresence(boost::shared_ptr<Presence> presence);
			void handleAvatarChanged(const JID& jid, const String& hash);
			void setEnabled(bool enabled);
		private:
			void handleOnJIDAdded(const JID &jid);
			void handleOnJIDRemoved(const JID &jid);
			void handleOnJIDUpdated(const JID &jid, const String& oldName, const std::vector<String> oldGroups);
			void handleStartChatRequest(const JID& contact);
			void handleJoinMUCRequest(const JID &muc, const String &nick);
			void handleUserAction(boost::shared_ptr<UserRosterAction> action);
			void handleChangeStatusRequest(StatusShow::Type show, const String &statusText);
			void handleShowOfflineToggled(bool state);
			JID myJID_;
			boost::shared_ptr<XMPPRoster> xmppRoster_;
			MainWindowFactory* mainWindowFactory_;
			TreeWidgetFactory* treeWidgetFactory_;
			MainWindow* mainWindow_;
			Roster* roster_;
			OfflineRosterFilter* offlineFilter_;
			AvatarManager* avatarManager_;
			NickResolver* nickResolver_;
	};
}
#endif