From 4656f05cc6e0db2bddb3ec1409c530f1d334e949 Mon Sep 17 00:00:00 2001 From: Thanos Doukoudakis Date: Wed, 5 Apr 2017 17:18:09 +0100 Subject: Don't pass the impromptu MUC 'reason' as the room JID Changing the constructor of the CreateImpromptuMUCUIEvent class not to accept default values to its parameters. This approach is less prone to mistakes, like forgetting an argument. This commit fixes SWIFT-271 bug, where only two arguments were being passed in the constructor. As a result the reason string was used to create a room JID, making the room unusable. By passing an empty string, the room JID created is not valid, and when ChatsManager handles the event, it will generate a new valid room JID. Test information: Unit test pass. Tested the creation of new impromptu chat with with windows 10 (qt5.7). Change-Id: I4ce9ee7db14b9125970a03f19d1ac0c32e1b5a0e diff --git a/Swift/Controllers/UIEvents/CreateImpromptuMUCUIEvent.h b/Swift/Controllers/UIEvents/CreateImpromptuMUCUIEvent.h index e420bad..ed9fd85 100644 --- a/Swift/Controllers/UIEvents/CreateImpromptuMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/CreateImpromptuMUCUIEvent.h @@ -32,7 +32,7 @@ class CreateImpromptuMUCUIEvent : public UIEvent { * is used to recreate an old impromptu chat room. * @param reason */ - CreateImpromptuMUCUIEvent(const std::vector& jids, const JID& roomJID = JID(), const std::string reason = "") : jids_(jids), roomJID_(roomJID), reason_(reason) { } + CreateImpromptuMUCUIEvent(const std::vector& jids, const JID& roomJID, const std::string reason) : jids_(jids), roomJID_(roomJID), reason_(reason) { } std::vector getJIDs() const { return jids_; } JID getRoomJID() const { return roomJID_; } diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index e770186..8d15739 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -157,7 +157,7 @@ void QtUserSearchWindow::handleAccepted() { jids.push_back(contact->jid); } - eventStream_->send(std::make_shared(jids, Q2PSTRING(firstMultiJIDPage_->reason_->text()))); + eventStream_->send(std::make_shared(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text()))); break; case Type::InviteToChat: for (Contact::ref contact : contactVector_) { -- cgit v0.10.2-6-g49f6