Comparison

plugins/muc/muc.lib.lua @ 5983:930109558aa2

MUC: Split out sending of the topic into method separate from sending history
author Kim Alvefur <zash@zash.se>
date Sat, 18 Jan 2014 18:11:13 +0100
parent 5982:2d5685c6262f
child 6004:09151d26560a
comparison
equal deleted inserted replaced
5982:2d5685c6262f 5983:930109558aa2
185 local msg = history[i].stanza; 185 local msg = history[i].stanza;
186 msg.attr.to = to; 186 msg.attr.to = to;
187 self:_route_stanza(msg); 187 self:_route_stanza(msg);
188 end 188 end
189 end 189 end
190 end
191 function room_mt:send_subject(to)
190 if self._data['subject'] then 192 if self._data['subject'] then
191 self:_route_stanza(st.message({type='groupchat', from=self._data['subject_from'] or self.jid, to=to}):tag("subject"):text(self._data['subject'])); 193 self:_route_stanza(st.message({type='groupchat', from=self._data['subject_from'] or self.jid, to=to}):tag("subject"):text(self._data['subject']));
192 end 194 end
193 end 195 end
194 196
514 pr:tag("status", {code='201'}):up(); 516 pr:tag("status", {code='201'}):up();
515 end 517 end
516 pr.attr.to = from; 518 pr.attr.to = from;
517 self:_route_stanza(pr); 519 self:_route_stanza(pr);
518 self:send_history(from, stanza); 520 self:send_history(from, stanza);
521 self:send_subject(from);
519 elseif not affiliation then -- registration required for entering members-only room 522 elseif not affiliation then -- registration required for entering members-only room
520 local reply = st.error_reply(stanza, "auth", "registration-required"):up(); 523 local reply = st.error_reply(stanza, "auth", "registration-required"):up();
521 reply.tags[1].attr.code = "407"; 524 reply.tags[1].attr.code = "407";
522 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 525 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
523 else -- banned 526 else -- banned