From: Gu Feng Date: Fri, 24 Oct 2014 16:55:49 +0000 (+0800) Subject: Return an empty element in an IQ-result when no vCard exists. X-Git-Tag: 14.12~28^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94cdcd7b34ccc83acfb32be09016cb7859d20916;p=ejabberd Return an empty element in an IQ-result when no vCard exists. According to XEP-0054, if no vCard exists, the server MUST return a stanza error (which SHOULD be ) or an IQ-result containing an empty element. Signed-off-by: Gu Feng --- diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 0451a5193..8afac260b 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -186,6 +186,11 @@ process_sm_iq(From, To, error -> IQ#iq{type = error, sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}; + [] -> + IQ#iq{type = result, + sub_el = [#xmlel{name = <<"vCard">>, + attrs = [{<<"xmlns">>, ?NS_VCARD}], + children = []}]}; Els -> IQ#iq{type = result, sub_el = Els} end end.