Software /
code /
prosody-modules
Comparison
mod_muc_ban_ip/mod_muc_ban_ip.lua @ 1651:933403ee07ec
mod_muc_ban_ip: Cleanup [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Apr 2015 17:35:05 +0200 |
parent | 1647:8860405e2af6 |
child | 3403:823027110e29 |
comparison
equal
deleted
inserted
replaced
1650:66d67f0bae16 | 1651:933403ee07ec |
---|---|
20 end | 20 end |
21 banned_from[from] = true; | 21 banned_from[from] = true; |
22 module:log("debug", "Banned IP address %s from %s", ip, from); | 22 module:log("debug", "Banned IP address %s from %s", ip, from); |
23 end | 23 end |
24 | 24 |
25 function check_for_incoming_ban(event) | 25 local function check_for_incoming_ban(event) |
26 local stanza = event.stanza; | 26 local stanza = event.stanza; |
27 local to_session = full_sessions[stanza.attr.to]; | 27 local to_session = full_sessions[stanza.attr.to]; |
28 if to_session then | 28 if to_session then |
29 local directed = to_session.directed; | 29 local directed = to_session.directed; |
30 local from = stanza.attr.from; | 30 local from = stanza.attr.from; |
40 end | 40 end |
41 end | 41 end |
42 end | 42 end |
43 end | 43 end |
44 | 44 |
45 function check_for_ban(event) | 45 local function check_for_ban(event) |
46 local ip = event.origin.ip; | 46 local ip = event.origin.ip; |
47 local to = jid_bare(event.stanza.attr.to); | 47 local to = jid_bare(event.stanza.attr.to); |
48 if ip_bans[ip] and ip_bans[ip][to] then | 48 if ip_bans[ip] and ip_bans[ip][to] then |
49 event.origin.send(st.error_reply(event.stanza, "auth", "forbidden") | 49 event.origin.send(st.error_reply(event.stanza, "auth", "forbidden") |
50 :tag("x", { xmlns = xmlns_muc_user }) | 50 :tag("x", { xmlns = xmlns_muc_user }) |