diff options
Diffstat (limited to 'Swiften/Events')
-rw-r--r-- | Swiften/Events/Event.h | 13 | ||||
-rw-r--r-- | Swiften/Events/MessageEvent.h | 15 |
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: |