Software /
code /
prosody-modules
Changeset
3054:5e94061c1aa7
mod_delay: Don't break on smacks resume
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Mon, 28 May 2018 05:27:03 +0200 |
parents | 3052:e4a986d55bb2 |
children | 3055:6abee021d9db |
files | mod_delay/mod_delay.lua |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_delay/mod_delay.lua Sun May 27 17:49:46 2018 +0200 +++ b/mod_delay/mod_delay.lua Mon May 28 05:27:03 2018 +0200 @@ -1,3 +1,9 @@ +-- Copyright (C) 2016-2017 Thilo Molitor +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- + local add_filter = require "util.filters".add_filter; local remove_filter = require "util.filters".remove_filter; local datetime = require "util.datetime"; @@ -23,7 +29,12 @@ module:hook("resource-bind", function(event) add_filter(event.session, "stanzas/in", add_delay, 1); end); - +module:hook("smacks-hibernation-end", function(event) + -- older smacks module versions send only the "intermediate" session in event.session and no session.resumed one + if event.resumed then + add_filter(event.resumed, "stanzas/in", add_delay, 1); + end +end); module:hook("pre-resource-unbind", function (event) remove_filter(event.session, "stanzas/in", add_delay); end);