Mercurial > prosody-modules
comparison mod_firewall/mod_firewall.lua @ 6535:82b6a03b9dfa
mod_firewall: Remove obsolete and broken mark/unmark commands
Replaced by flags
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 11 May 2026 13:16:18 +0100 |
| parents | 5aeefc2251d4 |
| children | 24c34968dd45 |
comparison
equal
deleted
inserted
replaced
| 6534:5aeefc2251d4 | 6535:82b6a03b9dfa |
|---|---|
| 847 print(); | 847 print(); |
| 848 end | 848 end |
| 849 print("end -- End of file "..filename); | 849 print("end -- End of file "..filename); |
| 850 end | 850 end |
| 851 end | 851 end |
| 852 | |
| 853 | |
| 854 -- Console | |
| 855 | |
| 856 local console_env = module:shared("/*/admin_shell/env"); | |
| 857 | |
| 858 console_env.firewall = {}; | |
| 859 | |
| 860 function console_env.firewall:mark(user_jid, mark_name) | |
| 861 local username, host = jid.split(user_jid); | |
| 862 if not username or not hosts[host] then | |
| 863 return nil, "Invalid JID supplied"; | |
| 864 elseif not idsafe(mark_name) then | |
| 865 return nil, "Invalid characters in mark name"; | |
| 866 end | |
| 867 if not module:context(host):fire_event("firewall/marked/user", { | |
| 868 username = session.username; | |
| 869 mark = mark_name; | |
| 870 timestamp = os.time(); | |
| 871 }) then | |
| 872 return nil, "Mark not set - is mod_firewall loaded on that host?"; | |
| 873 end | |
| 874 return true, "User marked"; | |
| 875 end | |
| 876 | |
| 877 function console_env.firewall:unmark(jid, mark_name) | |
| 878 local username, host = jid.split(user_jid); | |
| 879 if not username or not hosts[host] then | |
| 880 return nil, "Invalid JID supplied"; | |
| 881 elseif not idsafe(mark_name) then | |
| 882 return nil, "Invalid characters in mark name"; | |
| 883 end | |
| 884 if not module:context(host):fire_event("firewall/unmarked/user", { | |
| 885 username = session.username; | |
| 886 mark = mark_name; | |
| 887 }) then | |
| 888 return nil, "Mark not removed - is mod_firewall loaded on that host?"; | |
| 889 end | |
| 890 return true, "User unmarked"; | |
| 891 end |
