mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Obtain and provide photo type in vCard LDAP (#3541)
This commit is contained in:
parent
31884f6c9d
commit
7ee018ad23
@ -268,7 +268,8 @@ ldap_attribute_to_vcard({Attr, Value}, V) ->
|
||||
<<"role">> -> V#vcard_temp{role = Value};
|
||||
<<"tel">> -> V#vcard_temp{tel = [#vcard_tel{number = Value}|Ts]};
|
||||
<<"email">> -> V#vcard_temp{email = [#vcard_email{userid = Value}|Es]};
|
||||
<<"photo">> -> V#vcard_temp{photo = #vcard_photo{binval = Value}};
|
||||
<<"photo">> -> V#vcard_temp{photo = #vcard_photo{binval = Value,
|
||||
type = photo_type(Value)}};
|
||||
<<"family">> -> V#vcard_temp{n = N#vcard_name{family = Value}};
|
||||
<<"given">> -> V#vcard_temp{n = N#vcard_name{given = Value}};
|
||||
<<"middle">> -> V#vcard_temp{n = N#vcard_name{middle = Value}};
|
||||
@ -282,6 +283,11 @@ ldap_attribute_to_vcard({Attr, Value}, V) ->
|
||||
_ -> V
|
||||
end.
|
||||
|
||||
-spec photo_type(binary()) -> binary().
|
||||
photo_type(Value) ->
|
||||
Type = eimp:get_type(Value),
|
||||
<<"image/", (atom_to_binary(Type, latin1))/binary>>.
|
||||
|
||||
map_vcard_attr(VCardName, Attributes, Pattern, UD) ->
|
||||
Res = lists:filter(
|
||||
fun({Name, _}) ->
|
||||
|
Loading…
Reference in New Issue
Block a user