24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-08 21:43:07 +02:00

mod_mix_pam: Do roster pushes on join/leave

Before the channels were added/removed from the database but the
clients were not notified of it.
This commit is contained in:
Linus Jahn 2022-06-20 11:42:19 +02:00
parent 5cb2bf5fcc
commit 2707927f3d
No known key found for this signature in database
GPG Key ID: 4663231A91A1E27B

View File

@ -293,6 +293,18 @@ process_join_result(#iq{from = Channel,
#iq{to = To} = IQ) ->
case add_channel(To, Channel, ID) of
ok ->
% Do roster push
#jid{luser = ChannelName, lserver = Service} = Channel,
mod_roster:push_item(To, #roster{}, #roster{
jid = {ChannelName, Service, <<>>},
name = <<>>,
subscription = none,
ask = none,
groups = [],
askmessage = <<>>,
mix_participant_id = ID
}),
% send IQ result
ChanID = make_channel_id(Channel, ID),
Join1 = Join#mix_join{id = <<"">>, jid = ChanID},
ResIQ = xmpp:make_iq_result(IQ, #mix_client_join{join = Join1}),
@ -304,7 +316,15 @@ process_join_result(Err, IQ) ->
process_iq_error(Err, IQ).
-spec process_leave_result(iq(), iq()) -> ok.
process_leave_result(#iq{type = result, sub_els = [#mix_leave{} = Leave]}, IQ) ->
process_leave_result(#iq{from = Channel, type = result, sub_els = [#mix_leave{} = Leave]},
#iq{to = User} = IQ) ->
% Do roster push
#jid{luser = ChannelName, lserver = Service} = Channel,
mod_roster:push_item(User,
#roster{jid = {ChannelName, Service, <<>>}, subscription = none},
#roster{jid = {ChannelName, Service, <<>>},
subscription = remove}),
% send iq result
ResIQ = xmpp:make_iq_result(IQ, #mix_client_leave{leave = Leave}),
ejabberd_router:route(ResIQ);
process_leave_result(Err, IQ) ->