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 

mask ban

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Thu Aug 21, 2008 12:43 pm    Post subject: mask ban Reply with quote

when I set !ban <nick> .. the eggdrop ban's the user in this way *!*~Tester@*.moldtelecom.md

does anybody know what do i need to change so the eggdrop will ban only the MASK ?

Code:
proc pub_lol_ban {nick host hand chan arg} {
   set arg [charfilter $arg]
   global lol botnick
   if {![check $hand $nick $host]} {
      if {$lol(silent) == 1 || [checksilent $hand]} {return 0}
                puthelp "NOTICE $nick :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
      return 0
   }
   if {[llength $arg] < 1} {
      puthelp "NOTICE $nick :\002Usage:\002 [string trim $lol(cmdchar)]ban <nick|mask> \[time\] \[reason\]"
      return 0
   }
   set who [lindex $arg 0]
   set ti [lindex $arg 1]
   if {[number $ti]} {
      set reason [lrange $arg 2 end]
   } {
      set ti ""
      set reason [lrange $arg 1 end]
   }
   if {$reason == ""} {set reason "requested by $hand"}
   if {[string first "*" $who] != -1 || [string first "?" $who] != -1} {
      if {$reason == "requested by $hand"} {set reason "MaskBan: $who"}
      set who [strlwr $who]
      set bancount 0
      set flags "-$lol(no_ban_flags)&-$lol(no_ban_flags)"
      if {$lol(no_ban_flags) == ""} {
         set list [strlwr [chanlist $chan]]
      } {
         set list [strlwr [chanlist $chan $flags]]
      }
      foreach chanuser $list {
         set banmask ""
         if {[string match [strlwr $who] [strlwr $chanuser]] && $chanuser != [strlwr $botnick] && $chanuser != [strlwr $nick] && ![isop $chanuser $chan] && ![isvoice $chanuser $chan]} {
            incr bancount
            set ipmask [lindex [split [maskhost $chanuser![getchanhost $chanuser $chan]] "@"] 1]
            set userm [lindex [split [getchanhost $chanuser $chan] "@"] 0]
            set banmask *!*$userm@$ipmask
                        set x "X"
                        putmsg $x "ban $chan $banmask ($nick) $reason"
            newchanban $chan $banmask $nick $reason
            if {[botisop $chan]} {
               putserv "MODE $chan +b $banmask"
               putserv "KICK $chan $chanuser :$nick: $reason"
                           }
         }
      }
      if {$bancount == 0} {
                        puthelp "NOTICE $nick :Sorry but no one matches this mask."
      }
   } {
      if {![onchan $who $chan]} {
                        puthelp "NOTICE $nick :Sorry, but I don't see $who in $chan."
         return 0
      }
      if {[strlwr $who] == [strlwr $botnick]} {
         puthelp "NOTICE $nick :Yeah right, like I'm going to let you ban ME!"
         return 0
      }
      if {[nick2hand $who $chan] != "*"} {
         if {$hand != [nick2hand $who $chan]} {
            if {[matchattr [nick2hand $who $chan] o|o $chan] && ![matchattr $hand o|o $chan]} {
                                        puthelp "NOTICE $nick :Sorry, you must be an operator to ban an operator."
               return 0
            }
            if {([matchattr [nick2hand $who $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan]} {
                                        puthelp "NOTICE $nick :Sorry, you must be a master to ban a master or a bot."
               return 0
            }
         }
      }
      set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
      set userm [lindex [split [getchanhost $who $chan] "@"] 0]
      set banmask *!*@$ipmask
            set x "X"
            putmsg $x "ban $chan $banmask ($nick) :$reason"
      if {[botisop $chan]} {
         if {[isop $who $chan]} {pushmode $chan -o $who}
         putserv "MODE $chan +b $banmask"
         putserv "KICK $chan $who :$reason"
      }
      switch $ti {
         ""
         {
            newchanban $chan $banmask $nick $reason
            puthelp "NOTICE $nick :New mask added: $banmask"
         }
         0
         {
            newchanban $chan $banmask $nick $reason $ti
            puthelp "NOTICE $nick :New mask added permanently: $banmask"
         }
         default
         {
            newchanban $chan $banmask $nick $reason $ti
            puthelp "NOTICE $nick :New mask added for $ti minutes: $banmask"
         }
      }
   }
   return 0
}
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Thu Aug 21, 2008 12:52 pm    Post subject: Reply with quote

Hi.
u should read the config lol.

Code:
# BAN TYPE : HOW DO YOU WANT TO BAN THE USER ? DEFAULT 1
#  0 - *!*user@*.domain
#  1 - *!*@host.domain
set lol(bantype) 1


if not, try it.

Code:
proc pub_lol_ban {nick host hand chan arg} {
   set arg [charfilter $arg]
   global lol botnick
   if {![check $hand $nick $host]} {
      if {$lol(silent) == 1 || [checksilent $hand]} {return 0}
                puthelp "NOTICE $nick :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
      return 0
   }
   if {[llength $arg] < 1} {
      puthelp "NOTICE $nick :\002Usage:\002 [string trim $lol(cmdchar)]ban <nick|mask> \[time\] \[reason\]"
      return 0
   }
   set who [lindex $arg 0]
   set ti [lindex $arg 1]
   if {[number $ti]} {
      set reason [lrange $arg 2 end]
   } {
      set ti ""
      set reason [lrange $arg 1 end]
   }
   if {$reason == ""} {set reason "requested by $hand"}
   if {[string first "*" $who] != -1 || [string first "?" $who] != -1} {
      if {$reason == "requested by $hand"} {set reason "MaskBan: $who"}
      set who [strlwr $who]
      set bancount 0
      set flags "-$lol(no_ban_flags)&-$lol(no_ban_flags)"
      if {$lol(no_ban_flags) == ""} {
         set list [strlwr [chanlist $chan]]
      } {
         set list [strlwr [chanlist $chan $flags]]
      }
      foreach chanuser $list {
         set banmask ""
         if {[string match [strlwr $who] [strlwr $chanuser]] && $chanuser != [strlwr $botnick] && $chanuser != [strlwr $nick] && ![isop $chanuser $chan] && ![isvoice $chanuser $chan]} {
            incr bancount
            set ipmask [lindex [split [maskhost $chanuser![getchanhost $chanuser $chan]] "@"] 1]
            set userm [lindex [split [getchanhost $chanuser $chan] "@"] 0]
         set banmask *!*@[lindex [split [getchanhost $chanuser $chan] @] 1]
                        set x "X"
                        putmsg $x "ban $chan $banmask ($nick) $reason"
            newchanban $chan $banmask $nick $reason
            if {[botisop $chan]} {
               putserv "MODE $chan +b $banmask"
               putserv "KICK $chan $chanuser :$nick: $reason"
                           }
         }
      }
      if {$bancount == 0} {
                        puthelp "NOTICE $nick :Sorry but no one matches this mask."
      }
   } {
      if {![onchan $who $chan]} {
                        puthelp "NOTICE $nick :Sorry, but I don't see $who in $chan."
         return 0
      }
      if {[strlwr $who] == [strlwr $botnick]} {
         puthelp "NOTICE $nick :Yeah right, like I'm going to let you ban ME!"
         return 0
      }
      if {[nick2hand $who $chan] != "*"} {
         if {$hand != [nick2hand $who $chan]} {
            if {[matchattr [nick2hand $who $chan] o|o $chan] && ![matchattr $hand o|o $chan]} {
                                        puthelp "NOTICE $nick :Sorry, you must be an operator to ban an operator."
               return 0
            }
            if {([matchattr [nick2hand $who $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan]} {
                                        puthelp "NOTICE $nick :Sorry, you must be a master to ban a master or a bot."
               return 0
            }
         }
      }
      set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
      set userm [lindex [split [getchanhost $who $chan] "@"] 0]
     set banmask *!*@[lindex [split [getchanhost $who $chan] @] 1]
            set x "X"
            putmsg $x "ban $chan $banmask ($nick) :$reason"
      if {[botisop $chan]} {
         if {[isop $who $chan]} {pushmode $chan -o $who}
         putserv "MODE $chan +b $banmask"
         putserv "KICK $chan $who :$reason"
      }
      switch $ti {
         ""
         {
            newchanban $chan $banmask $nick $reason
            puthelp "NOTICE $nick :New mask added: $banmask"
         }
         0
         {
            newchanban $chan $banmask $nick $reason $ti
            puthelp "NOTICE $nick :New mask added permanently: $banmask"
         }
         default
         {
            newchanban $chan $banmask $nick $reason $ti
            puthelp "NOTICE $nick :New mask added for $ti minutes: $banmask"
         }
      }
   }
   return 0
}
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Thu Aug 21, 2008 1:32 pm    Post subject: Reply with quote

Thx .. it works now Very Happy

Code:
set banmask *!*@[lindex [split [getchanhost $who $chan] @] 1]


THX Nor7on
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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