Changeset

1746:3c60081ca10a

MUC: Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 07 Sep 2009 20:36:29 +0500
parents 1745:15039fac3693
children 1747:28e5f6b535a8
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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