mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 01:39:35 +02:00
Compare commits
2 commits
053fd26994
...
7c1da7e0cf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7c1da7e0cf | ||
![]() |
e709f99b47 |
1 changed files with 26 additions and 0 deletions
|
@ -3221,6 +3221,7 @@ process_item_change(Item, SD, UJID) ->
|
|||
true ->
|
||||
send_kickban_presence(UJID, JID, Reason, 321, none, SD),
|
||||
maybe_send_affiliation(JID, none, SD),
|
||||
unsubscribe_from_room(JID, SD),
|
||||
SD1 = set_affiliation(JID, none, SD),
|
||||
set_role(JID, none, SD1);
|
||||
_ ->
|
||||
|
@ -3237,6 +3238,7 @@ process_item_change(Item, SD, UJID) ->
|
|||
{JID, affiliation, outcast, Reason} ->
|
||||
send_kickban_presence(UJID, JID, Reason, 301, outcast, SD),
|
||||
maybe_send_affiliation(JID, outcast, SD),
|
||||
unsubscribe_from_room(JID, SD),
|
||||
{result, undefined, SD2} =
|
||||
process_iq_mucsub(JID,
|
||||
#iq{type = set,
|
||||
|
@ -3279,6 +3281,30 @@ process_item_change(Item, SD, UJID) ->
|
|||
{error, xmpp:err_internal_server_error()}
|
||||
end.
|
||||
|
||||
-spec unsubscribe_from_room(jid(), state()) -> ok | error.
|
||||
unsubscribe_from_room(JID, SD) ->
|
||||
case SD#state.config#config.members_only of
|
||||
false ->
|
||||
ok;
|
||||
true ->
|
||||
case mod_muc:unhibernate_room(SD#state.server_host, SD#state.host, SD#state.room) of
|
||||
{error, Reason0} ->
|
||||
error;
|
||||
{ok, Pid} ->
|
||||
_UnsubPid =
|
||||
spawn(fun() ->
|
||||
case unsubscribe(Pid, JID) of
|
||||
ok ->
|
||||
ok;
|
||||
{error, Reason} ->
|
||||
?WARNING_MSG("Failed to automatically unsubscribe expelled member from room: ~ts",
|
||||
[Reason]),
|
||||
error
|
||||
end
|
||||
end)
|
||||
end
|
||||
end.
|
||||
|
||||
-spec find_changed_items(jid(), affiliation(), role(),
|
||||
[muc_item()], binary(), state(), [admin_action()]) ->
|
||||
{result, [admin_action()]}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue