mod_carbons: Carbon chat messages or normal messages that have a body
authorKim Alvefur <zash@zash.se>
Wed, 26 Aug 2015 15:35:41 +0000 (17:35 +0200)
committerKim Alvefur <zash@zash.se>
Wed, 26 Aug 2015 15:35:41 +0000 (17:35 +0200)
plugins/mod_carbons.lua

index 51242809d3c2e91c5d96c3ceccab90457a023d1d..dc5c05e065276dbada1631a1b81a731a9df123b5 100644 (file)
@@ -21,14 +21,12 @@ module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons);
 
 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