egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bad channel kicker

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Passionate
Voice


Joined: 25 Oct 2005
Posts: 15

PostPosted: Tue Oct 25, 2005 9:44 am    Post subject: bad channel kicker Reply with quote

Code:

## BadWhois
# version 0.1
# caesar <cezarica [at] prietenii [dot] com>
# #eggdrop @ Undernet.org
# http://www.r0x0ring.com/

###
## Description:
# Performs a whois on join and places a *!*@host ban if mathes a banned realname or a banned channel.

###
## Available commands:
#
#     Where  Flag Command   Description
#     -----  ---- -------   -----------
#     PUB : N/A
#
#     MSG : N/A
#
#     DCC :  n|n .chanset   Use .chanset to set what protections to active for the particular channel or not.
#                           Example: .chanset #mychan +badwhois
#                                    .chanset #otherchan -badwhois

###
## Custom channel flags:
#
#  Flag:       Description:
#  -----       ------------
#  +badwhois  Channels marked with this flag will be "checked" for bad realnames and bad channels on join.
#
# Attention!
#  By default the channel flag (badwhois) is disabled. Enable it on the channels you wish.
#  Don't use this script
#

##
# Adjust the folowing things to suit your needs!

# .1. What bad realnames should be banned?
set bwhois(list) {
"foo bar"
"bla bla"
"*moo*"
"???"
"*http://*"
"*www.*"
}

# .2. What bad channels should be banned?
set bwhois(chans) {#foo #moo #bar}

# .3. Specify the ban reason and the ban time (in minutes) for a bad realname:
set bwhois(br) {"You norteh norteh boy!" 60}

# .4. Specify the ban reason and the ban time (in minutes) for a bad channel:
set bwhois(bc) {"Wrong channel boy!" 60}

# .4. Number of joins in seconds do a delayed whois.
set bwhois(flud) "5:3:10"

#
## Don't edit past here unless you know TCL!
#

set bwhois(version) "0.1"
setudef flag badwhois

##
# binds

bind join * * badwhois:join
bind part - * badwhois:part
bind raw - 311 badwhois:check
bind raw - 319 badwhois:chans

##
# whois on join

proc badwhois:join {nick uhost hand chan} {
  global bflud bwhois
  if {![channel get $chan badwhois] || [isbotnick $nick ] || [matchattr $hand f|f $chan]} {
    return
  }
  if {![info exists bflud($chan)]} {
    set bflud($chan) 0
  }
  incr bflud($chan)
  utimer [lindex [set bla [split $bwhois(flud) ":"]] 1] [list incr bflud($chan) -1]
  if {$bflud($chan) >= [lindex $bla 0]} {
    puthelp "WHOIS $nick"
    } else {
    utimer [lindex $bla 2] [puthelp "WHOIS $nick"]
  }
  lappend bwhois(whois) "$nick:$chan:*!*@[lindex [split $uhost @] 1]"
}

##
# realname check

proc badwhois:check {from key txt} {
  global bwhois
  if {![info exists bwhois(whois)]} {
    set bwhois(whois) ""
  }
  if {[isbotnick [set nick [lindex [split $txt] 1]]] || [validuser [nick2hand $nick]]} {
    return
  }
  set realname [stripcodes bcruag [string range [join [lrange [split $txt] 5 end]] 1 end]]
  foreach bla $bwhois(list) {
    if {[string match -nocase $bla $realname]} {
      set position [lsearch $bwhois(whois) "*:[set mask *!*@[lindex $txt 3]]*"]
      if {[botisop [set chan [lindex [set t [split [lindex $bwhois(whois) $position] :]] 1]]]} {
        putquick "KICK $chan $nick :[lindex $bwhois(br) 0]" -next
      }
      newchanban $chan $mask BadWhois [lindex $bwhois(br) 0] [lindex $bwhois(br) 1]
      set bwhois(whois) [lreplace $bwhois(whois) $position $position]
      break
    }
  }
}

##
# channels check

proc badwhois:chans {from key txt} {
  global bwhois
  if {[isbotnick [set nick [lindex [split $txt] 1]]] || [validuser [nick2hand $nick]]} {
    return
  }
  if {[set position [lsearch $bwhois(whois) "*$nick:*"]] != -1} {
    foreach bla [lrange $txt 2 e] {
      if {[string match -nocase "*[string trimleft $bla ":@+"]*" $bwhois(chans)]} {
        if {[botisop [set chan [lindex [set t [split [lindex $bwhois(whois) $position] :]] 1]]]} {
          putquick "KICK $chan [lindex $t 0] :[lindex $bwhois(bc) 0]" -next
        }
        newchanban $chan [lindex $t 2] BadWhois [lindex $bwhois(bc) 0] [lindex $bwhois(bc) 1]
        set bwhois(whois) [lreplace $bwhois(whois) $position $position]
        break
      }
    }
  }
}

##
# array remove

proc badwhois:part {nick uhost hand chan msg} {
  global bflud
  if {[isbotnick $nick] && [string match -nocase "*$chan*" [array names bflud]]} {
    array unset bflud $chan
  }
}

putlog "badwhois v$bwhois(version) loaded.."


This tcl making the bans sticky. How to alter it as not to make the bans sticky.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Tue Oct 25, 2005 10:05 am    Post subject: Reply with quote

Code:
.chanset #chan -enforcebans +dynamicbans

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber