summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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