# HG changeset patch # User Waqas Hussain # Date 1255831556 -18000 # Node ID 2f73fe2b3edd47f156a7985c1388012bbe8ed34f # Parent c31aa53348b862f159acbd0e4a4afee64964a0b9 mod_vcard: Moved completely to new event based hooks. diff -r c31aa53348b8 -r 2f73fe2b3edd plugins/mod_vcard.lua --- a/plugins/mod_vcard.lua Sun Oct 18 06:55:00 2009 +0500 +++ b/plugins/mod_vcard.lua Sun Oct 18 07:05:56 2009 +0500 @@ -21,7 +21,8 @@ module:add_feature(xmlns_vcard); -function handle_vcard(session, stanza) +function handle_vcard(event) + local session, stanza = event.origin, event.stanza; if stanza.tags[1].name == "vCard" then local to = stanza.attr.to; if stanza.attr.type == "get" then @@ -55,7 +56,9 @@ end end -module:add_iq_handler({"c2s", "s2sin", "component"}, xmlns_vcard, handle_vcard); +--module:add_iq_handler({"c2s", "s2sin", "component"}, xmlns_vcard, handle_vcard); +module:hook("iq/bare/vcard-temp:vCard", handle_vcard); +module:hook("iq/host/vcard-temp:vCard", handle_vcard); -- COMPAT: https://support.process-one.net/browse/EJAB-1045 if module:get_option("vcard_compatibility") then @@ -63,7 +66,7 @@ local stanza = data.stanza; if stanza.attr.type == "get" and stanza.tags[1] and stanza.tags[1].attr.xmlns == xmlns_vcard then - return handle_vcard(data.origin, stanza); + return handle_vcard(data); end end, 1); end