25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Degenderise room error message (#747)

This commit is contained in:
Badlop 2015-12-23 19:34:23 +01:00
parent 1f4916041e
commit c42e026f9c

View File

@ -225,8 +225,9 @@ normal_state({route, From, <<"">>,
<<"error">> -> <<"error">> ->
case is_user_online(From, StateData) of case is_user_online(From, StateData) of
true -> true ->
ErrorText = <<"This participant is kicked from the " ErrorText = <<"It is not allowed to send error messages to the"
"room because he sent an error message">>, " room. This participant (~s) sent an error "
"message (~s) and gets kicked from the room">>,
NewState = expulse_participant(Packet, From, StateData, NewState = expulse_participant(Packet, From, StateData,
translate:translate(Lang, translate:translate(Lang,
ErrorText)), ErrorText)),
@ -512,9 +513,9 @@ normal_state({route, From, ToNick,
of of
{expulse_sender, Reason} -> {expulse_sender, Reason} ->
?DEBUG(Reason, []), ?DEBUG(Reason, []),
ErrorText = <<"This participant is kicked from the " ErrorText = <<"It is not allowed to send error messages to the"
"room because he sent an error message " " room. This participant (~s) sent an error "
"to another participant">>, "message (~s) and gets kicked from the room">>,
NewState = expulse_participant(Packet, From, StateData, NewState = expulse_participant(Packet, From, StateData,
translate:translate(Lang, ErrorText)), translate:translate(Lang, ErrorText)),
{next_state, normal_state, NewState}; {next_state, normal_state, NewState};
@ -1053,9 +1054,9 @@ process_presence(From, Nick,
end, end,
remove_online_user(From, NewState, Reason); remove_online_user(From, NewState, Reason);
<<"error">> -> <<"error">> ->
ErrorText = ErrorText = <<"It is not allowed to send error messages to the"
<<"This participant is kicked from the " " room. This participant (~s) sent an error "
"room because he sent an error presence">>, "message (~s) and gets kicked from the room">>,
expulse_participant(Packet, From, StateData, expulse_participant(Packet, From, StateData,
translate:translate(Lang, translate:translate(Lang,
ErrorText)); ErrorText));
@ -1310,11 +1311,13 @@ get_error_condition2(Packet) ->
<- EEls], <- EEls],
{condition, Condition}. {condition, Condition}.
make_reason(Packet, From, StateData, Reason1) ->
{ok, #user{nick = FromNick}} = (?DICT):find(jlib:jid_tolower(From), StateData#state.users),
Condition = get_error_condition(Packet),
iolist_to_binary(io_lib:format(Reason1, [FromNick, Condition])).
expulse_participant(Packet, From, StateData, Reason1) -> expulse_participant(Packet, From, StateData, Reason1) ->
ErrorCondition = get_error_condition(Packet), Reason2 = make_reason(Packet, From, StateData, Reason1),
Reason2 = iolist_to_binary(
io_lib:format(binary_to_list(Reason1) ++ ": " ++ "~s",
[ErrorCondition])),
NewState = add_user_presence_un(From, NewState = add_user_presence_un(From,
#xmlel{name = <<"presence">>, #xmlel{name = <<"presence">>,
attrs = attrs =