# HG changeset patch # User Waqas Hussain # Date 1244294549 -18000 # Node ID e1bfe78167610e2c88c03053e197ae0bccc234da # Parent f6e56a555c37a67ee834c9b399d6670d94973391 mod_pep: Maintain user nodes for delayed delivery diff -r f6e56a555c37 -r e1bfe7816761 plugins/mod_pep.lua --- a/plugins/mod_pep.lua Fri Jun 05 20:18:55 2009 +0100 +++ b/plugins/mod_pep.lua Sat Jun 06 18:22:29 2009 +0500 @@ -7,6 +7,8 @@ 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 @@ :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