25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Parse sub elements of the mix join remote result

This commit is contained in:
Jonah Brüchert 2022-07-02 17:20:35 +02:00 committed by badlop
parent b1e6e408f8
commit 0faf34b26d

View File

@ -262,13 +262,25 @@ remove_user(LUser, LServer) ->
%%% Internal functions %%% Internal functions
%%%=================================================================== %%%===================================================================
-spec process_join(iq()) -> ignore. -spec process_join(iq()) -> ignore.
process_join(#iq{from = From, process_join(#iq{from = From, lang = Lang,
sub_els = [#mix_client_join{channel = Channel, sub_els = [#mix_client_join{channel = Channel,
join = Join}]} = IQ) -> join = Join}]} = IQ) ->
ejabberd_router:route_iq( ejabberd_router:route_iq(
#iq{from = jid:remove_resource(From), #iq{from = jid:remove_resource(From),
to = Channel, type = set, sub_els = [Join]}, to = Channel, type = set, sub_els = [Join]},
fun(ResIQ) -> process_join_result(ResIQ, IQ) end), fun(#iq{sub_els = [El]} = ResIQ) ->
try xmpp:decode(El) of
MixJoin ->
process_join_result(ResIQ#iq {
sub_els = [MixJoin]
}, IQ)
catch
_:{xmpp_codec, Reason} ->
Txt = xmpp:io_format_error(Reason),
Err = xmpp:err_bad_request(Txt, Lang),
ejabberd_router:route_error(IQ, Err)
end
end),
ignore. ignore.
-spec process_leave(iq()) -> iq() | error. -spec process_leave(iq()) -> iq() | error.
@ -309,7 +321,7 @@ process_join_result(#iq{from = #jid{} = Channel,
{error, db_failure} -> {error, db_failure} ->
ejabberd_router:route_error(IQ, db_error(IQ)) ejabberd_router:route_error(IQ, db_error(IQ))
end; end;
process_join_result(Err, IQ) -> process_join_result(#iq{type = error} = Err, IQ) ->
process_iq_error(Err, IQ). process_iq_error(Err, IQ).
-spec process_leave_result(iq(), iq()) -> ok. -spec process_leave_result(iq(), iq()) -> ok.