25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-10 15:47:30 +01:00

o Fix a bug in process_sm_iq/3 where a badmatch exception was raised

when the user didn't have a vCard.
o  Fix a bug in remove_user/2 where the exmpp_jid module was use instead
of exmpp_stringprep.

SVN Revision: 1570
This commit is contained in:
Jean-Sébastien Pédron 2008-09-23 13:05:43 +00:00
parent 5803c51633
commit 0e91ea9e5f
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2008-09-23 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/mod_vcard.erl (process_sm_iq): Fix a bug where a badmatch
exception was raised when the user didn't have a vCard.
(remove_user): Fix a bug where the exmpp_jid module was use instead of
exmpp_stringprep.
2008-09-22 Jean-Sébastien Pédron <js.pedron@meetic-corp.com> 2008-09-22 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/mod_vcard.erl (get_sm_features): Remove unappropriate * src/mod_vcard.erl (get_sm_features): Remove unappropriate

View File

@ -172,7 +172,7 @@ process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
F = fun() -> F = fun() ->
mnesia:read({vcard, US}) mnesia:read({vcard, US})
end, end,
[VCard | _] = case mnesia:transaction(F) of Els = case mnesia:transaction(F) of
{atomic, Rs} -> {atomic, Rs} ->
lists:map(fun(R) -> lists:map(fun(R) ->
R#vcard.vcard R#vcard.vcard
@ -180,7 +180,12 @@ process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
{aborted, _Reason} -> {aborted, _Reason} ->
[] []
end, end,
exmpp_iq:result(IQ_Rec, VCard); case Els of
[VCard | _] ->
exmpp_iq:result(IQ_Rec, VCard);
_ ->
exmpp_iq:result(IQ_Rec)
end;
process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) -> process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) ->
#jid{node = User, ldomain = LServer} = From, #jid{node = User, ldomain = LServer} = From,
case lists:member(LServer, ?MYHOSTS) of case lists:member(LServer, ?MYHOSTS) of
@ -643,8 +648,8 @@ reindex_vcards() ->
remove_user(User, Server) -> remove_user(User, Server) ->
LUser = exmpp_jid:nodeprep(User), LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_jid:nameprep(Server), LServer = exmpp_stringprep:nameprep(Server),
US = {LUser, LServer}, US = {LUser, LServer},
F = fun() -> F = fun() ->
mnesia:delete({vcard, US}), mnesia:delete({vcard, US}),