diff options
Diffstat (limited to 'Sluift/client.cpp')
-rw-r--r-- | Sluift/client.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp index 79d988a..f1fc2c7 100644 --- a/Sluift/client.cpp +++ b/Sluift/client.cpp @@ -598,12 +598,14 @@ SLUIFT_LUA_FUNCTION_WITH_HELP( "jid The JID of the contact to add\n" "name The name to use in the contact list\n" "groups An array of group names to add the contact to\n") { Sluift::globals.eventLoop.runOnce(); SluiftClient* client = getClient(L); RosterItemPayload item; + int timeout = getGlobalTimeout(L); + if (lua_type(L, 2) == LUA_TTABLE) { lua_getfield(L, 2, "jid"); const char* rawJID = lua_tostring(L, -1); if (rawJID) { item.setJID(std::string(rawJID)); } @@ -636,13 +638,13 @@ SLUIFT_LUA_FUNCTION_WITH_HELP( client->getRoster(); if (!client->getClient()->getRoster()->containsJID(item.getJID())) { RosterPayload::ref roster = boost::make_shared<RosterPayload>(); roster->addItem(item); Sluift::Response response = client->sendVoidRequest( - SetRosterRequest::create(roster, client->getClient()->getIQRouter()), -1); + SetRosterRequest::create(roster, client->getClient()->getIQRouter()), timeout); if (response.error) { return response.convertToLuaResult(L); } } client->getClient()->getSubscriptionManager()->requestSubscription(item.getJID()); lua_pushboolean(L, true); @@ -656,18 +658,19 @@ SLUIFT_LUA_FUNCTION_WITH_HELP( "jid the JID of the contact to remove\n", "" ) { Sluift::globals.eventLoop.runOnce(); SluiftClient* client = getClient(L); JID jid(Lua::checkString(L, 2)); + int timeout = getGlobalTimeout(L); RosterPayload::ref roster = boost::make_shared<RosterPayload>(); roster->addItem(RosterItemPayload(JID(Lua::checkString(L, 2)), "", RosterItemPayload::Remove)); return client->sendVoidRequest( - SetRosterRequest::create(roster, client->getClient()->getIQRouter()), -1).convertToLuaResult(L); + SetRosterRequest::create(roster, client->getClient()->getIQRouter()), timeout).convertToLuaResult(L); } SLUIFT_LUA_FUNCTION_WITH_HELP( Client, confirm_subscription, "Confirm subscription of a contact.", "self\n" |