Software / code / prosody-modules
Annotate
mod_measure_active_users/mod_measure_active_users.lua @ 6296:1661f6a74141
Multible community modules: Update Readme
diff --git a/mod_admin_blocklist/README.md b/mod_admin_blocklist/README.md
--- a/mod_admin_blocklist/README.md
+++ b/mod_admin_blocklist/README.md
@@ -24,8 +24,9 @@ admin_blocklist_roles = { "prosody:opera
# Compatibility
Prosody-Version Status
- --------------- ------
- trunk* Works
- 0.12 Works
+ -------------- ------
+ trunk* Works
+ 13 Works
+ 0.12 Works
-*as of 2024-12-21
+ *as of 2025-06-13
diff --git a/mod_audit/README.md b/mod_audit/README.md
--- a/mod_audit/README.md
+++ b/mod_audit/README.md
@@ -52,6 +52,7 @@ prosodyctl mod_audit user@example.com
# Compatibilty
-Requires Prosody **trunk** as of 2025-02-11.
-
-Does not work with Prosody 0.12 or earlier.
+ Prosody-Version Status
+ ----- ------
+ 13 Works
+ 0.12 Does not work
diff --git a/mod_csi_grace_period/README.md b/mod_csi_grace_period/README.md
--- a/mod_csi_grace_period/README.md
+++ b/mod_csi_grace_period/README.md
@@ -16,9 +16,9 @@ pocket is not the best use of radio time
Works with [mod_csi_simple][doc:modules:mod_csi_simple] which is
included with Prosody.
- ------- --------------
- trunk* Works
- 0.12 Works
- ------- --------------
+ ------- -------
+ trunk* Works
+ 13 Works
+ 0.12 Works
-*as of 2024-10-22
+ *as of 2025-06-13
diff --git a/mod_http_upload_external/README.md b/mod_http_upload_external/README.md
--- a/mod_http_upload_external/README.md
+++ b/mod_http_upload_external/README.md
@@ -19,7 +19,6 @@ Implementations
* [PHP implementation](https://hg.prosody.im/prosody-modules/raw-file/tip/mod_http_upload_external/share.php)
* [Python3+Flask implementation](https://github.com/horazont/xmpp-http-upload)
* [Go implementation, Prosody Filer](https://github.com/ThomasLeister/prosody-filer)
-* [Go implementation, HMAC File Server](https://github.com/PlusOne/hmac-file-server)
* [Perl implementation for nginx](https://github.com/weiss/ngx_http_upload)
* [Rust implementation](https://gitlab.com/nyovaya/xmpp-http-upload)
@@ -88,9 +87,10 @@ Compatibility
=============
Prosody-Version Status
- ---------------- --------------------
- trunk Works as of 24-12-12
- 0.12 Works
+ ---------------- --------------------
+ trunk Works as of 25-06-13
+ 13 Works
+ 0.12 Works
Implementation
==============
diff --git a/mod_muc_moderation/README.md b/mod_muc_moderation/README.md
--- a/mod_muc_moderation/README.md
+++ b/mod_muc_moderation/README.md
@@ -27,10 +27,11 @@ modules_enabled = {
# Compatibility
- ------- ---------------
- trunk Works^[as of 2024-10-22]
- 0.12 Works
- ------- ---------------
+ ------- ---------------
+ trunk Works^[as of 2025-06-13]
+ 13 Works
+ 0.12 Works
+ ------- ---------------
## XEP version
diff --git a/mod_s2s_idle_timeout/README.md b/mod_s2s_idle_timeout/README.md
--- a/mod_s2s_idle_timeout/README.md
+++ b/mod_s2s_idle_timeout/README.md
@@ -25,9 +25,10 @@ Compatibility
=============
Prosody Version Status
- ----------------- -----------
- trunk[^1] Works
- 0.12 Works
- ----------------- -----------
+ ----------------- -----------
+ trunk[^1] Works
+ 13 Works
+ 0.12 Works
+ ----------------- -----------
-[^1]: as of 2024-10-22
+[^1]: as of 2025-06-13
diff --git a/mod_s2s_keepalive/README.md b/mod_s2s_keepalive/README.md
--- a/mod_s2s_keepalive/README.md
+++ b/mod_s2s_keepalive/README.md
@@ -34,9 +34,10 @@ Compatibility
=============
Prosody Version Status
- ----------------- -----------
- trunk[^1] Works
- 0.12 Works
- ----------------- -----------
+ ----------------- -----------
+ trunk[^1] Works
+ 13 Works
+ 0.12 Works
+ ----------------- -----------
-[^1]: as of 2024-11-11
+[^1]: as of 2025-06-13
| author | Menel <menel@snikket.de> |
|---|---|
| date | Fri, 13 Jun 2025 09:53:41 +0200 |
| parent | 5887:ca62f9984f4b |
| rev | line source |
|---|---|
|
4774
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local store = module:open_store("lastlog2"); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 local measure_d1 = module:measure("active_users_1d", "amount"); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 local measure_d7 = module:measure("active_users_7d", "amount"); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 local measure_d30 = module:measure("active_users_30d", "amount"); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 |
|
5800
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
7 local is_enabled = require "core.usermanager".user_is_enabled; |
|
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
8 |
|
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
9 -- Exclude disabled user accounts from the counts if usermanager supports that API |
|
5814
9d3d719db285
mod_measure_active_users: Fix inverted logic (thanks mirux)
Matthew Wild <mwild1@gmail.com>
parents:
5801
diff
changeset
|
10 local count_disabled = module:get_option_boolean("measure_active_users_count_disabled", is_enabled == nil); |
|
5800
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
11 |
|
5801
32d662015a84
mod_measure_active_users: Use the new mod_lastlog2 API
Matthew Wild <mwild1@gmail.com>
parents:
5800
diff
changeset
|
12 local get_last_active = module:depends("lastlog2").get_last_active; |
|
32d662015a84
mod_measure_active_users: Use the new mod_lastlog2 API
Matthew Wild <mwild1@gmail.com>
parents:
5800
diff
changeset
|
13 |
|
4774
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 function update_calculations() |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 module:log("debug", "Calculating active users"); |
|
5800
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
16 local host = module.host; |
|
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
17 local host_user_sessions = prosody.hosts[host].sessions; |
|
4774
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 local active_d1, active_d7, active_d30 = 0, 0, 0; |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 local now = os.time(); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 for username in store:users() do |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 if host_user_sessions[username] then |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 -- Active now |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 active_d1, active_d7, active_d30 = |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 active_d1 + 1, active_d7 + 1, active_d30 + 1; |
|
5800
34b46d157797
mod_measure_active_users: Exclude disabled user accounts from counts
Matthew Wild <mwild1@gmail.com>
parents:
4774
diff
changeset
|
25 elseif count_disabled or is_enabled(username, host) then |
|
5801
32d662015a84
mod_measure_active_users: Use the new mod_lastlog2 API
Matthew Wild <mwild1@gmail.com>
parents:
5800
diff
changeset
|
26 local last_active = get_last_active(username); |
|
32d662015a84
mod_measure_active_users: Use the new mod_lastlog2 API
Matthew Wild <mwild1@gmail.com>
parents:
5800
diff
changeset
|
27 if last_active then |
|
4774
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 if now - last_active < 86400 then |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 active_d1 = active_d1 + 1; |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 if now - last_active < 86400*7 then |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 active_d7 = active_d7 + 1; |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 if now - last_active < 86400*30 then |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 active_d30 = active_d30 + 1; |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 module:log("debug", "Active users (took %ds): %d (24h), %d (7d), %d (30d)", os.time()-now, active_d1, active_d7, active_d30); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 measure_d1(active_d1); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 measure_d7(active_d7); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 measure_d30(active_d30); |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 end |
|
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 |
|
5887
ca62f9984f4b
mod_measure_active_users: Switch to mod_cron for scheduling
Matthew Wild <mwild1@gmail.com>
parents:
5814
diff
changeset
|
46 -- Schedule at startup |
|
4774
1132f2888cd2
mod_measure_active_users: Calculate active user counts over fixed time periods
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 module:add_timer(15, update_calculations); |
|
5887
ca62f9984f4b
mod_measure_active_users: Switch to mod_cron for scheduling
Matthew Wild <mwild1@gmail.com>
parents:
5814
diff
changeset
|
48 |
|
ca62f9984f4b
mod_measure_active_users: Switch to mod_cron for scheduling
Matthew Wild <mwild1@gmail.com>
parents:
5814
diff
changeset
|
49 -- Recalculate hourly |
|
ca62f9984f4b
mod_measure_active_users: Switch to mod_cron for scheduling
Matthew Wild <mwild1@gmail.com>
parents:
5814
diff
changeset
|
50 module:hourly(update_calculations); |