# HG changeset patch # User tmolitor # Date 1527870274 -7200 # Node ID 2a918a8c47dbbf83e40492d70bcd0d4609d686ea # Parent 6b860de18a53269587961f7e5f78aa88526ce523 mod_cloud_notify: use next() instead of # operator and update README diff -r 6b860de18a53 -r 2a918a8c47db mod_cloud_notify/README.markdown --- 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: diff -r 6b860de18a53 -r 2a918a8c47db mod_cloud_notify/mod_cloud_notify.lua --- 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 = {};