Software /
code /
prosody-modules
Comparison
mod_carbons/mod_carbons.lua @ 463:7d6a05f94941
mod_carbons: Fix top_resources loop and correctly stamp sent messages (thanks xnyhps)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 30 Oct 2011 01:41:33 +0200 |
parent | 462:f28a3f260fc2 |
child | 480:0cef5be669de |
comparison
equal
deleted
inserted
replaced
462:f28a3f260fc2 | 463:7d6a05f94941 |
---|---|
59 from = bare_jid, | 59 from = bare_jid, |
60 to = full_jid, | 60 to = full_jid, |
61 type = orig_type, | 61 type = orig_type, |
62 } | 62 } |
63 :tag("forwarded", { xmlns = xmlns_forward }) | 63 :tag("forwarded", { xmlns = xmlns_forward }) |
64 :tag("received", { xmlns = xmlns_carbons }):up() | 64 :tag("sent", { xmlns = xmlns_carbons }):up() |
65 :add_child(msg); | 65 :add_child(msg); |
66 core_route_stanza(origin, fwd); | 66 core_route_stanza(origin, fwd); |
67 end | 67 end |
68 end | 68 end |
69 end | 69 end |
90 local no_carbon_to = {}; | 90 local no_carbon_to = {}; |
91 if resource then | 91 if resource then |
92 no_carbon_to[resource] = true; | 92 no_carbon_to[resource] = true; |
93 else | 93 else |
94 local top_resources = user_sessions.top_resources; | 94 local top_resources = user_sessions.top_resources; |
95 for i=1,top_resources do | 95 for i, session in ipairs(top_resources) do |
96 no_carbon_to[top_resources[i]] = true; | 96 no_carbon_to[session.resource] = true; |
97 module:log("debug", "not going to send to /%s", resource); | |
97 end | 98 end |
98 end | 99 end |
99 | 100 |
100 if not stanza:get_child("private", xmlns_carbons) | 101 if not stanza:get_child("private", xmlns_carbons) |
101 and not stanza:get_child("forwarded", xmlns_forward) then | 102 and not stanza:get_child("forwarded", xmlns_forward) then |
121 | 122 |
122 -- Stanzas sent by local clients | 123 -- Stanzas sent by local clients |
123 module:hook("pre-message/bare", c2s_message_handler, 1); | 124 module:hook("pre-message/bare", c2s_message_handler, 1); |
124 module:hook("pre-message/full", c2s_message_handler, 1); | 125 module:hook("pre-message/full", c2s_message_handler, 1); |
125 -- Stanszas to local clients | 126 -- Stanszas to local clients |
126 module:hook("message/bare", s2c_message_handler, 1); -- this will suck | 127 module:hook("message/bare", s2c_message_handler, 1); |
127 module:hook("message/full", s2c_message_handler, 1); | 128 module:hook("message/full", s2c_message_handler, 1); |
128 | 129 |
129 module:add_feature(xmlns_carbons); | 130 module:add_feature(xmlns_carbons); |