Mercurial > prosody-hg
comparison core/servermanager.lua @ 315:4df26c981728
Fixed servermanager to use session.send for sending stanzas
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 16 Nov 2008 05:02:15 +0500 |
| parents | 0abe771b43c6 |
| children | d97d59cfd1e8 |
comparison
equal
deleted
inserted
replaced
| 314:851f271d25b0 | 315:4df26c981728 |
|---|---|
| 1 | 1 |
| 2 local st = require "util.stanza"; | 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'; | 3 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; |
| 5 | 4 |
| 6 require "modulemanager" | 5 require "modulemanager" |
| 7 | 6 |
| 8 -- Handle stanzas that were addressed to the server (whether they came from c2s, s2s, etc.) | 7 -- Handle stanzas that were addressed to the server (whether they came from c2s, s2s, etc.) |
| 9 function handle_stanza(origin, stanza) | 8 function handle_stanza(origin, stanza) |
| 10 -- Use plugins | 9 -- Use plugins |
| 11 if not modulemanager.handle_stanza(origin, stanza) then | 10 if not modulemanager.handle_stanza(origin, stanza) then |
| 12 if stanza.name == "iq" then | 11 if stanza.name == "iq" then |
| 13 if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then | 12 if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then |
| 14 send(origin, st.error_reply(stanza, "cancel", "service-unavailable")); | 13 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 15 end | 14 end |
| 16 elseif stanza.name == "message" then | 15 elseif stanza.name == "message" then |
| 17 send(origin, st.error_reply(stanza, "cancel", "service-unavailable")); | 16 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 18 elseif stanza.name ~= "presence" then | 17 elseif stanza.name ~= "presence" then |
| 19 error("Unknown stanza"); | 18 error("Unknown stanza"); |
| 20 end | 19 end |
| 21 end | 20 end |
| 22 end | 21 end |
