Software /
code /
prosody
Comparison
plugins/mod_carbons.lua @ 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 |
parent | 6546:3426e903c48d |
child | 6804:9f40ae38f0de |
comparison
equal
deleted
inserted
replaced
6802:442019e955dc | 6803:7ed87299dbf9 |
---|---|
19 module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons); | 19 module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons); |
20 module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); | 20 module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); |
21 | 21 |
22 local function message_handler(event, c2s) | 22 local function message_handler(event, c2s) |
23 local origin, stanza = event.origin, event.stanza; | 23 local origin, stanza = event.origin, event.stanza; |
24 local orig_type = stanza.attr.type; | 24 local orig_type = stanza.attr.type or "normal"; |
25 local orig_from = stanza.attr.from; | 25 local orig_from = stanza.attr.from; |
26 local orig_to = stanza.attr.to; | 26 local orig_to = stanza.attr.to; |
27 | 27 |
28 if not (orig_type == nil | 28 if not(orig_type == "chat" or orig_type == "normal" and stanza:get_child("body")) then |
29 or orig_type == "normal" | 29 return -- Only chat type messages |
30 or orig_type == "chat") then | |
31 return -- No carbons for messages of type error or headline | |
32 end | 30 end |
33 | 31 |
34 -- Stanza sent by a local client | 32 -- Stanza sent by a local client |
35 local bare_jid = jid_bare(orig_from); | 33 local bare_jid = jid_bare(orig_from); |
36 local target_session = origin; | 34 local target_session = origin; |