equal
deleted
inserted
replaced
9 local datamanager = require "util.datamanager"; |
9 local datamanager = require "util.datamanager"; |
10 local datetime = require "util.datetime"; |
10 local datetime = require "util.datetime"; |
11 |
11 |
12 local jid_split = require "util.jid".split; |
12 local jid_split = require "util.jid".split; |
13 local jid_bare = require "util.jid".bare; |
13 local jid_bare = require "util.jid".bare; |
|
14 local jid_prep = require "util.jid".prep; |
14 local st = require "util.stanza"; |
15 local st = require "util.stanza"; |
15 local log = require "util.logger".init("mod_muc"); |
16 local log = require "util.logger".init("mod_muc"); |
16 local multitable_new = require "util.multitable".new; |
17 local multitable_new = require "util.multitable".new; |
17 local t_insert, t_remove = table.insert, table.remove; |
18 local t_insert, t_remove = table.insert, table.remove; |
18 local setmetatable = setmetatable; |
19 local setmetatable = setmetatable; |
410 local role = current_nick and self._occupants[current_nick].role or self:get_default_role(affiliation); |
411 local role = current_nick and self._occupants[current_nick].role or self:get_default_role(affiliation); |
411 local item = stanza.tags[1].tags[1]; |
412 local item = stanza.tags[1].tags[1]; |
412 if item and item.name == "item" then |
413 if item and item.name == "item" then |
413 if type == "set" then |
414 if type == "set" then |
414 local callback = function() origin.send(st.reply(stanza)); end |
415 local callback = function() origin.send(st.reply(stanza)); end |
|
416 if item.attr.jid then -- Validate provided JID |
|
417 item.attr.jid = jid_prep(item.attr.jid); |
|
418 if not item.attr.jid then |
|
419 origin.send(st.error_reply(stanza, "modify", "jid-malformed")); |
|
420 return; |
|
421 end |
|
422 end |
415 if not item.attr.jid and item.attr.nick then -- COMPAT Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation |
423 if not item.attr.jid and item.attr.nick then -- COMPAT Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation |
416 local occupant = self._occupants[self.jid.."/"..item.attr.nick]; |
424 local occupant = self._occupants[self.jid.."/"..item.attr.nick]; |
417 if occupant then item.attr.jid = occupant.jid; end |
425 if occupant then item.attr.jid = occupant.jid; end |
418 end |
426 end |
419 if item.attr.affiliation and item.attr.jid and not item.attr.role then |
427 if item.attr.affiliation and item.attr.jid and not item.attr.role then |