diff options
author | Tobias Markmann <tm@ayena.de> | 2016-08-17 09:02:24 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2017-04-18 15:38:43 (GMT) |
commit | 57a611f942f2387e497334888a4bc4f68b9275c9 (patch) | |
tree | 4785288a4aca2ac31f1de50c71a1d782b7d5ae6a /Swift/Controllers/UnitTest | |
parent | 476e2b32106449dc52a0b237caeb0492fe6c9c32 (diff) | |
download | swift-57a611f942f2387e497334888a4bc4f68b9275c9.zip swift-57a611f942f2387e497334888a4bc4f68b9275c9.tar.bz2 |
Support Last Message Correction in multi client scenarios
Previously Last Message Correction edits are only applied if
they came from the same resource. This makes sense in MUC
scenarios but does not in 1-to-1 chats.
This changes the Last Message Correction behaviour for
MUC and 1-to-1 chats so that different clients from the same
bare JID can edit each others messages.
Test-Information:
Added unit test to verify Last Message Corrections work
as expected when coming from the same client and from
different clients.
Manually verified that the receiving client correctly shows
a corrected message if the sending client reconnected between
first message and edit.
All unit tests pass on OS X 10.11.6 with Qt 5.5.1.
Change-Id: If533ecc7032e59e324979c577726f2da739012e6
Diffstat (limited to 'Swift/Controllers/UnitTest')
-rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index 84c86fc..7682781 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -43,10 +43,14 @@ namespace Swift { virtual void addErrorMessage(const ChatMessage& message) { lastAddedErrorMessage_ = message; } - virtual void replaceMessage(const ChatMessage& /*message*/, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/) {} + + virtual void replaceMessage(const ChatMessage& message, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/) { + lastReplacedMessage_ = message; + } + virtual void replaceWithAction(const ChatMessage& /*message*/, const std::string& /*id*/, const boost::posix_time::ptime& /*time*/) {} virtual void replaceLastMessage(const ChatMessage& message, const TimestampBehaviour /*timestampBehaviour*/) { - lastReplacedMessage_ = message; + lastReplacedLastMessage_ = message; } virtual void replaceSystemMessage(const ChatMessage& message, const std::string& /*id*/, const TimestampBehaviour /*timestampBehaviour*/) { lastReplacedSystemMessage_ = message; @@ -124,7 +128,7 @@ namespace Swift { } void resetLastMessages() { - lastAddedMessage_ = lastAddedAction_ = lastAddedPresence_ = lastReplacedMessage_ = lastAddedSystemMessage_ = lastReplacedSystemMessage_ = ChatMessage(); + lastAddedMessage_ = lastAddedAction_ = lastAddedPresence_ = lastReplacedLastMessage_ = lastAddedSystemMessage_ = lastReplacedSystemMessage_ = ChatMessage(); lastAddedMessageSenderName_ = lastAddedActionSenderName_ = ""; lastAddedMessageSenderIsSelf_ = lastAddedActionSenderIsSelf_ = false; } @@ -138,6 +142,7 @@ namespace Swift { bool lastAddedActionSenderIsSelf_ = false; ChatMessage lastAddedPresence_; ChatMessage lastReplacedMessage_; + ChatMessage lastReplacedLastMessage_; ChatMessage lastAddedSystemMessage_; ChatMessage lastReplacedSystemMessage_; ChatMessage lastAddedErrorMessage_; |