]> granicus.if.org Git - ejabberd/commitdiff
mod_stream_mgmt: Drop unused code
authorHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 28 May 2019 22:30:59 +0000 (00:30 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 28 May 2019 22:30:59 +0000 (00:30 +0200)
Revert the changes applied to mod_stream_mgmt in commit
b76f90fe396ee7a1ed5c5f7006431879929fc2a1, as the new implementation of
mod_offline's 'use_mam_for_storage' feature doesn't need them.

src/mod_stream_mgmt.erl

index 34ce4e53dfdfdcf126e46111bcab1e70f1fb8fe2..1a4308c58cb992dc6c5ea52ce9b66ea53045042b 100644 (file)
@@ -591,25 +591,22 @@ route_unacked_stanzas(#{mgmt_state := MgmtState,
                      end,
     ?DEBUG("Re-routing ~B unacknowledged stanza(s) to ~s",
           [p1_queue:len(Queue), jid:encode(JID)]),
-    p1_queue:foldl(
-      fun({_, _Time, #presence{from = From}}, Acc) ->
-             ?DEBUG("Dropping presence stanza from ~s", [jid:encode(From)]),
-             Acc;
-        ({_, _Time, #iq{} = El}, Acc) ->
+    p1_queue:foreach(
+      fun({_, _Time, #presence{from = From}}) ->
+             ?DEBUG("Dropping presence stanza from ~s", [jid:encode(From)]);
+        ({_, _Time, #iq{} = El}) ->
              Txt = <<"User session terminated">>,
              ejabberd_router:route_error(
-               El, xmpp:err_service_unavailable(Txt, Lang)),
-             Acc;
-        ({_, _Time, #message{from = From, meta = #{carbon_copy := true}}}, Acc) ->
+               El, xmpp:err_service_unavailable(Txt, Lang));
+        ({_, _Time, #message{from = From, meta = #{carbon_copy := true}}}) ->
              %% XEP-0280 says: "When a receiving server attempts to deliver a
              %% forked message, and that message bounces with an error for
              %% any reason, the receiving server MUST NOT forward that error
              %% back to the original sender."  Resending such a stanza could
              %% easily lead to unexpected results as well.
              ?DEBUG("Dropping forwarded message stanza from ~s",
-                    [jid:encode(From)]),
-             Acc;
-        ({_, Time, #message{} = Msg}, Acc) ->
+                    [jid:encode(From)]);
+        ({_, Time, #message{} = Msg}) ->
              case ejabberd_hooks:run_fold(message_is_archived,
                                           LServer, false,
                                           [State, Msg]) of
@@ -618,26 +615,17 @@ route_unacked_stanzas(#{mgmt_state := MgmtState,
                             [jid:encode(xmpp:get_from(Msg))]);
                  false when ResendOnTimeout ->
                      NewEl = add_resent_delay_info(State, Msg, Time),
-                     NewEl2 = case Acc of
-                                  first_resend ->
-                                      xmpp:put_meta(NewEl, first_from_queue, true);
-                                  _ ->
-                                      NewEl
-                              end,
-                     ejabberd_router:route(NewEl2),
-                     false;
+                     ejabberd_router:route(NewEl);
                  false ->
                      Txt = <<"User session terminated">>,
                      ejabberd_router:route_error(
-                       Msg, xmpp:err_service_unavailable(Txt, Lang)),
-                     Acc
+                       Msg, xmpp:err_service_unavailable(Txt, Lang))
              end;
-          ({_, _Time, El}, Acc) ->
+        ({_, _Time, El}) ->
              %% Raw element of type 'error' resulting from a validation error
              %% We cannot pass it to the router, it will generate an error
-             ?DEBUG("Do not route raw element from ack queue: ~p", [El]),
-             Acc
-      end, first_resend, Queue);
+             ?DEBUG("Do not route raw element from ack queue: ~p", [El])
+      end, Queue);
 route_unacked_stanzas(_State) ->
     ok.