25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Fix broken hooked functions

This commit is contained in:
Evgeniy Khramtsov 2014-07-15 19:22:33 +04:00
parent fd298521e2
commit b5f1b17926

View File

@ -47,7 +47,7 @@
handle_cast/2, terminate/2, code_change/3]).
%% hook handlers
-export([user_send_packet/4, user_receive_packet/5,
-export([user_send_packet/3, user_receive_packet/4,
c2s_presence_in/2, c2s_broadcast_recipients/6]).
-include("ejabberd.hrl").
@ -142,12 +142,11 @@ read_caps([_ | Tail], Result) ->
read_caps(Tail, Result);
read_caps([], Result) -> Result.
user_send_packet(#xmlel{name = <<"presence">>, attrs = Attrs,
children = Els} = Pkt,
_C2SState,
#jid{luser = User, lserver = Server} = From,
user_send_packet(#jid{luser = User, lserver = Server} = From,
#jid{luser = User, lserver = Server,
lresource = <<"">>}) ->
lresource = <<"">>},
#xmlel{name = <<"presence">>, attrs = Attrs,
children = Els} = Pkt) ->
Type = xml:get_attr_s(<<"type">>, Attrs),
if Type == <<"">>; Type == <<"available">> ->
case read_caps(Els) of
@ -158,13 +157,13 @@ user_send_packet(#xmlel{name = <<"presence">>, attrs = Attrs,
true -> ok
end,
Pkt;
user_send_packet(Pkt, _C2SState, _From, _To) ->
user_send_packet( _From, _To, Pkt) ->
Pkt.
user_receive_packet(#xmlel{name = <<"presence">>, attrs = Attrs,
children = Els} = Pkt,
_C2SState, #jid{lserver = Server},
From, _To) ->
user_receive_packet(#jid{lserver = Server},
From, _To,
#xmlel{name = <<"presence">>, attrs = Attrs,
children = Els} = Pkt) ->
Type = xml:get_attr_s(<<"type">>, Attrs),
IsRemote = not lists:member(From#jid.lserver, ?MYHOSTS),
if IsRemote and
@ -177,7 +176,7 @@ user_receive_packet(#xmlel{name = <<"presence">>, attrs = Attrs,
true -> ok
end,
Pkt;
user_receive_packet(Pkt, _C2SState, _JID, _From, _To) ->
user_receive_packet( _JID, _From, _To, Pkt) ->
Pkt.
-spec caps_stream_features([xmlel()], binary()) -> [xmlel()].