summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/EventController.cpp')
-rw-r--r--Swift/Controllers/EventController.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Swift/Controllers/EventController.cpp b/Swift/Controllers/EventController.cpp
index 3849aa7..71ccaeb 100644
--- a/Swift/Controllers/EventController.cpp
+++ b/Swift/Controllers/EventController.cpp
@@ -3,23 +3,26 @@
#include <boost/bind.hpp>
#include <algorithm>
+#include "Swiften/Events/MessageEvent.h"
+#include "Swiften/Events/SubscriptionRequestEvent.h"
namespace Swift {
EventController::EventController() {
}
-void EventController::handleIncomingEvent(boost::shared_ptr<Event> sourceEvent) {
+void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) {
boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent);
- if (messageEvent && messageEvent->isReadable()) {
+ boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
+ if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent) {
events_.push_back(sourceEvent);
- messageEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, messageEvent));
+ sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));
onEventQueueLengthChange(events_.size());
onEventQueueEventAdded(sourceEvent);
}
}
-void EventController::handleEventConcluded(boost::shared_ptr<Event> event) {
+void EventController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end());
onEventQueueLengthChange(events_.size());
}