Mercurial > prosody-modules
changeset 6350:908d44cfb693
mod_measure_active_users: Add support for mod_account_activity in Prosody 13.0
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 18 Dec 2025 10:43:50 +0000 |
| parents | 2d256ea0c157 |
| children | 1a08652c3fea |
| files | mod_measure_active_users/README.md mod_measure_active_users/mod_measure_active_users.lua |
| diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_measure_active_users/README.md Sat Dec 06 18:22:04 2025 +0000 +++ b/mod_measure_active_users/README.md Thu Dec 18 10:43:50 2025 +0000 @@ -37,4 +37,7 @@ Compatibility ============= -Requires Prosody 0.11 or later with mod_lastlog2 enabled. +Requires Prosody 13.0 or later with mod_account_activity enabled. + +Alternatively, supports Prosody 0.12 with the community module mod_lastlog2 +enabled.
--- a/mod_measure_active_users/mod_measure_active_users.lua Sat Dec 06 18:22:04 2025 +0000 +++ b/mod_measure_active_users/mod_measure_active_users.lua Thu Dec 18 10:43:50 2025 +0000 @@ -1,4 +1,8 @@ -local store = module:open_store("lastlog2"); +local is_prosody_13 = prosody.features:contains("loader"); -- proxy for mod_account_activity + +local activity_mod = is_prosody_13 and "account_activity" or "lastlog2"; + +local store = module:open_store(activity_mod); local measure_d1 = module:measure("active_users_1d", "amount"); local measure_d7 = module:measure("active_users_7d", "amount"); @@ -9,7 +13,7 @@ -- Exclude disabled user accounts from the counts if usermanager supports that API local count_disabled = module:get_option_boolean("measure_active_users_count_disabled", is_enabled == nil); -local get_last_active = module:depends("lastlog2").get_last_active; +local get_last_active = module:depends(activity_mod).get_last_active; function update_calculations() module:log("debug", "Calculating active users");
