Guest User

Untitled

a guest
May 9th, 2018
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1.  
  2. proc get:unnuke:format {{unnuke "input,unnuke"}} {
  3. global site
  4. if { $site($unnuke) == "" } { return 0 }
  5. set site($unnuke,length) [llength $site($unnuke)]
  6. set site($unnuke,reason) [lsearch -exact $site($unnuke) "\$reason"]
  7. set site($unnuke,release) [lsearch -exact $site($unnuke) "\$release"]
  8. set site($unnuke,source) [lsearch -exact $site($unnuke) "\$source"]
  9.  
  10. # and finally prepare the triggerstring that we're gonna use in the bind
  11. regsub -all {(\ +|\ *\$reason\ *|\ *\$release\ *|\ *\$source\ *)} $site($unnuke) * site($unnuke,trigger)
  12. regsub -all {\*\*+} $site($unnuke,trigger) * site($unnuke,trigger)
  13. pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke
  14. putlog "pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke"
  15. return 0
  16. }
  17.  
  18. set unnukenames [array names site input*unnuke]
  19. foreach item $unnukenames {
  20. set parts [split $item ","]
  21. if {[llength $parts] == 3} {
  22. get:unnuke:format [join $parts ","]
  23. } elseif {[llength $parts] == 2} {
  24. get:unnuke:format
  25. }
  26. }
  27. unset unnukenames
  28.  
  29. proc prebot:pub:unnuke { nick uhost hand chan arg } {
  30. global armour module network mysql site
  31. if {[channel get $chan unnukefrom]} {
  32. foreach trigger [array names site input*,unnuke] {
  33. if {[lindex $arg 0] == [lindex $site($trigger) 0]} { set unnuke $trigger }
  34. }
  35. if { $site($unnuke,release) != -1 } {
  36. set release [string trim [lindex $arg $site($unnuke,release)]]
  37. } else { set release "" }
  38. if { $site($unnuke,reason) != -1 } {
  39. set reason [string trim [lindex $arg $site($unnuke,reason)]]
  40. } else { set reason "" }
  41. if { $site($unnuke,source) != -1 } {
  42. set source [string trim [lindex $arg $site($unnuke,source)]]
  43. } else { set source $network }
  44.  
  45. set isrls [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'"]
  46. if { $isrls == 0 } { return 0 }
  47. set section [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'" -flatlist]
  48. set curtime [unixtime]
  49.  
  50. if { [lsearch -exact -inline $armour(unnuke) $release] == $release } { return 0 }
  51. set armour(unnuke) [linsert $armour(unnuke) 0 [string map {"." "_" "u" "oo" "c" "k"} $release]]
  52. set armour(unnuke) [lrange [linsert $armour(unnuke) 0 $release] 0 $armour(keepold)]
  53.  
  54. putallbots "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source"
  55. putallchans "spam" "UNNUKE $release $section $reason $curtime $nick $chan $network $source"
  56.  
  57. if { $module(db) == 1 } { prebot:db:add "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source" }
  58. }
  59. }
  60.  
  61.  
  62. proc get:unnuke:format {{unnuke "input,unnuke"}} {
  63. global site
  64. if { $site($unnuke) == "" } { return 0 }
  65. set site($unnuke,length) [llength $site($unnuke)]
  66. set site($unnuke,reason) [lsearch -exact $site($unnuke) "\$reason"]
  67. set site($unnuke,release) [lsearch -exact $site($unnuke) "\$release"]
  68. set site($unnuke,source) [lsearch -exact $site($unnuke) "\$source"]
  69.  
  70. # and finally prepare the triggerstring that we're gonna use in the bind
  71. regsub -all {(\ +|\ *\$reason\ *|\ *\$release\ *|\ *\$source\ *)} $site($unnuke) * site($unnuke,trigger)
  72. regsub -all {\*\*+} $site($unnuke,trigger) * site($unnuke,trigger)
  73. pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke
  74. putlog "pbbind pubm -|- $site($unnuke,trigger) prebot:pub:unnuke"
  75. return 0
  76. }
  77.  
  78. set unnukenames [array names site input*unnuke]
  79. foreach item $unnukenames {
  80. set parts [split $item ","]
  81. if {[llength $parts] == 3} {
  82. get:unnuke:format [join $parts ","]
  83. } elseif {[llength $parts] == 2} {
  84. get:unnuke:format
  85. }
  86. }
  87. unset unnukenames
  88.  
  89. proc prebot:pub:unnuke { nick uhost hand chan arg } {
  90. global armour module network mysql site
  91. if {[channel get $chan unnukefrom]} {
  92. foreach trigger [array names site input*,unnuke] {
  93. if {[lindex $arg 0] == [lindex $site($trigger) 0]} { set unnuke $trigger }
  94. }
  95. if { $site($unnuke,release) != -1 } {
  96. set release [string trim [lindex $arg $site($unnuke,release)]]
  97. } else { set release "" }
  98. if { $site($unnuke,reason) != -1 } {
  99. set reason [string trim [lindex $arg $site($unnuke,reason)]]
  100. } else { set reason "" }
  101. if { $site($unnuke,source) != -1 } {
  102. set source [string trim [lindex $arg $site($unnuke,source)]]
  103. } else { set source $network }
  104.  
  105. set isrls [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'"]
  106. if { $isrls == 0 } { return 0 }
  107. set section [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'" -flatlist]
  108. set curtime [unixtime]
  109.  
  110. if { [lsearch -exact -inline $armour(unnuke) $release] == $release } { return 0 }
  111. set armour(unnuke) [linsert $armour(unnuke) 0 [string map {"." "_" "u" "oo" "c" "k"} $release]]
  112. set armour(unnuke) [lrange [linsert $armour(unnuke) 0 $release] 0 $armour(keepold)]
  113.  
  114. putallbots "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source"
  115. putallchans "spam" "UNNUKE $release $section $reason $curtime $nick $chan $network $source"
  116.  
  117. if { $module(db) == 1 } { prebot:db:add "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source" }
  118. }
  119. }
  120.  
  121.  
  122. bind bot -|- DBUNNUKE prebot:bot:unnuke
  123. proc prebot:bot:unnuke { bot cmd arg } {
  124. global armour module mysql site put
  125. set release [lindex $arg 0]
  126. set reason [lindex $arg 2]
  127. set section [::mysql::sel $mysql(handle) "SELECT rel_section FROM allpres WHERE rel_name = '$release'" -flatlist]
  128. set curtime [lindex $arg 3]
  129. set nick [lindex $arg 4]
  130. set chan [lindex $arg 5]
  131. set network [lindex $arg 6]
  132. set source [lindex $arg 7]
  133.  
  134. if { [lsearch -exact -inline $armour(unnuke) $release] == $release } { return 0 }
  135. set armour(unnuke) [linsert $armour(unnuke) 0 [string map {"." "_" "u" "oo" "c" "k"} $release]]
  136. set armour(unnuke) [lrange [linsert $armour(unnuke) 0 $release] 0 $armour(keepold)]
  137.  
  138. set chflag "unnuke"
  139. foreach chan [string tolower [channels]] {
  140. if {[channel get $chan unnuketo]} {
  141. if {[info exists site(output,[string tolower $chan],$chflag)]} {
  142. set output $site(output,[string tolower $chan],$chflag)
  143. } else { set output $site(output,default,$chflag) }
  144.  
  145. if { [llength $site(output,nuke,allowedsource)] <= 0 } { set SendToNetwork "1"
  146. } elseif { [lsearch -exact $site(output,nuke,allowedsource) $source] != -1 } { set SendToNetwork "1"
  147. } else { set SendToNetwork "0" }
  148.  
  149. if { $SendToNetwork == "1" } {
  150. if {[info exists site(fish,[string tolower $chan],key)]} {
  151. if {[info exists site(fish,[string tolower $chan],prefix)]} {
  152. $put(fast) "PRIVMSG $chan :$site(fish,[string tolower $chan],prefix) [encrypt $site(fish,[string tolower $chan],key) [subst $output]]"
  153. } else {
  154. $put(fast) "PRIVMSG $chan :$site(fish,default,prefix) [encrypt $site(fish,[string tolower $chan],key) [subst $output]]"
  155. }
  156. } else { $put(fast) "PRIVMSG $chan :[subst $output]" }
  157. }
  158. }
  159. }
  160.  
  161. if { $module(db) == 1 } { prebot:db:add "DBUNNUKE $release $section $reason $curtime $nick $chan $network $source" }
  162. }
  163.  
  164. bind bot -|- DBUNNUKEOK prebot:bot:unnukespam
  165. proc prebot:bot:unnukespam { bot cmd arg } {
  166. global armour module mysql site put
  167. set release [lindex $arg 0]
  168. set section [lindex $arg 1]
  169. set reason [lindex $arg 2]
  170. set curtime [lindex $arg 3]
  171. set nick [lindex $arg 4]
  172. set chan [lindex $arg 5]
  173. set network [lindex $arg 6]
  174. set source [lindex $arg 7]
  175.  
  176. putallchans "spam" "UNNUKE $release $section $reason $curtime $nick $chan $network $source"
  177. }
Add Comment
Please, Sign In to add comment