Software /
code /
prosody-modules
Changeset
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 |
parents | 748:f25b6a9f97bb |
children | 750:8133dd5f266a |
files | mod_compat_vcard/mod_compat_vcard.lua |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_compat_vcard/mod_compat_vcard.lua Thu Jul 26 15:14:06 2012 +0100 @@ -0,0 +1,19 @@ +-- Compatibility with clients and servers (i.e. ejabberd) that send vcard +-- requests to the full JID +-- +-- https://support.process-one.net/browse/EJAB-1045 + +local jid_bare = require "util.jid".bare; +local st = require "util.stanza"; +local core_process_stanza = prosody.core_process_stanza; + +module:hook("iq/full", function(event) + local stanza = event.stanza; + local payload = stanza.tags[1]; + if payload.name == "vCard" and stanza.attr.type == "get" and payload.attr.xmlns == "vcard-temp" then + local fixed_stanza = st.clone(event.stanza); + fixed_stanza.attr.to = jid_bare(stanza.attr.to); + core_process_stanza(event.origin, fixed_stanza); + return true; + end +end, 1);