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 

need to change Bad channel bantype.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Mon Jun 26, 2006 9:18 pm    Post subject: need to change Bad channel bantype. Reply with quote

Hey guys.
I am using badchan.tcl by bass, and wants to change the default ban type to *!*@host.ip here is the bass code responsible for it.
Code:

proc bmaskhost {uhost} {
  set uhost [lindex [split $uhost !] [expr [llength [split $uhost !]] -1]]
  set temp [string range [lindex [split $uhost @] 0] [expr [string length [lindex [split $uhost @] 0]] - 8] e]
  return "*!*$temp@[lindex [split [maskhost *!*@[lindex [split $uhost @] 1]] @] 1]"
}

proc bc_whois {from key args} {
  global bchan bcqueue bcnicks
#  putlog "319: $args"
  set args [join $args]
  set nick [string tolower [lindex $args 1]]
  if {[info exists bcnicks($nick)]} {set chan $bcnicks($nick)} {return 0}
  set chans [string tolower [lrange $args 2 e]]
  if {[lsearch $bchan(exempt) $chan] == -1 && $bchan(global) != ""} {set bans $bchan(global)} {set bans ""}
  if {[lsearch $bchan(chans) $chan] > -1} {set bans "$bans $bchan($chan)"}
  foreach tok $chans {
    set tok [string trimleft $tok ":@+"]
    foreach ban $bans {
      if {[string match [lindex $ban 0] $tok]} {
        putlog "badchan:  match! $nick k/b'd from $chan because [lrange $ban 1 e]"
        putlog "args: $args, ban: $ban"
        if {[onchan $nick $chan]} {newchanban $chan [bmaskhost [getchanhost $nick $chan]] badchan "[lrange $ban 1 e]" 10}
        return 0
      }
    }
  }
  return 0
}


I changed the code to this:
Code:

proc bmaskhost {uhost} {
  set uhost "*!*@[lindex [split $uhost @] 1]"
  return "$uhost"
}

any other suggestions please.


Last edited by honeybee on Tue Jun 27, 2006 9:24 am; edited 1 time in total
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Tue Jun 27, 2006 1:59 am    Post subject: Reply with quote

you splited and got the host.ip part of the uhost correctly, but you could just return it, without writing it to $uhost before

Code:
proc bmaskhost {uhost} {
  return "*!*@[lindex [split $uhost @] 1]"
}
Back to top
View user's profile Send private message Send e-mail
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Tue Jun 27, 2006 10:08 am    Post subject: Reply with quote

i guess its faster to set it and then return.
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Tue Jun 27, 2006 10:38 am    Post subject: Reply with quote

i really don't think you can feel the difference in execution speed with this change :) but why do you want another method of obtaining the ban? you already posted the fastest and simplest way one can use for this task
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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