Added: Roster manipulation functions to core.rostermanager
[prosody.git] / core / servermanager.lua
1
2 local st = require "util.stanza";
3 local send = require "core.sessionmanager".send_to_session;
4 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas';
5
6 require "modulemanager"
7
8 -- Handle stanzas that were addressed to the server (whether they came from c2s, s2s, etc.)
9 function handle_stanza(origin, stanza)
10         -- Use plugins
11         if not modulemanager.handle_stanza(origin, stanza) then
12                 if stanza.name == "iq" then
13                         local reply = st.reply(stanza);
14                         reply.attr.type = "error";
15                         reply:tag("error", { type = "cancel" })
16                                 :tag("service-unavailable", { xmlns = xmlns_stanzas });
17                         send(origin, reply);
18                 end
19         end
20 end