plugins.groupchat: Trying to get subject to behave properly

Wed, 19 Jan 2011 20:37:12 +0100

author
Kim Alvefur <zash@zash.se>
date
Wed, 19 Jan 2011 20:37:12 +0100
changeset 185
4f897d0e01c4
parent 184
8173e57522bf
child 186
bb34b8bc00ae

plugins.groupchat: Trying to get subject to behave properly

plugins/groupchat.lua file | annotate | diff | comparison | revisions
--- a/plugins/groupchat.lua	Thu Jan 13 00:23:17 2011 +0100
+++ b/plugins/groupchat.lua	Wed Jan 19 20:37:12 2011 +0100
@@ -38,7 +38,7 @@
 		end
 		local room = setmetatable({
 			stream = stream, jid = jid, nick = nick,
-			subject = "",
+			subject = nil,
 			occupants = {},
 			events = events.new()
 		}, room_mt);
@@ -80,8 +80,9 @@
 		end);
 		room:hook("message", function(msg)
 			local subject = msg.stanza:get_child("subject");
+			subject = subject and subject:get_text();
 			if subject then
-				room.subject = subject and subject:get_text() or "";
+				room.subject = #subject > 0 and subject or nil;
 			end
 		end);
 		local join_st = st.presence({to = jid.."/"..nick})

mercurial