BT.Private.tcl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 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. set hosts [getchanhost $user $chan]
  70. set uhost [return_mask $black(addusermask) $hosts $user]
  71. if {[userlist] != ""} {
  72. foreach usr [userlist] {
  73. set hst [getuser $usr hosts]
  74. foreach hhost $hst {
  75. if {[string match -nocase $hhost $uhost] && (![string match -nocase $usr $user])} {
  76. blacktools:tell $nick $host $hand $chan $chan1 add.5 $usr
  77. set user $usr
  78. set show_user $usr
  79. }
  80. }
  81. }
  82. }
  83. if {[validuser $user]} {
  84. chattr $user $flags $chan
  85. blacktools:tell $nick $host $hand $chan $chan1 private.7 $show_user
  86. return
  87. }
  88. adduser $user $uhost
  89. chattr $user $flags $chan
  90. blacktools:tell $nick $host $hand $chan $chan1 private.8 "$show_user $uhost"
  91. }
  92. }
  93. del {
  94. if {($user == "") && ($type == "0")} {
  95. blacktools:tell $nick $host $hand $chan $chan1 gl.instr $cmd
  96. return
  97. }
  98. if {($user == "") && ($type == "1")} {
  99. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick $cmd
  100. return
  101. }
  102. if {[onchan $user $chan]} {
  103. set getuser [nick2hand $user]
  104. if {$getuser != "*"} {
  105. set user $getuser
  106. }
  107. }
  108. if {[validuser $user]} {
  109. if {[matchattr $user $flags $chan]} {
  110. chattr $user -|-P $chan
  111. blacktools:tell $nick $host $hand $chan $chan1 private.9 $show_user
  112. } else { blacktools:tell $nick $host $hand $chan $chan1 private.6 $show_user
  113. }
  114. } else { blacktools:tell $nick $host $hand $chan $chan1 gl.nomem none }
  115. }
  116. list {
  117. set list [join [userlist $flags $chan]]
  118. if {$list == ""} { set list "NONE" }
  119. blacktools:tell $nick $host $hand $chan $chan1 private.11 none
  120. blacktools:tell $nick $host $hand $chan $chan1 private.5 $list
  121. }
  122. default {
  123. if {$type == "0"} {
  124. blacktools:tell $nick $host $hand $chan $chan1 gl.instr $cmd
  125. return
  126. }
  127. if {$type == "1"} {
  128. blacktools:tell $nick $host $hand $chan $chan1 gl.instr_nick $cmd
  129. return
  130. }
  131. }
  132. }
  133. }
  134. proc private:module {nick host hand chan} {
  135. global black botnick
  136. set handle [nick2hand $nick]
  137. if {![validchan $chan]} {
  138. return
  139. }
  140. set chan1 $chan
  141. if {[setting:get $chan private]} {
  142. if {[matchattr $handle nmo|oMASOVP $chan]} {
  143. return
  144. }
  145. blacktools:banner:2 $nick "PRIVATE" $chan $chan1 $host "0"
  146. who:chan $chan
  147. }
  148. }
  149. ##############
  150. #########################################################################
  151. ## END ##
  152. #########################################################################