Mercurial > prosody-hg
comparison plugins/mod_iq.lua @ 4797:e239668aa6d2
Merge 0.9->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 29 Apr 2012 02:10:55 +0100 |
| parents | 55501fc4394b |
| children | ca39f9b4cc8e |
comparison
equal
deleted
inserted
replaced
| 4796:04a34287dc12 | 4797:e239668aa6d2 |
|---|---|
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 | 9 |
| 10 local st = require "util.stanza"; | 10 local st = require "util.stanza"; |
| 11 local jid_split = require "util.jid".split; | |
| 12 | 11 |
| 13 local full_sessions = full_sessions; | 12 local full_sessions = full_sessions; |
| 14 local bare_sessions = bare_sessions; | |
| 15 | 13 |
| 16 if module:get_host_type() == "local" then | 14 if module:get_host_type() == "local" then |
| 17 module:hook("iq/full", function(data) | 15 module:hook("iq/full", function(data) |
| 18 -- IQ to full JID recieved | 16 -- IQ to full JID recieved |
| 19 local origin, stanza = data.origin, data.stanza; | 17 local origin, stanza = data.origin, data.stanza; |
| 31 end); | 29 end); |
| 32 end | 30 end |
| 33 | 31 |
| 34 module:hook("iq/bare", function(data) | 32 module:hook("iq/bare", function(data) |
| 35 -- IQ to bare JID recieved | 33 -- IQ to bare JID recieved |
| 36 local origin, stanza = data.origin, data.stanza; | 34 local stanza = data.stanza; |
| 37 local type = stanza.attr.type; | 35 local type = stanza.attr.type; |
| 38 | 36 |
| 39 -- TODO fire post processing events | 37 -- TODO fire post processing events |
| 40 if type == "get" or type == "set" then | 38 if type == "get" or type == "set" then |
| 41 local child = stanza.tags[1]; | 39 local child = stanza.tags[1]; |
| 47 end | 45 end |
| 48 end); | 46 end); |
| 49 | 47 |
| 50 module:hook("iq/self", function(data) | 48 module:hook("iq/self", function(data) |
| 51 -- IQ to self JID recieved | 49 -- IQ to self JID recieved |
| 52 local origin, stanza = data.origin, data.stanza; | 50 local stanza = data.stanza; |
| 53 local type = stanza.attr.type; | 51 local type = stanza.attr.type; |
| 54 | 52 |
| 55 if type == "get" or type == "set" then | 53 if type == "get" or type == "set" then |
| 56 local child = stanza.tags[1]; | 54 local child = stanza.tags[1]; |
| 57 local ret = module:fire_event("iq/self/"..child.attr.xmlns..":"..child.name, data); | 55 local ret = module:fire_event("iq/self/"..child.attr.xmlns..":"..child.name, data); |
| 62 end | 60 end |
| 63 end); | 61 end); |
| 64 | 62 |
| 65 module:hook("iq/host", function(data) | 63 module:hook("iq/host", function(data) |
| 66 -- IQ to a local host recieved | 64 -- IQ to a local host recieved |
| 67 local origin, stanza = data.origin, data.stanza; | 65 local stanza = data.stanza; |
| 68 local type = stanza.attr.type; | 66 local type = stanza.attr.type; |
| 69 | 67 |
| 70 if type == "get" or type == "set" then | 68 if type == "get" or type == "set" then |
| 71 local child = stanza.tags[1]; | 69 local child = stanza.tags[1]; |
| 72 local ret = module:fire_event("iq/host/"..child.attr.xmlns..":"..child.name, data); | 70 local ret = module:fire_event("iq/host/"..child.attr.xmlns..":"..child.name, data); |
