Software /
code /
prosody-modules
Annotate
mod_carbons/mod_carbons.lua @ 1151:28d4b58bcc3b
mod_carbons: Add support for XEP-0334: Message Processing Hints
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 11 Aug 2013 23:37:26 +0200 |
parent | 900:aca1c5eb0508 |
child | 1167:8ceab2331216 |
rev | line source |
---|---|
521
6d0d2673f95e
mod_carbons: Add MIT license statement.
Kim Alvefur <zash@zash.se>
parents:
520
diff
changeset
|
1 -- XEP-0280: Message Carbons implementation for Prosody |
6d0d2673f95e
mod_carbons: Add MIT license statement.
Kim Alvefur <zash@zash.se>
parents:
520
diff
changeset
|
2 -- Copyright (C) 2011 Kim Alvefur |
6d0d2673f95e
mod_carbons: Add MIT license statement.
Kim Alvefur <zash@zash.se>
parents:
520
diff
changeset
|
3 -- |
6d0d2673f95e
mod_carbons: Add MIT license statement.
Kim Alvefur <zash@zash.se>
parents:
520
diff
changeset
|
4 -- This file is MIT/X11 licensed. |
6d0d2673f95e
mod_carbons: Add MIT license statement.
Kim Alvefur <zash@zash.se>
parents:
520
diff
changeset
|
5 |
462 | 6 local st = require "util.stanza"; |
7 local jid_bare = require "util.jid".bare; | |
850
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
8 local xmlns_carbons = "urn:xmpp:carbons:2"; |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
9 local xmlns_carbons_old = "urn:xmpp:carbons:1"; |
884
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
10 local xmlns_carbons_really_old = "urn:xmpp:carbons:0"; |
462 | 11 local xmlns_forward = "urn:xmpp:forward:0"; |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
12 local full_sessions, bare_sessions = full_sessions, bare_sessions; |
462 | 13 |
804
9927d88a1b2a
mod_carbons: Merge enable and disable handlers
Kim Alvefur <zash@zash.se>
parents:
743
diff
changeset
|
14 local function toggle_carbons(event) |
462 | 15 local origin, stanza = event.origin, event.stanza; |
16 if stanza.attr.type == "set" then | |
804
9927d88a1b2a
mod_carbons: Merge enable and disable handlers
Kim Alvefur <zash@zash.se>
parents:
743
diff
changeset
|
17 local state = stanza.tags[1].name; |
9927d88a1b2a
mod_carbons: Merge enable and disable handlers
Kim Alvefur <zash@zash.se>
parents:
743
diff
changeset
|
18 module:log("debug", "%s %sd carbons", origin.full_jid, state); |
850
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
19 origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns; |
462 | 20 origin.send(st.reply(stanza)); |
21 return true | |
22 end | |
804
9927d88a1b2a
mod_carbons: Merge enable and disable handlers
Kim Alvefur <zash@zash.se>
parents:
743
diff
changeset
|
23 end |
9927d88a1b2a
mod_carbons: Merge enable and disable handlers
Kim Alvefur <zash@zash.se>
parents:
743
diff
changeset
|
24 module:hook("iq/self/"..xmlns_carbons..":disable", toggle_carbons); |
9927d88a1b2a
mod_carbons: Merge enable and disable handlers
Kim Alvefur <zash@zash.se>
parents:
743
diff
changeset
|
25 module:hook("iq/self/"..xmlns_carbons..":enable", toggle_carbons); |
462 | 26 |
850
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
27 -- COMPAT |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
28 module:hook("iq/self/"..xmlns_carbons_old..":disable", toggle_carbons); |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
29 module:hook("iq/self/"..xmlns_carbons_old..":enable", toggle_carbons); |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
30 |
884
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
31 -- COMPAT :( |
888
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
32 if module:get_option_boolean("carbons_v0") then |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
33 module:hook("iq/self/"..xmlns_carbons_really_old..":carbons", function(event) |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
34 local origin, stanza = event.origin, event.stanza; |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
35 if stanza.attr.type == "set" then |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
36 local state = stanza.tags[1].attr.mode; |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
37 origin.want_carbons = state == "enable" and xmlns_carbons_really_old; |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
38 origin.send(st.reply(stanza)); |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
39 return true; |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
40 end |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
41 end); |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
42 end |
884
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
43 |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
44 local function message_handler(event, c2s) |
462 | 45 local origin, stanza = event.origin, event.stanza; |
46 local orig_type = stanza.attr.type; | |
835
07cc1efde2f8
mod_carbons: Fix handling of messages from remote hosts
Kim Alvefur <zash@zash.se>
parents:
833
diff
changeset
|
47 local orig_from = stanza.attr.from; |
462 | 48 local orig_to = stanza.attr.to; |
49 | |
50 if not (orig_type == nil | |
51 or orig_type == "normal" | |
52 or orig_type == "chat") then | |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
53 return -- No carbons for messages of type error or headline |
462 | 54 end |
55 | |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
56 -- Stanza sent by a local client |
836
a86131581180
mod_carbons: Less complicated assignments (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
835
diff
changeset
|
57 local bare_jid = jid_bare(orig_from); |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
58 local target_session = origin; |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
59 local top_priority = false; |
836
a86131581180
mod_carbons: Less complicated assignments (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
835
diff
changeset
|
60 local user_sessions = bare_sessions[bare_jid]; |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
61 |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
62 -- Stanza about to be delivered to a local client |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
63 if not c2s then |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
64 bare_jid = jid_bare(orig_to); |
836
a86131581180
mod_carbons: Less complicated assignments (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
835
diff
changeset
|
65 target_session = full_sessions[orig_to]; |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
66 user_sessions = bare_sessions[bare_jid]; |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
67 if not target_session and user_sessions then |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
68 -- The top resources will already receive this message per normal routing rules, |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
69 -- so we are going to skip them in order to avoid sending duplicated messages. |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
70 local top_resources = user_sessions.top_resources; |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
71 top_priority = top_resources and top_resources[1].priority |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
72 end |
462 | 73 end |
74 | |
585
ce2798a1bc56
mod_carbons: Don't try to send carbons for entirely offline users.
Kim Alvefur <zash@zash.se>
parents:
545
diff
changeset
|
75 if not user_sessions then |
605
5175f6d33470
mod_carbons: Add more debug logging
Kim Alvefur <zash@zash.se>
parents:
585
diff
changeset
|
76 module:log("debug", "Skip carbons for offline user"); |
585
ce2798a1bc56
mod_carbons: Don't try to send carbons for entirely offline users.
Kim Alvefur <zash@zash.se>
parents:
545
diff
changeset
|
77 return -- No use in sending carbons to an offline user |
ce2798a1bc56
mod_carbons: Don't try to send carbons for entirely offline users.
Kim Alvefur <zash@zash.se>
parents:
545
diff
changeset
|
78 end |
ce2798a1bc56
mod_carbons: Don't try to send carbons for entirely offline users.
Kim Alvefur <zash@zash.se>
parents:
545
diff
changeset
|
79 |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
80 if not c2s and stanza:get_child("private", xmlns_carbons) then |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
81 stanza:maptags(function(tag) |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
82 return tag.attr.xmlns == xmlns_carbons |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
83 and tag.name == "private" and tag or nil; |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
84 end); |
605
5175f6d33470
mod_carbons: Add more debug logging
Kim Alvefur <zash@zash.se>
parents:
585
diff
changeset
|
85 module:log("debug", "Message tagged private, ignoring"); |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
86 return |
1151
28d4b58bcc3b
mod_carbons: Add support for XEP-0334: Message Processing Hints
Kim Alvefur <zash@zash.se>
parents:
900
diff
changeset
|
87 elseif stanza:get_child("no-copy", "urn:xmpp:hints") then |
28d4b58bcc3b
mod_carbons: Add support for XEP-0334: Message Processing Hints
Kim Alvefur <zash@zash.se>
parents:
900
diff
changeset
|
88 module:log("debug", "Message has no-copy hint, ignoring"); |
28d4b58bcc3b
mod_carbons: Add support for XEP-0334: Message Processing Hints
Kim Alvefur <zash@zash.se>
parents:
900
diff
changeset
|
89 return |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
90 end |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
91 |
832
9087431d35f6
mod_carbons: Add comments and rename some variables to make it clearer
Kim Alvefur <zash@zash.se>
parents:
804
diff
changeset
|
92 -- Create the carbon copy and wrap it as per the Stanza Forwarding XEP |
9087431d35f6
mod_carbons: Add comments and rename some variables to make it clearer
Kim Alvefur <zash@zash.se>
parents:
804
diff
changeset
|
93 local copy = st.clone(stanza); |
9087431d35f6
mod_carbons: Add comments and rename some variables to make it clearer
Kim Alvefur <zash@zash.se>
parents:
804
diff
changeset
|
94 copy.attr.xmlns = "jabber:client"; |
9087431d35f6
mod_carbons: Add comments and rename some variables to make it clearer
Kim Alvefur <zash@zash.se>
parents:
804
diff
changeset
|
95 local carbon = st.message{ from = bare_jid, type = orig_type, } |
896
d24d87ca3f5f
mod_carbons: <forwarded/> should be nested in <sent/>/<received/>
Florian Zeitz <florob@babelmonkeys.de>
parents:
888
diff
changeset
|
96 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }) |
664
2f11d2473afd
mod_carbons: Move creation of the carbon stanza out of the loop.
Kim Alvefur <zash@zash.se>
parents:
618
diff
changeset
|
97 :tag("forwarded", { xmlns = xmlns_forward }) |
832
9087431d35f6
mod_carbons: Add comments and rename some variables to make it clearer
Kim Alvefur <zash@zash.se>
parents:
804
diff
changeset
|
98 :add_child(copy):reset(); |
664
2f11d2473afd
mod_carbons: Move creation of the carbon stanza out of the loop.
Kim Alvefur <zash@zash.se>
parents:
618
diff
changeset
|
99 |
850
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
100 -- COMPAT |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
101 local carbon_old = st.message{ from = bare_jid, type = orig_type, } |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
102 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons_old }):up() |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
103 :tag("forwarded", { xmlns = xmlns_forward }) |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
104 :add_child(copy):reset(); |
0900ba54991e
mod_carbons: Update to latest version of XEP-0280, while supporting the old version.
Kim Alvefur <zash@zash.se>
parents:
837
diff
changeset
|
105 |
884
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
106 -- COMPAT |
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
107 local carbon_really_old = st.clone(stanza) |
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
108 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons_really_old }):up() |
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
109 |
618
267548522810
mod_carbons: Remove useless protection against loop that can't happen
Kim Alvefur <zash@zash.se>
parents:
617
diff
changeset
|
110 user_sessions = user_sessions and user_sessions.sessions; |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
111 for _, session in pairs(user_sessions) do |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
112 -- Carbons are sent to resources that have enabled it |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
113 if session.want_carbons |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
114 -- but not the resource that sent the message, or the one that it's directed to |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
115 and session ~= target_session |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
116 -- and isn't among the top resources that would receive the message per standard routing rules |
888
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
117 and (c2s or session.priority ~= top_priority) |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
118 -- don't send v0 carbons (or copies) for c2s |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
119 and (not c2s or session.want_carbons ~= xmlns_carbons_really_old) then |
833
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
120 carbon.attr.to = session.full_jid; |
30d49c26d219
mod_carbons: Optimize and clarify (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
832
diff
changeset
|
121 module:log("debug", "Sending carbon to %s", session.full_jid); |
884
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
122 local carbon = session.want_carbons == xmlns_carbons_old and carbon_old -- COMPAT |
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
123 or session.want_carbons == xmlns_carbons_really_old and carbon_really_old -- COMPAT |
2ece37bf9cc6
mod_carbons: Support the pre-forwarding version of Carbons. Please don't implement this.
Kim Alvefur <zash@zash.se>
parents:
854
diff
changeset
|
124 or carbon; |
832
9087431d35f6
mod_carbons: Add comments and rename some variables to make it clearer
Kim Alvefur <zash@zash.se>
parents:
804
diff
changeset
|
125 session.send(carbon); |
462 | 126 end |
127 end | |
128 end | |
129 | |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
130 local function c2s_message_handler(event) |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
131 return message_handler(event, true) |
462 | 132 end |
133 | |
134 -- Stanzas sent by local clients | |
900
aca1c5eb0508
mod_carbons: Catch outgoing messages to hosts (thanks waqas)
Kim Alvefur <zash@zash.se>
parents:
896
diff
changeset
|
135 module:hook("pre-message/host", c2s_message_handler, 1); |
462 | 136 module:hook("pre-message/bare", c2s_message_handler, 1); |
137 module:hook("pre-message/full", c2s_message_handler, 1); | |
510
59e80326f2b3
mod_carbons: Fix a typo and unindent a line.
Kim Alvefur <zash@zash.se>
parents:
480
diff
changeset
|
138 -- Stanzas to local clients |
480
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
139 module:hook("message/bare", message_handler, 1); |
0cef5be669de
mod_carbons: Consolidate message handlers
Kim Alvefur <zash@zash.se>
parents:
463
diff
changeset
|
140 module:hook("message/full", message_handler, 1); |
462 | 141 |
142 module:add_feature(xmlns_carbons); | |
854
1c64ab8ae374
mod_carbons: Advertise support for the previous version
Kim Alvefur <zash@zash.se>
parents:
850
diff
changeset
|
143 module:add_feature(xmlns_carbons_old); |
888
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
144 if module:get_option_boolean("carbons_v0") then |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
145 module:add_feature(xmlns_carbons_really_old); |
f8d08f8ed7de
mod_carbons: Make support for v0 disabled by default, don't send v0 carbons for c2s
Michael Holzt <kju@fqdn.org>
parents:
884
diff
changeset
|
146 end |