bind join - * joinproc

proc joinproc {nick uhost hand chan} {
	if {![string match -nocase "$chan" "#channel"]} { return 0 }

	global joined

	set ::joined($nick) [clock seconds]

	if {[string equal -nocase $nick "Blacky"] || [string match -nocase "*@its.com" $uhost]} {

		puthelp "PRIVMSG #controlchan :Blacky, i'm clearing your uptime-database so you can update your uptimes with mine" 
		putbot Blacky "clear"
		puthelp "PRIVMSG #controlchan :Blacky, I'm sending the info..."

		foreach nick [chanlist "#controlchan"] {
			if {![info exists ::joined($nick)]} {
				set ::joined($nick) [getchanjoin $nick #channel]
			}
			putbot Blacky "join $nick [expr {[clock seconds] - $::joined($nick)}]"
			puthelp "PRIVMSG #controlchan :$nick has already joined as of [duration [expr {[clock seconds] - $::joined($nick)}]] ago" 
		}
	} else {
		putbot Blacky "join $nick 0"
	}
}