Mercurial > prosody-modules
comparison mod_carbons/mod_carbons.lua @ 1789:dbce8a7726ef
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 | 7dbde05b48a9 |
| children | eefe4b69b5f6 |
comparison
equal
deleted
inserted
replaced
| 1788:d2b82b90c413 | 1789: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; |
