25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-31 15:21:38 +01:00

Don't try to send privacy pushes in OOR mode

This commit is contained in:
Alexey Shchepin 2012-10-30 13:29:15 +02:00
parent e62af41fa8
commit bef66dba24

View File

@ -1505,13 +1505,17 @@ handle_info({route, _From, _To, {broadcast, Data}},
attrs = [{<<"name">>, attrs = [{<<"name">>,
PrivListName}], PrivListName}],
children = []}]}]}, children = []}]}]},
PrivFrom = jlib:jid_remove_resource(StateData#state.jid),
PrivTo = StateData#state.jid,
PrivPushEl = jlib:replace_from_to( PrivPushEl = jlib:replace_from_to(
jlib:jid_remove_resource(StateData#state.jid), PrivFrom,
StateData#state.jid, PrivTo,
jlib:iq_to_xml(PrivPushIQ)), jlib:iq_to_xml(PrivPushIQ)),
send_element(StateData, PrivPushEl), send_element(StateData, PrivPushEl),
StateData2 = send_or_enqueue_packet(
StateData, PrivFrom, PrivTo, PrivPushEl),
fsm_next_state(StateName, fsm_next_state(StateName,
StateData#state{privacy_list = NewPL}) StateData2#state{privacy_list = NewPL})
end; end;
{blocking, What} -> {blocking, What} ->
route_blocking(What, StateData), route_blocking(What, StateData),
@ -1788,18 +1792,7 @@ handle_info({route, From, To,
jlib:jid_to_string(To), NewAttrs), jlib:jid_to_string(To), NewAttrs),
FixedPacket = #xmlel{name = Name, attrs = Attrs2, FixedPacket = #xmlel{name = Name, attrs = Attrs2,
children = Els}, children = Els},
NewState2 = if NewState#state.reception and NewState2 = send_or_enqueue_packet(NewState, From, To, FixedPacket),
not
(NewState#state.standby and
(Name /= "message")) ->
send_element(NewState, FixedPacket),
ack(NewState, From, To, FixedPacket);
true ->
NewState1 =
send_out_of_reception_message(NewState, From,
To, Packet),
enqueue(NewState1, From, To, FixedPacket)
end,
ejabberd_hooks:run(user_receive_packet, ejabberd_hooks:run(user_receive_packet,
StateData#state.server, StateData#state.server,
[StateData#state.debug, StateData#state.jid, From, [StateData#state.debug, StateData#state.jid, From,
@ -2134,6 +2127,19 @@ send_trailer(StateData)
send_trailer(StateData) -> send_trailer(StateData) ->
send_text(StateData, ?STREAM_TRAILER). send_text(StateData, ?STREAM_TRAILER).
send_or_enqueue_packet(State, From, To, Packet) ->
#xmlel{name = Name} = Packet,
if State#state.reception and
not (State#state.standby and
(Name /= "message")) ->
send_element(State, Packet),
ack(State, From, To, Packet);
true ->
NewState = send_out_of_reception_message(State, From, To, Packet),
enqueue(NewState, From, To, Packet)
end.
new_id() -> randoms:get_string(). new_id() -> randoms:get_string().
is_auth_packet(El) -> is_auth_packet(El) ->