Software /
code /
prosody-modules
Comparison
mod_compat_vcard/mod_compat_vcard.lua @ 749:1a7cdc874b8c
mod_compat_vcard: Handle vcard requests sent to full JIDs (a spec violation commited by older versions of ejabberd and possibly others) - replaces vcard_compatibility option from Prosody 0.8
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 26 Jul 2012 15:14:06 +0100 |
child | 1297:3df303543765 |
comparison
equal
deleted
inserted
replaced
748:f25b6a9f97bb | 749:1a7cdc874b8c |
---|---|
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); |