Changeset

4608:4e8fa75cc678

mod_firewall: Remove reliance on full_sessions being a global While it exists as a global now, we want to move away from these globals eventually.
author Kim Alvefur <zash@zash.se>
date Wed, 30 Jun 2021 14:48:59 +0200
parents 4607:c8ccaac78f64
children 4609:fcfe691d6322
files mod_firewall/conditions.lib.lua mod_firewall/mod_firewall.lua
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua	Wed Jun 30 14:33:06 2021 +0200
+++ b/mod_firewall/conditions.lib.lua	Wed Jun 30 14:48:59 2021 +0200
@@ -304,7 +304,7 @@
 
 -- TO FULL JID?
 function condition_handlers.TO_FULL_JID()
-	return "not not full_sessions[to]", { "to" };
+	return "not not full_sessions[to]", { "to", "full_sessions" };
 end
 
 -- CHECK LIST: spammers contains $<@from>
--- a/mod_firewall/mod_firewall.lua	Wed Jun 30 14:33:06 2021 +0200
+++ b/mod_firewall/mod_firewall.lua	Wed Jun 30 14:48:59 2021 +0200
@@ -216,6 +216,9 @@
 			return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle);
 		end;
 	};
+	full_sessions = {
+		global_code = [[local full_sessions = prosody.full_sessions;]];
+	};
 	rostermanager = {
 		global_code = [[local rostermanager = require "core.rostermanager";]];
 	};