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.
Old posts that have not been replied to for several years.
sKy
Op
Posts: 194 Joined: Thu Apr 14, 2005 5:58 pm
Location: Germany
Post
by sKy » Sun May 01, 2005 10:48 am
Is there a way to do the same like this script but with more speed?
(hostlist is much bigger)
Code: Select all
set hostlist {
"*.il24.net"
"*.comcast.net"
"*.jazztel.es"
"*.telia.com"
"*.attbi.com"
...........
...........
...........
}
bind join - * onjoin:check
proc onjoin:check { nickname hostname handle channel } {
set host [lindex [split $hostname "@"] 1]
foreach h $hostlist {
if { [string match -nocase $h $host] } {
procname $var $var ....
return
}
}
}
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 01, 2005 11:04 am
if you bind join - "* <mask>" it might make it faster, but then you'll have alot of bind joins, so I suggest you keep it this way.
sKy
Op
Posts: 194 Joined: Thu Apr 14, 2005 5:58 pm
Location: Germany
Post
by sKy » Sun May 01, 2005 11:08 am
what about lsearch? i tryed but i can`t find "right match"
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 01, 2005 11:12 am
With lsearch you search for an element in a list and it will return it's position in the list (which would be a number) or -1 if it doesn't exist. So, you can't match with lsearch.
sKy
Op
Posts: 194 Joined: Thu Apr 14, 2005 5:58 pm
Location: Germany
Post
by sKy » Sun May 01, 2005 11:26 am
mmh :/
no other way?
how is the internal bot banlist coded? that`s still fast until the banlist is huge.
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Sun May 01, 2005 12:21 pm
dont disapoint the guy. of course lsearch can search for wildcards:
http://www.tcl.tk/man/tcl8.4/TclCmd/lsearch.htm#M10
you can probably speed up the thing, when you set the list like:
set hostlist {*.il24.net *.comcast.net *.jazztel.es *.telia.com *.attbi.com ...}
an alternitve would be to do:
set hostlist [lrange $hostlist 0 end]
this should strip any redudant code.
Code: Select all
#De_Kus# set hostlist
Currently: "*.il24.net" "*.comcast.net" "*.jazztel.es" "*.telia.com" "*.attbi.com"
tcl: evaluate (.tcl): lrange $hostlist 0 end
Tcl: *.il24.net *.comcast.net *.jazztel.es *.telia.com *.attbi.com
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
arcane
Master
Posts: 280 Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:
Post
by arcane » Mon May 02, 2005 3:30 am
hm.. maybe sort the list and use lsearch -sorted. i think that would be the most effective improvement.
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Wed May 04, 2005 11:27 pm
Tcl's lsearch won't work with -glob and -sorted at the same time. However you could write a search function that does that... it's kind of tricky because you have to split the list up based on where the wildcards are (beginning, middle, end). I was doing something like this for eggdrop 1.9.
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Thu May 05, 2005 4:30 am
we still don't know how much the lrange and lsearch speed up does ^-^.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Fri May 06, 2005 12:37 pm
If we use -glob with lsearch we can match an element with wildcards to an element in a list. So we can't match this!that@those to this!*@* in the list but we can do vice-versa.
example:
.tcl set thislist {"yo!*@*" "hayda*!me@*"}
.tcl lsearch -glob $thislist yo!hayda@haydek
Tcl: -1
.tcl lsearch -glob $thislist *!me@*
Tcl: 1
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Fri May 06, 2005 5:01 pm
Sky, how big is your list anyway? Unless it's really big I doubt this is much of an issue, but if it is, I'll try writing that thing I was talking about in tcl. Still might not make a whole lot of difference but it would be kind of fun.
sKy
Op
Posts: 194 Joined: Thu Apr 14, 2005 5:58 pm
Location: Germany
Post
by sKy » Fri May 06, 2005 5:32 pm
It`s not too big and to slow now but the size will be bigger every day.