Comparison

plugins/muc/muc.lib.lua @ 3393:5b8de0731c4d

MUC: Store the nick (full room JID) which set the subject, and send subject to occupants from that JID.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 20 Jul 2010 17:39:02 +0500
parent 3361:8d4e7c231d3e
child 3445:2fde9cb97f76
comparison
equal deleted inserted replaced
3392:6e31b49c4ab8 3393:5b8de0731c4d
204 msg.attr.to = to; 204 msg.attr.to = to;
205 self:_route_stanza(msg); 205 self:_route_stanza(msg);
206 end 206 end
207 end 207 end
208 if self._data['subject'] then 208 if self._data['subject'] then
209 self:_route_stanza(st.message({type='groupchat', from=self.jid, to=to}):tag("subject"):text(self._data['subject'])); 209 self:_route_stanza(st.message({type='groupchat', from=self._data['subject_from'] or self.jid, to=to}):tag("subject"):text(self._data['subject']));
210 end 210 end
211 end 211 end
212 212
213 function room_mt:get_disco_info(stanza) 213 function room_mt:get_disco_info(stanza)
214 return st.reply(stanza):query("http://jabber.org/protocol/disco#info") 214 return st.reply(stanza):query("http://jabber.org/protocol/disco#info")
231 end 231 end
232 function room_mt:set_subject(current_nick, subject) 232 function room_mt:set_subject(current_nick, subject)
233 -- TODO check nick's authority 233 -- TODO check nick's authority
234 if subject == "" then subject = nil; end 234 if subject == "" then subject = nil; end
235 self._data['subject'] = subject; 235 self._data['subject'] = subject;
236 self._data['subject_from'] = current_nick;
236 if self.save then self:save(); end 237 if self.save then self:save(); end
237 local msg = st.message({type='groupchat', from=current_nick}) 238 local msg = st.message({type='groupchat', from=current_nick})
238 :tag('subject'):text(subject):up(); 239 :tag('subject'):text(subject):up();
239 self:broadcast_message(msg, false); 240 self:broadcast_message(msg, false);
240 return true; 241 return true;