-
Notifications
You must be signed in to change notification settings - Fork 0
/
op.etcl
128 lines (125 loc) · 6.11 KB
/
op.etcl
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
###
# Usage: /msg botnick op [<channel>] [<nick1> <nick2> <nick3> ...]
###
### OP:
bind msg - op "msg_error msg_op"
bind pub - $set(cmd)op "pub_error pub_op"
### CHANNEL:
proc pub_op {nick uhost handle chan text} {
global set
chan_settings op c $nick $uhost $handle $chan $text
if {![validuser $handle] || [level $handle $chan] == "0" || ![auth_check $nick $uhost $handle $chan] || [backup_check $chan]} {
return
} elseif {[changet $chan nochanmsg]} {
notice $nick $handle "$set(cmd)commands have been disabled for $chan"
} elseif {[level $handle $chan] < [comget $chan op]} {
notice $nick $handle "Your level of [level $handle $chan] is less then the required [comget $chan op] for this command"
} elseif {[lindex $text 0] == "" && [level $handle $chan] < [changet $chan oprestrict]} {
notice $nick $handle "Your level of [level $handle $chan] is less then the required [changet $chan oprestrict] during this OpRestriction"
} elseif {[lindex $text 0] == ""} {
pushmode $chan +o $nick
putcmdlog "> !$handle! ($nick!$uhost) OP\[c\] ($chan)"
} else {
set n ""
set no ""
foreach u $text {
if {![onchan $u $chan] || [isop $u $chan]} {
continue
} elseif {[changet $chan oprestrict] == "0" || [matchattr [nick2hand $u] b]} {
set n $n,$u
pushmode $chan +o $u
} elseif {[nick2hand $u] != ""} {
if {![suspend [nick2hand $u] $chan] && [nickinfo [nick2hand $u] auth] && [level [nick2hand $u] $chan] >= [changet $chan oprestrict] && [nickinfo [nick2hand $u] userhost] == [getchanhost [nick2hand $u]]} {
set n $n,$u
pushmode $chan +o $u
} else {
set no "$no, $u"
}
} else {
set no "$no, $u"
}
}
notice $n $n "You were oped on $chan by $nick \[$handle\]"
if {$no != ""} {
notice $nick $handle "$chan is in OpRestrict mode, could not op these people: [string trimleft $no ", "]"
}
putcmdlog "> !$handle! ($nick!$uhost) OP\[c\] ($chan): $text"
}
}
### QUERY:
proc msg_op {nick uhost handle text} {
global set
if {![validuser $handle]} {
return
} elseif {[isspecial $handle [lindex $text 1]] >= "100" && [level $handle [lindex $text 0]] == "0"} {
if {[lindex $text 0] == ""} {
notice $nick $handle "Invalid request: Wheres the password?"
} elseif {![passwdok $handle [lindex $text 0]]} {
notice $nick $handle "Password mismatch for $handle"
putcmdlog "> !$handle! ($nick!$uhost) failed OP \[opermode\]"
} elseif {![string match #* [lindex $text 1]]} {
notice $nick $handle "Invalid request: [lindex $text 0] is not a channel"
} elseif {[passwdok $handle [lindex $text 0]] && [lindex $text 1] != ""} {
chan_settings op m $nick $uhost $handle [lindex $text 1] "*** Used Operator Power"
pushmode [lindex $text 1] +o $nick
homechan "\[$handle\]($nick!$uhost): op'd themselves on [lindex $text 1] - opermode"
putcmdlog "> !$handle! ($nick!$uhost) OP\[m\] [lindex $text 1] \[opermode\]"
} elseif {[passwdok $handle [lindex $text 0]]} {
foreach channel [comchan $nick] {
if {[botisop $channel] && ![isop $nick $channel]} {
pushmode $channel +o $nick
chan_settings op m $nick $uhost $handle $channel "*** Used Operator Power"
}
}
homechan "\[$handle\]($nick!$uhost): op'd themselves on all channels - opermode"
putcmdlog "> !$handle! ($nick!$uhost): op'd themselves on all channels \[opermode\]"
}
} elseif {[lindex $text 0] == ""} {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
notice $nick $handle "Invalid request: Wheres the channel name?"
} elseif {![string match #* [lindex $text 0]]} {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
notice $nick $handle "Invalid request: [lindex $text 0] is not a channel"
} elseif {![validchan [lindex $text 0]]} {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
notice $nick $handle "Invalid request: [lindex $text 0] is not a valid channel"
} elseif {![auth_check $nick $uhost $handle [lindex $text 0]] || [level $handle [lindex $text 0]] == "0"} {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
} elseif {[level $handle [lindex $text 0]] < [comget [lindex $text 0] op]} {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
notice $nick $handle "Your level of [level $handle [lindex $text 0]] is less then the required [comget [lindex $text 0] op] for this command"
} elseif {[lindex $text 1] == "" && [level $handle [lindex $text 0]] < [changet [lindex $text 0] oprestrict]} {
notice $nick $handle "Your level of [level $handle [lindex $text 0]] is less then the required [changet [lindex $text 0] oprestrict] during this OpRestriction"
} elseif {[lindex $text 1] == ""} {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
pushmode [lindex $text 0] +o $nick
putcmdlog "> !$handle! ($nick!$uhost) OP\[m\] ([lindex $text 0])"
} else {
chan_settings op m $nick $uhost $handle [lindex $text 0] $text
set chan [lindex $text 0]
set n ""
set no ""
foreach u $text {
if {![onchan $u $chan] || [isop $u $chan]} {
continue
} elseif {[changet $chan oprestrict] == "0" || [matchattr [nick2hand $u] b]} {
set n $n,$u
pushmode $chan +o $u
} elseif {[nick2hand $u] != ""} {
if {![suspend [nick2hand $u] $chan] && [nickinfo [nick2hand $u] auth] && [level [nick2hand $u] $chan] >= [changet $chan oprestrict] && [nickinfo [nick2hand $u] userhost] == [getchanhost [nick2hand $u]]} {
set n $n,$u
pushmode $chan +o $u
} else {
set no "$no, $u"
}
} else {
set no "$no, $u"
}
}
notice $n $n "You were oped on [lindex $text 0] by $nick \[$handle\]"
if {$no != ""} {
notice $nick $handle "[lindex $text 0] is in OpRestrict mode, could not op these people: [string trimleft $no ", "]"
}
putcmdlog "> !$handle! ($nick!$uhost) OP\[m\] ([lindex $text 0]): $text"
}
}