Changeset

6191:5956f4e69ab2

plugins/muc/muc.lib: Subjects get sent even if empty.
author daurnimator <quae@daurnimator.com>
date Fri, 28 Mar 2014 20:25:10 -0400
parents 6190:6580e557cc61
children 6192:f97aa1f4b1f1
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 6 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Fri Mar 28 18:47:35 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Fri Mar 28 20:25:10 2014 -0400
@@ -424,26 +424,21 @@
 function room_mt:get_subject()
 	return self._data['subject'], self._data['subject_from']
 end
-local function create_subject_message(subject)
-	return st.message({type='groupchat'})
+local function create_subject_message(from, subject)
+	return st.message({from = from; type = "groupchat"})
 		:tag('subject'):text(subject):up();
 end
 function room_mt:send_subject(to)
-	local from, subject = self:get_subject()
-	if subject then
-		local msg = create_subject_message(subject)
-		msg.attr.from = from
-		msg.attr.to = to
-		self:route_stanza(msg);
-	end
+	local msg = create_subject_message(self:get_subject());
+	msg.attr.to = to;
+	self:route_stanza(msg);
 end
 function room_mt:set_subject(current_nick, subject)
 	if subject == "" then subject = nil; end
 	self._data['subject'] = subject;
 	self._data['subject_from'] = current_nick;
 	if self.save then self:save(); end
-	local msg = create_subject_message(subject)
-	msg.attr.from = current_nick
+	local msg = create_subject_message(current_nick, subject);
 	self:broadcast_message(msg, false);
 	return true;
 end