Software /
code /
prosody
Annotate
plugins/mod_carbons.lua @ 6898:d01254d5a825
net.websocket.frames: Pack and unpack 64bit ints without overflows (lua-bitop/bit32 are 32bit)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 06 Oct 2015 18:03:04 +0200 |
parent | 6841:be87ab2d611c |
child | 7670:2be85cb3bc66 |
rev | line source |
---|---|
6546
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 -- XEP-0280: Message Carbons implementation for Prosody |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 -- Copyright (C) 2011 Kim Alvefur |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 -- |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 -- This file is MIT/X11 licensed. |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 local st = require "util.stanza"; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 local jid_bare = require "util.jid".bare; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 local xmlns_carbons = "urn:xmpp:carbons:2"; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 local xmlns_forward = "urn:xmpp:forward:0"; |
6804
9f40ae38f0de
mod_carbons: Get full_ and bare_sessions from the prosody global [luacheck]
Kim Alvefur <zash@zash.se>
parents:
6803
diff
changeset
|
10 local full_sessions, bare_sessions = prosody.full_sessions, prosody.bare_sessions; |
6546
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 local function toggle_carbons(event) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 local origin, stanza = event.origin, event.stanza; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 local state = stanza.tags[1].name; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 module:log("debug", "%s %sd carbons", origin.full_jid, state); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns; |
6841
be87ab2d611c
plugins: Explicitly return to halt event propagation (session.send sometimes does not return true)
Kim Alvefur <zash@zash.se>
parents:
6804
diff
changeset
|
17 origin.send(st.reply(stanza)); |
be87ab2d611c
plugins: Explicitly return to halt event propagation (session.send sometimes does not return true)
Kim Alvefur <zash@zash.se>
parents:
6804
diff
changeset
|
18 return true; |
6546
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 local function message_handler(event, c2s) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 local origin, stanza = event.origin, event.stanza; |
6803
7ed87299dbf9
mod_carbons: Carbon chat messages or normal messages that have a body
Kim Alvefur <zash@zash.se>
parents:
6546
diff
changeset
|
25 local orig_type = stanza.attr.type or "normal"; |
6546
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 local orig_from = stanza.attr.from; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 local orig_to = stanza.attr.to; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 |
6803
7ed87299dbf9
mod_carbons: Carbon chat messages or normal messages that have a body
Kim Alvefur <zash@zash.se>
parents:
6546
diff
changeset
|
29 if not(orig_type == "chat" or orig_type == "normal" and stanza:get_child("body")) then |
7ed87299dbf9
mod_carbons: Carbon chat messages or normal messages that have a body
Kim Alvefur <zash@zash.se>
parents:
6546
diff
changeset
|
30 return -- Only chat type messages |
6546
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 -- Stanza sent by a local client |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 local bare_jid = jid_bare(orig_from); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 local target_session = origin; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 local top_priority = false; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 local user_sessions = bare_sessions[bare_jid]; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 -- Stanza about to be delivered to a local client |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 if not c2s then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 bare_jid = jid_bare(orig_to); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 target_session = full_sessions[orig_to]; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 user_sessions = bare_sessions[bare_jid]; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 if not target_session and user_sessions then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 -- The top resources will already receive this message per normal routing rules, |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 -- so we are going to skip them in order to avoid sending duplicated messages. |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 local top_resources = user_sessions.top_resources; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
48 top_priority = top_resources and top_resources[1].priority |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
52 if not user_sessions then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
53 module:log("debug", "Skip carbons for offline user"); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 return -- No use in sending carbons to an offline user |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
55 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
56 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
57 if stanza:get_child("private", xmlns_carbons) then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
58 if not c2s then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
59 stanza:maptags(function(tag) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
60 if not ( tag.attr.xmlns == xmlns_carbons and tag.name == "private" ) then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
61 return tag; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
62 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
63 end); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
64 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
65 module:log("debug", "Message tagged private, ignoring"); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
66 return |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
67 elseif stanza:get_child("no-copy", "urn:xmpp:hints") then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
68 module:log("debug", "Message has no-copy hint, ignoring"); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
69 return |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
70 elseif stanza:get_child("x", "http://jabber.org/protocol/muc#user") then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
71 module:log("debug", "MUC PM, ignoring"); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 return |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
73 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
74 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
75 -- Create the carbon copy and wrap it as per the Stanza Forwarding XEP |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
76 local copy = st.clone(stanza); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
77 copy.attr.xmlns = "jabber:client"; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
78 local carbon = st.message{ from = bare_jid, type = orig_type, } |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
79 :tag(c2s and "sent" or "received", { xmlns = xmlns_carbons }) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
80 :tag("forwarded", { xmlns = xmlns_forward }) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
81 :add_child(copy):reset(); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
82 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
83 user_sessions = user_sessions and user_sessions.sessions; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
84 for _, session in pairs(user_sessions) do |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
85 -- Carbons are sent to resources that have enabled it |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
86 if session.want_carbons |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
87 -- but not the resource that sent the message, or the one that it's directed to |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
88 and session ~= target_session |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
89 -- and isn't among the top resources that would receive the message per standard routing rules |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
90 and (c2s or session.priority ~= top_priority) then |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
91 carbon.attr.to = session.full_jid; |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
92 module:log("debug", "Sending carbon to %s", session.full_jid); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
93 session.send(carbon); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
94 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
95 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
96 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
97 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
98 local function c2s_message_handler(event) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
99 return message_handler(event, true) |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
100 end |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
101 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
102 -- Stanzas sent by local clients |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
103 module:hook("pre-message/host", c2s_message_handler, 1); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
104 module:hook("pre-message/bare", c2s_message_handler, 1); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
105 module:hook("pre-message/full", c2s_message_handler, 1); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
106 -- Stanzas to local clients |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
107 module:hook("message/bare", message_handler, 1); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
108 module:hook("message/full", message_handler, 1); |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
109 |
3426e903c48d
mod_carbons: Import XEP-0280 implementation from prosody-modules (sans compat with older versions of the protocol)
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
110 module:add_feature(xmlns_carbons); |