Mercurial > prosody-hg
comparison plugins/mod_iq.lua @ 3678:ce04b8b144de
mod_iq: Don't hook 'iq/full' on components.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 02 Dec 2010 16:56:30 +0500 |
| parents | 43b854062206 |
| children | afdce92d07be |
comparison
equal
deleted
inserted
replaced
| 3677:dad563ed54aa | 3678:ce04b8b144de |
|---|---|
| 11 local jid_split = require "util.jid".split; | 11 local jid_split = require "util.jid".split; |
| 12 | 12 |
| 13 local full_sessions = full_sessions; | 13 local full_sessions = full_sessions; |
| 14 local bare_sessions = bare_sessions; | 14 local bare_sessions = bare_sessions; |
| 15 | 15 |
| 16 module:hook("iq/full", function(data) | 16 if module::get_host_type() == "local" then |
| 17 -- IQ to full JID recieved | 17 module:hook("iq/full", function(data) |
| 18 local origin, stanza = data.origin, data.stanza; | 18 -- IQ to full JID recieved |
| 19 local origin, stanza = data.origin, data.stanza; | |
| 19 | 20 |
| 20 local session = full_sessions[stanza.attr.to]; | 21 local session = full_sessions[stanza.attr.to]; |
| 21 if session then | 22 if session then |
| 22 -- TODO fire post processing event | 23 -- TODO fire post processing event |
| 23 session.send(stanza); | 24 session.send(stanza); |
| 24 else -- resource not online | 25 else -- resource not online |
| 25 if stanza.attr.type == "get" or stanza.attr.type == "set" then | 26 if stanza.attr.type == "get" or stanza.attr.type == "set" then |
| 26 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 27 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 28 end | |
| 27 end | 29 end |
| 28 end | 30 return true; |
| 29 return true; | 31 end); |
| 30 end); | 32 end |
| 31 | 33 |
| 32 module:hook("iq/bare", function(data) | 34 module:hook("iq/bare", function(data) |
| 33 -- IQ to bare JID recieved | 35 -- IQ to bare JID recieved |
| 34 local origin, stanza = data.origin, data.stanza; | 36 local origin, stanza = data.origin, data.stanza; |
| 35 local type = stanza.attr.type; | 37 local type = stanza.attr.type; |
