173 table.insert(code, ("(group_contains(%q, bare_to) and group_contains(%q, bare_from))"):format(group_name, group_name)) |
173 table.insert(code, ("(group_contains(%q, bare_to) and group_contains(%q, bare_from))"):format(group_name, group_name)) |
174 end |
174 end |
175 return "not "..table.concat(code, " or "), { "group_contains", "bare_to", "bare_from" }; |
175 return "not "..table.concat(code, " or "), { "group_contains", "bare_to", "bare_from" }; |
176 end |
176 end |
177 |
177 |
|
178 -- COMPAT w/0.12: Deprecated |
178 function condition_handlers.FROM_ADMIN_OF(host) |
179 function condition_handlers.FROM_ADMIN_OF(host) |
179 return ("is_admin(bare_from, %s)"):format(host ~= "*" and metaq(host) or nil), { "is_admin", "bare_from" }; |
180 return ("is_admin(bare_from, %s)"):format(host ~= "*" and metaq(host) or nil), { "is_admin", "bare_from" }; |
180 end |
181 end |
181 |
182 |
|
183 -- COMPAT w/0.12: Deprecated |
182 function condition_handlers.TO_ADMIN_OF(host) |
184 function condition_handlers.TO_ADMIN_OF(host) |
183 return ("is_admin(bare_to, %s)"):format(host ~= "*" and metaq(host) or nil), { "is_admin", "bare_to" }; |
185 return ("is_admin(bare_to, %s)"):format(host ~= "*" and metaq(host) or nil), { "is_admin", "bare_to" }; |
184 end |
186 end |
185 |
187 |
|
188 -- COMPAT w/0.12: Deprecated |
186 function condition_handlers.FROM_ADMIN() |
189 function condition_handlers.FROM_ADMIN() |
187 return ("is_admin(bare_from, current_host)"), { "is_admin", "bare_from", "current_host" }; |
190 return ("is_admin(bare_from, current_host)"), { "is_admin", "bare_from", "current_host" }; |
188 end |
191 end |
189 |
192 |
|
193 -- COMPAT w/0.12: Deprecated |
190 function condition_handlers.TO_ADMIN() |
194 function condition_handlers.TO_ADMIN() |
191 return ("is_admin(bare_to, current_host)"), { "is_admin", "bare_to", "current_host" }; |
195 return ("is_admin(bare_to, current_host)"), { "is_admin", "bare_to", "current_host" }; |
|
196 end |
|
197 |
|
198 -- MAY: permission_to_check |
|
199 function condition_handlers.MAY(permission_to_check) |
|
200 return ("module:may(%q, event)"):format(permission_to_check); |
|
201 end |
|
202 |
|
203 function condition_handlers.TO_ROLE(role_name) |
|
204 return ("get_jid_role(bare_to, current_host) == %q"):format(role_name), { "get_jid_role", "current_host", "bare_to" }; |
|
205 end |
|
206 |
|
207 function condition_handlers.FROM_ROLE(role_name) |
|
208 return ("get_jid_role(bare_from, current_host) == %q"):format(role_name), { "get_jid_role", "current_host", "bare_from" }; |
192 end |
209 end |
193 |
210 |
194 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 }; |
211 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 }; |
195 |
212 |
196 local function current_time_check(op, hour, minute) |
213 local function current_time_check(op, hour, minute) |