summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Events/MessageEvent.h')
-rw-r--r--Swiften/Events/MessageEvent.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Swiften/Events/MessageEvent.h b/Swiften/Events/MessageEvent.h
new file mode 100644
index 0000000..43174a1
--- /dev/null
+++ b/Swiften/Events/MessageEvent.h
@@ -0,0 +1,33 @@
+#ifndef SWIFTEN_MessageEvent_H
+#define SWIFTEN_MessageEvent_H
+
+#include <cassert>
+
+#include <boost/signals.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "Swiften/Events/StanzaEvent.h"
+#include "Swiften/Elements/Message.h"
+
+namespace Swift {
+ class MessageEvent : public StanzaEvent {
+ public:
+ MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza){};
+ virtual ~MessageEvent(){};
+ boost::shared_ptr<Message> getStanza() {return stanza_;}
+
+ bool isReadable() {
+ return getStanza()->isError() || !getStanza()->getBody().isEmpty();
+ }
+
+ void read() {
+ assert (isReadable());
+ conclude();
+ }
+
+ private:
+ boost::shared_ptr<Message> stanza_;
+ };
+}
+
+#endif