aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2013-05-03 10:42:24 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2013-05-03 10:42:24 +0200
commita61b7b1d98f3b8b8cbae954046b497fa2126e81a (patch)
treea7a3bc0161dc2530886c2173a0eab4138cb434f0 /src
parentAdd ability to limit number of registered users. (diff)
Don't forget about directed presences sent after receiving global presence
It caused problem with presences send to conference rooms, as this change made us not always send presence unavailable when user went offline, which did make conference have phantom users. This revert functional changes introduced in e521c8368a9796d4464bee1c98361f24e67a369c
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_c2s.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 7b5d326da..9bec834f0 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -199,17 +199,17 @@ get_subscription(LFrom, StateData) ->
broadcast(FsmRef, Type, From, Packet) ->
FsmRef ! {broadcast, Type, From, Packet}.
-%% Used by mod_ack and mod_ping.
+%% Used by mod_ack and mod_ping.
%% If the client is not oor capable, we must stop the session,
%% and be sure to not return until the c2s process has really stopped. This
-%% is to avoid race conditions when resending messages in mod_ack (EJABS-1677).
+%% is to avoid race conditions when resending messages in mod_ack (EJABS-1677).
%% In the other side, if the client is oor capable, then this just
%% switch reception to false, and returns inmediately.
stop_or_detach(FsmRef) ->
case ?GEN_FSM:sync_send_event(FsmRef, stop_or_detach) of
stopped ->
MRef = erlang:monitor(process, FsmRef),
- receive
+ receive
{'DOWN', MRef, process, FsmRef, _Reason}->
ok
after 5 ->
@@ -2402,8 +2402,9 @@ presence_broadcast_first(From, StateData, Packet) ->
JIDs2Probe = format_and_check_privacy(From, StateData, Packet, JIDsProbe, out),
Server = StateData#state.server,
send_multiple(From, Server, JIDs2Probe, PacketProbe),
- As = StateData#state.pres_f, %%Reuse existing structure, don't create a new one
- JIDs = ?SETS:to_list(StateData#state.pres_f),
+ As = ?SETS:foldl(fun ?SETS:add_element/2, StateData#state.pres_f,
+ StateData#state.pres_a),
+ JIDs = ?SETS:to_list(As),
JIDs2 = format_and_check_privacy(From, StateData, Packet, JIDs, out),
Server = StateData#state.server,
send_multiple(From, Server, JIDs2, Packet),