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]),
|| {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,
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,