BT.Private.tcl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ########################### PRIVATE 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 private:process {nick host hand chan chan1 why user shost type} {
  17. global botnick black
  18. set cmd_status [btcmd:status $chan $hand "private" 0]
  19. if {$cmd_status == "1"} {
  20. return
  21. }
  22. if {[matchattr $hand q]} { blacktools:tell $nick $host $hand $chan $chan1 gl.glsuspend none
  23. return
  24. }
  25. if {[matchattr $hand -|q $chan]} { blacktools:tell $nick $host $hand $chan $chan1 gl.suspend none
  26. return
  27. }
  28. set flags "-|P"
  29. set cmd "private"
  30. set show_user $user
  31. if {$why == ""} {
  32. switch $type {
  33. 0 {
  34. blacktools:tell $nick $host $hand $chan $chan1 gl.instr "private"
  35. }
  36. 1 {
  37. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick "private"
  38. }
  39. 2 {
  40. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_priv "private"
  41. }
  42. }
  43. return
  44. }
  45. switch $why {
  46. add {
  47. if {($user == "") && ($type == "0")} {
  48. blacktools:tell $nick $host $hand $chan $chan1 gl.instr $cmd
  49. return
  50. }
  51. if {($user == "") && ($type == "1")} {
  52. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick $cmd
  53. return
  54. }
  55. if {[onchan $user $chan]} {
  56. set getuser [nick2hand $user]
  57. if {$getuser != "*"} {
  58. set user $getuser
  59. }
  60. }
  61. if {[validuser $user]} {
  62. if {[matchattr $user $flags $chan]} {
  63. blacktools:tell $nick $host $hand $chan $chan1 private.10 $show_user
  64. return
  65. }
  66. chattr $user $flags $chan
  67. blacktools:tell $nick $host $hand $chan $chan1 private.7 $show_user
  68. } else {
  69. if {[onchan $user $chan]} {
  70. set hosts [getchanhost $user $chan]
  71. set uhost [return_mask $black(hostdefaultadd) $hosts $user]
  72. if {[userlist] != ""} {
  73. foreach usr [userlist] {
  74. set hst [getuser $usr hosts]
  75. foreach hhost $hst {
  76. if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
  77. blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
  78. set user $usr
  79. set show_user $usr
  80. }
  81. }
  82. }
  83. }
  84. } else {set uhost $shost}
  85. if {[validuser $user]} {
  86. chattr $user $flags $chan
  87. blacktools:tell $nick $host $hand $chan $chan1 private.7 $show_user
  88. return
  89. }
  90. if {$uhost == ""} {
  91. blacktools:tell $nick $host $hand $chan $chan1 gl.instr $cmd
  92. return 0
  93. }
  94. adduser $user $uhost
  95. chattr $user $flags $chan
  96. blacktools:tell $nick $host $hand $chan $chan1 private.8 "$show_user $uhost"
  97. }
  98. }
  99. del {
  100. if {($user == "") && ($type == "0")} {
  101. blacktools:tell $nick $host $hand $chan $chan1 gl.instr $cmd
  102. return
  103. }
  104. if {($user == "") && ($type == "1")} {
  105. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick $cmd
  106. return
  107. }
  108. if {[onchan $user $chan]} {
  109. set getuser [nick2hand $user]
  110. if {$getuser != "*"} {
  111. set user $getuser
  112. }
  113. }
  114. if {[validuser $user]} {
  115. if {[matchattr $user $flags $chan]} {
  116. chattr $user -|-P $chan
  117. blacktools:tell $nick $host $hand $chan $chan1 private.9 $show_user
  118. } else { blacktools:tell $nick $host $hand $chan $chan1 private.6 $show_user
  119. }
  120. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
  121. }
  122. list {
  123. set list [join [userlist $flags $chan]]
  124. if {$list == ""} { set list "NONE" }
  125. blacktools:tell $nick $host $hand $chan $chan1 private.11 none
  126. blacktools:tell $nick $host $hand $chan $chan1 private.5 $list
  127. }
  128. default {
  129. if {$type == "0"} {
  130. blacktools:tell $nick $host $hand $chan $chan1 gl.instr $cmd
  131. return
  132. }
  133. if {$type == "1"} {
  134. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick $cmd
  135. return
  136. }
  137. }
  138. }
  139. }
  140. proc private:module {nick host hand chan} {
  141. global black botnick
  142. set handle [nick2hand $nick]
  143. if {![validchan $chan]} {
  144. return
  145. }
  146. set chan1 $chan
  147. if {[setting:get $chan private]} {
  148. if {[matchattr $handle nmo|oMASOVP $chan]} {
  149. return
  150. }
  151. blacktools:banner:2 $nick "PRIVATE" $chan $chan1 $host "0" ""
  152. who:chan $chan
  153. }
  154. }
  155. ##############
  156. #########################################################################
  157. ## END ##
  158. #########################################################################