summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-04-16 09:11:15 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-04-25 09:26:47 (GMT)
commit4c29d43177cb49625f7c6e731c9618b175071141 (patch)
treeb08f17551fd219b7ede17043162166f59fbbafbd
parentb42a5c5849813fe8db3bd3889378a53238cc36f7 (diff)
downloadswift-contrib-4c29d43177cb49625f7c6e731c9618b175071141.zip
swift-contrib-4c29d43177cb49625f7c6e731c9618b175071141.tar.bz2
Fix MUC invite being treated like impromptu MUC invite.
Change-Id: Iec52f9fabfdcfc3a83681a10d7e0d5f0de2b4ee2
-rw-r--r--Swift/Controllers/Chat/AutoAcceptMUCInviteDecider.h14
-rw-r--r--Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp8
2 files changed, 16 insertions, 6 deletions
diff --git a/Swift/Controllers/Chat/AutoAcceptMUCInviteDecider.h b/Swift/Controllers/Chat/AutoAcceptMUCInviteDecider.h
index 0f85a8a..d6e069f 100644
--- a/Swift/Controllers/Chat/AutoAcceptMUCInviteDecider.h
+++ b/Swift/Controllers/Chat/AutoAcceptMUCInviteDecider.h
@@ -5,4 +5,10 @@
*/
+/*
+ * Copyright (c) 2014 Kevin Smith and Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
#pragma once
@@ -19,6 +25,10 @@ namespace Swift {
bool isAutoAcceptedInvite(const JID& from, MUCInvitationPayload::ref invite) {
- if (!invite->getIsImpromptu() && !invite->getIsContinuation()) {
- return false;
+ if (!invite->getIsImpromptu()) {
+ return false; /* always ask the user for normal MUC invites */
+ }
+
+ if (invite->getIsContinuation()) {
+ return true;
}
diff --git a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp
index c1cf33d..90590ee 100644
--- a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp
@@ -1,4 +1,4 @@
/*
- * Copyright (c) 2011 Kevin Smith
+ * Copyright (c) 2011-2014 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
@@ -6,6 +6,5 @@
#include <Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h>
-
-
+#include <Swiften/Parser/Tree/NullParserElement.h>
namespace Swift {
@@ -18,5 +17,6 @@ void MUCInvitationPayloadParser::handleTree(ParserElement::ref root) {
invite->setReason(root->getAttributes().getAttribute("reason"));
invite->setThread(root->getAttributes().getAttribute("thread"));
- invite->setIsImpromptu(root->getChild("impromptu", "http://swift.im/impromptu") ? true : false);
+ ParserElement::ref impromptuNode = root->getChild("impromptu", "http://swift.im/impromptu");
+ invite->setIsImpromptu(!boost::dynamic_pointer_cast<NullParserElement>(impromptuNode));
}