Mercurial > prosody-modules
changeset 3079:2a918a8c47db
mod_cloud_notify: use next() instead of # operator and update README
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Fri, 01 Jun 2018 18:24:34 +0200 (2018-06-01) |
parents | 6b860de18a53 |
children | b003d72d9ce6 |
files | mod_cloud_notify/README.markdown mod_cloud_notify/mod_cloud_notify.lua |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_cloud_notify/README.markdown Fri Jun 01 17:54:07 2018 +0200 +++ b/mod_cloud_notify/README.markdown Fri Jun 01 18:24:34 2018 +0200 @@ -18,6 +18,8 @@ App servers are notified about offline messages, messages stored by [mod_mam] or messages waiting in the smacks queue. +**Please note:** Multi client setups don't work properly if MAM is disabled and using +this module won't change this at all! The business rules outlined [here] are all honored[^2]. To cooperate with [mod_smacks] this module consumes some events:
--- a/mod_cloud_notify/mod_cloud_notify.lua Fri Jun 01 17:54:07 2018 +0200 +++ b/mod_cloud_notify/mod_cloud_notify.lua Fri Jun 01 18:24:34 2018 +0200 @@ -8,6 +8,7 @@ local s_match = string.match; local s_sub = string.sub; local os_time = os.time; +local next = next; local st = require"util.stanza"; local jid = require"util.jid"; local dataform = require"util.dataforms".new; @@ -360,7 +361,7 @@ -- http://xmpp.org/extensions/xep-0357.html#publishing local function handle_notify_request(stanza, node, user_push_services) local pushes = 0; - if not user_push_services or not #user_push_services then return pushes end + if not user_push_services or next(user_push_services) == nil then return pushes end for push_identifier, push_info in pairs(user_push_services) do local send_push = true; -- only send push to this node when not already done for this stanza or if no stanza is given at all @@ -496,7 +497,7 @@ -- only notify if the stanza destination is the mam user we store it for if event.for_user == to then local user_push_services = push_store:get(to); - if not #user_push_services then return end + if next(user_push_services) == nil then return end -- only notify nodes with no active sessions (smacks is counted as active and handled separate) local notify_push_sevices = {};