]> granicus.if.org Git - ejabberd/commitdiff
Include <x/> tag in presence errors related to nick change
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Sat, 9 Dec 2017 20:13:20 +0000 (23:13 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Sat, 9 Dec 2017 20:13:20 +0000 (23:13 +0300)
Refer to example 52 and example 53 of XEP-0045 for details.
Thanks to Daniel Gultsch for spotting this.

src/mod_muc_room.erl

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