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.

add newhost when nick change

Old posts that have not been replied to for several years.
Locked
H
HecKel
Voice
Posts: 23
Joined: Wed Jan 19, 2005 3:50 pm
Location: Lisbon, Portugal

add newhost when nick change

Post by HecKel »

I have this code, but that doesn't work :S where is the error?

If you had a better idea that's wellcome ;)

Code: Select all

bind nick - * check_user_nick

proc check_user_nick {nick uhost hand chan newnick} {
	if {[validuser $hand]} {
		utimer 120 [ask_user $hand $newnick]
	}
}

proc ask_user {hand newnick} {
	set nick [hand2nick $hand]
	if {![string match "" $nick] && [string match $newnick $nick]} {
		if {![validuser "$nick!*@*"]} {
			puthelp "NOTICE $nick :Do you want to add this host to my db?"
			puthelp "NOTICE $nick :Try \002/msg LammestBot addthishost\002 to add this host"
		}
	}
}

bind msg - addthishost add_host

proc add_host {nick uhost hand args} {
	set line ""
	setuser $hand HOSTS "$nick!*@*"
	foreach host [getuser $hand HOSTS] {
		append line "$host "
	}
	if {$line != ""} {
		puthelp "PRIVMSG $nick :You hosts are:"
		puthelp "PRIVMSG $nick :$line"
	}
}
tnks HecKel
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Re: add newhost when nick change

Post by De Kus »

HecKel wrote: set nick [hand2nick $hand]
if {![string match "" $nick] && [string match $newnick $nick]} {
if {![validuser "$nick!*@*"]} {
My sleepy mind tells me, this will never be true, in case you register nicks only from the nickmask and he still has the new unknown nick newnick. hand2nick will not resolve and therefore it will never match with newnick :D.
for nicktracing you would probably have to create a seperate global array/table.
ah, yes, please check the command validuser again in the doc, a hostmark will most likely not match a handle (though its posible). :D
[23:48:46] <StarZ|Clan> Added Muh!*@*.* (no host) with no password and no flags.
[23:49:35] <StarZ|Clan> [23:49:35] tcl: evaluate (.tcl): validuser Muh!*@*.*
[23:49:35] <StarZ|Clan> Tcl: 1
setuser $hand HOSTS "$nick!*@*"
again, this can't work. you dont have the old handle, you must figure it out first to add the new, yet unknown, hostmark.
usually hostmark commands would use "addthishost <pass> <hand>". there is a tcl command to check the decoded password against the encrypted one in the userfile.
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...
Locked