MUC: Added legacy error codes to nickname conflict presence errors.

Fri, 25 Sep 2009 03:21:57 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Fri, 25 Sep 2009 03:21:57 +0500
changeset 1818
a394e0bd4847
parent 1817
5a86a9826b96
child 1819
ed1911be26c7

MUC: Added legacy error codes to nickname conflict presence errors.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Thu Sep 24 11:17:47 2009 +0100
+++ b/plugins/muc/muc.lib.lua	Fri Sep 25 03:21:57 2009 +0500
@@ -240,7 +240,9 @@
 					else -- change nick
 						if self._occupants[to] then
 							log("debug", "%s couldn't change nick", current_nick);
-							origin.send(st.error_reply(stanza, "cancel", "conflict"):tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+							local reply = st.error_reply(stanza, "cancel", "conflict"):up();
+							reply.tags[1].attr.code = "409";
+							origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
 						else
 							local data = self._occupants[current_nick];
 							local to_nick = select(3, jid_split(to));
@@ -272,7 +274,9 @@
 				end
 				if not new_nick then
 					log("debug", "%s couldn't join due to nick conflict: %s", from, to);
-					origin.send(st.error_reply(stanza, "cancel", "conflict"):tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+					local reply = st.error_reply(stanza, "cancel", "conflict"):up();
+					reply.tags[1].attr.code = "409";
+					origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
 				else
 					log("debug", "%s joining as %s", from, to);
 					if not next(self._affiliations) then -- new room, no owners

mercurial