Changeset

6803:7ed87299dbf9

mod_carbons: Carbon chat messages or normal messages that have a body
author Kim Alvefur <zash@zash.se>
date Wed, 26 Aug 2015 17:35:41 +0200
parents 6802:442019e955dc
children 6804:9f40ae38f0de
files plugins/mod_carbons.lua
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_carbons.lua	Wed Aug 26 14:32:20 2015 +0200
+++ b/plugins/mod_carbons.lua	Wed Aug 26 17:35:41 2015 +0200
@@ -21,14 +21,12 @@
 
 local function message_handler(event, c2s)
 	local origin, stanza = event.origin, event.stanza;
-	local orig_type = stanza.attr.type;
+	local orig_type = stanza.attr.type or "normal";
 	local orig_from = stanza.attr.from;
 	local orig_to = stanza.attr.to;
 	
-	if not (orig_type == nil
-			or orig_type == "normal"
-			or orig_type == "chat") then
-		return -- No carbons for messages of type error or headline
+	if not(orig_type == "chat" or orig_type == "normal" and stanza:get_child("body")) then
+		return -- Only chat type messages
 	end
 
 	-- Stanza sent by a local client