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 /Swiftob/LuaCommands.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 'Swiftob/LuaCommands.cpp')
-rw-r--r-- | Swiftob/LuaCommands.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Swiftob/LuaCommands.cpp b/Swiftob/LuaCommands.cpp index 1192452..18535f3 100644 --- a/Swiftob/LuaCommands.cpp +++ b/Swiftob/LuaCommands.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -380,7 +380,7 @@ int LuaCommands::get_setting(lua_State *L) { void LuaCommands::handleLuaListener(int callbackIndex, lua_State* L, Swift::Message::ref message) { lua_rawgeti(L, LUA_REGISTRYINDEX, callbackIndex); - lua_pushstring(L, message->getBody().c_str()); + lua_pushstring(L, message->getBody().get_value_or("").c_str()); lua_pushstring(L, message->getFrom().toBare().toString().c_str()); lua_pushstring(L, message->getFrom().getResource().c_str()); messageOntoStack(message, L); @@ -426,7 +426,7 @@ void LuaCommands::messageOntoStack(Swift::Message::ref message, lua_State* L) { lua_setfield(L, -2, "frombare"); lua_pushstring(L, message->getTo().toString().c_str()); lua_setfield(L, -2, "to"); - lua_pushstring(L, message->getBody().c_str()); + lua_pushstring(L, message->getBody().get_value_or("").c_str()); lua_setfield(L, -2, "body"); } |