Software /
code /
prosody-modules
Comparison
mod_firewall/conditions.lib.lua @ 5816: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 |
parent | 5815:14e17927c0ec |
comparison
equal
deleted
inserted
replaced
5815:14e17927c0ec | 5816:e304e19536f2 |
---|---|
203 function condition_handlers.MAY(permission_to_check) | 203 function condition_handlers.MAY(permission_to_check) |
204 return ("module:may(%q, event)"):format(permission_to_check); | 204 return ("module:may(%q, event)"):format(permission_to_check); |
205 end | 205 end |
206 | 206 |
207 function condition_handlers.TO_ROLE(role_name) | 207 function condition_handlers.TO_ROLE(role_name) |
208 return ("get_jid_role(bare_to, current_host).name == %q"):format(role_name), { "get_jid_role", "current_host", "bare_to" }; | 208 return ("recipient_role and recipient_role.name == %q"):format(role_name), { "recipient_role" }; |
209 end | 209 end |
210 | 210 |
211 function condition_handlers.FROM_ROLE(role_name) | 211 function condition_handlers.FROM_ROLE(role_name) |
212 return ("get_jid_role(bare_from, current_host).name == %q"):format(role_name), { "get_jid_role", "current_host", "bare_from" }; | 212 return ("sender_role and sender_role.name == %q"):format(role_name), { "sender_role" }; |
213 end | 213 end |
214 | 214 |
215 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 }; | 215 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 }; |
216 | 216 |
217 local function current_time_check(op, hour, minute) | 217 local function current_time_check(op, hour, minute) |