summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Events')
-rw-r--r--Swiften/Events/MessageEvent.h4
-rw-r--r--Swiften/Events/StanzaEvent.h (renamed from Swiften/Events/Event.h)6
-rw-r--r--Swiften/Events/SubscriptionRequestEvent.h36
3 files changed, 41 insertions, 5 deletions
diff --git a/Swiften/Events/MessageEvent.h b/Swiften/Events/MessageEvent.h
index 0adfa82..1f71493 100644
--- a/Swiften/Events/MessageEvent.h
+++ b/Swiften/Events/MessageEvent.h
@@ -6,11 +6,11 @@
#include <boost/signals.hpp>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Events/Event.h"
+#include "Swiften/Events/StanzaEvent.h"
#include "Swiften/Elements/Message.h"
namespace Swift {
- class MessageEvent : public Event {
+ class MessageEvent : public StanzaEvent {
public:
MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza){};
virtual ~MessageEvent(){};
diff --git a/Swiften/Events/Event.h b/Swiften/Events/StanzaEvent.h
index b4a71f6..adef112 100644
--- a/Swiften/Events/Event.h
+++ b/Swiften/Events/StanzaEvent.h
@@ -4,10 +4,10 @@
#include <boost/shared_ptr.hpp>
namespace Swift {
- class Event {
+ class StanzaEvent {
public:
- Event(){};
- virtual ~Event() {};
+ StanzaEvent(){};
+ virtual ~StanzaEvent() {};
boost::signal<void()> onConclusion;
};
}
diff --git a/Swiften/Events/SubscriptionRequestEvent.h b/Swiften/Events/SubscriptionRequestEvent.h
new file mode 100644
index 0000000..fe41df7
--- /dev/null
+++ b/Swiften/Events/SubscriptionRequestEvent.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <cassert>
+
+#include <boost/signals.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "Swiften/Events/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();
+ onConclusion();
+ }
+
+ void decline() {
+ onDecline();
+ onConclusion();
+ }
+
+ private:
+ JID jid_;
+ String reason_;
+ };
+}
+