From 4c29d43177cb49625f7c6e731c9618b175071141 Mon Sep 17 00:00:00 2001 From: Richard Maudsley Date: Wed, 16 Apr 2014 10:11:15 +0100 Subject: Fix MUC invite being treated like impromptu MUC invite. Change-Id: Iec52f9fabfdcfc3a83681a10d7e0d5f0de2b4ee2 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 @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * 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 #include @@ -18,8 +24,12 @@ 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; } std::string auto_accept_mode = settings_->getSetting(SettingConstants::INVITE_AUTO_ACCEPT_MODE); 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,12 +1,11 @@ /* - * 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. */ #include - - +#include namespace Swift { @@ -17,7 +16,8 @@ void MUCInvitationPayloadParser::handleTree(ParserElement::ref root) { invite->setPassword(root->getAttributes().getAttribute("password")); 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(impromptuNode)); } } -- cgit v0.10.2-6-g49f6