Diff

mod_http_muc_log/mod_http_muc_log.lua @ 1578:a68ec7a2dc02

mod_http_muc_log: Show only messages with presentable content
author Kim Alvefur <zash@zash.se>
date Thu, 20 Nov 2014 20:01:07 +0100
parent 1577:0a6974f2cb55
child 1579:9e784ddac236
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Thu Nov 20 19:56:22 2014 +0100
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Thu Nov 20 20:01:07 2014 +0100
@@ -271,22 +271,24 @@
 		subject = item:get_child_text("subject");
 		verb = nil;
 		if subject then
-			verb = "set the topic to";
+			verb, body = "set the topic to", subject;
 		elseif body and body:sub(1,4) == "/me " then
 			verb, body = body:sub(5), nil;
 		elseif item.name == "presence" then
 			verb = item.attr.type == "unavailable" and "has left" or "has joined";
 		end
-		logs[i], i = line_template { 
-			key = key;
-			datetime = datetime.datetime(when);
-			time = datetime.time(when);
-			verb = verb;
-			body = subject or body;
-			nick = select(3, jid_split(item.attr.from));
-			st_name = item.name;
-			st_type = item.attr.type;
-		}, i + 1;
+		if body or verb then
+			logs[i], i = line_template {
+				key = key;
+				datetime = datetime.datetime(when);
+				time = datetime.time(when);
+				verb = verb;
+				body = body;
+				nick = select(3, jid_split(item.attr.from));
+				st_name = item.name;
+				st_type = item.attr.type;
+			}, i + 1;
+		end
 		first = first or key;
 		last = key;
 	end