mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Resending unacked stanzas should send even archived msgs if mod_offline is enabled
Messages that are received when no c2s is active will be stored in offline, even when mam archived them, so i don't think we should be doing something different in this case.
This commit is contained in:
parent
cd0b65f4d5
commit
37226dd41f
@ -605,6 +605,7 @@ route_unacked_stanzas(#{mgmt_state := MgmtState,
|
|||||||
end,
|
end,
|
||||||
?DEBUG("Re-routing ~B unacknowledged stanza(s) to ~ts",
|
?DEBUG("Re-routing ~B unacknowledged stanza(s) to ~ts",
|
||||||
[p1_queue:len(Queue), jid:encode(JID)]),
|
[p1_queue:len(Queue), jid:encode(JID)]),
|
||||||
|
ModOfflineEnabled = gen_mod:is_loaded(LServer, mod_offline),
|
||||||
p1_queue:foreach(
|
p1_queue:foreach(
|
||||||
fun({_, _Time, #presence{from = From}}) ->
|
fun({_, _Time, #presence{from = From}}) ->
|
||||||
?DEBUG("Dropping presence stanza from ~ts", [jid:encode(From)]);
|
?DEBUG("Dropping presence stanza from ~ts", [jid:encode(From)]);
|
||||||
@ -621,16 +622,17 @@ route_unacked_stanzas(#{mgmt_state := MgmtState,
|
|||||||
?DEBUG("Dropping forwarded message stanza from ~ts",
|
?DEBUG("Dropping forwarded message stanza from ~ts",
|
||||||
[jid:encode(From)]);
|
[jid:encode(From)]);
|
||||||
({_, Time, #message{} = Msg}) ->
|
({_, Time, #message{} = Msg}) ->
|
||||||
case ejabberd_hooks:run_fold(message_is_archived,
|
case {ModOfflineEnabled, ResendOnTimeout,
|
||||||
LServer, false,
|
xmpp:get_meta(Msg, mam_archived, false)} of
|
||||||
[State, Msg]) of
|
Val when Val == {true, true, false};
|
||||||
true ->
|
Val == {true, true, true};
|
||||||
?DEBUG("Dropping archived message stanza from ~ts",
|
Val == {false, true, false} ->
|
||||||
[jid:encode(xmpp:get_from(Msg))]);
|
|
||||||
false when ResendOnTimeout ->
|
|
||||||
NewEl = add_resent_delay_info(State, Msg, Time),
|
NewEl = add_resent_delay_info(State, Msg, Time),
|
||||||
ejabberd_router:route(NewEl);
|
ejabberd_router:route(NewEl);
|
||||||
false ->
|
{_, _, true} ->
|
||||||
|
?DEBUG("Dropping archived message stanza from ~s",
|
||||||
|
[jid:encode(xmpp:get_from(Msg))]);
|
||||||
|
_ ->
|
||||||
Txt = ?T("User session terminated"),
|
Txt = ?T("User session terminated"),
|
||||||
ejabberd_router:route_error(
|
ejabberd_router:route_error(
|
||||||
Msg, xmpp:err_service_unavailable(Txt, Lang))
|
Msg, xmpp:err_service_unavailable(Txt, Lang))
|
||||||
|
Loading…
Reference in New Issue
Block a user