mod_carbons/mod_carbons.lua
changeset 1793 dbce8a7726ef
parent 1343 7dbde05b48a9
child 1798 eefe4b69b5f6
equal deleted inserted replaced
1792:d2b82b90c413 1793:dbce8a7726ef
    26 module:hook("iq-set/self/"..xmlns_carbons_old..":enable", toggle_carbons);
    26 module:hook("iq-set/self/"..xmlns_carbons_old..":enable", toggle_carbons);
    27 module:hook("iq-set/self/"..xmlns_carbons_really_old..":carbons", toggle_carbons);
    27 module:hook("iq-set/self/"..xmlns_carbons_really_old..":carbons", toggle_carbons);
    28 
    28 
    29 local function message_handler(event, c2s)
    29 local function message_handler(event, c2s)
    30 	local origin, stanza = event.origin, event.stanza;
    30 	local origin, stanza = event.origin, event.stanza;
    31 	local orig_type = stanza.attr.type;
    31 	local orig_type = stanza.attr.type or "normal";
    32 	local orig_from = stanza.attr.from;
    32 	local orig_from = stanza.attr.from;
    33 	local orig_to = stanza.attr.to;
    33 	local orig_to = stanza.attr.to;
    34 
    34 
    35 	if not (orig_type == nil
    35 	if not(orig_type == "chat" or orig_type == "normal" and standard:get_child("body")) then
    36 			or orig_type == "normal"
    36 		return -- Only chat type messages
    37 			or orig_type == "chat") then
       
    38 		return -- No carbons for messages of type error or headline
       
    39 	end
    37 	end
    40 
    38 
    41 	-- Stanza sent by a local client
    39 	-- Stanza sent by a local client
    42 	local bare_jid = jid_bare(orig_from);
    40 	local bare_jid = jid_bare(orig_from);
    43 	local target_session = origin;
    41 	local target_session = origin;