mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
avoid sending duplicated events
This commit is contained in:
parent
faa6ad26a0
commit
4bdf1bc7a6
@ -827,7 +827,7 @@ send_loop(State) ->
|
|||||||
end;
|
end;
|
||||||
(_) -> ok
|
(_) -> ok
|
||||||
end,
|
end,
|
||||||
Subscriptions)
|
lists:usort(Subscriptions))
|
||||||
end,
|
end,
|
||||||
State#state.plugins),
|
State#state.plugins),
|
||||||
if not State#state.ignore_pep_from_offline ->
|
if not State#state.ignore_pep_from_offline ->
|
||||||
@ -1166,22 +1166,21 @@ disco_items(Host, Node, From) ->
|
|||||||
%% presence hooks handling functions
|
%% presence hooks handling functions
|
||||||
%%
|
%%
|
||||||
|
|
||||||
caps_update(#jid{luser = U, lserver = S, lresource = R} = From, To, _Features) ->
|
caps_update(#jid{luser = U, lserver = S, lresource = R}, #jid{lserver = Host} = JID, _Features)
|
||||||
Pid = ejabberd_sm:get_session_pid(U, S, R),
|
when Host =/= S ->
|
||||||
presence_probe(From, To, Pid).
|
presence(Host, {presence, U, S, [R], JID});
|
||||||
|
caps_update(From, To, _Feature) ->
|
||||||
|
ok.
|
||||||
|
|
||||||
presence_probe(#jid{luser = User, lserver = Server, lresource = Resource} = JID,
|
presence_probe(#jid{luser = U, lserver = S, lresource = R} = JID, JID, Pid) ->
|
||||||
JID, Pid) ->
|
presence(S, {presence, JID, Pid}),
|
||||||
presence(Server, {presence, JID, Pid}),
|
presence(S, {presence, U, S, [R], JID});
|
||||||
presence(Server, {presence, User, Server, [Resource], JID});
|
presence_probe(#jid{luser = U, lserver = S}, #jid{luser = U, lserver = S}, _Pid) ->
|
||||||
presence_probe(#jid{luser = User, lserver = Server},
|
%% ignore presence_probe from my other ressources
|
||||||
#jid{luser = User, lserver = Server}, _Pid) ->
|
%% to not get duplicated last items
|
||||||
%% ignore presence_probe from other ressources for the current user
|
|
||||||
%% this way, we do not send duplicated last items if user already connected with other clients
|
|
||||||
ok;
|
ok;
|
||||||
presence_probe(#jid{luser = User, lserver = Server, lresource = Resource},
|
presence_probe(#jid{luser = U, lserver = S, lresource = R} = From, #jid{lserver = Host} = JID, _Pid) ->
|
||||||
#jid{lserver = Host} = JID, _Pid) ->
|
presence(Host, {presence, U, S, [R], JID}).
|
||||||
presence(Host, {presence, User, Server, [Resource], JID}).
|
|
||||||
|
|
||||||
presence(ServerHost, Presence) ->
|
presence(ServerHost, Presence) ->
|
||||||
SendLoop = case
|
SendLoop = case
|
||||||
|
@ -475,7 +475,7 @@ send_loop(State) ->
|
|||||||
end;
|
end;
|
||||||
(_) -> ok
|
(_) -> ok
|
||||||
end,
|
end,
|
||||||
Subscriptions)
|
lists:usort(Subscriptions))
|
||||||
end,
|
end,
|
||||||
State#state.plugins),
|
State#state.plugins),
|
||||||
if not State#state.ignore_pep_from_offline ->
|
if not State#state.ignore_pep_from_offline ->
|
||||||
@ -817,22 +817,21 @@ disco_items(Host, Node, From) ->
|
|||||||
%% presence hooks handling functions
|
%% presence hooks handling functions
|
||||||
%%
|
%%
|
||||||
|
|
||||||
caps_update(#jid{luser = U, lserver = S, lresource = R} = From, To, _Features) ->
|
caps_update(#jid{luser = U, lserver = S, lresource = R}, #jid{lserver = Host} = JID, _Features)
|
||||||
Pid = ejabberd_sm:get_session_pid(U, S, R),
|
when Host =/= S ->
|
||||||
presence_probe(From, To, Pid).
|
presence(Host, {presence, U, S, [R], JID});
|
||||||
|
caps_update(From, To, _Feature) ->
|
||||||
|
ok.
|
||||||
|
|
||||||
presence_probe(#jid{luser = User, lserver = Server, lresource = Resource} = JID,
|
presence_probe(#jid{luser = U, lserver = S, lresource = R} = JID, JID, Pid) ->
|
||||||
JID, Pid) ->
|
presence(S, {presence, JID, Pid}),
|
||||||
presence(Server, {presence, JID, Pid}),
|
presence(S, {presence, U, S, [R], JID});
|
||||||
presence(Server, {presence, User, Server, [Resource], JID});
|
presence_probe(#jid{luser = U, lserver = S}, #jid{luser = U, lserver = S}, _Pid) ->
|
||||||
presence_probe(#jid{luser = User, lserver = Server},
|
%% ignore presence_probe from my other ressources
|
||||||
#jid{luser = User, lserver = Server}, _Pid) ->
|
%% to not get duplicated last items
|
||||||
%% ignore presence_probe from other ressources for the current user
|
|
||||||
%% this way, we do not send duplicated last items if user already connected with other clients
|
|
||||||
ok;
|
ok;
|
||||||
presence_probe(#jid{luser = User, lserver = Server, lresource = Resource},
|
presence_probe(#jid{luser = U, lserver = S, lresource = R} = From, #jid{lserver = Host} = JID, _Pid) ->
|
||||||
#jid{lserver = Host} = JID, _Pid) ->
|
presence(Host, {presence, U, S, [R], JID}).
|
||||||
presence(Host, {presence, User, Server, [Resource], JID}).
|
|
||||||
|
|
||||||
presence(ServerHost, Presence) ->
|
presence(ServerHost, Presence) ->
|
||||||
SendLoop = case
|
SendLoop = case
|
||||||
|
Loading…
Reference in New Issue
Block a user