Software /
code /
prosody
Comparison
plugins/mod_xmlrpc.lua @ 877:0bababc930dd
mod_xmlrpc: Handle RPC stanzas sent over XMPP (XEP-0009: Jabber-RPC)
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 04 Mar 2009 22:22:40 +0500 |
parent | 875:e73b6ef579c7 |
child | 880:ff4a08d73772 |
comparison
equal
deleted
inserted
replaced
876:fad020cead52 | 877:0bababc930dd |
---|---|
79 return create_error_response(500, "Error in creating response: "..result); | 79 return create_error_response(500, "Error in creating response: "..result); |
80 end | 80 end |
81 return create_error_response(0, result or "nil"); | 81 return create_error_response(0, result or "nil"); |
82 end | 82 end |
83 | 83 |
84 --[[local function handle_xmpp_request(origin, stanza) | 84 local function handle_xmpp_request(origin, stanza) |
85 local query = stanza.tags[1]; | 85 local query = stanza.tags[1]; |
86 if query.name == "query" then | 86 if query.name == "query" then |
87 if #query.tags == 1 then | 87 if #query.tags == 1 then |
88 local success, method, args = pcall(translate_request, query.tags[1]); | 88 local success, method, args = pcall(translate_request, query.tags[1]); |
89 if success then | 89 if success then |
97 end | 97 end |
98 else | 98 else |
99 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 99 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
100 end | 100 end |
101 end | 101 end |
102 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:rpc", handle_xmpp_request);]] | 102 module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:rpc", handle_xmpp_request); |
103 module:add_feature("jabber:iq:rpc"); | |
103 | 104 |
104 local function handle_http_request(method, body, request) | 105 local function handle_http_request(method, body, request) |
105 local stanza = body and parse_xml(body); | 106 local stanza = body and parse_xml(body); |
106 if (not stanza) or request.method ~= "POST" then | 107 if (not stanza) or request.method ~= "POST" then |
107 return "<html><body>You really don't look like an XML-RPC client to me... what do you want?</body></html>"; | 108 return "<html><body>You really don't look like an XML-RPC client to me... what do you want?</body></html>"; |