Mercurial > prosody-modules
comparison mod_compat_vcard/mod_compat_vcard.lua @ 753:9d5731af2c27
Merge with Oliver Gerlich
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 27 Jul 2012 14:29:59 +0100 |
parents | 1a7cdc874b8c |
children | 3df303543765 |
comparison
equal
deleted
inserted
replaced
752:9bbd99f2057a | 753:9d5731af2c27 |
---|---|
1 -- Compatibility with clients and servers (i.e. ejabberd) that send vcard | |
2 -- requests to the full JID | |
3 -- | |
4 -- https://support.process-one.net/browse/EJAB-1045 | |
5 | |
6 local jid_bare = require "util.jid".bare; | |
7 local st = require "util.stanza"; | |
8 local core_process_stanza = prosody.core_process_stanza; | |
9 | |
10 module:hook("iq/full", function(event) | |
11 local stanza = event.stanza; | |
12 local payload = stanza.tags[1]; | |
13 if payload.name == "vCard" and stanza.attr.type == "get" and payload.attr.xmlns == "vcard-temp" then | |
14 local fixed_stanza = st.clone(event.stanza); | |
15 fixed_stanza.attr.to = jid_bare(stanza.attr.to); | |
16 core_process_stanza(event.origin, fixed_stanza); | |
17 return true; | |
18 end | |
19 end, 1); |