Comparison

plugins/muc/muc.lib.lua @ 9022:293ebfed71f7

MUC: Simplify creation of <{muc}x> for room creation It’s only sent to the creator so no need to have separate variants for different kinds of participants.
author Kim Alvefur <zash@zash.se>
date Thu, 12 Jul 2018 01:23:19 +0200
parent 9017:1184f5762592
child 9023:ce461a67d2cc
comparison
equal deleted inserted replaced
9021:548ba4090012 9022:293ebfed71f7
437 local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";}); 437 local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";});
438 dest_x:tag("status", {code = "201"}):up(); 438 dest_x:tag("status", {code = "201"}):up();
439 if self:get_whois() == "anyone" then 439 if self:get_whois() == "anyone" then
440 dest_x:tag("status", {code = "100"}):up(); 440 dest_x:tag("status", {code = "100"}):up();
441 end 441 end
442 local self_x;
443 if nick_changed then 442 if nick_changed then
444 self_x = st.clone(dest_x); 443 dest_x:tag("status", {code = "210"}):up();
445 self_x:tag("status", {code = "210"}):up();
446 end 444 end
447 self:save_occupant(dest_occupant); 445 self:save_occupant(dest_occupant);
448 446
449 self:publicise_occupant_status(dest_occupant, {base = dest_x, self = self_x}); 447 self:publicise_occupant_status(dest_occupant, dest_x);
450 448
451 module:fire_event("muc-occupant-joined", { 449 module:fire_event("muc-occupant-joined", {
452 room = self; 450 room = self;
453 nick = dest_occupant.nick; 451 nick = dest_occupant.nick;
454 occupant = dest_occupant; 452 occupant = dest_occupant;