From a07029dcad76294a749d74946cae670a8cf3c12d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Tue, 13 Jul 2021 17:56:16 +0200 Subject: [PATCH] Fix previous commit to pass all tests --- src/ejabberd_router_multicast.erl | 8 ++++---- src/mod_muc_room.erl | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ejabberd_router_multicast.erl b/src/ejabberd_router_multicast.erl index 6e0201c90..54abf671c 100644 --- a/src/ejabberd_router_multicast.erl +++ b/src/ejabberd_router_multicast.erl @@ -217,12 +217,12 @@ update_to_in_wrapped(Packet, To) -> } = PSItems } = PSEvent]} -> Internal2 = xmpp:set_to(Internal, To), - PSItem2 = PSItem#ps_item{sub_els = Internal2}, - PSItems2 = PSItems#ps_items{items = PSItem2}, + PSItem2 = PSItem#ps_item{sub_els = [Internal2]}, + PSItems2 = PSItems#ps_items{items = [PSItem2]}, PSEvent2 = PSEvent#ps_event{items = PSItems2}, - Packet#message{sub_els = [PSEvent2]}; + xmpp:set_to(Packet#message{sub_els = [PSEvent2]}, To); _ -> - Packet + xmpp:set_to(Packet, To) end. %%-------------------------------------------------------------------- diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 1c9710c60..eb12a9470 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -4626,7 +4626,7 @@ store_room_no_checks(StateData, ChangesHints) -> send_subscriptions_change_notifications(From, Nick, Type, State) -> {WJ, WN} = maps:fold( - fun({WithJid, WithNick} = Res, #subscriber{nodes = Nodes, jid = JID}, _) -> + fun(_, #subscriber{nodes = Nodes, jid = JID}, {WithJid, WithNick} = Res) -> case lists:member(?NS_MUCSUB_NODES_SUBSCRIBERS, Nodes) of true -> case (State#state.config)#config.anonymous == false orelse @@ -4640,7 +4640,7 @@ send_subscriptions_change_notifications(From, Nick, Type, State) -> false -> Res end - end, ok, State#state.subscribers), + end, {[], []}, State#state.subscribers), if WJ /= [] -> Payload1 = case Type of subscribe -> #muc_subscribe{jid = From, nick = Nick}; @@ -4779,7 +4779,7 @@ send_wrapped_multiple(From, Users, Packet, Node, State) -> not lists:member(303, Codes)) of true -> ejabberd_router_multicast:route_multicast( - State#state.jid, State#state.server_host, Dir, + From, State#state.server_host, Dir, #presence{id = p1_rand:get_string(), type = unavailable}, false); false -> @@ -4791,7 +4791,7 @@ send_wrapped_multiple(From, Users, Packet, Node, State) -> _ -> ok end, - ejabberd_router_multicast:route_multicast(State#state.jid, State#state.server_host, + ejabberd_router_multicast:route_multicast(From, State#state.server_host, Dir, Packet, false) end, case Wra of @@ -4804,7 +4804,7 @@ send_wrapped_multiple(From, Users, Packet, Node, State) -> _ -> p1_rand:get_string() end, - NewPacket = wrap(From, State#state.jid, Packet, Node, Id), + NewPacket = wrap(From, undefined, Packet, Node, Id), NewPacket2 = xmpp:put_meta(NewPacket, in_muc_mam, MamEnabled), ejabberd_router_multicast:route_multicast(State#state.jid, State#state.server_host, Wra, NewPacket2, true)