mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Provide meaningful text to user when admin kicks session (EJAB-1455)
This commit is contained in:
parent
2150b10901
commit
ac0e199d36
@ -1217,14 +1217,15 @@ handle_info({send_text, Text}, StateName, StateData) ->
|
||||
send_text(StateData, Text),
|
||||
ejabberd_hooks:run(c2s_loop_debug, [Text]),
|
||||
fsm_next_state(StateName, StateData);
|
||||
handle_info(replaced, _StateName, StateData) ->
|
||||
handle_info(replaced, StateName, StateData) ->
|
||||
Lang = StateData#state.lang,
|
||||
send_element(StateData,
|
||||
?SERRT_CONFLICT(Lang,
|
||||
<<"Replaced by new connection">>)),
|
||||
Xmlelement = ?SERRT_CONFLICT(Lang, <<"Replaced by new connection">>),
|
||||
handle_info({kick, replaced, Xmlelement}, StateName, StateData);
|
||||
handle_info({kick, Reason, Xmlelement}, _StateName, StateData) ->
|
||||
send_element(StateData, Xmlelement),
|
||||
send_trailer(StateData),
|
||||
{stop, normal,
|
||||
StateData#state{authenticated = replaced}};
|
||||
StateData#state{authenticated = Reason}};
|
||||
handle_info({route, _From, _To, {broadcast, Data}},
|
||||
StateName, StateData) ->
|
||||
?DEBUG("broadcast~n~p~n", [Data]),
|
||||
|
@ -1846,13 +1846,14 @@ set_form(From, Host, ?NS_ADMINL(<<"delete-user">>),
|
||||
|| {User, Server} <- ASL2],
|
||||
{result, []};
|
||||
set_form(From, Host, ?NS_ADMINL(<<"end-user-session">>),
|
||||
_Lang, XData) ->
|
||||
Lang, XData) ->
|
||||
AccountString = get_value(<<"accountjid">>, XData),
|
||||
JID = jlib:string_to_jid(AccountString),
|
||||
LUser = JID#jid.luser,
|
||||
LServer = JID#jid.lserver,
|
||||
true = LServer == Host orelse
|
||||
get_permission_level(From) == global,
|
||||
Xmlelement = ?SERRT_POLICY_VIOLATION(Lang, <<"has been kicked">>),
|
||||
case JID#jid.lresource of
|
||||
<<>> ->
|
||||
SIDs = mnesia:dirty_select(session,
|
||||
@ -1860,14 +1861,14 @@ set_form(From, Host, ?NS_ADMINL(<<"end-user-session">>),
|
||||
usr = {LUser, LServer, '_'},
|
||||
_ = '_'},
|
||||
[], ['$1']}]),
|
||||
[Pid ! replaced || {_, Pid} <- SIDs];
|
||||
[Pid ! {kick, kicked_by_admin, Xmlelement} || {_, Pid} <- SIDs];
|
||||
R ->
|
||||
[{_, Pid}] = mnesia:dirty_select(session,
|
||||
[{#session{sid = '$1',
|
||||
usr = {LUser, LServer, R},
|
||||
_ = '_'},
|
||||
[], ['$1']}]),
|
||||
Pid ! replaced
|
||||
Pid ! {kick, kicked_by_admin, Xmlelement}
|
||||
end,
|
||||
{result, []};
|
||||
set_form(From, Host,
|
||||
|
Loading…
Reference in New Issue
Block a user