BT.antibadquitpart.tcl 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ###################### ANTIBADQUITPART TCL ##########################
  6. #########################################################################
  7. ## ##
  8. ## BlackTools : http://blacktools.tclscripts.net ##
  9. ## Bugs report : http://www.tclscripts.net/ ##
  10. ## GitHub page : https://github.com/tclscripts/BlackToolS-TCL ##
  11. ## Online Help : irc://irc.undernet.org/tcl-help ##
  12. ## #TCL-HELP / UnderNet ##
  13. ## You can ask in english or romanian ##
  14. ## ##
  15. #########################################################################
  16. proc badquitpart:protect {nick host hand chan arg} {
  17. global botnick black
  18. set chan1 $chan
  19. set arg [split $arg]
  20. set found_pub ""
  21. set found_color 0
  22. set found_msgflood 0
  23. set banmask [return_mask [return_host_num "antibadquitpart" $chan $host] $host $nick]
  24. if {![validchan $chan]} { return }
  25. if {[setting:get $chan badquitpart]} {
  26. set handle [nick2hand $nick]
  27. foreach usr [userlist "-|AOMV" $chan] {
  28. set hst [getuser $usr hosts]
  29. foreach hhost $hst {
  30. if {[string match -nocase $hhost $banmask]} {
  31. return
  32. }
  33. }
  34. }
  35. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  36. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  37. set bl_protect [blacktools:protect $nick $chan]
  38. if {$bl_protect == "1"} { return }
  39. if {[isbotnick $nick]} { return }
  40. set text [check:except $arg $chan $black(badquitpartwords) $black(badquitpartexcept) "BADQUITPART"]
  41. set check_word [check:file:word $chan $text "BADQUITPART"]
  42. if {$check_word != ""} {
  43. set found_pub $check_word
  44. }
  45. if {$found_pub != ""} {
  46. blacktools:banner:2 $nick "ANTIBADQUITPART:$found_pub" $chan $chan1 $host "0" ""
  47. if {[link:status $chan] == "1"} {
  48. foreach c [link:chan:get $chan] {
  49. blacktools:banner:2 $nick "ANTIBADQUITPART:$found_pub" $c $c $host "1" ""
  50. }
  51. blacktools:link_ban2 [link:get] 0
  52. } else { who:chan $chan }
  53. return
  54. }
  55. }
  56. if {[setting:get $chan quitpartcolor]} {
  57. set handle [nick2hand $nick]
  58. foreach usr [userlist "-|AOMV" $chan] {
  59. set hst [getuser $usr hosts]
  60. foreach hhost $hst {
  61. if {[string match -nocase $hhost $banmask]} {
  62. return
  63. }
  64. }
  65. }
  66. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  67. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  68. set bl_protect [blacktools:protect $nick $chan]
  69. if {$bl_protect == "1"} { return }
  70. if {[isbotnick $nick]} { return }
  71. foreach color $black(badcolors) {
  72. if {[setting:get $chan quitpartcolor] && [string match -nocase $color $arg]} {
  73. set found_color 1
  74. }
  75. }
  76. if {$found_color == "1"} {
  77. blacktools:banner:2 $nick "ANTIBADQUITPART:COLOR" $chan $chan $host "0" ""
  78. if {[link:status $chan] == "1"} {
  79. foreach c [link:chan:get $chan] {
  80. blacktools:banner:2 $nick "ANTIBADQUITPART:COLOR" $c $c $host "1" ""
  81. }
  82. }
  83. return
  84. }
  85. }
  86. if {[setting:get $chan quitpartmsgflood]} {
  87. set handle [nick2hand $nick]
  88. foreach usr [userlist "-|AOMV" $chan] {
  89. set hst [getuser $usr hosts]
  90. foreach hhost $hst {
  91. if {[string match -nocase $hhost $banmask]} {
  92. return
  93. }
  94. }
  95. }
  96. if {![botisop $chan] && ![setting:get $chan xonly]} { return }
  97. if {[matchattr $handle $black(exceptflags) $chan]} { return }
  98. set bl_protect [blacktools:protect $nick $chan]
  99. if {$bl_protect == "1"} { return }
  100. if {[isbotnick $nick]} { return }
  101. set getlongchar [setting:get $chan quitpartmsgflood-char]
  102. if {$getlongchar == ""} { set getlongchar "$black(badquitpartmsgchar)" }
  103. if {[string length $arg] >= $getlongchar} {
  104. set found_msgflood 1
  105. }
  106. if {$found_msgflood == "1"} {
  107. if {$black(badquitpartmode) != ""} {
  108. putserv "MODE $chan +$black(badquitpartmode)"
  109. utimer $black(badquitpartsecunde) [list badquitpart:removemode $chan]
  110. }
  111. blacktools:banner:2 $nick "ANTIBADQUITPART:MSGFLOOD" $chan $chan $host "0" ""
  112. if {[link:status $chan] == "1"} {
  113. foreach c [link:chan:get $chan] {
  114. blacktools:banner:2 $nick "ANTIBADQUITPART:MSGFLOOD" $c $c $host "1" ""
  115. }
  116. }
  117. return
  118. }
  119. }
  120. }
  121. proc badquitpart:removemode {chan} {
  122. global black
  123. putserv "MODE $chan -$black(badquitpartmode)"
  124. }
  125. proc badquitpartsign:protect {nick host hand chan arg} {
  126. badquitpart:protect $nick $host $hand $chan $arg
  127. }
  128. proc badquitpart:module {nick host hand chan arg} {
  129. global black lastbind
  130. set type 0
  131. set chan1 "$chan"
  132. set why [lindex [split $arg] 0]
  133. set except [join [lrange [split $arg] 1 end]]
  134. set number [lindex [split $arg] 1]
  135. if {[regexp {^[&#]} $why] && [matchattr $hand nmo|M $why]} {
  136. set chan "$why"
  137. set why [lindex [split $arg] 1]
  138. set except [join [lrange [split $arg] 2 end]]
  139. set number [lindex [split $arg] 2]
  140. }
  141. set return [blacktools:mychar $lastbind $hand]
  142. if {$return == "0"} {
  143. return
  144. }
  145. prot:module:process $nick $host $hand $chan $chan1 $why $except $type $number "badquitpart"
  146. }
  147. ##############
  148. #########################################################################
  149. ## END ##
  150. #########################################################################