summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-11-10 14:00:45 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-11-10 14:00:45 (GMT)
commitbe6fd0b4b580d81bfe33975c28ee7a939d6c6723 (patch)
treee16f211641a8c76c8e0eabf111dd7517a3a9920d /Swift/Controllers
parentd38f6d1111dda81ec4c5bbf0e3c95a128ff77e62 (diff)
downloadswift-be6fd0b4b580d81bfe33975c28ee7a939d6c6723.zip
swift-be6fd0b4b580d81bfe33975c28ee7a939d6c6723.tar.bz2
Don't crash on login with pending subscription events.
Change-Id: I8459b36c92703d5cfc877a6cdd92281541d8df3a
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/XMPPEvents/EventController.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp
index 9841923..d84dfe3 100644
--- a/Swift/Controllers/XMPPEvents/EventController.cpp
+++ b/Swift/Controllers/XMPPEvents/EventController.cpp
@@ -25,25 +25,26 @@ EventController::~EventController() {
event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event));
}
}
void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) {
boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent);
boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent);
boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(sourceEvent);
boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(sourceEvent);
/* If it's a duplicate subscription request, remove the previous request first */
if (subscriptionEvent) {
- foreach(boost::shared_ptr<StanzaEvent> existingEvent, events_) {
+ EventList existingEvents(events_);
+ foreach(boost::shared_ptr<StanzaEvent> existingEvent, existingEvents) {
boost::shared_ptr<SubscriptionRequestEvent> existingSubscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(existingEvent);
if (existingSubscriptionEvent) {
if (existingSubscriptionEvent->getJID() == subscriptionEvent->getJID()) {
existingEvent->conclude();
}
}
}
}
if ((messageEvent && messageEvent->isReadable()) || subscriptionEvent || errorEvent || mucInviteEvent) {
events_.push_back(sourceEvent);
sourceEvent->onConclusion.connect(boost::bind(&EventController::handleEventConcluded, this, sourceEvent));