diff options
Diffstat (limited to 'mod_stanza_delay.lua')
| -rw-r--r-- | mod_stanza_delay.lua | 19 |
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); |
