summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-15 21:10:25 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-15 21:17:47 (GMT)
commit127b96597bcb1b5d5a823222f3dd28f4b7aa354a (patch)
tree1e87148e7d45fcd46e3fee3904eeb9046a834d83 /Swift/Controllers
parente215caa4811f4c80c9f6767c523e649d5058cc61 (diff)
downloadswift-contrib-127b96597bcb1b5d5a823222f3dd28f4b7aa354a.zip
swift-contrib-127b96597bcb1b5d5a823222f3dd28f4b7aa354a.tar.bz2
Moved events from Swiften to Swift.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp2
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp2
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.h2
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp2
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp2
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp2
-rw-r--r--Swift/Controllers/EventNotifier.cpp8
-rw-r--r--Swift/Controllers/EventNotifier.h2
-rw-r--r--Swift/Controllers/EventWindowController.h2
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/MainController.h2
-rw-r--r--Swift/Controllers/RosterController.cpp6
-rw-r--r--Swift/Controllers/SConscript2
-rw-r--r--Swift/Controllers/SoundEventController.cpp2
-rw-r--r--Swift/Controllers/SoundEventController.h2
-rw-r--r--Swift/Controllers/SystemTrayController.cpp2
-rw-r--r--Swift/Controllers/UIInterfaces/EventWindow.h2
-rw-r--r--Swift/Controllers/UnitTest/RosterControllerTest.cpp2
-rw-r--r--Swift/Controllers/XMPPEvents/ErrorEvent.h31
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp (renamed from Swift/Controllers/EventController.cpp)8
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.h (renamed from Swift/Controllers/EventController.h)4
-rw-r--r--Swift/Controllers/XMPPEvents/MessageEvent.h39
-rw-r--r--Swift/Controllers/XMPPEvents/StanzaEvent.h28
-rw-r--r--Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h46
24 files changed, 173 insertions, 29 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index c4bd788..dc15242 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -16,7 +16,7 @@
#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swift/Controllers/NickResolver.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
namespace Swift {
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index ffaf3af..177cdf0 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -15,7 +15,7 @@
#include "Swiften/Client/StanzaChannel.h"
#include "Swiften/Elements/Delay.h"
#include "Swiften/Base/foreach.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h"
diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h
index d537d84..4bad1db 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.h
+++ b/Swift/Controllers/Chat/ChatControllerBase.h
@@ -20,7 +20,7 @@
#include "Swiften/Elements/Stanza.h"
#include "Swiften/Base/String.h"
#include "Swiften/Elements/DiscoInfo.h"
-#include "Swiften/Events/MessageEvent.h"
+#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
#include "Swiften/JID/JID.h"
#include "Swiften/Elements/SecurityLabelsCatalog.h"
#include "Swiften/Elements/ErrorPayload.h"
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 933d3cb..bd4fcb8 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -9,7 +9,7 @@
#include <boost/bind.hpp>
#include "Swift/Controllers/Chat/ChatController.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/Chat/MUCController.h"
#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h"
#include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h"
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 533c9ed..5b98fcd 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -13,7 +13,7 @@
#include "Swiften/Base/foreach.h"
#include "SwifTools/TabComplete.h"
#include "Swiften/Base/foreach.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/UIInterfaces/ChatWindow.h"
#include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h"
#include "Swift/Controllers/UIEvents/UIEventStream.h"
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index bd49cd4..a17575c 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -15,7 +15,7 @@
#include "Swift/Controllers/UIInterfaces/ChatListWindowFactory.h"
#include "Swiften/Client/Client.h"
#include "Swift/Controllers/Chat/ChatController.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/Chat/MUCController.h"
#include "Swiften/Presence/PresenceSender.h"
#include "Swiften/Avatars/NullAvatarManager.h"
diff --git a/Swift/Controllers/EventNotifier.cpp b/Swift/Controllers/EventNotifier.cpp
index 09ad1da..7a293b6 100644
--- a/Swift/Controllers/EventNotifier.cpp
+++ b/Swift/Controllers/EventNotifier.cpp
@@ -8,14 +8,14 @@
#include <boost/bind.hpp>
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "SwifTools/Notifier/Notifier.h"
#include "Swiften/Avatars/AvatarManager.h"
#include "Swift/Controllers/NickResolver.h"
#include "Swiften/JID/JID.h"
-#include "Swiften/Events/MessageEvent.h"
-#include "Swiften/Events/SubscriptionRequestEvent.h"
-#include "Swiften/Events/ErrorEvent.h"
+#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
+#include "Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h"
+#include "Swift/Controllers/XMPPEvents/ErrorEvent.h"
namespace Swift {
diff --git a/Swift/Controllers/EventNotifier.h b/Swift/Controllers/EventNotifier.h
index 49c2c6c..8b4dc23 100644
--- a/Swift/Controllers/EventNotifier.h
+++ b/Swift/Controllers/EventNotifier.h
@@ -10,7 +10,7 @@
#include "SwifTools/Notifier/Notifier.h"
#include "Swiften/Base/boost_bsignals.h"
-#include "Swiften/Events/StanzaEvent.h"
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
#include "Swiften/JID/JID.h"
namespace Swift {
diff --git a/Swift/Controllers/EventWindowController.h b/Swift/Controllers/EventWindowController.h
index 0710da5..28b9bf6 100644
--- a/Swift/Controllers/EventWindowController.h
+++ b/Swift/Controllers/EventWindowController.h
@@ -8,7 +8,7 @@
#include "Swift/Controllers/UIInterfaces/EventWindowFactory.h"
#include "Swift/Controllers/UIInterfaces/EventWindow.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
namespace Swift {
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index aab7cff..3cfa2a7 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -21,7 +21,7 @@
#include "Swiften/VCards/VCardStorage.h"
#include "Swift/Controllers/Chat/MUCSearchController.h"
#include "Swift/Controllers/Chat/ChatsManager.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/EventWindowController.h"
#include "Swift/Controllers/UIInterfaces/LoginWindow.h"
#include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h"
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 63a6063..c0885b6 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -24,7 +24,7 @@
#include "Swiften/Settings/SettingsProvider.h"
#include "Swift/Controllers/ProfileSettingsProvider.h"
#include "Swiften/Elements/CapsInfo.h"
-#include "Swiften/Events/ErrorEvent.h"
+#include "Swift/Controllers/XMPPEvents/ErrorEvent.h"
#include "Swiften/Roster/XMPPRoster.h"
namespace Swift {
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index da10e5b..c8f94f1 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -14,11 +14,11 @@
#include "Swift/Controllers/NickResolver.h"
#include "Swiften/Queries/Requests/GetRosterRequest.h"
#include "Swiften/Queries/Requests/SetRosterRequest.h"
-#include "Swiften/Events/SubscriptionRequestEvent.h"
-#include "Swiften/Events/ErrorEvent.h"
+#include "Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h"
+#include "Swift/Controllers/XMPPEvents/ErrorEvent.h"
#include "Swiften/Presence/PresenceOracle.h"
#include "Swiften/Presence/PresenceSender.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swiften/Queries/IQRouter.h"
#include "Swiften/Roster/Roster.h"
#include "Swiften/Roster/SetPresence.h"
diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript
index 1a850b1..d37b370 100644
--- a/Swift/Controllers/SConscript
+++ b/Swift/Controllers/SConscript
@@ -29,7 +29,6 @@ if env["SCONS_STAGE"] == "build" :
"MainController.cpp",
"NickResolver.cpp",
"RosterController.cpp",
- "EventController.cpp",
"EventWindowController.cpp",
"SoundEventController.cpp",
"SystemTrayController.cpp",
@@ -37,6 +36,7 @@ if env["SCONS_STAGE"] == "build" :
"StatusTracker.cpp",
"PresenceNotifier.cpp",
"EventNotifier.cpp",
+ "XMPPEvents/EventController.cpp",
"UIEvents/UIEvent.cpp",
"UIInterfaces/XMLConsoleWidget.cpp",
"UIInterfaces/ChatListWindow.cpp",
diff --git a/Swift/Controllers/SoundEventController.cpp b/Swift/Controllers/SoundEventController.cpp
index 3d6a80a..0351445 100644
--- a/Swift/Controllers/SoundEventController.cpp
+++ b/Swift/Controllers/SoundEventController.cpp
@@ -8,7 +8,7 @@
#include <boost/bind.hpp>
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/SoundPlayer.h"
#include "Swift/Controllers/UIEvents/UIEventStream.h"
#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
diff --git a/Swift/Controllers/SoundEventController.h b/Swift/Controllers/SoundEventController.h
index c9e0da7..556a811 100644
--- a/Swift/Controllers/SoundEventController.h
+++ b/Swift/Controllers/SoundEventController.h
@@ -8,7 +8,7 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Events/StanzaEvent.h"
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
#include "Swiften/Settings/SettingsProvider.h"
#include "Swift/Controllers/UIEvents/UIEvent.h"
diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp
index 758bdd8..23a94fa 100644
--- a/Swift/Controllers/SystemTrayController.cpp
+++ b/Swift/Controllers/SystemTrayController.cpp
@@ -8,7 +8,7 @@
#include <boost/bind.hpp>
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swift/Controllers/SystemTray.h"
namespace Swift {
diff --git a/Swift/Controllers/UIInterfaces/EventWindow.h b/Swift/Controllers/UIInterfaces/EventWindow.h
index d174d8d..0999e0e 100644
--- a/Swift/Controllers/UIInterfaces/EventWindow.h
+++ b/Swift/Controllers/UIInterfaces/EventWindow.h
@@ -7,7 +7,7 @@
#pragma once
#include "boost/shared_ptr.hpp"
-#include "Swiften/Events/StanzaEvent.h"
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
namespace Swift {
class EventWindow {
diff --git a/Swift/Controllers/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
index 174b682..de46588 100644
--- a/Swift/Controllers/UnitTest/RosterControllerTest.cpp
+++ b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
@@ -21,7 +21,7 @@
#include "Swiften/Roster/GroupRosterItem.h"
#include "Swiften/Roster/ContactRosterItem.h"
#include "Swiften/Avatars/NullAvatarManager.h"
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include "Swiften/Presence/PresenceOracle.h"
#include "Swiften/Presence/PresenceSender.h"
#include "Swift/Controllers/NickResolver.h"
diff --git a/Swift/Controllers/XMPPEvents/ErrorEvent.h b/Swift/Controllers/XMPPEvents/ErrorEvent.h
new file mode 100644
index 0000000..3f78109
--- /dev/null
+++ b/Swift/Controllers/XMPPEvents/ErrorEvent.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <cassert>
+
+#include "Swiften/Base/boost_bsignals.h"
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
+#include "Swiften/Base/String.h"
+#include "Swiften/JID/JID.h"
+
+namespace Swift {
+ class ErrorEvent : public StanzaEvent {
+ public:
+ ErrorEvent(const JID& jid, const String& text) : jid_(jid), text_(text){};
+ virtual ~ErrorEvent(){};
+ const JID& getJID() const {return jid_;};
+ const String& getText() const {return text_;};
+
+ private:
+ JID jid_;
+ String text_;
+ };
+}
+
diff --git a/Swift/Controllers/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index bf24ff0..b14ff46 100644
--- a/Swift/Controllers/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swift/Controllers/EventController.h"
+#include "Swift/Controllers/XMPPEvents/EventController.h"
#include <boost/bind.hpp>
#include <algorithm>
-#include "Swiften/Events/MessageEvent.h"
-#include "Swiften/Events/ErrorEvent.h"
-#include "Swiften/Events/SubscriptionRequestEvent.h"
+#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
+#include "Swift/Controllers/XMPPEvents/ErrorEvent.h"
+#include "Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h"
namespace Swift {
diff --git a/Swift/Controllers/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h
index f96f4d8..b405556 100644
--- a/Swift/Controllers/EventController.h
+++ b/Swift/Controllers/XMPPEvents/EventController.h
@@ -12,8 +12,8 @@
#include <boost/shared_ptr.hpp>
#include <vector>
-#include "Swiften/Events/StanzaEvent.h"
-#include "Swiften/Events/MessageEvent.h"
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
+#include "Swift/Controllers/XMPPEvents/MessageEvent.h"
namespace Swift {
class EventController {
diff --git a/Swift/Controllers/XMPPEvents/MessageEvent.h b/Swift/Controllers/XMPPEvents/MessageEvent.h
new file mode 100644
index 0000000..313ad78
--- /dev/null
+++ b/Swift/Controllers/XMPPEvents/MessageEvent.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#ifndef SWIFTEN_MessageEvent_H
+#define SWIFTEN_MessageEvent_H
+
+#include <cassert>
+
+#include "Swiften/Base/boost_bsignals.h"
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
+#include "Swiften/Elements/Message.h"
+
+namespace Swift {
+ class MessageEvent : public StanzaEvent {
+ public:
+ MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza){};
+
+ boost::shared_ptr<Message> getStanza() {return stanza_;}
+
+ bool isReadable() {
+ return getStanza()->isError() || !getStanza()->getBody().isEmpty();
+ }
+
+ void read() {
+ assert (isReadable());
+ conclude();
+ }
+
+ private:
+ boost::shared_ptr<Message> stanza_;
+ };
+}
+
+#endif
diff --git a/Swift/Controllers/XMPPEvents/StanzaEvent.h b/Swift/Controllers/XMPPEvents/StanzaEvent.h
new file mode 100644
index 0000000..78dd4dc
--- /dev/null
+++ b/Swift/Controllers/XMPPEvents/StanzaEvent.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include "Swiften/Base/boost_bsignals.h"
+
+namespace Swift {
+ class StanzaEvent {
+ public:
+ StanzaEvent() : time_(boost::posix_time::microsec_clock::universal_time()) {concluded_ = false;};
+ virtual ~StanzaEvent() {};
+ void conclude() {concluded_ = true; onConclusion();};
+ /** Do not call this directly from outside the class */
+ boost::signal<void()> onConclusion;
+ bool getConcluded() {return concluded_;};
+ boost::posix_time::ptime getTime() {return time_;}
+ private:
+ bool concluded_;
+ boost::posix_time::ptime time_;
+ };
+}
diff --git a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h
new file mode 100644
index 0000000..704a86c
--- /dev/null
+++ b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <cassert>
+
+#include "Swiften/Base/boost_bsignals.h"
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
+#include "Swiften/Base/String.h"
+#include "Swiften/JID/JID.h"
+
+namespace Swift {
+ class SubscriptionRequestEvent : public StanzaEvent {
+ public:
+ SubscriptionRequestEvent(const JID& jid, const String& reason) : jid_(jid), reason_(reason){};
+ virtual ~SubscriptionRequestEvent(){};
+ const JID& getJID() const {return jid_;};
+ const String& getReason() const {return reason_;};
+ boost::signal<void()> onAccept;
+ boost::signal<void()> onDecline;
+ void accept() {
+ onAccept();
+ conclude();
+ };
+
+ void decline() {
+ onDecline();
+ conclude();
+ };
+
+ void defer() {
+ conclude();
+ }
+
+ private:
+ JID jid_;
+ String reason_;
+ };
+}
+