TCL Auth Voice

Auth Voice

bind msg -|- auth auth_msg
proc auth_msg {nick uhost hand text} {
    global botnick
    set pass [lindex $text 0]
    if {$pass == ""} {
	puthelp "NOTICE $nick :Usage: /msg $botnick auth \[\002passw0rd\002\]"
	return 0
    }
    if {[onchan $nick] == 0} {
	puthelp "NOTICE $nick :You must be \002on a channel\002 to use this command!"
	return 0
    }
    if {$hand == "*"} {
	if {[lindex $text 1] == ""} {
	    return 0
	}
	set ok 0
	set hand [lindex $text 1]
	foreach user [userlist] {
	    if {[string tolower $user] == [string tolower $hand]} {
		set userr $user
		set ok 1
	    }
	}
	if {$ok == 0} {
	    return 0
	}
	regsub {~} $uhost "" uhost
	setuser $userr HOSTS *!$uhost
    }
    if {[passwdok $hand $pass] == 0} {
	puthelp "NOTICE $nick :\002Invalid\002 Password!"
	return 0
    }
    if {$hand != "*"} {
	setuser $hand xtra idented 1
	setuser $hand xtra nickid $nick
    } else {
	setuser $userr xtra idented 1
	setuser $userr xtra nickid $nick
	set hand $userr
    }
    puthelp "NOTICE $nick :Password accepted, you are now identified."
    foreach chan [channels] {
	if {![isop $hand $chan] && ![isvoice $hand $chan]} {
	    pushmode $chan +v $nick
	}
    }
}

bind part -|- * unid_part
proc unid_part {nick uhost hand chan msg} {
    if {$hand == "*"} {
	return 0
    }
    if {[getuser $hand xtra idented] == 1} {
	setuser $hand xtra idented "DEAD [unixtime]"
    }
}

bind sign -|- * unid_quit
proc unid_quit {nick uhost hand chan reason} {
    if {$hand == "*"} {
	return 0
    }
    if {[getuser $hand xtra idented] == 1} {
	setuser $hand xtra idented "DEAD [unixtime]"
    }
}

bind kick -|- * unid_kick
proc unid_kick {nick uhost hand chan target reason} {
    foreach user [userlist] {
	if {[string tolower [getuser $user xtra nickid]] == [string tolower $target]} {
	    setuser $hand xtra idented "DEAD [unixtime]"
	}
    }
}

bind splt -|- * unid_split
proc unid_split {nick uhost hand chan} {
    if {$hand == "*"} {
	return 0
    }
    if {[getuser $hand xtra idented] == 1} {
	setuser $hand xtra idented "DEAD [unixtime]"
    }
}

bind nick -|- * chnickid
proc chnickid {nick uhost hand chan newnick} {
    if {$hand == "*"} {
	return 0
    }
    if {[getuser $hand xtra idented] == 1} {
	setuser $hand xtra nickid "$newnick"
    }
}

bind join -|- * idim_proc
proc idim_proc {nick uhost hand chan} {
    if {$hand == "*"} {
	return 0
    }
    if {[getuser $hand xtra idented] == 1} {
	setuser $hand xtra idented "DEAD [unixtime] ERROR!"
    } elseif {[lindex [getuser $hand xtra idented] 0] == "DEAD"} {
	if {([unixtime] - [lindex [getuser $hand xtra idented] 1]) > (4 * 60)} {
	    setuser $hand xtra idented 0
	} else {
	    setuser $hand xtra idented 1
	    setuser $hand xtra nickid $nick
	    puthelp "NOTICE $nick :I recognize you there $hand!"
	    foreach chan [channels] {
		if {![isop $hand $chan] && ![isvoice $hand $chan]} {
		    pushmode $chan +v $nick
	    	}
	    }
	}
    }
}
bind rejn -|- * rejnid_proc
proc rejnid_proc {nick uhost hand chan} {
    if {$hand == "*"} {
	return 0
    }
    if {[getuser $hand xtra idented] == 1} {
	setuser $hand xtra idented "DEAD [unixtime] ERROR!"
    } elseif {[lindex [getuser $hand xtra idented] 0] == "DEAD"} {
	if {([unixtime] - [lindex [getuser $hand xtra idented] 1]) > (4 * 60)} {
	    setuser $hand xtra idented 0
	} else {
	    setuser $hand xtra idented 1
	    setuser $hand xtra nickid $nick
	    puthelp "NOTICE $nick :I recognize you there $hand!"
	    foreach chan [channels] {
		if {![isop $hand $chan] && ![isvoice $hand $chan]} {
		    pushmode $chan +v $nick
	    	}
	    }
	}
    }
}
putlog "AutoV script by IRCHelp.UniBG.oRG ft. LHG Crew Loaded"