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.

A TCL request...

Old posts that have not been replied to for several years.
Locked
e
earthdark

Post by earthdark »

Wonder if someone can script a little command for me?

Basically, it would be binded as m|m dcc and syntax would be .command hand host where the script would basically clear all the hosts of user "hand" and add the new hostmask "host."

Oh yea, one more thing, it would be great if you can come up with the dcc command name too cause I can't think of anything that would be meaningful and not conflict with existing commands. :P
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You can try this, I made the command ".newhosts" because it's shorter than ".overwritehosts" heh.

Code: Select all

bind dcc m newhosts newhosts

proc newhosts {hand idx text} {
        set parts [split $text]
        set target [lindex $text 0]
        set newhosts [lrange $text 1 end]
        if {![validuser $target]} {
                putdcc $idx "syntax: .newhosts <handle> <new host 1> <new host 2> ..."
                return 0
        }
        setuser $target HOSTS
        foreach host $newhosts {
                setuser $target HOSTS $host
        }
        return 1
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

strdarg, the man of the moment himself, teaches me the ways to splitting strings to lists, and forgets to do it himself. Well, partialy. He split the string, but forgot to use it.

It is advisable if you use this version instead.

Code: Select all

bind dcc m newhosts newhosts
proc newhosts {hand idx text} {
        set parts [split $text]
        set target [lindex $parts 0]
        set newhosts [lrange $parts 1 end]
        if {![validuser $target]} {
                putdcc $idx "syntax: .newhosts <handle> <new host 1> <new host 2> ..."
                return 0
        }
        setuser $target HOSTS
        foreach host $newhosts {
                setuser $target HOSTS $host
        }
        return 1
}
e
earthdark

Post by earthdark »

Thanks a bunch guys.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

heh thanks pp :)
Locked