summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-04-26 10:33:06 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-26 10:33:06 (GMT)
commit9a34412bef9992d97d2d2094f5e42a3cc9470262 (patch)
treec808937c48561eae29a88b5c9ddb7bf14890c916 /Swift/Controllers/EventWindowController.cpp
parent4fc14f392e953ee2309312d9d8a07dc01303c838 (diff)
downloadswift-contrib-9a34412bef9992d97d2d2094f5e42a3cc9470262.zip
swift-contrib-9a34412bef9992d97d2d2094f5e42a3cc9470262.tar.bz2
Avoid duplicate subscription requests.
Resolves: #1040 Resolves: #876
Diffstat (limited to 'Swift/Controllers/EventWindowController.cpp')
-rw-r--r--Swift/Controllers/EventWindowController.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Swift/Controllers/EventWindowController.cpp b/Swift/Controllers/EventWindowController.cpp
index 47554ce..32b9c76 100644
--- a/Swift/Controllers/EventWindowController.cpp
+++ b/Swift/Controllers/EventWindowController.cpp
@@ -1,11 +1,12 @@
/*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2012 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swift/Controllers/EventWindowController.h"
+#include <Swift/Controllers/EventWindowController.h>
+#include <Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h>
#include <boost/bind.hpp>
namespace Swift {
@@ -37,7 +38,14 @@ void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaE
void EventWindowController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
window_->removeEvent(event);
- window_->addEvent(event, false);
+ bool includeAsCompleted = true;
+ /* Because subscription requests get duplicated, don't add them back */
+ if (boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event)) {
+ includeAsCompleted = false;
+ }
+ if (includeAsCompleted) {
+ window_->addEvent(event, false);
+ }
event->onConclusion.disconnect(boost::bind(&EventWindowController::handleEventConcluded, this, event));
}