From 3b7449fb9299b2aea919342c2b909e59be7d72da Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 18 Jun 2010 16:12:06 +0200 Subject: [PATCH] Fix result IQ vcard stanza --- src/mod_vcard_ldap.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index 9f1f8a025..c894efe58 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -261,8 +261,8 @@ process_vcard_ldap(To, IQ_Rec, Server) -> VCardMap = State#state.vcard_map, case find_ldap_user(LUser, State) of #eldap_entry{attributes = Attributes} -> - Vcard = ldap_attributes_to_vcard(Attributes, VCardMap, {LUser, LServer}), - exmpp_iq:result(IQ_Rec, Vcard); + VcardEl = ldap_attributes_to_vcard(Attributes, VCardMap, {LUser, LServer}), + exmpp_iq:result(IQ_Rec, VcardEl); _ -> exmpp_iq:result(IQ_Rec) end; @@ -307,12 +307,12 @@ ldap_attributes_to_vcard(Attributes, VCardMap, UD) -> NElts = [ldap_attribute_to_vcard(vCardN, Attr) || Attr <- Attrs], OElts = [ldap_attribute_to_vcard(vCardO, Attr) || Attr <- Attrs], AElts = [ldap_attribute_to_vcard(vCardA, Attr) || Attr <- Attrs], - [#xmlel{ns = ?NS_VCARD, name = 'vCard', children = + #xmlel{ns = ?NS_VCARD, name = 'vCard', children = lists:append([X || X <- Elts, X /= none], [#xmlel{ns = ?NS_VCARD, name = 'N', children = [X || X <- NElts, X /= none]}, #xmlel{ns = ?NS_VCARD, name = 'ORG', children = [X || X <- OElts, X /= none]}, #xmlel{ns = ?NS_VCARD, name = 'ADR', children = [X || X <- AElts, X /= none]}]) - }]. + }. ldap_attribute_to_vcard(vCard, {"fn", Value}) -> exmpp_xml:set_cdata(#xmlel{ns = ?NS_VCARD, name = 'FN'}, Value);