Mercurial > prosody-modules
comparison mod_firewall/actions.lib.lua @ 5537:4b9a7684ae02
mod_firewall: marks: Fix marking a user with no previous marks
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 08 Jun 2023 16:53:12 +0100 |
| parents | 96dec7681af8 |
| children | 40f8b9cc2065 |
comparison
equal
deleted
inserted
replaced
| 5536:96dec7681af8 | 5537:4b9a7684ae02 |
|---|---|
| 218 function action_handlers.UNMARK_ORIGIN(name) | 218 function action_handlers.UNMARK_ORIGIN(name) |
| 219 return [[session.firewall_marked_]]..idsafe(name)..[[ = nil;]] | 219 return [[session.firewall_marked_]]..idsafe(name)..[[ = nil;]] |
| 220 end | 220 end |
| 221 | 221 |
| 222 function action_handlers.MARK_USER(name) | 222 function action_handlers.MARK_USER(name) |
| 223 return ([[if session.firewall_marks then | 223 return ([[fire_event("firewall/marked/user", { |
| 224 fire_event("firewall/marked/user", { | |
| 225 username = session.username; | 224 username = session.username; |
| 226 mark = %q; | 225 mark = %q; |
| 227 timestamp = current_timestamp; | 226 timestamp = current_timestamp; |
| 228 }); | 227 }); |
| 229 end]]):format(idsafe(name)), { "timestamp" }; | 228 ]]):format(idsafe(name)), { "timestamp" }; |
| 230 end | 229 end |
| 231 | 230 |
| 232 function action_handlers.UNMARK_USER(name) | 231 function action_handlers.UNMARK_USER(name) |
| 233 return ([[if session.firewall_marks then | 232 return ([[fire_event("firewall/unmarked/user", { |
| 234 fire_event("firewall/unmarked/user", { | |
| 235 username = session.username; | 233 username = session.username; |
| 236 mark = %q; | 234 mark = %q; |
| 237 }); | 235 }); |
| 238 end]]):format(idsafe(name)); | 236 ]]):format(idsafe(name)); |
| 239 end | 237 end |
| 240 | 238 |
| 241 function action_handlers.ADD_TO(spec) | 239 function action_handlers.ADD_TO(spec) |
| 242 local list_name, value = spec:match("(%S+) (.+)"); | 240 local list_name, value = spec:match("(%S+) (.+)"); |
| 243 local meta_deps = {}; | 241 local meta_deps = {}; |
