diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-06-06 18:22:29 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-06-06 18:22:29 +0500 |
commit | 6a2de54e78b5df4afb830941adb3fac75ae4e4c7 (patch) | |
tree | 586d7c610a713514acb7f336e7028763d45d4120 | |
parent | df5c3bcaafdc7b428adb9d0d0b2929e654855bae (diff) | |
download | prosody-6a2de54e78b5df4afb830941adb3fac75ae4e4c7.tar.gz prosody-6a2de54e78b5df4afb830941adb3fac75ae4e4c7.zip |
mod_pep: Maintain user nodes for delayed delivery
-rw-r--r-- | plugins/mod_pep.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua index 438b077d..b4ff82fb 100644 --- a/plugins/mod_pep.lua +++ b/plugins/mod_pep.lua @@ -7,6 +7,8 @@ local user_exists = require "core.usermanager".user_exists; local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; local pairs, ipairs = pairs, ipairs; +local data = {}; + local function publish(session, node, item) local stanza = st.message({from=session.full_jid, type='headline'}) :tag('event', {xmlns='http://jabber.org/protocol/pubsub#event'}) @@ -15,8 +17,14 @@ local function publish(session, node, item) :up() :up(); + local bare = session.username..'@'..session.host; + -- store for the future + local user_data = data[bare]; + if not user_data then user_data = {}; data[bare] = user_data; end + user_data[node] = stanza; + -- broadcast to resources - stanza.attr.to = session.username..'@'..session.host; + stanza.attr.to = bare; core_route_stanza(session, stanza); -- broadcast to contacts |