summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-21 22:33:09 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-22 14:54:54 (GMT)
commitf5c2750f56c78d115bb9e8a7c5d50316da98b6d5 (patch)
tree661c761e7ebb526e1d71848c127046605e036729 /Swiften/Events
parent37a3ff6afe96c39bbf075d05da72e5f2c684dfa4 (diff)
downloadswift-f5c2750f56c78d115bb9e8a7c5d50316da98b6d5.zip
swift-f5c2750f56c78d115bb9e8a7c5d50316da98b6d5.tar.bz2
Lots of plumbing for event view.
This isn't ready yet, but clicking on a message in the event view will now cause the chat to pop up, and the plumbing is there for doing something with subscription requests - I just don't, yet.
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_;
+ };
+}
+