Diff

plugins/mod_carbons.lua @ 6811:82350a06df6e

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Wed, 02 Sep 2015 18:55:35 +0100
parent 6804:9f40ae38f0de
child 6841:be87ab2d611c
line wrap: on
line diff
--- a/plugins/mod_carbons.lua	Mon Aug 24 13:16:49 2015 +1000
+++ b/plugins/mod_carbons.lua	Wed Sep 02 18:55:35 2015 +0100
@@ -7,7 +7,7 @@
 local jid_bare = require "util.jid".bare;
 local xmlns_carbons = "urn:xmpp:carbons:2";
 local xmlns_forward = "urn:xmpp:forward:0";
-local full_sessions, bare_sessions = full_sessions, bare_sessions;
+local full_sessions, bare_sessions = prosody.full_sessions, prosody.bare_sessions;
 
 local function toggle_carbons(event)
 	local origin, stanza = event.origin, event.stanza;
@@ -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