diff mod_firewall/conditions.lib.lua @ 5793:e304e19536f2

mod_firewall: TO/FROM ROLE: Handle JIDs with no role (thanks Zash)
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Dec 2023 19:06:37 +0000
parents 14e17927c0ec
children
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua	Mon Dec 11 19:09:25 2023 +0000
+++ b/mod_firewall/conditions.lib.lua	Tue Dec 12 19:06:37 2023 +0000
@@ -205,11 +205,11 @@
 end
 
 function condition_handlers.TO_ROLE(role_name)
-	return ("get_jid_role(bare_to, current_host).name == %q"):format(role_name), { "get_jid_role", "current_host", "bare_to" };
+	return ("recipient_role and recipient_role.name == %q"):format(role_name), { "recipient_role" };
 end
 
 function condition_handlers.FROM_ROLE(role_name)
-	return ("get_jid_role(bare_from, current_host).name == %q"):format(role_name), { "get_jid_role", "current_host", "bare_from" };
+	return ("sender_role and sender_role.name == %q"):format(role_name), { "sender_role" };
 end
 
 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 };