plugins/muc/subject.lib: If subject is not set by an occupant, it should come from room jid itself
authordaurnimator <quae@daurnimator.com>
Fri, 18 Apr 2014 12:20:07 -0400
changeset 6228 4968d18e2c1e
parent 6227 bb75c011b15e
child 6229 8aa59b73f801
plugins/muc/subject.lib: If subject is not set by an occupant, it should come from room jid itself
plugins/muc/subject.lib.lua
--- a/plugins/muc/subject.lib.lua	Fri Apr 18 12:19:33 2014 -0400
+++ b/plugins/muc/subject.lib.lua	Fri Apr 18 12:20:07 2014 -0400
@@ -43,7 +43,8 @@
 end);
 
 local function get_subject(room)
-	return room._data.subject_from, room._data.subject;
+	-- a <message/> stanza from the room JID (or from the occupant JID of the entity that set the subject)
+	return room._data.subject_from or room.jid, room._data.subject;
 end
 
 local function send_subject(room, to)
@@ -66,7 +67,7 @@
 
 -- Send subject to joining user
 module:hook("muc-occupant-joined", function(event)
-	event.room:send_subject(event.stanza.attr.from);
+	send_subject(event.room, event.stanza.attr.from);
 end, 20);
 
 -- Role check for subject changes