1 |
|
2 local st = require "util.stanza"; |
|
3 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; |
|
4 |
|
5 local modulemanager = require "core.modulemanager"; |
|
6 |
|
7 -- Handle stanzas that were addressed to the server (whether they came from c2s, s2s, etc.) |
|
8 function handle_stanza(origin, stanza) |
|
9 -- Use plugins |
|
10 if not modulemanager.handle_stanza(origin, stanza) then |
|
11 if stanza.name == "iq" then |
|
12 if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then |
|
13 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
|
14 end |
|
15 elseif stanza.name == "message" then |
|
16 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
|
17 elseif stanza.name ~= "presence" then |
|
18 error("Unknown stanza"); |
|
19 end |
|
20 end |
|
21 end |
|