diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-22 07:51:50 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2016-11-30 10:29:11 (GMT) |
commit | c65a90e2a73814d09ad8c60adc4a259e90006db7 (patch) | |
tree | c6b0f90fba9aa2c64e94e35e99c9b30557d5e4ad /Swift/Controllers/Chat/ChatControllerBase.cpp | |
parent | 2039930eadd4756068a8a60c8340d9908a7136d3 (diff) | |
download | swift-c65a90e2a73814d09ad8c60adc4a259e90006db7.zip swift-c65a90e2a73814d09ad8c60adc4a259e90006db7.tar.bz2 |
Show MUC PM item-not-found error in MUC PM window
Previously, if one would send a MUC PM to a user that has
left a room the error response from the MUC would be shown
in the MUC room.
Now the error will show in the MUC PM window, if the MUC PM
full JID has a ChatController.
Test-Information:
Added unit test verifying new behaviour. Manually verified that
the error is shown in the MUC PM window instead of the MUC room
window.
Change-Id: I1b259d5eee9e22217bbe7e5c09294d2166a77895
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index b339bd0..da9064e 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -270,7 +270,13 @@ void ChatControllerBase::handleIncomingMessage(std::shared_ptr<MessageEvent> mes std::string body = optionalBody.get_value_or(""); if (message->isError()) { if (!message->getTo().getResource().empty()) { - std::string errorMessage = str(format(QT_TRANSLATE_NOOP("", "Couldn't send message: %1%")) % getErrorMessage(message->getPayload<ErrorPayload>())); + std::string errorMessage; + if (message->getPayload<Swift::ErrorPayload>()->getCondition() == ErrorPayload::ItemNotFound) { + errorMessage = QT_TRANSLATE_NOOP("", "This user could not be found in the room."); + } + else { + errorMessage = str(format(QT_TRANSLATE_NOOP("", "Couldn't send message: %1%")) % getErrorMessage(message->getPayload<ErrorPayload>())); + } chatWindow_->addErrorMessage(chatMessageParser_->parseMessageBody(errorMessage)); } } |