BT.inviteban.tcl 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ########################## INVITEBAN 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 inviteban:protect {from type arg} {
  17. global black
  18. set invitechan [lindex [split $arg] 1]
  19. set ::invitechan $invitechan
  20. if {[string match -nocase "*!*" $from]} {
  21. set split_from [split $from "!"]
  22. set from_nick [lindex [split $split_from] 0]
  23. if {[string equal -nocase $from_nick $black(chanserv)]} {
  24. return
  25. }
  26. putserv "USERHOST :$from_nick"
  27. bind RAW - 302 inviteban:gethost
  28. return
  29. }
  30. if {[string equal -nocase $from $black(chanserv)]} {
  31. return
  32. }
  33. putserv "USERHOST :$from"
  34. bind RAW - 302 inviteban:gethost
  35. }
  36. proc inviteban:gethost {from keyword arguments} {
  37. global black
  38. set invitechan $::invitechan
  39. set hostname [lindex [split $arguments] 1]
  40. set channels ""
  41. if {[regexp {\+} $hostname]} {
  42. set split_host [split $hostname "+"]
  43. } else {
  44. set split_host [split $hostname "-"]
  45. }
  46. set mask [lindex $split_host 1]
  47. set getnick [string map {
  48. "=" ""
  49. ":" ""
  50. } [lindex $split_host 0]]
  51. if {$getnick != ""} {
  52. foreach chan [channels] {
  53. set bl_protect [blacktools:protect $getnick $chan]
  54. if {$bl_protect == "1"} { continue }
  55. if {[matchattr [nick2hand $getnick] $black(exceptflags) $chan]} {
  56. continue
  57. }
  58. lappend channels $chan
  59. }
  60. }
  61. if {$channels != ""} {
  62. inviteban:act $channels 0 $mask $invitechan $getnick
  63. }
  64. check:if:bind "inviteban:gethost" "302"
  65. }
  66. proc inviteban:act {channels num mask invitechan nick} {
  67. global black
  68. set chan [join [lindex [split $channels] $num]]
  69. set inc 0
  70. if {$chan == ""} {
  71. return
  72. }
  73. if {[setting:get $chan inviteban]} {
  74. if {[onchan $nick $chan]} {
  75. blacktools:banner:2 $nick "INVITEBAN:[encoding convertto utf-8 $invitechan]" $chan $chan $mask "0" ""
  76. who:chan $chan
  77. }
  78. }
  79. set inc [expr $num + 1]
  80. if {[lindex $channels $inc] != ""} {
  81. utimer 5 [list inviteban:act $channels $inc $mask $invitechan $nick]
  82. }
  83. }
  84. ##############
  85. #########################################################################
  86. ## END ##
  87. #########################################################################