diff options
author | Tobias Markmann <tm@ayena.de> | 2015-01-30 13:56:12 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-02-03 17:27:11 (GMT) |
commit | 53c86d070255ae1a33b7a3642bb6eb9ce42e7f70 (patch) | |
tree | f2793fbb216ffcd9b34bde3c8f6d1c419523c214 /Swift/QtUI/QtChatWindow.cpp | |
parent | 4b2c07264f6cfccf8ed577c9b68b5b237e528be0 (diff) | |
download | swift-53c86d070255ae1a33b7a3642bb6eb9ce42e7f70.zip swift-53c86d070255ae1a33b7a3642bb6eb9ce42e7f70.tar.bz2 |
Fix chat log system messages related to entering a room
In the past MUCController added a "trying to enter..." message and
later tried to replace this with "entered room as..." message. However,
any message received in between, like a system message about room topic,
came in between since MUCController replaced the *last* message added
to the log.
The new code also adds message IDs to system messages. This way the
correct message can be replaced on successful login, no matter how
many messages came in between.
Test-Information:
Tested against a MUC component that send a system message before
sending the join presence back to a user.
Change-Id: I3bcb5d78de680494965d837b2ad3edb847ff7f99
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index e80a863..55cc26d 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -69,7 +69,7 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt correctionEnabled_ = Maybe; fileTransferEnabled_ = Maybe; updateTitleWithUnreadCount(); - + assert(settings); #ifdef SWIFT_EXPERIMENTAL_FT setAcceptDrops(true); #endif @@ -522,6 +522,9 @@ int QtChatWindow::getCount() { return unreadCount_; } +void QtChatWindow::replaceSystemMessage(const ChatWindow::ChatMessage& message, const std::string& id, const ChatWindow::TimestampBehaviour timestampBehaviour) { + messageLog_->replaceSystemMessage(message, id, timestampBehaviour); +} void QtChatWindow::returnPressed() { if (!isOnline_ || (blockingState_ == IsBlocked)) { @@ -814,9 +817,9 @@ std::string QtChatWindow::addAction(const ChatMessage& message, const std::strin } -void QtChatWindow::addSystemMessage(const ChatMessage& message, Direction direction) { +std::string QtChatWindow::addSystemMessage(const ChatMessage& message, Direction direction) { handleAppendedToLog(); - messageLog_->addSystemMessage(message, direction); + return messageLog_->addSystemMessage(message, direction); } void QtChatWindow::addPresenceMessage(const ChatMessage& message, Direction direction) { |