]> granicus.if.org Git - ejabberd/commitdiff
Return an empty <vCard/> element in an IQ-result when no vCard exists.
authorGu Feng <flygoast@126.com>
Fri, 24 Oct 2014 16:55:49 +0000 (00:55 +0800)
committerGu Feng <flygoast@126.com>
Fri, 24 Oct 2014 16:55:49 +0000 (00:55 +0800)
According to XEP-0054, if no vCard exists, the server MUST return a stanza
error (which SHOULD be <item-not-found/>) or an IQ-result containing an
empty <vCard/> element.

Signed-off-by: Gu Feng <flygoast@126.com>
src/mod_vcard.erl

index 0451a5193d22e07bdef8ec2ee2a35774bb371aac..8afac260bb0c214eb6c129606dcc571888e132c2 100644 (file)
@@ -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.