summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-06-01 08:48:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-06-01 09:24:28 (GMT)
commit2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch)
treed46294f35150c4f0f43deaf2d31fceaf945ae715 /Swiften/Events
downloadswift-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip
swift-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2
Import.
Diffstat (limited to 'Swiften/Events')
-rw-r--r--Swiften/Events/Makefile.inc0
-rw-r--r--Swiften/Events/MessageEvent.h31
2 files changed, 31 insertions, 0 deletions
diff --git a/Swiften/Events/Makefile.inc b/Swiften/Events/Makefile.inc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Swiften/Events/Makefile.inc
diff --git a/Swiften/Events/MessageEvent.h b/Swiften/Events/MessageEvent.h
new file mode 100644
index 0000000..27eecaf
--- /dev/null
+++ b/Swiften/Events/MessageEvent.h
@@ -0,0 +1,31 @@
+#ifndef SWIFTEN_MessageEvent_H
+#define SWIFTEN_MessageEvent_H
+
+#include <cassert>
+
+#include "Swiften/Elements/Message.h"
+
+#include <boost/shared_ptr.hpp>
+
+namespace Swift {
+ class MessageEvent {
+ public:
+ MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza){}
+ boost::shared_ptr<Message> getStanza() {return stanza_;}
+ boost::signal<void()> onRead;
+
+ bool isReadable() {
+ return getStanza()->isError() || !getStanza()->getBody().isEmpty();
+ }
+
+ void read() {
+ assert (isReadable());
+ onRead();
+ }
+
+ private:
+ boost::shared_ptr<Message> stanza_;
+ };
+}
+
+#endif