comparison plugins/mod_vcard4.lua @ 10707:c4b49939b471 0.11

mod_vcard4: Report correct error condition (fixes #1521) On error, the second return value is the error condition, not the third.
author Kim Alvefur <zash@zash.se>
date Fri, 03 Apr 2020 22:35:47 +0200
parents e977b64ebd81
children 74b9e05af71e
comparison
equal deleted inserted replaced
10703:6b63ba5b078a 10707:c4b49939b471
12 12
13 local pep_service = mod_pep.get_pep_service(jid_split(stanza.attr.to) or origin.username); 13 local pep_service = mod_pep.get_pep_service(jid_split(stanza.attr.to) or origin.username);
14 local ok, id, item = pep_service:get_last_item("urn:xmpp:vcard4", stanza.attr.from); 14 local ok, id, item = pep_service:get_last_item("urn:xmpp:vcard4", stanza.attr.from);
15 if ok and item then 15 if ok and item then
16 origin.send(st.reply(stanza):add_child(item.tags[1])); 16 origin.send(st.reply(stanza):add_child(item.tags[1]));
17 elseif item == "item-not-found" or not id then 17 elseif id == "item-not-found" or not id then
18 origin.send(st.error_reply(stanza, "cancel", "item-not-found")); 18 origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
19 elseif item == "forbidden" then 19 elseif id == "forbidden" then
20 origin.send(st.error_reply(stanza, "auth", "forbidden")); 20 origin.send(st.error_reply(stanza, "auth", "forbidden"));
21 else 21 else
22 origin.send(st.error_reply(stanza, "modify", "undefined-condition")); 22 origin.send(st.error_reply(stanza, "modify", "undefined-condition"));
23 end 23 end
24 return true; 24 return true;