Mercurial > prosody-modules
comparison mod_compat_vcard/mod_compat_vcard.lua @ 1297:3df303543765
mod_compat_vcard: Fix traceback from probably empty stanzas (Thanks Biszkopcik)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 02 Feb 2014 23:21:10 +0100 |
parents | 1a7cdc874b8c |
children |
comparison
equal
deleted
inserted
replaced
1296:b1a92a87309c | 1297:3df303543765 |
---|---|
8 local core_process_stanza = prosody.core_process_stanza; | 8 local core_process_stanza = prosody.core_process_stanza; |
9 | 9 |
10 module:hook("iq/full", function(event) | 10 module:hook("iq/full", function(event) |
11 local stanza = event.stanza; | 11 local stanza = event.stanza; |
12 local payload = stanza.tags[1]; | 12 local payload = stanza.tags[1]; |
13 if payload.name == "vCard" and stanza.attr.type == "get" and payload.attr.xmlns == "vcard-temp" then | 13 if payload and stanza.attr.type == "get" and payload.name == "vCard" and payload.attr.xmlns == "vcard-temp" then |
14 local fixed_stanza = st.clone(event.stanza); | 14 local fixed_stanza = st.clone(event.stanza); |
15 fixed_stanza.attr.to = jid_bare(stanza.attr.to); | 15 fixed_stanza.attr.to = jid_bare(stanza.attr.to); |
16 core_process_stanza(event.origin, fixed_stanza); | 16 core_process_stanza(event.origin, fixed_stanza); |
17 return true; | 17 return true; |
18 end | 18 end |