diff options
author | Roger Planas <roger.planas@isode.com> | 2013-12-20 11:36:04 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-12-27 20:00:09 (GMT) |
commit | 8068f4a7a49f723809778e9194166046a3e5cb38 (patch) | |
tree | 1e0f73712ff93f523c1beb75eecfd403ee90408f /Sluift | |
parent | 2cb6df163319cdef371607ad527558e09d707129 (diff) | |
download | swift-8068f4a7a49f723809778e9194166046a3e5cb38.zip swift-8068f4a7a49f723809778e9194166046a3e5cb38.tar.bz2 |
Sluift: Add message_type to message event
Change-Id: I156b4cbec401918377af5fd8f21c9845f665b4cb
Diffstat (limited to 'Sluift')
-rw-r--r-- | Sluift/client.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp index cd675fa..97f9106 100644 --- a/Sluift/client.cpp +++ b/Sluift/client.cpp @@ -364,6 +364,20 @@ static std::string convertPresenceTypeToString(Presence::Type type) { return result; } +static std::string convertMessageTypeToString(Message::Type type) { + std::string result; + + switch (type) { + case Message::Normal: result = "normal"; break; + case Message::Chat: result = "chat"; break; + case Message::Error: result = "error"; break; + case Message::Groupchat: result = "groupchat"; break; + case Message::Headline: result = "headline"; break; + } + + return result; +} + static void pushEvent(lua_State* L, const SluiftClient::Event& event) { switch (event.type) { case SluiftClient::Event::MessageType: { @@ -371,7 +385,8 @@ static void pushEvent(lua_State* L, const SluiftClient::Event& event) { Lua::Table result = boost::assign::map_list_of ("type", boost::make_shared<Lua::Value>(std::string("message"))) ("from", boost::make_shared<Lua::Value>(message->getFrom().toString())) - ("body", boost::make_shared<Lua::Value>(message->getBody())); + ("body", boost::make_shared<Lua::Value>(message->getBody())) + ("message_type", boost::make_shared<Lua::Value>(convertMessageTypeToString(message->getType()))); Lua::pushValue(L, result); Lua::registerTableToString(L, -1); break; |