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

Include <x/> tag in presence errors related to nick change

Refer to example 52 and example 53 of XEP-0045 for details.
Thanks to Daniel Gultsch for spotting this.
This commit is contained in:
Evgeniy Khramtsov 2017-12-09 23:13:20 +03:00
parent 614bd9dd72
commit ae66c17ec0

View File

@ -1011,22 +1011,25 @@ do_process_presence(Nick, #presence{from = From, type = available, lang = Lang}
{(StateData#state.config)#config.allow_visitor_nickchange, {(StateData#state.config)#config.allow_visitor_nickchange,
is_visitor(From, StateData)}} of is_visitor(From, StateData)}} of
{_, _, {false, true}} -> {_, _, {false, true}} ->
Packet1 = Packet#presence{sub_els = [#muc{}]},
ErrText = <<"Visitors are not allowed to change their " ErrText = <<"Visitors are not allowed to change their "
"nicknames in this room">>, "nicknames in this room">>,
Err = xmpp:err_not_allowed(ErrText, Lang), Err = xmpp:err_not_allowed(ErrText, Lang),
ejabberd_router:route_error(Packet, Err), ejabberd_router:route_error(Packet1, Err),
StateData; StateData;
{true, _, _} -> {true, _, _} ->
Packet1 = Packet#presence{sub_els = [#muc{}]},
ErrText = <<"That nickname is already in use by another " ErrText = <<"That nickname is already in use by another "
"occupant">>, "occupant">>,
Err = xmpp:err_conflict(ErrText, Lang), Err = xmpp:err_conflict(ErrText, Lang),
ejabberd_router:route_error(Packet, Err), ejabberd_router:route_error(Packet1, Err),
StateData; StateData;
{_, false, _} -> {_, false, _} ->
Packet1 = Packet#presence{sub_els = [#muc{}]},
ErrText = <<"That nickname is registered by another " ErrText = <<"That nickname is registered by another "
"person">>, "person">>,
Err = xmpp:err_conflict(ErrText, Lang), Err = xmpp:err_conflict(ErrText, Lang),
ejabberd_router:route_error(Packet, Err), ejabberd_router:route_error(Packet1, Err),
StateData; StateData;
_ -> _ ->
change_nick(From, Nick, StateData) change_nick(From, Nick, StateData)