summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/PresenceNotifier.h')
-rw-r--r--Swift/Controllers/PresenceNotifier.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/Swift/Controllers/PresenceNotifier.h b/Swift/Controllers/PresenceNotifier.h
new file mode 100644
index 0000000..f5bf3d4
--- /dev/null
+++ b/Swift/Controllers/PresenceNotifier.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+#include <set>
+
+#include "Swiften/Base/boost_bsignals.h"
+#include "Swiften/Elements/Presence.h"
+#include "Swiften/JID/JID.h"
+#include "SwifTools/Notifier/Notifier.h"
+#include "Swiften/Avatars/AvatarManager.h"
+#include "Swiften/Network/Timer.h"
+
+namespace Swift {
+ class TimerFactory;
+ class StanzaChannel;
+ class MUCRegistry;
+ class XMPPRoster;
+ class PresenceOracle;
+
+ class PresenceNotifier {
+ public:
+ PresenceNotifier(StanzaChannel* stanzaChannel, Notifier* notifier, const MUCRegistry* mucRegistry, AvatarManager* avatarManager, const XMPPRoster* roster, const PresenceOracle* presenceOracle, TimerFactory* timerFactory);
+ ~PresenceNotifier();
+
+ void setInitialQuietPeriodMS(int ms);
+
+ boost::signal<void (const JID&)> onNotificationActivated;
+
+ private:
+ void handlePresenceReceived(boost::shared_ptr<Presence>);
+ void handleStanzaChannelAvailableChanged(bool);
+ void handleNotificationActivated(JID jid);
+ void handleTimerTick();
+ String getStatusType(const JID&) const;
+ String getStatusMessage(const JID&) const;
+
+ private:
+ void showNotification(const JID& jid, Notifier::Type type);
+
+ private:
+ StanzaChannel* stanzaChannel;
+ Notifier* notifier;
+ const MUCRegistry* mucRegistry;
+ AvatarManager* avatarManager;
+ const XMPPRoster* roster;
+ const PresenceOracle* presenceOracle;
+ TimerFactory* timerFactory;
+ boost::shared_ptr<Timer> timer;
+ bool justInitialized;
+ bool inQuietPeriod;
+ std::set<JID> availableUsers;
+ };
+}
+