BT.Protection.tcl 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  1. ##########################################################
  2. #
  3. # BLackToolS
  4. # Protection TCL
  5. #
  6. # BLaCkShaDoW ProductionS
  7. ##########################################################
  8. set black(antipub_file) "scripts/BlackTools/FILES/$username.antipub_except.txt"
  9. set black(bad_saylist) "scripts/BlackTools/FILES/$username.bad_saylist.txt"
  10. if {![file exists $black(antipub_file)]} {
  11. set file [open $black(antipub_file) w]
  12. close $file
  13. }
  14. if {![file exists $black(bad_saylist)]} {
  15. set file [open $black(bad_saylist) w]
  16. close $file
  17. }
  18. proc bad:add:word {chan host msg} {
  19. global black
  20. set counter 0
  21. set file [open $black(bad_saylist) r]
  22. set w [read -nonewline $file]
  23. close $file
  24. set data [split $w "\n"]
  25. if {$w != ""} {
  26. foreach line $data {
  27. set channel [lindex [split $line] 0]
  28. set hostmask [lindex [split $line] 1]
  29. if {[string match -nocase $channel $chan] && [string equal -nocase $host $hostmask]} {
  30. set counter [expr $counter + 1]
  31. }
  32. }
  33. for {set j 0} {$j < $counter} {incr j} {
  34. set file [open $black(bad_saylist) "r"]
  35. set database [read -nonewline $file]
  36. close $file
  37. set data [split $database "\n"]
  38. set i [lsearch -glob $data "$chan $host *"]
  39. if {$i > -1} {
  40. set line [lindex $data $i]
  41. set delete [lreplace $data $i $i]
  42. set file [open $black(bad_saylist) "w"]
  43. puts $file [join $delete "\n"]
  44. close $file
  45. }
  46. }
  47. set file [open $black(bad_saylist) "r"]
  48. set database [read -nonewline $file]
  49. close $file
  50. if {$database == ""} {
  51. set file [open $black(bad_saylist) "w"]
  52. close $file
  53. }
  54. }
  55. set file [open $black(bad_saylist) "a"]
  56. puts $file "$chan $host $msg"
  57. close $file
  58. }
  59. proc badword:autocheck {minute hour day month year} {
  60. global black
  61. set file [open $black(bad_saylist) r]
  62. set w [read -nonewline $file]
  63. close $file
  64. set data [split $w "\n"]
  65. if {$w != ""} {
  66. foreach line $data {
  67. set chan [lindex [split $line] 0]
  68. set hostmask [lindex [split $line] 1]
  69. if {![validchan $chan]} {
  70. bad:del:word $chan $hostmask
  71. } else {
  72. if {![isban $hostmask $chan]} {
  73. bad:del:word $chan $hostmask
  74. }
  75. }
  76. }
  77. }
  78. }
  79. proc check:badword:unban {level chan message} {
  80. global black
  81. if {[string equal "*" $chan] && [string match -nocase "*No longer banning*" $message]} {
  82. set ban [lindex $message 3]
  83. set channel [lindex $message 5]
  84. bad:del:word $channel $ban
  85. }
  86. }
  87. proc bad:del:word {chan host} {
  88. global black
  89. set counter 0
  90. set file [open $black(bad_saylist) r]
  91. set w [read -nonewline $file]
  92. close $file
  93. set data [split $w "\n"]
  94. if {$w != ""} {
  95. foreach line $data {
  96. set channel [lindex [split $line] 0]
  97. set hostmask [lindex [split $line] 1]
  98. if {[string match -nocase $channel $chan] && [string equal -nocase $host $hostmask]} {
  99. set counter [expr $counter + 1]
  100. }
  101. }
  102. for {set j 0} {$j < $counter} {incr j} {
  103. set file [open $black(bad_saylist) "r"]
  104. set database [read -nonewline $file]
  105. close $file
  106. set data [split $database "\n"]
  107. set i [lsearch -glob $data "$chan $host *"]
  108. if {$i > -1} {
  109. set line [lindex $data $i]
  110. set delete [lreplace $data $i $i]
  111. set file [open $black(bad_saylist) "w"]
  112. puts $file [join $delete "\n"]
  113. close $file
  114. }
  115. }
  116. set file [open $black(bad_saylist) "r"]
  117. set database [read -nonewline $file]
  118. close $file
  119. if {$database == ""} {
  120. set file [open $black(bad_saylist) "w"]
  121. close $file
  122. }
  123. }
  124. }
  125. proc check:badword:entries {oldpath newpath} {
  126. global botnick
  127. if {![file exists $newpath]} {
  128. set file [open $newpath w]
  129. close $file
  130. }
  131. if {[file exists $oldpath]} {
  132. set file [open $oldpath r]
  133. set w [read -nonewline $file]
  134. close $file
  135. if {$w != ""} {
  136. set data [split $w "\n"]
  137. foreach entry $data {
  138. set file [open $newpath a]
  139. puts $file "$entry"
  140. close $file
  141. }
  142. set file [open $oldpath w]
  143. close $file
  144. }
  145. }
  146. }
  147. set old_badword_dir "$username.bword.db"
  148. set new_badword_dir "scripts/BlackTools/FILES/$username.bword.txt"
  149. check:badword:entries $old_badword_dir $new_badword_dir
  150. proc blacktools:banner:1 {banmask botnick chan reason mode timer bantime} {
  151. global black
  152. if {[channel get $chan xban]} {
  153. set getcount [channel get $chan kickcount]
  154. set getxtime [channel get $chan xbantime]
  155. set getxlevel [channel get $chan xbanlevel]
  156. if {$getxlevel == "0"} { set getxlevel "100"}
  157. if {$getxtime == "0"} { set getxtime "1" }
  158. set kcount [expr $getcount +1]
  159. channel set $chan kickcount $kcount
  160. if {[channel get $chan showcount]} {
  161. set reason "$reason - $kcount -"
  162. } else {
  163. set reason "$reason"
  164. }
  165. putquick "MODE $chan +$mode" -next ;utimer $timer [list putquick "MODE $chan -$mode"]
  166. putquick "PRIVMSG $black(chanserv) :ban $chan $banmask $getxtime $getxlevel $reason"
  167. newchanban $chan $banmask $botnick $reason $bantime
  168. if {![channel get $chan chanreport]} {
  169. return 0
  170. }
  171. set backchan [channel get $chan backchan]
  172. if {$backchan == ""} {
  173. return 0
  174. }
  175. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  176. return 0
  177. }
  178. if {[info exists black($chan:anounce)]} {
  179. return 0
  180. }
  181. set black($chan:anounce) 1
  182. set getlang [string tolower [channel get $chan lang]]
  183. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  184. set replace(%banmask%) $banmask
  185. set replace(%bantime%) $bantime
  186. set replace(%reason%) $reason
  187. set replace(%chan%) $chan
  188. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  189. } else {
  190. set getcount [channel get $chan kickcount]
  191. set kcount [expr $getcount +1]
  192. channel set $chan kickcount $kcount
  193. if {[channel get $chan showcount]} {
  194. set reason "$reason - $kcount -" } else {
  195. set reason "$reason" }
  196. putquick "MODE $chan +$mode" -next ;utimer $timer [list putquick "MODE $chan -$mode"]
  197. newchanban $chan $banmask $botnick $reason $bantime
  198. if {![channel get $chan chanreport]} {
  199. return 0
  200. }
  201. set backchan [channel get $chan backchan]
  202. if {$backchan == ""} {
  203. return 0
  204. }
  205. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  206. return 0
  207. }
  208. if {[info exists black($chan:anounce)]} {
  209. return 0
  210. }
  211. set black($chan:anounce) 1
  212. set getlang [string tolower [channel get $chan lang]]
  213. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  214. set replace(%banmask%) $banmask
  215. set replace(%bantime%) $bantime
  216. set replace(%reason%) $reason
  217. set replace(%chan%) $chan
  218. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  219. }
  220. utimer 5 [list unset black($chan:anounce)]
  221. }
  222. proc blacktools:banner:2 {banmask botnick chan reason bantime} {
  223. global black
  224. if {[channel get $chan xban]} {
  225. set getcount [channel get $chan kickcount]
  226. set getxtime [channel get $chan xbantime]
  227. if {$getxtime == "0"} { set getxtime "1" }
  228. set getxlevel [channel get $chan xbanlevel]
  229. if {$getxlevel == "0"} { set getxlevel "100"}
  230. set kcount [expr $getcount +1]
  231. channel set $chan kickcount $kcount
  232. if {[channel get $chan showcount]} {
  233. set reason "$reason - $kcount -"
  234. } else {
  235. set reason "$reason"
  236. }
  237. putquick "PRIVMSG $black(chanserv) :ban $chan $banmask $getxtime $getxlevel $reason"
  238. newchanban $chan $banmask $botnick $reason $bantime
  239. if {![channel get $chan chanreport]} {
  240. return 0
  241. }
  242. set backchan [channel get $chan backchan]
  243. if {$backchan == ""} {
  244. return 0
  245. }
  246. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  247. return 0
  248. }
  249. if {[info exists black($chan:anounce)]} {
  250. return 0
  251. }
  252. set black($chan:anounce) 1
  253. set getlang [string tolower [channel get $chan lang]]
  254. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  255. set replace(%banmask%) $banmask
  256. set replace(%bantime%) $bantime
  257. set replace(%reason%) $reason
  258. set replace(%chan%) $chan
  259. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  260. } else {
  261. set getcount [channel get $chan kickcount]
  262. set kcount [expr $getcount +1]
  263. channel set $chan kickcount $kcount
  264. if {[channel get $chan showcount]} {
  265. set reason "$reason - $kcount -" } else {
  266. set reason "$reason" }
  267. newchanban $chan $banmask $botnick $reason $bantime
  268. if {![channel get $chan chanreport]} {
  269. return 0
  270. }
  271. set backchan [channel get $chan backchan]
  272. if {$backchan == ""} {
  273. return 0
  274. }
  275. if {!([validchan $backchan]) || !([onchan $botnick $backchan])} {
  276. return 0
  277. }
  278. if {[info exists black($chan:anounce)]} {
  279. return 0
  280. }
  281. set black($chan:anounce) 1
  282. set getlang [string tolower [channel get $chan lang]]
  283. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  284. set replace(%banmask%) $banmask
  285. set replace(%bantime%) $bantime
  286. set replace(%reason%) $reason
  287. set replace(%chan%) $chan
  288. puthelp "PRIVMSG $backchan :[string map [array get replace] $black(say.$getlang.reportchan)]"
  289. }
  290. utimer 5 [list unset black($chan:anounce)]
  291. }
  292. ################################ antipub ###########################
  293. proc antipub:filter {str} {
  294. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  295. return $str
  296. }
  297. proc antipub:protect {nick host hand chan arg} {
  298. global black botnick
  299. set text [antipub:filter [join [split $arg]]]
  300. set handle [nick2hand $nick]
  301. set find_pub 0
  302. if {![validchan $chan]} { return }
  303. if {[channel get $chan antipub]} {
  304. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  305. if {![botisop $chan]} { return }
  306. if {[antipub:protect:except $text $chan] == "1"} {
  307. return
  308. }
  309. set getreason [channel get $chan antipub-reason]
  310. if {$getreason == ""} {
  311. set getlang [string tolower [channel get $chan lang]]
  312. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  313. set getreason $black(say.$getlang.antipub.1)
  314. }
  315. set getbantime [channel get $chan antipub-bantime]
  316. if {$getbantime == "0"} { set getbantime $black(antipubbantime) }
  317. set replace(%chan%) $chan
  318. set protectreason [string map [array get replace] $getreason]
  319. set reason "$protectreason"
  320. set banmask *!*@[lindex [split $host @] 1]
  321. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  322. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  323. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  324. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  325. foreach antipub [string tolower $black(antipubword)] {
  326. if {[string match -nocase $antipub $arg]} {
  327. set find_pub 1
  328. blacktools:banner:1 $banmask "ANTIPUB" $chan $reason $black(antipubmode) $black(antipubsecunde) $getbantime
  329. }
  330. }
  331. if {$find_pub == "1"} {
  332. bad:add:word $chan $banmask $arg
  333. }
  334. }
  335. }
  336. proc antipub:protect:me {nick host hand chan keyword arg} {
  337. global black
  338. antipub:protect $nick $host $hand $chan $arg
  339. }
  340. proc antipub:protect:except {text chan} {
  341. global black
  342. set text [split $text]
  343. set counter_word 0
  344. set counter_except 0
  345. set found_pub 0
  346. foreach antipub $black(antipubword) {
  347. if {[string match -nocase $antipub $text]} {
  348. set found_pub 1
  349. }
  350. }
  351. if {$found_pub == 0} { return }
  352. foreach except $black(antipubexcept) {
  353. set position [lsearch -exact [string tolower $text] [string tolower $except]]
  354. if {$position > -1} {
  355. set text [lreplace $text $position $position]
  356. }
  357. }
  358. set file [open $black(antipub_file) "r"]
  359. set database [read -nonewline $file]
  360. close $file
  361. set data [split $database "\n"]
  362. foreach line $data {
  363. set channel [lindex [split $line] 0]
  364. set link [lindex $line 1]
  365. foreach word $text {
  366. if {[string equal -nocase $channel $chan] && [string match -nocase $link $word]} {
  367. set position [lsearch -exact [string tolower $text] [string tolower $word]]
  368. if {$position > -1} {
  369. set text [lreplace $text $position $position]
  370. }
  371. }
  372. }
  373. }
  374. foreach antipub $black(antipubword) {
  375. if {[string match -nocase $antipub $text]} {
  376. return 0
  377. }
  378. }
  379. return 1
  380. }
  381. proc antipub:module {nick host hand chan arg} {
  382. global black
  383. set type 0
  384. set chan1 "$chan"
  385. set why [lindex [split $arg] 0]
  386. set except [lrange [split $arg] 1 end]
  387. if {[regexp {^[&#]} $why] && [matchattr $hand nm|- $chan]} {
  388. set chan "$why"
  389. set why [lindex [split $arg] 1]
  390. set except [lrange [split $arg] 2 end]
  391. }
  392. antipub:module:process $nick $host $hand $chan $chan1 $why $except $type
  393. }
  394. proc antipub:module:process {nick host hand chan chan1 why except type} {
  395. global black botnick
  396. set i 0
  397. set char(p) [lindex $black(cmdchar) 0]
  398. if {[string match -nocase "none" "$char(p)"]} {
  399. set char(p) ""
  400. }
  401. if {[matchattr $hand nm|- $chan]} {
  402. if {($why == "") && ($type == "0")} {
  403. blacktools:tell $nick $host $hand $chan $chan1 antipub.2 none
  404. return
  405. }
  406. if {($why == "") && ($type == "1")} {
  407. blacktools:tell $nick $host $hand $chan $chan1 antipub.3 none
  408. return
  409. }
  410. }
  411. if {($why == "") && ($type == "0")} {
  412. blacktools:tell $nick $host $hand $chan $chan1 antipub.4 none
  413. return
  414. }
  415. if {($why == "") && ($type == "1")} {
  416. blacktools:tell $nick $host $hand $chan $chan1 antipub.5 none
  417. return
  418. }
  419. if {![validchan $chan]} {
  420. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  421. return
  422. }
  423. if {![onchan $botnick $chan]} {
  424. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  425. return
  426. }
  427. switch -exact -- [string tolower $why] {
  428. add {
  429. if {$except == ""} {
  430. blacktools:tell $nick $host $hand $chan $chan1 antipub.9 none
  431. return
  432. }
  433. set file [open $black(antipub_file) a]
  434. puts $file "$chan $except"
  435. blacktools:tell $nick $host $hand $chan $chan1 antipub.6 $except
  436. close $file
  437. }
  438. list {
  439. set counter 0
  440. set found_it 0
  441. set file [open $black(antipub_file) r]
  442. set database [read -nonewline $file]
  443. close $file
  444. set data [split $database "\n"]
  445. blacktools:tell $nick $host $hand $chan $chan1 antipub.7 none
  446. foreach line $data {
  447. set channel [lindex [split $line] 0]
  448. set link [lindex [split $line] 1]
  449. if {[string equal -nocase $channel $chan]} {
  450. set counter [expr $counter + 1]
  451. set found_it 1
  452. blacktools:tell $nick $host $hand $chan $chan1 antipub.8 "$counter.) $link"
  453. }
  454. }
  455. if {$found_it == "0"} {
  456. blacktools:tell $nick $host $hand $chan $chan1 antipub.10 none
  457. return
  458. }
  459. }
  460. del {
  461. set counter 0
  462. if {$except == ""} {
  463. blacktools:tell $nick $host $hand $chan $chan1 antipub.11 none
  464. return
  465. }
  466. set file [open $black(antipub_file) r]
  467. set database [read -nonewline $file]
  468. close $file
  469. set data [split $database "\n"]
  470. foreach line $data {
  471. set channel [lindex [split $line] 0]
  472. set link [lindex [split $line] 1]
  473. if {[string equal -nocase $channel $chan] && [string equal -nocase $except $link]} {
  474. set counter [expr $counter + 1]
  475. }
  476. }
  477. for {set j 0} {$j < $counter} {incr j} {
  478. set file [open $black(antipub_file) "r"]
  479. set database [read -nonewline $file]
  480. close $file
  481. set data [split $database "\n"]
  482. set i [lsearch -glob $data "* $except"]
  483. if {$i > -1} {
  484. set line [lindex $data $i]
  485. set delete [lreplace $data $i $i]
  486. set file [open $black(antipub_file) "w"]
  487. puts $file [join $delete "\n"]
  488. close $file
  489. }
  490. }
  491. set file [open $black(antipub_file) "r"]
  492. set database [read -nonewline $file]
  493. close $file
  494. if {$database == ""} {
  495. set file [open $black(antipub_file) "w"]
  496. close $file
  497. }
  498. blacktools:tell $nick $host $hand $chan $chan1 antipub.12 $counter
  499. }
  500. }
  501. }
  502. ############################### antinotice #############################
  503. proc antinotice:protect {nick host hand arg chan} {
  504. global black botnick
  505. set handle [nick2hand $nick]
  506. if {![validchan $chan]} { return 0 }
  507. set getreason [channel get $chan antinotice-reason]
  508. if {$getreason == ""} {
  509. set getlang [string tolower [channel get $chan lang]]
  510. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  511. set getreason $black(say.$getlang.antinotice.1)
  512. }
  513. set getbantime [channel get $chan antinotice-bantime]
  514. if {$getbantime == "0"} { set getbantime $black(antinoticebantime) }
  515. set replace(%chan%) $chan
  516. set protectreason [string map [array get replace] $getreason]
  517. set banmask *!*@[lindex [split $host @] 1]
  518. set reason "$protectreason"
  519. if {![botisop $chan]} { return }
  520. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  521. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  522. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  523. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  524. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  525. if {[isbotnick $nick]} { return }
  526. if {$chan == $botnick} { return }
  527. if { [channel get $chan antinotice] } {
  528. blacktools:banner:1 $banmask $botnick $chan $reason $black(antinoticemode) $black(antinoticesecunde) $getbantime
  529. }
  530. }
  531. ############################## antictcp ################################
  532. proc antictcp:protect {nick host hand chan keyword arg} {
  533. global black botnick
  534. set handle [nick2hand $nick]
  535. if {![validchan $chan]} { return 0 }
  536. set getreason [channel get $chan antictcp-reason]
  537. if {$getreason == ""} {
  538. set getlang [string tolower [channel get $chan lang]]
  539. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  540. set getreason $black(say.$getlang.antictcp.1)
  541. }
  542. set getbantime [channel get $chan antictcp-bantime]
  543. if {$getbantime == "0"} { set getbantime $black(antictcpbantime) }
  544. set replace(%chan%) $chan
  545. set protectreason [string map [array get replace] $getreason]
  546. set reason "$protectreason"
  547. set banmask *!*@[lindex [split $host @] 1]
  548. if {[string equal -nocase "action" $keyword] || [string equal -nocase "chat" $keyword]} {return 0}
  549. if {![botisop $chan]} { return 0 }
  550. if {[matchattr $handle $black(exceptflags) $chan]} { return}
  551. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  552. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  553. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  554. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  555. if {[isbotnick $nick]} { return }
  556. if { [channel get $chan antictcp] } {
  557. blacktools:banner:1 $banmask $botnick $chan $reason $black(antictcpmode) $black(antictcpsecunde) $getbantime
  558. }
  559. }
  560. ############################## antibadword ################################
  561. proc antibadword:filter {str} {
  562. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  563. return $str
  564. }
  565. proc antibadword:protect {nick host hand chan arg} {
  566. global black botnick username
  567. set bwordir "scripts/BlackTools/FILES/$username.bword.txt"
  568. set handle [nick2hand $nick]
  569. set found_word 0
  570. if {![validchan $chan]} { return }
  571. set getreason [channel get $chan antibadword-reason]
  572. if {$getreason == ""} {
  573. set getlang [string tolower [channel get $chan lang]]
  574. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  575. set getreason $black(say.$getlang.antibadword.1)
  576. }
  577. set getbantime [channel get $chan antibadword-bantime]
  578. if {$getbantime == "0"} { set getbantime $black(antibadwordbantime) }
  579. set replace(%chan%) $chan
  580. set protectreason [string map [array get replace] $getreason]
  581. set text [antibadword:filter $arg]
  582. set reason "$protectreason"
  583. set banmask *!*@[lindex [split $host @] 1]
  584. if {![botisop $chan]} { return }
  585. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  586. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  587. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  588. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  589. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  590. if {[isbotnick $nick]} { return }
  591. if {[channel get $chan antibadword]} {
  592. set file [open $bwordir "r"]
  593. set data [read -nonewline $file]
  594. close $file
  595. set lines [split $data "\n"]
  596. foreach word $lines {
  597. set c [lindex [split $word] 0]
  598. set w [lrange [split $word] 1 end]
  599. if {[string match -nocase $c $chan]} {
  600. if {[string match -nocase $w $text]} {
  601. set found_word 1
  602. blacktools:banner:2 $banmask "BADWORD" $chan $reason $getbantime
  603. }
  604. }
  605. }
  606. foreach antibadword [string tolower $black(antibadword)] {
  607. if {[string match -nocase $antibadword $text]} {
  608. set found_word 1
  609. blacktools:banner:2 $banmask "BADWORD" $chan $reason $getbantime
  610. }
  611. }
  612. if {$found_word == 1} {
  613. bad:add:word $chan $banmask $arg
  614. }
  615. }
  616. }
  617. proc antibadword:protect:me {nick host hand chan keyword arg} {
  618. global black
  619. antibadword:protect $nick $host $hand $chan $arg
  620. }
  621. ################################ badword ##################################
  622. proc antibadword:command:public {nick host hand chan arg} {
  623. global black botnick
  624. set why [lindex [split $arg] 0]
  625. set type 0
  626. set chan1 "$chan"
  627. set bdword [lrange [split $arg] 1 end]
  628. set bdnumber [lindex [split $arg] 1]
  629. if {[regexp {^[&#]} $why] && [matchattr $hand nm|- $chan]} {
  630. set chan "$why"
  631. set why [lindex [split $arg] 1]
  632. set bdnumber [lindex [split $arg] 2]
  633. set bdword [lrange [split $arg] 2 end]
  634. }
  635. antibadword:command:process $nick $host $hand $chan $chan1 $why $bdword $bdnumber $type
  636. }
  637. proc antibadword:command:process {nick host hand chan chan1 why bdword bdnumber type} {
  638. global black botnick username
  639. set bwordir "scripts/BlackTools/FILES/$username.bword.txt"
  640. set i 0
  641. set foundchan 0
  642. set char(p) [lindex $black(cmdchar) 0]
  643. if {[string match -nocase "none" "$char(p)"]} {
  644. set char(p) ""
  645. }
  646. if {[matchattr $hand nm|- $chan]} {
  647. if {($why == "") && ($type == "0")} {
  648. blacktools:tell $nick $host $hand $chan $chan1 badword.1 none
  649. return
  650. }
  651. if {($why == "") && ($type == "1")} {
  652. blacktools:tell $nick $host $hand $chan $chan1 badword.2 none
  653. return
  654. }
  655. }
  656. if {($why == "") && ($type == "0")} {
  657. blacktools:tell $nick $host $hand $chan $chan1 badword.3 none
  658. return
  659. }
  660. if {($why == "") && ($type == "1")} {
  661. blacktools:tell $nick $host $hand $chan $chan1 badword.4 none
  662. return
  663. }
  664. if {![validchan $chan]} {
  665. blacktools:tell $nick $host $hand $chan $chan1 gl.novalidchan none
  666. return
  667. }
  668. if {![onchan $botnick $chan]} {
  669. blacktools:tell $nick $host $hand $chan $chan1 gl.notonchan none
  670. return
  671. }
  672. switch -exact -- [string tolower $why] {
  673. add {
  674. set file [open $bwordir a]
  675. puts $file "$chan $bdword"
  676. close $file
  677. blacktools:tell $nick $host $hand $chan $chan1 badword.5 $bdword
  678. }
  679. list {
  680. set file [open $bwordir "r"]
  681. set why [read -nonewline $file]
  682. close $file
  683. set data [split $why "\n"]
  684. if {$why == ""} {
  685. blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
  686. blacktools:tell $nick $host $hand $chan $chan1 badword.7 none
  687. return
  688. }
  689. blacktools:tell $nick $host $hand $chan $chan1 badword.6 none
  690. foreach word $data {
  691. set c [lindex [split $word] 0]
  692. set word [lrange [split $word] 1 end]
  693. if {[string match -nocase $chan $c]} {
  694. set foundchan 1
  695. set i [expr $i +1]
  696. blacktools:tell $nick $host $hand $chan $chan1 badword.8 " $i . $word"
  697. }
  698. }
  699. if {$foundchan == 0} {
  700. blacktools:tell $nick $host $hand $chan $chan1 badword.7 none
  701. }
  702. }
  703. del {
  704. if {![regexp {^[0-9]} $bdnumber]} {
  705. blacktools:tell $nick $host $hand $chan $chan1 badword.9 $bdword
  706. return
  707. }
  708. set file [open $bwordir "r"]
  709. set data [read -nonewline $file]
  710. close $file
  711. set lines [split $data "\n"]
  712. foreach word $lines {
  713. set c [lindex [split $word] 0]
  714. if {[string match -nocase $c $chan]} {
  715. set i [expr $bdnumber - 1]
  716. set delete [lreplace $lines $i $i]
  717. set file [open $bwordir "w"]
  718. puts $file [join $delete "\n"]
  719. close $file
  720. }
  721. }
  722. set file [open $bwordir "r"]
  723. set data [read -nonewline $file]
  724. close $file
  725. if {$data == ""} {
  726. set files [open $bwordir "w"]
  727. close $files
  728. }
  729. blacktools:tell $nick $host $hand $chan $chan1 badword.10 $bdnumber
  730. }
  731. }
  732. }
  733. ############################## AntiLongText ################################
  734. proc antilongtext:protect {nick uhost hand chan arg} {
  735. global black botnick
  736. set handle [nick2hand $nick]
  737. if {![validchan $chan]} { return }
  738. set getreason [channel get $chan antilongtext-reason]
  739. if {$getreason == ""} {
  740. set getlang [string tolower [channel get $chan lang]]
  741. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  742. set getreason $black(say.$getlang.antilongtext.1)
  743. }
  744. set getbantime [channel get $chan antilongtext-bantime]
  745. if {$getbantime == "0"} { set getbantime $black(longbantime) }
  746. set getlongchar [channel get $chan antilongtextmax]
  747. if {$getlongchar == "0"} { set getlongchar "$black(longchar)" }
  748. set replace(%chan%) $chan
  749. set protectreason [string map [array get replace] $getreason]
  750. set banmask "*!*@[lindex [split $uhost @] 1]"
  751. set reason "$protectreason"
  752. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  753. if {![botisop $chan]} { return 0 }
  754. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  755. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  756. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  757. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  758. if {[isbotnick $nick]} { return }
  759. if {[string length $arg] >= $getlongchar} {
  760. if {[channel get $chan antilongtext]} {
  761. blacktools:banner:1 $banmask $botnick $chan $reason $black(longmode) $black(longtimemode) $getbantime
  762. }
  763. }
  764. }
  765. proc antilongtext:protect:me {nick host hand chan keyword arg} {
  766. global black
  767. antilongtext:protect $nick $host $hand $chan $arg
  768. }
  769. ############################ AntiBAdQuitPart ##############################
  770. set black(badcolors) {
  771. "*\x03*"
  772. "*\037*"
  773. "*\002*"
  774. }
  775. proc antipubpart:protect {nick host hand chan arg} {
  776. global botnick black
  777. set handle [nick2hand $nick]
  778. if {![validchan $chan]} { return 0 }
  779. set getreason [channel get $chan antibadquitpart-reason]
  780. if {$getreason == ""} {
  781. set getlang [string tolower [channel get $chan lang]]
  782. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  783. set getreason $black(say.$getlang.antibadquitpart.1)
  784. }
  785. set getbantime [channel get $chan antibadquitpart-bantime]
  786. if {$getbantime == "0"} { set getbantime $black(badquitparttime) }
  787. set replace(%chan%) $chan
  788. set protectreason [string map [array get replace] $getreason]
  789. set banmask "*!*@[lindex [split $host @] 1]"
  790. set reason "$protectreason"
  791. if {[channel get $chan badquitpart]} {
  792. foreach word $black(badquitpartwords) {
  793. if {![botisop $chan]} { return }
  794. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  795. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  796. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  797. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  798. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  799. if {[isbotnick $nick]} { return }
  800. if {[string match -nocase $word $arg]} {
  801. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  802. }
  803. }
  804. }
  805. }
  806. proc antipubsign:protect {nick host hand chan arg} {
  807. antipubpart:protect $nick $host $hand $chan $arg
  808. }
  809. proc anticolorpart:protect {nick host hand chan arg} {
  810. global botnick black
  811. set handle [nick2hand $nick]
  812. if {![validchan $chan]} { return }
  813. set getreason [channel get $chan antibadquitpart-reason]
  814. if {$getreason == ""} {
  815. set getlang [string tolower [channel get $chan lang]]
  816. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  817. set getreason $black(say.$getlang.antibadquitpart.1)
  818. }
  819. set getbantime [channel get $chan antibadquitpart-bantime]
  820. if {$getbantime == "0"} { set getbantime $black(badquitparttime) }
  821. set replace(%chan%) $chan
  822. set protectreason [string map [array get replace] $getreason]
  823. set banmask "*!*@[lindex [split $host @] 1]"
  824. set reason "$protectreason"
  825. if {[channel get $chan badquitpart]} {
  826. foreach color $black(badcolors) {
  827. if {![botisop $chan]} { return }
  828. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  829. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  830. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  831. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  832. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  833. if {[isbotnick $nick]} { return }
  834. if {($black(badquitpartcolour) == "1") && [string match -nocase $color $arg]} {
  835. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  836. }
  837. }
  838. }
  839. }
  840. proc anticolorquit:protect {nick host hand chan arg} {
  841. anticolorpart:protect $nick $host $hand $chan $arg
  842. }
  843. ########################### AntiJoinPart #############################
  844. proc antijoinpart:protect {nick host hand chan arg} {
  845. global black botnick
  846. set handle [nick2hand $nick]
  847. if {![validchan $chan]} { return }
  848. set getreason [channel get $chan antijoinpart-reason]
  849. if {$getreason == ""} {
  850. set getlang [string tolower [channel get $chan lang]]
  851. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  852. set getreason $black(say.$getlang.antijoinpart.1)
  853. }
  854. set getbantime [channel get $chan antijoinpart-bantime]
  855. if {$getbantime == "0"} { set getbantime $black(joinpartbantime) }
  856. set replace(%chan%) $chan
  857. set protectreason [string map [array get replace] $getreason]
  858. set banmask "*!*@[lindex [split $host @] 1]"
  859. set reason "$protectreason"
  860. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  861. if {[isbotnick $nick]} { return }
  862. if {$chan == $botnick} { return }
  863. if {[channel get $chan antijoinpart]} {
  864. if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$black(joinparttime)}]} {
  865. blacktools:banner:1 $banmask $botnick $chan $reason $black(joinpartmode) $black(joinparttimemode) $getbantime
  866. }
  867. }
  868. }
  869. proc spam:filter {str} {
  870. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  871. return $str
  872. }
  873. ############################# AntiSpam ##############################
  874. proc antispam:protect {nick uhost hand arg} {
  875. global botnick black
  876. set text [spam:filter $arg]
  877. set handle [nick2hand $nick]
  878. foreach spammer [string tolower $black(spamword)] {
  879. if {[string match -nocase $spammer $arg]} {
  880. foreach chans [channels] {
  881. if {![validchan $chans]} { return }
  882. set getreason [channel get $chans antispam-reason]
  883. if {$getreason == ""} {
  884. set getlang [string tolower [channel get $chans lang]]
  885. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  886. set getreason $black(say.$getlang.antispam.1)
  887. }
  888. set getbantime [channel get $chans antispam-bantime]
  889. if {$getbantime == "0"} { set getbantime $black(spamban) }
  890. if {[onchan $nick $chans]} {
  891. if {[channel get $chans antispam]} {
  892. if {![botisop $chans]} { return }
  893. if {[isbotnick $nick]} { return }
  894. set banmask *!*@[lindex [split $uhost @] 1]
  895. set replace(%chan%) $chans
  896. set protectreason [string map [array get replace] $getreason]
  897. set reason "$protectreason"
  898. if {[matchattr $handle $black(exceptflags) $chans]} { return 0 }
  899. if {[channel get $chans vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chans vprotect]] }
  900. if {[channel get $chans oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chans oprotect]] }
  901. if {[isvoice $nick $chans] && [string equal -nocase $vprotect "ON"]} { return }
  902. if {[isop $nick $chans] && [string equal -nocase $oprotect "ON"]} { return }
  903. blacktools:banner:2 $banmask $botnick $chans $reason $getbantime
  904. }
  905. }
  906. }
  907. }
  908. }
  909. }
  910. proc antispam:protect:msg {nick host hand chan } {
  911. global black
  912. if {![validchan $chan]} { return }
  913. if {[channel get $chan antispam]} {
  914. if {[isbotnick $nick]} { return }
  915. if {[info exists black(turnOnFlood:$chan)]} {
  916. return
  917. }
  918. set handle [nick2hand $nick]
  919. if {$black(spamreq) == "1"} {
  920. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  921. set getmsg [channel get $chan antispam-message]
  922. if {$getmsg == ""} {
  923. set getlang [string tolower [channel get $chan lang]]
  924. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  925. set getmsg $black(say.$getlang.antispam.2)
  926. }
  927. set replace(%nick%) $nick
  928. set replace(%chan%) $chan
  929. set spamsg [string map [array get replace] $getmsg]
  930. puthelp "PRIVMSG $nick :$spamsg"
  931. }
  932. }
  933. }
  934. proc antispam:protect:cycle {min hour day mon year} {
  935. global black
  936. if {([scan $min %d]+([scan $hour %d]*60)) % $black(spamcycle) == 0} {
  937. foreach chan [channels] {
  938. if {![channel get $chan inactive]} {
  939. if {[channel get $chan antispam]} {
  940. putserv "PART $chan :$black(spammsgcycle)"; putserv "JOIN $chan"
  941. }
  942. }
  943. }
  944. }
  945. }
  946. ############################## AntiRepeat ###############################
  947. proc antirepeat:protect {nick host hand chan arg} {
  948. global black botnick count
  949. set arg [antipub:filter [join [split $arg]]]
  950. set handle [nick2hand $nick]
  951. if {![validchan $chan]} { return }
  952. if {[channel get $chan antirepeat]} {
  953. if {![botisop $chan]} { return }
  954. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  955. if {[isbotnick $nick]} { return }
  956. set getreason [channel get $chan antirepeat-reason]
  957. if {$getreason == ""} {
  958. set getlang [string tolower [channel get $chan lang]]
  959. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  960. set getreason $black(say.$getlang.antirepeat.1)
  961. }
  962. set getbantime [channel get $chan antirepeat-bantime]
  963. if {$getbantime == "0"} { set getbantime $black(antirepeatbantime) }
  964. set replace(%chan%) $chan
  965. set protectreason [string map [array get replace] $getreason]
  966. set reason "$protectreason"
  967. set repeatset [channel get $chan antirepeat-setting]
  968. if {$repeatset == ""} { set repeatset "$black(repeats)" }
  969. set number [scan $repeatset %\[^:\]]
  970. set time [scan $repeatset %*\[^:\]:%s]
  971. set banmask *!*@[lindex [split $host @] 1]
  972. foreach tmr [utimers] {
  973. if {[string match "*count(repeat:$host:$chan:$arg)*" [join [lindex $tmr 1]]]} {
  974. killutimer [lindex $tmr 2]
  975. }
  976. }
  977. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  978. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  979. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  980. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  981. if {![info exists count(repeat:$host:$chan:$arg)]} {
  982. set count(repeat:$host:$chan:$arg) 0
  983. }
  984. if {![info exists count(repeat:$host:$chan)]} {
  985. set count(repeat:$host:$chan) 0
  986. }
  987. incr count(repeat:$host:$chan:$arg)
  988. utimer $time [list unset count(repeat:$host:$chan:$arg)]
  989. if {$count(repeat:$host:$chan:$arg) >= $number} {
  990. if {$black(antirepeattype) == "0"} { set count(repeat:$host:$chan) 2 }
  991. incr count(repeat:$host:$chan)
  992. if {$count(repeat:$host:$chan) == 1} {
  993. set getcount [channel get $chan kickcount]
  994. set kcount [expr $getcount +1]
  995. channel set $chan kickcount $kcount
  996. if {[channel get $chan showcount]} {
  997. set reason "$reason - $kcount -"
  998. } else {
  999. set reason "$reason"
  1000. }
  1001. putquick "KICK $chan $nick :$reason"
  1002. }
  1003. if {$count(repeat:$host:$chan) >= 2} {
  1004. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1005. unset count(repeat:$host:$chan)
  1006. }
  1007. }
  1008. }
  1009. }
  1010. proc antirepeat:protect:me {nick host hand chan keyword arg} {
  1011. antirepeat:protect $nick $host $hand $chan $arg
  1012. }
  1013. ############################# AntiColor ################################
  1014. proc anticolor:protect {nick host hand chan arg} {
  1015. global black botnick count
  1016. set arg [join [split $arg]]
  1017. if {![validchan $chan]} { return }
  1018. set getreason [channel get $chan anticolor-reason]
  1019. if {$getreason == ""} {
  1020. set getlang [string tolower [channel get $chan lang]]
  1021. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1022. set getreason $black(say.$getlang.anticolor.1)
  1023. }
  1024. set getbantime [channel get $chan anticolor-bantime]
  1025. if {$getbantime == "0"} { set getbantime $black(anticolorbantime) }
  1026. set replace(%chan%) $chan
  1027. set protectreason [string map [array get replace] $getreason]
  1028. set reason "$protectreason"
  1029. set banmask *!*@[lindex [split $host @] 1]
  1030. set handle [nick2hand $nick]
  1031. if {[channel get $chan anticolor]} {
  1032. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1033. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1034. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1035. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1036. if {![botisop $chan]} { return }
  1037. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  1038. if {[isbotnick $nick]} { return }
  1039. if {![info exists count(color:$host:$chan)]} {
  1040. set count(color:$host:$chan) 0
  1041. }
  1042. if {[string match *\003* $arg]} {
  1043. incr count(color:$host:$chan)
  1044. if {$black(anticolortype) == "0" } { set count(color:$host:$chan) 2 }
  1045. if {$count(color:$host:$chan) == 1} {
  1046. set getcount [channel get $chan kickcount]
  1047. set kcount [expr $getcount +1]
  1048. channel set $chan kickcount $kcount
  1049. if {[channel get $chan showcount]} {
  1050. set reason "$reason - $kcount -"
  1051. } else {
  1052. set reason "$reason"
  1053. }
  1054. putquick "KICK $chan $nick :$reason"
  1055. }
  1056. if {$count(color:$host:$chan) == 2} {
  1057. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1058. unset count(color:$host:$chan)
  1059. }
  1060. }
  1061. }
  1062. }
  1063. proc anticolor:protect:me {nick host hand chan keyword arg} {
  1064. anticolor:protect $nick $host $hand $chan $arg
  1065. }
  1066. ############################# AntiBold ################################
  1067. proc antibold:protect {nick host hand chan arg} {
  1068. global black botnick count
  1069. set arg [split $arg]
  1070. if {![validchan $chan]} { return }
  1071. set getreason [channel get $chan antibold-reason]
  1072. if {$getreason == ""} {
  1073. set getlang [string tolower [channel get $chan lang]]
  1074. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1075. set getreason $black(say.$getlang.antibold.1)
  1076. }
  1077. set getbantime [channel get $chan antibold-bantime]
  1078. if {$getbantime == "0"} { set getbantime $black(antiboldbantime) }
  1079. set replace(%chan%) $chan
  1080. set protectreason [string map [array get replace] $getreason]
  1081. set reason "$protectreason"
  1082. set banmask *!*@[lindex [split $host @] 1]
  1083. set handle [nick2hand $nick]
  1084. if {[channel get $chan antibold]} {
  1085. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1086. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1087. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1088. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1089. if {![botisop $chan]} { return }
  1090. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  1091. if {[isbotnick $nick]} { return }
  1092. if {![info exists count(bold:$host:$chan)]} {
  1093. set count(bold:$host:$chan) 0
  1094. }
  1095. if {[string match *\002* $arg]} {
  1096. incr count(bold:$host:$chan)
  1097. if {$black(antiboldtype) == "0" } { set count(bold:$host:$chan) 2 }
  1098. if {$count(bold:$host:$chan) == 1} {
  1099. set getcount [channel get $chan kickcount]
  1100. set kcount [expr $getcount +1]
  1101. channel set $chan kickcount $kcount
  1102. if {[channel get $chan showcount]} {
  1103. set reason "$reason - $kcount -"
  1104. } else {
  1105. set reason "$reason"
  1106. }
  1107. putquick "KICK $chan $nick :$reason"
  1108. }
  1109. if {$count(bold:$host:$chan) == 2} {
  1110. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1111. unset count(bold:$host:$chan)
  1112. }
  1113. }
  1114. }
  1115. }
  1116. proc antibold:protect:me {nick host hand chan keyword arg} {
  1117. antibold:protect $nick $host $hand $chan $arg
  1118. }
  1119. ############################ AntiUnderline ###############################
  1120. proc antiunderline:protect {nick host hand chan arg} {
  1121. global black botnick count
  1122. set arg [split $arg]
  1123. if {![validchan $chan]} { return }
  1124. set getreason [channel get $chan antiunderline-reason]
  1125. if {$getreason == ""} {
  1126. set getlang [string tolower [channel get $chan lang]]
  1127. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1128. set getreason $black(say.$getlang.antiunderline.1)
  1129. }
  1130. set getbantime [channel get $chan antiunderline-bantime]
  1131. if {$getbantime == "0"} { set getbantime $black(antiunderlinebantime) }
  1132. set replace(%chan%) $chan
  1133. set protectreason [string map [array get replace] $getreason]
  1134. set reason "$protectreason"
  1135. set banmask *!*@[lindex [split $host @] 1]
  1136. set handle [nick2hand $nick]
  1137. if {[channel get $chan antiunderline]} {
  1138. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1139. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1140. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1141. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1142. if {![botisop $chan]} { return }
  1143. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  1144. if {[isbotnick $nick]} { return }
  1145. if {![info exists count(underline:$host:$chan)]} {
  1146. set count(underline:$host:$chan) 0
  1147. }
  1148. if {[string match *\037* $arg]} {
  1149. incr count(underline:$host:$chan)
  1150. if {$black(antiunderlinetype) == "0" } { set count(underline:$host:$chan) 2 }
  1151. if {$count(underline:$host:$chan) == 1} {
  1152. set getcount [channel get $chan kickcount]
  1153. set kcount [expr $getcount +1]
  1154. channel set $chan kickcount $kcount
  1155. if {[channel get $chan showcount]} {
  1156. set reason "$reason - $kcount -"
  1157. } else {
  1158. set reason "$reason"
  1159. }
  1160. putquick "KICK $chan $nick :$reason"
  1161. }
  1162. if {$count(underline:$host:$chan) == 2} {
  1163. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1164. unset count(underline:$host:$chan)
  1165. }
  1166. }
  1167. }
  1168. }
  1169. proc antiunderline:protect:me {nick host hand chan keyword arg} {
  1170. antiunderline:protect $nick $host $hand $chan $arg
  1171. }
  1172. ############################## AntiCaps #################################
  1173. proc anticaps:protect {nick host hand chan arg} {
  1174. global black botnick count
  1175. set handle [nick2hand $nick]
  1176. if {![validchan $chan]} { return }
  1177. set getreason [channel get $chan anticaps-reason]
  1178. if {$getreason == ""} {
  1179. set getlang [string tolower [channel get $chan lang]]
  1180. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1181. set getreason $black(say.$getlang.anticaps.1)
  1182. }
  1183. set getbantime [channel get $chan anticaps-bantime]
  1184. if {$getbantime == "0"} { set getbantime $black(anticapsbantime) }
  1185. set replace(%chan%) $chan
  1186. set protectreason [string map [array get replace] $getreason]
  1187. set reason "$protectreason"
  1188. set banmask *!*@[lindex [split $host @] 1]
  1189. if {![info exists count(caps:$host:$chan)]} {
  1190. set count(caps:$host:$chan) 0
  1191. }
  1192. if {[channel get $chan anticaps]} {
  1193. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1194. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1195. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1196. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1197. if {![botisop $chan]} { return }
  1198. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  1199. if {[isbotnick $nick]} { return }
  1200. set caps($nick:$host) 0
  1201. foreach word [split $arg {}] {
  1202. if [string match \[A-Z\] $word] {
  1203. incr caps($nick:$host)
  1204. }
  1205. }
  1206. if {$caps($nick:$host) == 0} {
  1207. return 0
  1208. }
  1209. if {[string length $arg] < 20} {return 0}
  1210. set capchar [string length $arg]
  1211. set number $caps($nick:$host)/$capchar
  1212. if {[expr 100 * $caps($nick:$host) / $capchar] > $black(anticapscount)} {
  1213. incr count(caps:$host:$chan)
  1214. if {$black(anticapstype) == "0" } { set count(caps:$host:$chan) 2 }
  1215. if {$count(caps:$host:$chan) == 1} {
  1216. set getcount [channel get $chan kickcount]
  1217. set kcount [expr $getcount +1]
  1218. channel set $chan kickcount $kcount
  1219. if {[channel get $chan showcount]} {
  1220. set reason "$reason - $kcount -"
  1221. } else {
  1222. set reason "$reason"
  1223. }
  1224. putquick "KICK $chan $nick :$reason"
  1225. }
  1226. if {$count(caps:$host:$chan) == 2} {
  1227. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1228. unset count(caps:$host:$chan)
  1229. }
  1230. }
  1231. }
  1232. }
  1233. proc anticaps:protect:me {nick host hand chan keyword arg} {
  1234. anticaps:protect $nick $host $hand $chan $arg
  1235. }
  1236. ################################ BadIdent #################################
  1237. proc badident:protect:join {nick host hand chan} {
  1238. global black botnick
  1239. if {![validchan $chan]} { return }
  1240. set getreason [channel get $chan badident-reason]
  1241. if {$getreason == ""} {
  1242. set getlang [string tolower [channel get $chan lang]]
  1243. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1244. set getreason $black(say.$getlang.badident.1)
  1245. }
  1246. set getbantime [channel get $chan badident-bantime]
  1247. if {$getbantime == "0"} { set getbantime $black(badidentbantime) }
  1248. set replace(%chan%) $chan
  1249. set protectreason [string map [array get replace] $getreason]
  1250. set reason "$protectreason"
  1251. set ident "[string trimleft [string tolower [lindex [split $host "@"] 0]] "~"]"
  1252. set banmask "*!*$ident@*"
  1253. if {![validchan $chan]} { return }
  1254. if {[channel get $chan badident]} {
  1255. if {![botisop $chan]} { return }
  1256. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1257. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1258. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1259. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1260. if {[matchattr $hand $black(exceptflags) $chan]} { return 0 }
  1261. foreach bit $black(badidentwords) {
  1262. if {[string match -nocase $bit $ident]} {
  1263. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1264. }
  1265. }
  1266. }
  1267. }
  1268. ############################## BadFullname ###############################
  1269. proc badfullname:protect:join {nick host hand chan} {
  1270. global botnick black
  1271. set ::cchan $chan
  1272. set ::nnick $nick
  1273. set ::hhost $host
  1274. set handle [nick2hand $nick]
  1275. if { [channel get $chan badfullname] } {
  1276. if {![botisop $chan]} { return }
  1277. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1278. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1279. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1280. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1281. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  1282. if {[onchan $nick $chan]} {
  1283. putquick "WHOIS $nick $nick"
  1284. bind RAW - 311 badfullname:protect
  1285. }
  1286. }
  1287. }
  1288. proc badfullname:protect { from keyword arguments } {
  1289. global botnick black
  1290. set chan $::cchan
  1291. set nick $::nnick
  1292. set host $::hhost
  1293. set getreason [channel get $chan badfullname-reason]
  1294. if {$getreason == ""} {
  1295. set getlang [string tolower [channel get $chan lang]]
  1296. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1297. set getreason $black(say.$getlang.badfullname.1)
  1298. }
  1299. set getbantime [channel get $chan badfullname-bantime]
  1300. if {$getbantime == "0"} { set getbantime $black(badfbantime) }
  1301. set replace(%chan%) $chan
  1302. set protectreason [string map [array get replace] $getreason]
  1303. set reason "$protectreason"
  1304. set fullname [string range [join [lrange $arguments 5 end]] 1 end]
  1305. if {[onchan $nick $chan]} {
  1306. set banmask *!*@[lindex [split [getchanhost $nick $chan] "@"] 1]
  1307. }
  1308. foreach realname $black(badfwords) {
  1309. if {[string match -nocase $realname $fullname]} {
  1310. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1311. }
  1312. }
  1313. unbind RAW - 311 badfullname:protect
  1314. }
  1315. ################################ BadNick #################################
  1316. proc badnick:protect:join {nick host hand chan} {
  1317. global black botnick
  1318. set handle [nick2hand $nick]
  1319. if {![validchan $chan]} { return 0 }
  1320. set getreason [channel get $chan badnick-reason]
  1321. if {$getreason == ""} {
  1322. set getlang [string tolower [channel get $chan lang]]
  1323. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1324. set getreason $black(say.$getlang.badnick.1)
  1325. }
  1326. set getbantime [channel get $chan badnick-bantime]
  1327. if {$getbantime == "0"} { set getbantime $black(badnickbantime) }
  1328. set replace(%chan%) $chan
  1329. set protectreason [string map [array get replace] $getreason]
  1330. set reason "$protectreason"
  1331. set banmask "$nick*!*@*"
  1332. if {![validchan $chan]} { return 0 }
  1333. if {[channel get $chan badnick]} {
  1334. if {![botisop $chan]} { return 0 }
  1335. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1336. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1337. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1338. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1339. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1340. foreach badnick [string tolower $black(badnickwords)] {
  1341. if {[string match $badnick [string tolower $nick]]} {
  1342. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1343. }
  1344. }
  1345. }
  1346. }
  1347. proc badnick:protect:change {nick host hand chan newnick} {
  1348. global black botnick
  1349. set handle [nick2hand $nick]
  1350. if {![validchan $chan]} { return 0 }
  1351. set getreason [channel get $chan badnick-reason]
  1352. if {$getreason == ""} {
  1353. set getlang [string tolower [channel get $chan lang]]
  1354. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1355. set getreason $black(say.$getlang.badnick.1)
  1356. }
  1357. set getbantime [channel get $chan badnick-bantime]
  1358. if {$getbantime == "0"} { set getbantime $black(badnickbantime) }
  1359. set replace(%chan%) $chan
  1360. set protectreason [string map [array get replace] $getreason]
  1361. set reason "$protectreason"
  1362. set banmask "$newnick*!*@*"
  1363. if {![validchan $chan]} { return 0 }
  1364. if {[channel get $chan badnick]} {
  1365. if {![botisop $chan]} { return 0 }
  1366. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1367. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1368. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1369. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1370. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1371. foreach badnick [string tolower $black(badnickwords)] {
  1372. if {[string match $badnick [string tolower $newnick]]} {
  1373. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1374. }
  1375. }
  1376. }
  1377. }
  1378. ########################### AntiJoinFlood ################################
  1379. proc joinflood:unlock {chan} {
  1380. global black
  1381. putquick "MODE $chan -$black(modes)"
  1382. unset black(floodjoin:on:$chan)
  1383. }
  1384. proc joinflood:protect {nick host hand chan} {
  1385. global black count
  1386. if {[channel get $chan antijoinflood]} {
  1387. set getset [channel get $chan joinflood]
  1388. if {$getset == ""} { set getset "4:5" }
  1389. set number [scan $getset %\[^:\]]
  1390. set time [scan $getset %*\[^:\]:%s]
  1391. set replace(%chan%) $chan
  1392. foreach tmr [utimers] {
  1393. if {[string match "*count(joinflood:$chan)*" [join [lindex $tmr 1]]]} {
  1394. killutimer [lindex $tmr 2]
  1395. }
  1396. }
  1397. if {[info exists black(floodjoin:on:$chan)]} {
  1398. return
  1399. }
  1400. if {![info exists count(joinflood:$chan)]} {
  1401. set count(joinflood:$chan) 0
  1402. }
  1403. incr count(joinflood:$chan)
  1404. utimer $time [list unset count(joinflood:$chan)]
  1405. if {$count(joinflood:$chan) >= "$number"} {
  1406. if {![botisop $chan]} { return 0 }
  1407. set black(floodjoin:on:$chan) 1
  1408. putquick "MODE $chan +$black(modes)" ; utimer $black(nomodetime) [list joinflood:unlock $chan]
  1409. if {$black(fjoinhow) == "1"} {
  1410. set getlang [string tolower [channel get $chan lang]]
  1411. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1412. set getmessage $black(say.$getlang.antijoinflood.1)
  1413. set message [string map [array get replace] $getmessage]
  1414. puthelp "NOTICE @$chan :$message"
  1415. }
  1416. }
  1417. }
  1418. }
  1419. ########################### User Protection ################################
  1420. proc protectpublic {nick host hand chan args} {
  1421. global black
  1422. set bans [lindex $args 1]
  1423. if {![botisop $chan]} { return 0 }
  1424. if {$bans == "*!*@*"} { putquick "MODE $chan -b $bans"
  1425. return
  1426. }
  1427. set list [userlist $black(exceptflags) $chan]
  1428. foreach user $list {
  1429. set hosts [getuser $user hosts]
  1430. foreach host $hosts {
  1431. if {[string match -nocase $bans $host]} {
  1432. putquick "MODE $chan -b $bans"
  1433. if {[onchan $black(chanserv) $chan]} {
  1434. putquick "PRIVMSG $black(chanserv) :unban $chan $bans"
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440. ############################## AntiChanFlood ###############################
  1441. proc antifloodchan:protect {nick host hand chan arg} {
  1442. global black botnick count
  1443. set arg [split $arg]
  1444. if {![validchan $chan]} { return 0 }
  1445. set getreason [channel get $chan antichanflood-reason]
  1446. if {$getreason == ""} {
  1447. set getlang [string tolower [channel get $chan lang]]
  1448. if {$getlang == ""} { set getlang "[string tolower $black(default_lang)]" }
  1449. set getreason $black(say.$getlang.antichanflood.1)
  1450. }
  1451. set getbantime [channel get $chan antichanflood-bantime]
  1452. if {$getbantime == "0"} { set getbantime $black(antifloodchanbantime) }
  1453. set replace(%chan%) $chan
  1454. set getset [channel get $chan chanflood]
  1455. if {$getset == ""} { set getset "4:5" }
  1456. set protectreason [string map [array get replace] $getreason]
  1457. set reason "$protectreason"
  1458. set number [scan $getset %\[^:\]]
  1459. set time [scan $getset %*\[^:\]:%s]
  1460. set banmask *!*@[lindex [split $host @] 1]
  1461. set handle [nick2hand $nick]
  1462. foreach tmr [utimers] {
  1463. if {[string match "*count(repeat:$host:$chan:flood)*" [join [lindex $tmr 1]]]} {
  1464. killutimer [lindex $tmr 2]
  1465. }
  1466. }
  1467. if {[channel get $chan antichanflood]} {
  1468. if {[channel get $chan vprotect] == ""} { set vprotect ON } else { set vprotect [string toupper [channel get $chan vprotect]] }
  1469. if {[channel get $chan oprotect] == ""} { set oprotect ON } else { set oprotect [string toupper [channel get $chan oprotect]] }
  1470. if {[isvoice $nick $chan] && [string equal -nocase $vprotect "ON"]} { return }
  1471. if {[isop $nick $chan] && [string equal -nocase $oprotect "ON"]} { return }
  1472. if {![botisop $chan]} { return 0 }
  1473. if {[matchattr $handle $black(exceptflags) $chan]} { return 0 }
  1474. if {[isbotnick $nick]} { return 0 }
  1475. if {![info exists count(repeat:$host:$chan:flood)]} {
  1476. set count(repeat:$host:$chan:flood) 0
  1477. }
  1478. if {![info exists count(repeat:$host:$chan)]} {
  1479. set count(repeat:$host:$chan) 0
  1480. }
  1481. incr count(repeat:$host:$chan:flood)
  1482. utimer $time [list unset count(repeat:$host:$chan:flood)]
  1483. if {$count(repeat:$host:$chan:flood) >= $number} {
  1484. if {$black(antifloodchantype) == "0"} { set count(repeat:$host:$chan) 2 }
  1485. incr count(repeat:$host:$chan)
  1486. if {$count(repeat:$host:$chan) == 1} {
  1487. set getcount [channel get $chan kickcount]
  1488. set kcount [expr $getcount +1]
  1489. channel set $chan kickcount $kcount
  1490. if {[channel get $chan showcount]} {
  1491. set reason "$reason - $kcount -"
  1492. } else {
  1493. set reason "$reason"
  1494. }
  1495. putquick "KICK $chan $nick :$reason"
  1496. }
  1497. if {$count(repeat:$host:$chan) >= 2} {
  1498. blacktools:banner:2 $banmask $botnick $chan $reason $getbantime
  1499. unset count(repeat:$host:$chan)
  1500. }
  1501. }
  1502. }
  1503. }
  1504. proc antifloodchan:protect:me {nick host hand chan keyword arg} {
  1505. antirepeat:protect $nick $host $hand $chan $arg
  1506. }