# HG changeset patch
# User Waqas Hussain <waqas20@gmail.com>
# Date 1279629542 -18000
# Node ID 5b8de0731c4d8ca3e17b34c34b0c64c2e7488adf
# Parent  6e31b49c4ab874a3db8538d617f9d60e86b8d9f5
MUC: Store the nick (full room JID) which set the subject, and send subject to occupants from that JID.

diff -r 6e31b49c4ab8 -r 5b8de0731c4d plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Tue Jul 20 12:37:28 2010 +0100
+++ b/plugins/muc/muc.lib.lua	Tue Jul 20 17:39:02 2010 +0500
@@ -206,7 +206,7 @@
 		end
 	end
 	if self._data['subject'] then
-		self:_route_stanza(st.message({type='groupchat', from=self.jid, to=to}):tag("subject"):text(self._data['subject']));
+		self:_route_stanza(st.message({type='groupchat', from=self._data['subject_from'] or self.jid, to=to}):tag("subject"):text(self._data['subject']));
 	end
 end
 
@@ -233,6 +233,7 @@
 	-- TODO check nick's authority
 	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 = st.message({type='groupchat', from=current_nick})
 		:tag('subject'):text(subject):up();