diff options
authorThanos Doukoudakis <>2017-04-05 16:18:09 (GMT)
committerThanos Doukoudakis <>2017-04-18 09:50:15 (GMT)
commit4656f05cc6e0db2bddb3ec1409c530f1d334e949 (patch)
parent4024517891d3a222e71e6632c3609fcda08c875e (diff)
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
2 files changed, 2 insertions, 2 deletions
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<JID>& jids, const JID& roomJID = JID(), const std::string reason = "") : jids_(jids), roomJID_(roomJID), reason_(reason) { }
+ CreateImpromptuMUCUIEvent(const std::vector<JID>& jids, const JID& roomJID, const std::string reason) : jids_(jids), roomJID_(roomJID), reason_(reason) { }
std::vector<JID> 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() {
- eventStream_->send(std::make_shared<CreateImpromptuMUCUIEvent>(jids, Q2PSTRING(firstMultiJIDPage_->reason_->text())));
+ eventStream_->send(std::make_shared<CreateImpromptuMUCUIEvent>(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text())));
case Type::InviteToChat:
for (Contact::ref contact : contactVector_) {