24 module:hook("iq/self/"..xmlns_carbons..":enable", toggle_carbons); |
24 module:hook("iq/self/"..xmlns_carbons..":enable", toggle_carbons); |
25 |
25 |
26 local function message_handler(event, c2s) |
26 local function message_handler(event, c2s) |
27 local origin, stanza = event.origin, event.stanza; |
27 local origin, stanza = event.origin, event.stanza; |
28 local orig_type = stanza.attr.type; |
28 local orig_type = stanza.attr.type; |
|
29 local orig_from = stanza.attr.from; |
29 local orig_to = stanza.attr.to; |
30 local orig_to = stanza.attr.to; |
30 |
31 |
31 if not (orig_type == nil |
32 if not (orig_type == nil |
32 or orig_type == "normal" |
33 or orig_type == "normal" |
33 or orig_type == "chat") then |
34 or orig_type == "chat") then |
34 return -- No carbons for messages of type error or headline |
35 return -- No carbons for messages of type error or headline |
35 end |
36 end |
36 |
37 |
37 -- Stanza sent by a local client |
38 -- Stanza sent by a local client |
38 local bare_jid = origin.username .. "@" .. origin.host; |
39 local bare_jid = origin.type == "c2s" and origin.username .. "@" .. origin.host or jid_bare(orig_from); |
39 local target_session = origin; |
40 local target_session = origin; |
40 local top_priority = false; |
41 local top_priority = false; |
41 local user_sessions = host_sessions[origin.username]; |
42 local user_sessions = host_sessions[origin.username]; |
42 |
43 |
43 -- Stanza about to be delivered to a local client |
44 -- Stanza about to be delivered to a local client |