diff options
author | Joanna Hulboj <joanna.hulboj@isode.com> | 2017-03-28 09:38:23 (GMT) |
---|---|---|
committer | Joanna Hulboj <joanna.hulboj@isode.com> | 2017-04-07 13:04:59 (GMT) |
commit | 0b4c4ade26c7ff77ba7f8b4ae83e4bd3581bf345 (patch) | |
tree | 3044fef83e2a0f09af6fc8df07b1afc98a251560 /Swift/Controllers/Chat/MUCController.cpp | |
parent | ed2226782ac15345aeb8e615b41d30e5aab67b51 (diff) | |
download | swift-0b4c4ade26c7ff77ba7f8b4ae83e4bd3581bf345.zip swift-0b4c4ade26c7ff77ba7f8b4ae83e4bd3581bf345.tar.bz2 |
Do not grey out chat view after clearing
Test-Information:
Run Swift, open chat window, enter a message and send it. Right click on
chat view and choose Clear. Chat log in a view will be cleared but it
will stay white. On the top of the chat view will be a message: e.g.
Starting chat with test - test@test.isode.net: Offline.
Change-Id: Ie453602e2f2b14e3ecca699821521ad33937ccf6
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.cpp')
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index a142ee0..73cf748 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -128,6 +128,7 @@ MUCController::MUCController ( chatWindow_->onGetAffiliationsRequest.connect(boost::bind(&MUCController::handleGetAffiliationsRequest, this)); chatWindow_->onChangeAffiliationsRequest.connect(boost::bind(&MUCController::handleChangeAffiliationsRequest, this, _1)); chatWindow_->onUnblockUserRequest.connect(boost::bind(&MUCController::handleUnblockUserRequest, this)); + chatWindow_->onContinuationsBroken.connect(boost::bind(&MUCController::addChatSystemMessage, this)); muc_->onJoinComplete.connect(boost::bind(&MUCController::handleJoinComplete, this, _1)); muc_->onJoinFailed.connect(boost::bind(&MUCController::handleJoinFailed, this, _1)); muc_->onOccupantJoined.connect(boost::bind(&MUCController::handleOccupantJoined, this, _1)); @@ -381,14 +382,14 @@ void MUCController::handleJoinComplete(const std::string& nick) { receivedActivity(); renameCounter_ = 0; joined_ = true; - std::string joinMessage; if (isImpromptu_) { - joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have joined the chat as %1%.")) % nick); - } else { - joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick); + lastStartMessage_ = str(format(QT_TRANSLATE_NOOP("", "You have joined the chat as %1%.")) % nick); + } + else { + lastStartMessage_ = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick); } setNick(nick); - chatWindow_->replaceSystemMessage(chatMessageParser_->parseMessageBody(joinMessage, "", true), lastJoinMessageUID_, ChatWindow::UpdateTimestamp); + chatWindow_->replaceSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_, "", true), lastJoinMessageUID_, ChatWindow::UpdateTimestamp); lastJoinMessageUID_ = ""; #ifdef SWIFT_EXPERIMENTAL_HISTORY @@ -660,13 +661,16 @@ void MUCController::setOnline(bool online) { std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); if (blockList && blockList->isBlocked(muc_->getJID())) { handleBlockingStateChanged(); - lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "You've blocked this room. To enter the room, first unblock it using the cog menu and try again")), ChatWindow::DefaultDirection); + lastStartMessage_ = QT_TRANSLATE_NOOP("", "You've blocked this room. To enter the room, first unblock it using the cog menu and try again"); + lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_ ), ChatWindow::DefaultDirection); } else { if (isImpromptu_) { - lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "Trying to join chat")), ChatWindow::DefaultDirection); + lastStartMessage_ = QT_TRANSLATE_NOOP("", "Trying to join chat"); + lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_), ChatWindow::DefaultDirection); } else { - lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(str(format(QT_TRANSLATE_NOOP("", "Trying to enter room %1%")) % toJID_.toString())), ChatWindow::DefaultDirection); + lastStartMessage_ = str(format(QT_TRANSLATE_NOOP("", "Trying to enter room %1%")) % toJID_.toString()); + lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_), ChatWindow::DefaultDirection); } if (loginCheckTimer_) { loginCheckTimer_->start(); @@ -1239,4 +1243,8 @@ void MUCController::displaySubjectIfChanged(const std::string& subject) { } } +void MUCController::addChatSystemMessage() { + lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_), ChatWindow::DefaultDirection); +} + } |