25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Return modules errors in set_vcard callback (#3502)

This commit is contained in:
Badlop 2021-02-15 13:12:52 +01:00
parent 4bc57f76eb
commit 72ecf91f08

View File

@ -403,7 +403,7 @@ vcard_iq_set(#iq{from = From, lang = Lang, sub_els = [VCard]} = IQ) ->
vcard_iq_set(Acc) ->
Acc.
-spec set_vcard(binary(), binary(), xmlel() | vcard_temp()) -> {error, badarg} | ok.
-spec set_vcard(binary(), binary(), xmlel() | vcard_temp()) -> {error, badarg|binary()} | ok.
set_vcard(User, LServer, VCARD) ->
case jid:nodeprep(User) of
error ->
@ -412,10 +412,14 @@ set_vcard(User, LServer, VCARD) ->
VCardEl = xmpp:encode(VCARD),
VCardSearch = make_vcard_search(User, LUser, LServer, VCardEl),
Mod = gen_mod:db_mod(LServer, ?MODULE),
Mod:set_vcard(LUser, LServer, VCardEl, VCardSearch),
ets_cache:delete(?VCARD_CACHE, {LUser, LServer},
case Mod:set_vcard(LUser, LServer, VCardEl, VCardSearch) of
{atomic, ok} ->
ets_cache:delete(?VCARD_CACHE, {LUser, LServer},
cache_nodes(Mod, LServer)),
ok
ok;
{atomic, Error} ->
{error, Error}
end
end.
-spec string2lower(binary()) -> binary().