-
Notifications
You must be signed in to change notification settings - Fork 8
/
bans.tcl
132 lines (117 loc) · 5.74 KB
/
bans.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# $Id: bans.tcl,v1.2 04/03/2016 05:41:42am GMT +12 (NZST) IRCSpeed Exp $
# Commands:
# !bans <=- shows channel ban list.
# !globans <=- shows global ban list.
# !addban *!*@banmask.etc reasons-for-ban <=- adds a channel ban.
# !delban *!*@banmask.etc <=- removes a channel ban.
# !gban *!*@banmask.etc reasons-for-ban <=- adds a global ban.
# !delgban *!*@banmask.etc <=- removes a global ban.
# MSGCMD: /msg botnick bans <=- shows global ban list.
# MSGCMD: /msg botnick bans #channel <=- shows channel ban list.
###################################################################
# Set global command trigger (default: !)
set banstriga "!"
# Set global access flags to use these commands (default: o)
# This global access flag is able to use: !bans, !globans, !gban, !delgban, !addban, !delban
set banglobflags o
# Set channel access flags to use these commands (default: m)
# This channel access flag is only able to use: !bans, !addban, !delban (like akick, for SOP)
set banchanflags m
proc getBanTriga {} {
global banstriga
return $banstriga
}
bind pub - ${banstriga}bans chan:bans
proc chan:bans {nick uhost hand chan arg} {
global banglobflags banchanflags
if {[matchattr [nick2hand $nick] $banglobflags|$banchanflags $chan]} {
putquick "PRIVMSG $chan :\002BANLIST\002 for $chan sent to $nick"
putserv "NOTICE $nick :********* \002$chan BanList\002 **********"
foreach botban [banlist $chan] {
putserv "NOTICE $nick :\002BOTBAN\002: $botban"
}
putserv "NOTICE $nick :********** \002$chan BanList \037END\037\002 **********"
}
}
bind pub - ${triga}globans glo:bans
proc glo:bans {nick uhost hand chan arg} {
global banglobflags
if {[matchattr [nick2hand $nick] $banglobflags]} {
putquick "PRIVMSG $chan :\002GLOBAL BANLIST\002 sent to $nick"
putquick "NOTICE $nick :********* \002Global BanList\002 **********"
foreach globan [banlist] {
putquick "NOTICE $nick :\002GLOBAN\002: $globan"
}
putquick "NOTICE $nick :********** \002Global BanList \037END\037\002 **********"
}
}
bind msg - bans ban:list
proc ban:list {nick uhost hand arg} {
global banglobflags banchanflags
if {([lindex $arg 0] == "") && ([matchattr [nick2hand $nick] $banglobflags])} {
putquick "NOTICE $nick :********** \002Global BanList\002 **********"
foreach globban [banlist] {
putquick "NOTICE $nick :\002GLOBBAN\002: $globban"
}
putquick "NOTICE $nick :********** \002Global BanList \037END\037\002 **********"
} else {
set chan [strlwr [lindex $arg 0]]
if {([lindex [split $arg] 0] != "") && ([matchattr [nick2hand $nick] $banglobflags|$banchanflags $chan])} {
putquick "NOTICE $nick :********** \002$chan BanList\002 **********"
foreach chanban [banlist $chan] {
putquick "NOTICE $nick :\002CHANBAN\002: $chanban"
}
putquick "NOTICE $nick :********** \002$chan BanList \037END\037\002 **********"
}
}
}
bind pub - ${banstriga}addban banint:pub
proc banint:pub {nick uhost hand chan arg} {
global banglobflags banchanflags
if {![matchattr [nick2hand $nick] $banglobflags|$banchanflags $chan]} {return}
set banmask [lindex [split $arg] 0]
if {$banmask == ""} {putquick "NOTICE $nick \037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getBanTriga]addban *!*@banmask.etc reason-for-ban"; return}
if {[isban $banmask $chan]} {putquick "PRIVMSG $chan :\037ERROR\037: Banmask already exists."; return}
set banreason [join [lrange [split $arg] 1 end]]
if {$banreason == ""} {putquick "NOTICE $nick \037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getBanTriga]addban *!*@banmask.etc reason-for-ban"; return}
putquick "MODE $chan +b $banmask"
newchanban "$chan" "$banmask" "$nick" "$banreason" 0
putquick "NOTICE $nick :Successfully Added Ban: $banmask for $chan"
return 0
}
bind pub - ${banstriga}delban unbanint:pub
proc unbanint:pub {nick uhost hand chan arg} {
global banglobflags banchanflags
if {![matchattr [nick2hand $nick] $banglobflags|$banchanflags $chan]} {return}
set unbanmask [lindex [split $arg] 0]
if {$unbanmask == ""} {putquick "NOTICE $nick \037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getBanTriga]delban *!*@banmask.etc"; return}
if {![isban $unbanmask $chan]} {putquick "PRIVMSG $chan :\037ERROR\037: Banmask not found."; return}
killchanban $chan $unbanmask
putquick "NOTICE $nick :Successfully Deleted Ban: $unbanmask for $chan"
return 0
}
bind pub - ${banstriga}gban gban:pub
proc gban:pub {nick uhost hand chan arg} {
global banglobflags
if {![matchattr [nick2hand $nick] $banglobflags]} {return}
set banmask [lindex [split $arg] 0]
if {$banmask == ""} {putquick "NOTICE $nick \037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getBanTriga]gban *!*@banmask.etc reason-for-ban"; return}
if {[isban $banmask]} {putquick "NOTICE $nick :\037ERROR\037: Banmask already exists."; return}
set banreason [join [lrange [split $arg] 1 end]]
if {$banreason == ""} {putquick "NOTICE $nick \037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getBanTriga]gban *!*@banmask.etc reason-for-ban"; return}
newban $banmask $nick $banreason 0
putquick "NOTICE $nick :Successfully Added Global Ban: $banmask for: [channels]"
return 0
}
bind pub - ${banstriga}delgban unbanglob:pub
proc unbanglob:pub {nick uhost hand chan arg} {
global banglobflags
if {![matchattr [nick2hand $nick] $banglobflags]} {return}
set unbanmask [lindex [split $arg] 0]
if {$unbanmask == ""} {putquick "NOTICE $nick \037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getBanTriga]delgban *!*@banmask.etc"; return}
if {![isban $unbanmask]} {putquick "NOTICE $nick :\037ERROR\037: Banmask not Found."; return}
killban $unbanmask
putquick "NOTICE $nick :Successfully Deleted Global Ban: $unbanmask for: [channels]"
return 0
}
putlog "LOADED .:Bans.tcl:. - istok @ IRCSpeed"