This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

mask ban

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

mask ban

Post by Danik »

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: Select all

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
}
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Hi.
u should read the config lol.

Code: Select all

# 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: Select all

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 
}
D
Danik
Halfop
Posts: 49
Joined: Sun Jun 15, 2008 12:59 pm
Location: Moldova
Contact:

Post by Danik »

Thx .. it works now :D

Code: Select all

set banmask *!*@[lindex [split [getchanhost $who $chan] @] 1]
THX Nor7on
Post Reply