Mercurial > prosody-hg
comparison plugins/mod_vcard.lua @ 2004:5033348feba8
mod_vcard: Cleaned up unused variables and global accesses.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 18 Oct 2009 07:40:14 +0500 |
| parents | b7429073f73f |
| children | 1e27e0092f19 |
comparison
equal
deleted
inserted
replaced
| 2003:b7429073f73f | 2004:5033348feba8 |
|---|---|
| 4 -- | 4 -- |
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 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 local hosts = _G.hosts; | 9 local st = require "util.stanza" |
| 10 local jid_split = require "util.jid".split; | |
| 10 local datamanager = require "util.datamanager" | 11 local datamanager = require "util.datamanager" |
| 11 | 12 |
| 12 local st = require "util.stanza" | 13 module:add_feature("vcard-temp"); |
| 13 local t_concat, t_insert = table.concat, table.insert; | |
| 14 | 14 |
| 15 local jid = require "util.jid" | 15 local function handle_vcard(event) |
| 16 local jid_split = jid.split; | |
| 17 | |
| 18 local xmlns_vcard = "vcard-temp"; | |
| 19 module:add_feature(xmlns_vcard); | |
| 20 | |
| 21 function handle_vcard(event) | |
| 22 local session, stanza = event.origin, event.stanza; | 16 local session, stanza = event.origin, event.stanza; |
| 23 local to = stanza.attr.to; | 17 local to = stanza.attr.to; |
| 24 if stanza.attr.type == "get" then | 18 if stanza.attr.type == "get" then |
| 25 local vCard; | 19 local vCard; |
| 26 if to then | 20 if to then |
| 55 -- COMPAT: https://support.process-one.net/browse/EJAB-1045 | 49 -- COMPAT: https://support.process-one.net/browse/EJAB-1045 |
| 56 if module:get_option("vcard_compatibility") then | 50 if module:get_option("vcard_compatibility") then |
| 57 module:hook("iq/full", function(data) | 51 module:hook("iq/full", function(data) |
| 58 local stanza = data.stanza; | 52 local stanza = data.stanza; |
| 59 local payload = stanza.tags[1]; | 53 local payload = stanza.tags[1]; |
| 60 if stanza.attr.type == "get" or stanza.attr.type == "set" and payload.name == "vCard" and payload.attr.xmlns == xmlns_vcard then | 54 if stanza.attr.type == "get" or stanza.attr.type == "set" and payload.name == "vCard" and payload.attr.xmlns == "vcard-temp" then |
| 61 return handle_vcard(data); | 55 return handle_vcard(data); |
| 62 end | 56 end |
| 63 end, 1); | 57 end, 1); |
| 64 end | 58 end |
