summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-03-19 09:17:18 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-03-19 15:10:33 (GMT)
commit580d3d49ea3df7bb1c00cb1052203d17ccaa9a8e (patch)
treec823ef404a7a70c261248c41530827caab07fc52 /Swiften/Events
parent5d9a6702c244eb4ab30ce96465d9deceedfe955a (diff)
downloadswift-contrib-580d3d49ea3df7bb1c00cb1052203d17ccaa9a8e.zip
swift-contrib-580d3d49ea3df7bb1c00cb1052203d17ccaa9a8e.tar.bz2
Start of event viewer.
Creates a basic event viewer framework, and plugs it into the Swift controllers, so that messages are displayed (in a very ugly way). Still a long way to go.
Diffstat (limited to 'Swiften/Events')
-rw-r--r--Swiften/Events/Event.h13
-rw-r--r--Swiften/Events/MessageEvent.h15
2 files changed, 21 insertions, 7 deletions
diff --git a/Swiften/Events/Event.h b/Swiften/Events/Event.h
new file mode 100644
index 0000000..b4a71f6
--- /dev/null
+++ b/Swiften/Events/Event.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <boost/signals.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace Swift {
+ class Event {
+ public:
+ Event(){};
+ virtual ~Event() {};
+ boost::signal<void()> onConclusion;
+ };
+}
diff --git a/Swiften/Events/MessageEvent.h b/Swiften/Events/MessageEvent.h
index 412b199..0adfa82 100644
--- a/Swiften/Events/MessageEvent.h
+++ b/Swiften/Events/MessageEvent.h
@@ -3,17 +3,18 @@
#include <cassert>
-#include "Swiften/Elements/Message.h"
-
#include <boost/signals.hpp>
#include <boost/shared_ptr.hpp>
+#include "Swiften/Events/Event.h"
+#include "Swiften/Elements/Message.h"
+
namespace Swift {
- class MessageEvent {
- public:
- MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza){}
+ class MessageEvent : public Event {
+ public:
+ MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza){};
+ virtual ~MessageEvent(){};
boost::shared_ptr<Message> getStanza() {return stanza_;}
- boost::signal<void()> onRead;
bool isReadable() {
return getStanza()->isError() || !getStanza()->getBody().isEmpty();
@@ -21,7 +22,7 @@ namespace Swift {
void read() {
assert (isReadable());
- onRead();
+ onConclusion();
}
private: