mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Return modules errors in set_vcard callback (#3502)
This commit is contained in:
parent
4bc57f76eb
commit
72ecf91f08
@ -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().
|
||||
|
Loading…
Reference in New Issue
Block a user