MUC: Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation.

Mon, 07 Sep 2009 20:36:29 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Mon, 07 Sep 2009 20:36:29 +0500
changeset 1746
3c60081ca10a
parent 1745
15039fac3693
child 1747
28e5f6b535a8

MUC: Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Mon Sep 07 20:35:09 2009 +0500
+++ b/plugins/muc/muc.lib.lua	Mon Sep 07 20:36:29 2009 +0500
@@ -327,7 +327,11 @@
 		if item and item.name == "item" then
 			if type == "set" then
 				local callback = function() origin.send(st.reply(stanza)); end
-				if item.attr.affiliation and item.attr.jid and not item.attr.role and not item.attr.nick then
+				if not item.attr.jid and item.attr.nick then -- COMPAT Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation
+					local occupant = self._occupants[self.jid.."/"..item.attr.nick];
+					if occupant then item.attr.jid = occupant.jid; end
+				end
+				if item.attr.affiliation and item.attr.jid and not item.attr.role then
 					local success, errtype, err = self:set_affiliation(actor, item.attr.jid, item.attr.affiliation, callback);
 					if not success then origin.send(st.error_reply(stanza, errtype, err)); end
 				elseif item.attr.role and item.attr.nick and not item.attr.affiliation then

mercurial