mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01: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:
parent
7564a4e953
commit
3bf0892c74
@ -293,6 +293,18 @@ process_join_result(#iq{from = Channel,
|
|||||||
#iq{to = To} = IQ) ->
|
#iq{to = To} = IQ) ->
|
||||||
case add_channel(To, Channel, ID) of
|
case add_channel(To, Channel, ID) of
|
||||||
ok ->
|
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),
|
ChanID = make_channel_id(Channel, ID),
|
||||||
Join1 = Join#mix_join{id = <<"">>, jid = ChanID},
|
Join1 = Join#mix_join{id = <<"">>, jid = ChanID},
|
||||||
ResIQ = xmpp:make_iq_result(IQ, #mix_client_join{join = Join1}),
|
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).
|
process_iq_error(Err, IQ).
|
||||||
|
|
||||||
-spec process_leave_result(iq(), iq()) -> ok.
|
-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}),
|
ResIQ = xmpp:make_iq_result(IQ, #mix_client_leave{leave = Leave}),
|
||||||
ejabberd_router:route(ResIQ);
|
ejabberd_router:route(ResIQ);
|
||||||
process_leave_result(Err, IQ) ->
|
process_leave_result(Err, IQ) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user