diff options
Diffstat (limited to 'Sluift/client.cpp')
| -rw-r--r-- | Sluift/client.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp index 06df6a4..1cdd8d7 100644 --- a/Sluift/client.cpp +++ b/Sluift/client.cpp @@ -441,71 +441,71 @@ SLUIFT_LUA_FUNCTION_WITH_HELP( client->getOptions().useTLS = (useTLS ? ClientOptions::UseTLSWhenAvailable : ClientOptions::NeverUseTLS); } lua_getfield(L, 2, "bosh_url"); if (!lua_isnil(L, -1)) { client->getOptions().boshURL = URL::fromString(lua_tostring(L, -1)); } lua_getfield(L, 2, "allow_plain_without_tls"); if (!lua_isnil(L, -1)) { client->getOptions().allowPLAINWithoutTLS = lua_toboolean(L, -1); } lua_pushvalue(L, 1); return 0; } SLUIFT_LUA_FUNCTION_WITH_HELP( Client, send_mam_query, "Builds and sends a MAM query.\n", "self\n" "mam_query parameters for the query\n" "jid optional jid to set in the 'to' field of the IQ stanza", "See help('MAMQuery') for details." ) { if (!lua_istable(L, 2)) { throw Lua::Exception("Missing MAMQuery"); } if (boost::shared_ptr<MAMQuery> mamQuery = boost::dynamic_pointer_cast<MAMQuery>(Sluift::globals.elementConvertor.convertFromLuaUntyped(L, 2, "mam_query"))) { IQRouter *router = getClient(L)->getClient()->getIQRouter(); JID jid; lua_getfield(L, 2, "jid"); if (!lua_isnil(L, -1)) { jid = JID(lua_tostring(L, -1)); } - router->sendIQ(IQ::createRequest(IQ::Get, jid, IDGenerator().generateID(), mamQuery)); + router->sendIQ(IQ::createRequest(IQ::Set, jid, IDGenerator().generateID(), mamQuery)); } else { throw Lua::Exception("Illegal MAMQuery"); } return 0; } static void pushEvent(lua_State* L, const SluiftClient::Event& event) { switch (event.type) { case SluiftClient::Event::MessageType: { Message::ref message = boost::dynamic_pointer_cast<Message>(event.stanza); 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())) ("message_type", boost::make_shared<Lua::Value>(MessageConvertor::convertMessageTypeToString(message->getType()))); Lua::pushValue(L, result); addPayloadsToTable(L, message->getPayloads()); Lua::registerTableToString(L, -1); break; } case SluiftClient::Event::PresenceType: { Presence::ref presence = boost::dynamic_pointer_cast<Presence>(event.stanza); Lua::Table result = boost::assign::map_list_of ("type", boost::make_shared<Lua::Value>(std::string("presence"))) ("from", boost::make_shared<Lua::Value>(presence->getFrom().toString())) ("status", boost::make_shared<Lua::Value>(presence->getStatus())) ("presence_type", boost::make_shared<Lua::Value>(PresenceConvertor::convertPresenceTypeToString(presence->getType()))); Lua::pushValue(L, result); addPayloadsToTable(L, presence->getPayloads()); Lua::registerTableToString(L, -1); break; } case SluiftClient::Event::PubSubEventType: { Sluift::globals.elementConvertor.convertToLua(L, event.pubsubEvent); |
Swift