diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_caps.erl | 6 | ||||
-rw-r--r-- | src/sha.erl | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/mod_caps.erl b/src/mod_caps.erl index b98db6ac7..1f89b6cc3 100644 --- a/src/mod_caps.erl +++ b/src/mod_caps.erl @@ -168,7 +168,11 @@ user_receive_packet(_DebugFlag, #jid{lserver = Server}, From, _To, {xmlelement, "presence", Attrs, Els}) -> Type = xml:get_attr_s("type", Attrs), - if Type == ""; Type == "available" -> + IsRemote = not lists:member(From#jid.lserver, ?MYHOSTS), + %% Local users presence caps are already handled by user_send_packet. + %% Otherwise we could send multiple request when broadcasting presence + %% to every local subscriber. + if IsRemote and ((Type == "") or (Type == "available")) -> case read_caps(Els) of nothing -> ok; diff --git a/src/sha.erl b/src/sha.erl index 33a82b889..d98c7848d 100644 --- a/src/sha.erl +++ b/src/sha.erl @@ -1,7 +1,7 @@ %%%---------------------------------------------------------------------- %%% File : sha.erl %%% Author : Alexey Shchepin <alexey@process-one.net> -%%% Purpose : +%%% Purpose : %%% Created : 20 Dec 2002 by Alexey Shchepin <alexey@process-one.net> %%% %%% @@ -28,7 +28,7 @@ -author('alexey@process-one.net'). -export([start/0, sha/1, sha1/1, sha224/1, sha256/1, sha384/1, - sha512/1]). + sha512/1, to_hexlist/1]). -ifdef(HAVE_MD2). -export([md2/1]). @@ -61,6 +61,9 @@ digit_to_xchar(D) -> sha(Text) -> Bin = crypto:sha(Text), + to_hexlist(Bin). + +to_hexlist(Bin) -> lists:reverse(ints_to_rxstr(binary_to_list(Bin), [])). ints_to_rxstr([], Res) -> |