diff options
author | Tobias Markmann <tm@ayena.de> | 2016-01-12 17:23:05 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2016-02-02 11:33:06 (GMT) |
commit | 1b9ccc1fef6104eaf951153ddccdc6bb15899e9a (patch) | |
tree | 428232448e9846265605820db6f380a5b98c018a /Swift/Controllers/Chat/ChatControllerBase.cpp | |
parent | 3afd061b713ce5fff604dee62dec8410a1de6a9c (diff) | |
download | swift-1b9ccc1fef6104eaf951153ddccdc6bb15899e9a.zip swift-1b9ccc1fef6104eaf951153ddccdc6bb15899e9a.tar.bz2 |
Change stanza body to boost::optional<std::string> type
Changed MUCController to only handle message stanzas as
subject change if <subject/> is present and neither <body/>
nor <thread/> is present in the message stanza.
Test-Information:
Added unit tests verifying behavior described in XEP-0045
section 8.1.
Unit tests pass on OS X 10.11.2.
Change-Id: I1d22272da1675176be131ab360b214a98f20533f
Diffstat (limited to 'Swift/Controllers/Chat/ChatControllerBase.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 4a84a6e..fef3e7a 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -172,8 +172,8 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool } message->setID(lastSentMessageStanzaID_ = idGenerator_.generateID()); stanzaChannel_->sendMessage(message); - postSendMessage(message->getBody(), boost::dynamic_pointer_cast<Stanza>(message)); - onActivity(message->getBody()); + postSendMessage(message->getBody().get(), boost::dynamic_pointer_cast<Stanza>(message)); + onActivity(message->getBody().get()); #ifdef SWIFT_EXPERIMENTAL_HISTORY logMessage(body, selfJID_, toJID_, now, false); @@ -237,7 +237,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m } } boost::shared_ptr<Message> message = messageEvent->getStanza(); - std::string body = message->getBody(); + std::string body = message->getBody().get_value_or(""); HighlightAction highlight; if (message->isError()) { if (!message->getTo().getResource().empty()) { @@ -286,7 +286,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m boost::shared_ptr<Replace> replace = message->getPayload<Replace>(); if (replace) { - std::string body = message->getBody(); + std::string body = message->getBody().get_value_or(""); // Should check if the user has a previous message std::map<JID, std::string>::iterator lastMessage; lastMessage = lastMessagesUIID_.find(from); |