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.

.+host .-host public commands

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Getodacul
Voice
Posts: 20
Joined: Thu Jun 07, 2007 2:32 pm

.+host .-host public commands

Post by Getodacul »

I need a script to add or remove a host on channel.
<me> .+host User1 *!*@new-hostname.tld
<Bot> *!*@new-hostname.tld added to User1
I find some tcl's that convert some dcc commands in public commands but modifications make that scripts broken or useless :)
Thanks.
User avatar
Getodacul
Voice
Posts: 20
Joined: Thu Jun 07, 2007 2:32 pm

Post by Getodacul »

Half problem solved but remhost or delhost it's out of line :)
bind pub o "+host" pub:addhost
#that's for user
bind pub n ".+host" pub:changehost
#that's for bots or other people

proc pub:addhost { nick userhost hand chan host } {
if {$host == ""} {
puthelp "privmsg $chan :+host <your-new-hostname>"
return 0
}
set hostname [lindex $host 0]
addhost $hand $hostname
puthelp "privmsg $chan :Added hostname $hostname to $hand"
}

proc pub:changehost { nick userhost hand chan text } {
set handle [lindex $text 0]
set newhost [lindex $text 1]
if {$text == ""} {
puthelp "privmsg $chan :.+host <handle> <new-hostname> (to see a handle use: !whois <nickname>)"
return 0
}
addhost $handle $newhost
puthelp "privmsg $chan :Added hostname $newhost to $handle "
}
putlog "Addhost Loaded"
The script it's tested and working fine. Feel free to modify.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

from tcl-commands.doc
getuser <handle> <entry-type> [extra info]
Description: an interface to the new generic userfile support. Valid
entry types are:
BOTFL - returns the current bot-specific flags for the user
(bot-only)
BOTADDR - returns a list containing the bot's address, telnet port,
and relay port (bot-only)
HOSTS - returns a list of hosts for the user
LASTON - returns a list containing the unixtime last seen and the
last seen place. LASTON #channel returns the time last
seen time for the channel or 0 if no info exists.
INFO - returns the user's global info line
XTRA - returns the user's XTRA info
COMMENT - returns the master-visible only comment for the user
EMAIL - returns the user's e-mail address
URL - returns the user's url
HANDLE - returns the user's handle as it is saved in the userfile
PASS - returns the user's encrypted password
Returns: info specific to each entry-type
Module: core

setuser <handle> <entry-type> [extra info]
Description: this is the counterpart of getuser. It lets you set the
various values. Other then the ones listed below, the entry-types are
the same as getuser's.
PASS - sets a users password (no third arg will clear it)
HOSTS - if used with no third arg, all hosts for the user will be
be cleared. Otherwise, *1* hostmask is added :P
LASTON - This setting has 3 forms. "setuser <handle> LASTON
<unixtime> <place>" sets global LASTON time, "setuser
<handle> LASTON <unixtime>" sets global LASTON time
(leaving the place field empty), and "setuser <handle>
LASTON <unixtime> <channel>" sets a users LASTON time for
a channel (if it is a valid channel).
Returns: nothing
Module: core
can't remember I've seen a remhots/delhost command, perhapse it was being provided by some other script?
something like this might work though

Code: Select all

# remhost <user> <hostmask>
#returns 1 if ok, 0 if not
proc remhost {user host} {
	if {([validuser $user]) && ([set ind [lsearch -exact [set hostlist [getuser $user HOSTS]] $host]] != -1)} {
		set hostlist [lreplace $hostlist $ind $ind]
		foreach {h} $hostlist { setuser $user HOSTS $h }
		return 1
	} else {
		return 0
	}
}
Elen sila lúmenn' omentielvo
Post Reply