summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Sluift/component.cpp')
-rw-r--r--Sluift/component.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/Sluift/component.cpp b/Sluift/component.cpp
index 5fa80ac..e92352e 100644
--- a/Sluift/component.cpp
+++ b/Sluift/component.cpp
@@ -1,47 +1,49 @@
1/* 1/*
2 * Copyright (c) 2014 Isode Limited. 2 * Copyright (c) 2014-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#include <boost/lambda/lambda.hpp>
8#include <boost/lambda/bind.hpp>
9#include <boost/assign/list_of.hpp>
10#include <iostream> 7#include <iostream>
11 8
9#include <boost/assign/list_of.hpp>
10#include <boost/lambda/bind.hpp>
11#include <boost/lambda/lambda.hpp>
12
13#include <Sluift/ElementConvertors/IQConvertor.h>
14#include <Sluift/ElementConvertors/MessageConvertor.h>
15#include <Sluift/ElementConvertors/PresenceConvertor.h>
16#include <Sluift/ElementConvertors/StanzaConvertor.h>
17#include <Sluift/ElementConvertors/StatusShowConvertor.h>
18#include <Sluift/Lua/Check.h>
19#include <Sluift/Lua/Exception.h>
20#include <Sluift/Lua/FunctionRegistration.h>
21#include <Sluift/Lua/LuaUtils.h>
22#include <Sluift/Lua/Value.h>
12#include <Sluift/SluiftComponent.h> 23#include <Sluift/SluiftComponent.h>
13#include <Swiften/JID/JID.h> 24#include <Sluift/globals.h>
14#include <Swiften/Elements/SoftwareVersion.h> 25
26#include <Swiften/Base/IDGenerator.h>
27#include <Swiften/Base/foreach.h>
28#include <Swiften/Elements/DiscoInfo.h>
29#include <Swiften/Elements/MAMQuery.h>
15#include <Swiften/Elements/Message.h> 30#include <Swiften/Elements/Message.h>
16#include <Swiften/Elements/Presence.h> 31#include <Swiften/Elements/Presence.h>
17#include <Swiften/Elements/RawXMLPayload.h> 32#include <Swiften/Elements/RawXMLPayload.h>
18#include <Swiften/Elements/RosterItemPayload.h> 33#include <Swiften/Elements/RosterItemPayload.h>
19#include <Swiften/Elements/RosterPayload.h> 34#include <Swiften/Elements/RosterPayload.h>
20#include <Swiften/Elements/DiscoInfo.h> 35#include <Swiften/Elements/SoftwareVersion.h>
21#include <Swiften/Elements/MAMQuery.h> 36#include <Swiften/JID/JID.h>
22#include <Swiften/Queries/GenericRequest.h>
23#include <Swiften/Presence/PresenceSender.h> 37#include <Swiften/Presence/PresenceSender.h>
24#include <Swiften/Roster/XMPPRoster.h>
25#include <Swiften/Roster/SetRosterRequest.h>
26#include <Swiften/Presence/SubscriptionManager.h> 38#include <Swiften/Presence/SubscriptionManager.h>
27#include <Swiften/Roster/XMPPRosterItem.h> 39#include <Swiften/Queries/GenericRequest.h>
28#include <Swiften/Queries/IQRouter.h> 40#include <Swiften/Queries/IQRouter.h>
29#include <Swiften/Queries/Requests/GetSoftwareVersionRequest.h> 41#include <Swiften/Queries/Requests/GetSoftwareVersionRequest.h>
30#include <Sluift/Lua/FunctionRegistration.h> 42#include <Swiften/Roster/SetRosterRequest.h>
31#include <Swiften/Base/foreach.h> 43#include <Swiften/Roster/XMPPRoster.h>
32#include <Swiften/Base/IDGenerator.h> 44#include <Swiften/Roster/XMPPRosterItem.h>
33#include <Sluift/Lua/Check.h>
34#include <Sluift/Lua/Value.h>
35#include <Sluift/Lua/Exception.h>
36#include <Sluift/Lua/LuaUtils.h>
37#include <Sluift/globals.h>
38#include <Sluift/ElementConvertors/StanzaConvertor.h>
39#include <Sluift/ElementConvertors/IQConvertor.h>
40#include <Sluift/ElementConvertors/PresenceConvertor.h>
41#include <Sluift/ElementConvertors/MessageConvertor.h>
42#include <Sluift/ElementConvertors/StatusShowConvertor.h>
43 45
44using namespace Swift; 46using namespace Swift;
45namespace lambda = boost::lambda; 47namespace lambda = boost::lambda;
46 48
47static inline SluiftComponent* getComponent(lua_State* L) { 49static inline SluiftComponent* getComponent(lua_State* L) {
@@ -326,15 +328,10 @@ static int sendQuery(lua_State* L, IQ::Type type) {
326 328
327 return component->sendRequest( 329 return component->sendRequest(
328 boost::make_shared< GenericRequest<Payload> >(type, from, to, payload, component->getComponent()->getIQRouter()), timeout).convertToLuaResult(L); 330 boost::make_shared< GenericRequest<Payload> >(type, from, to, payload, component->getComponent()->getIQRouter()), timeout).convertToLuaResult(L);
329} 331}
330 332
331#define DISPATCH_PUBSUB_PAYLOAD(payloadType, container, response) \
332 else if (boost::shared_ptr<payloadType> p = boost::dynamic_pointer_cast<payloadType>(payload)) { \
333 return component->sendPubSubRequest(type, to, p, timeout).convertToLuaResult(L); \
334 }
335
336SLUIFT_LUA_FUNCTION(Component, get) { 333SLUIFT_LUA_FUNCTION(Component, get) {
337 return sendQuery(L, IQ::Get); 334 return sendQuery(L, IQ::Get);
338} 335}
339 336
340SLUIFT_LUA_FUNCTION(Component, set) { 337SLUIFT_LUA_FUNCTION(Component, set) {