Comparison

plugins/muc/muc.lib.lua @ 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
parent 1745:15039fac3693
child 1749:cf2ade983e12
comparison
equal deleted inserted replaced
1745:15039fac3693 1746:3c60081ca10a
325 local role = current_nick and self._occupants[current_nick].role or self:get_default_role(affiliation); 325 local role = current_nick and self._occupants[current_nick].role or self:get_default_role(affiliation);
326 local item = stanza.tags[1].tags[1]; 326 local item = stanza.tags[1].tags[1];
327 if item and item.name == "item" then 327 if item and item.name == "item" then
328 if type == "set" then 328 if type == "set" then
329 local callback = function() origin.send(st.reply(stanza)); end 329 local callback = function() origin.send(st.reply(stanza)); end
330 if item.attr.affiliation and item.attr.jid and not item.attr.role and not item.attr.nick then 330 if not item.attr.jid and item.attr.nick then -- COMPAT Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation
331 local occupant = self._occupants[self.jid.."/"..item.attr.nick];
332 if occupant then item.attr.jid = occupant.jid; end
333 end
334 if item.attr.affiliation and item.attr.jid and not item.attr.role then
331 local success, errtype, err = self:set_affiliation(actor, item.attr.jid, item.attr.affiliation, callback); 335 local success, errtype, err = self:set_affiliation(actor, item.attr.jid, item.attr.affiliation, callback);
332 if not success then origin.send(st.error_reply(stanza, errtype, err)); end 336 if not success then origin.send(st.error_reply(stanza, errtype, err)); end
333 elseif item.attr.role and item.attr.nick and not item.attr.affiliation then 337 elseif item.attr.role and item.attr.nick and not item.attr.affiliation then
334 local success, errtype, err = self:set_role(actor, self.jid.."/"..item.attr.nick, item.attr.role, callback); 338 local success, errtype, err = self:set_role(actor, self.jid.."/"..item.attr.nick, item.attr.role, callback);
335 if not success then origin.send(st.error_reply(stanza, errtype, err)); end 339 if not success then origin.send(st.error_reply(stanza, errtype, err)); end