Comparison

plugins/muc/muc.lib.lua @ 8191:d43012448c1f

MUC: Use variable that actually exists (thanks Martin)
author Kim Alvefur <zash@zash.se>
date Sun, 06 Aug 2017 13:27:47 +0200
parent 8187:4d83876aac3e
child 8201:a0ad62a269df
child 8466:df970f76c720
comparison
equal deleted inserted replaced
8190:331caee0c774 8191:d43012448c1f
435 self._occupants[current_nick].sessions[from] = pr; 435 self._occupants[current_nick].sessions[from] = pr;
436 self:broadcast_presence(pr, from); 436 self:broadcast_presence(pr, from);
437 else -- change nick 437 else -- change nick
438 -- a MUC service MUST NOT allow empty or invisible Room Nicknames 438 -- a MUC service MUST NOT allow empty or invisible Room Nicknames
439 -- (i.e., Room Nicknames that consist only of one or more space characters). 439 -- (i.e., Room Nicknames that consist only of one or more space characters).
440 if not select(3, jid_split(nick)):find("[^ ]") then -- resourceprep turns all whitespace into 0x20 440 if not select(3, jid_split(to)):find("[^ ]") then -- resourceprep turns all whitespace into 0x20
441 module:log("debug", "Rejecting invisible nickname"); 441 module:log("debug", "Rejecting invisible nickname");
442 origin.send(st.error_reply(stanza, "cancel", "not-allowed")); 442 origin.send(st.error_reply(stanza, "cancel", "not-allowed"));
443 return; 443 return;
444 end 444 end
445 local occupant = self._occupants[current_nick]; 445 local occupant = self._occupants[current_nick];
474 -- self:handle_to_occupant(origin, stanza); -- resend available 474 -- self:handle_to_occupant(origin, stanza); -- resend available
475 --end 475 --end
476 else -- enter room 476 else -- enter room
477 -- a MUC service MUST NOT allow empty or invisible Room Nicknames 477 -- a MUC service MUST NOT allow empty or invisible Room Nicknames
478 -- (i.e., Room Nicknames that consist only of one or more space characters). 478 -- (i.e., Room Nicknames that consist only of one or more space characters).
479 if not select(3, jid_split(nick)):find("[^ ]") then -- resourceprep turns all whitespace into 0x20 479 if not select(3, jid_split(to)):find("[^ ]") then -- resourceprep turns all whitespace into 0x20
480 module:log("debug", "Rejecting invisible nickname"); 480 module:log("debug", "Rejecting invisible nickname");
481 origin.send(st.error_reply(stanza, "cancel", "not-allowed")); 481 origin.send(st.error_reply(stanza, "cancel", "not-allowed"));
482 return; 482 return;
483 end 483 end
484 local new_nick = to; 484 local new_nick = to;