summaryrefslogtreecommitdiff
path: root/mod_stanza_delay.lua
diff options
context:
space:
mode:
authorMatthew Fennell <matthew@fennell.dev>2026-01-12 22:34:32 +0000
committerMatthew Fennell <matthew@fennell.dev>2026-01-12 22:34:32 +0000
commit7c6888dda2ab0143509cd2d9096977feb8de9bec (patch)
treebc8d11e53a27dfec8df0af675728514a0d5f2564 /mod_stanza_delay.lua
Add mod_stanza_delaymain
Diffstat (limited to 'mod_stanza_delay.lua')
-rw-r--r--mod_stanza_delay.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/mod_stanza_delay.lua b/mod_stanza_delay.lua
new file mode 100644
index 0000000..f07ad12
--- /dev/null
+++ b/mod_stanza_delay.lua
@@ -0,0 +1,19 @@
+-- SPDX-FileCopyrightText: 2026 Matthew Fennell <matthew@fennell.dev>
+--
+-- SPDX-License-Identifier: AGPL-3.0-or-later
+
+-- This plugin delays IQs from any user named "user1" for 45 seconds.
+-- This is useful when testing Monal's MLPromises. By delaying the response for
+-- longer than the time an iOS app lives in the background, we can check what
+-- happens when a promise is handled by the notification service.
+
+function on_message(event)
+ local username = event.stanza:find"{jabber:iq:register}query/username#"
+ if (username == "user1") then
+ module:log("info", "Sleeping to give time to swipe away Monal");
+ os.execute("sleep 45")
+ module:log("info", "Done sleeping");
+ end
+end
+
+module:hook("iq/host", on_message, 9999);