################################################################################
###### Author: Khobbits ( #tcl on irc.swiftirc.net | tcl@khobbits.co.uk ) ######
################################################################################

# 'TCL bot' script

# Which Bouncer users does this script apply to?
# You can use '[bncuserlist]' or '[list username1 username 2 etc...]'
# Warning: the userlist is case sensitive.

set khtclusers [list Quantum]

foreach khtcluser $khtclusers {
	setctx $khtcluser
	bind pub n&- - khtcl
	bind pub n&- = khtclq

# Add the hosts you would like to have access by default here
	catch {adduser khobbits *!kh@why.not.beweird.org} result
	catch {chattr khobbits +n} result
}

proc khtcl {nick host hand chan arg} {
	set ctx [getctx]
	catch {eval $arg} result
	setctx $ctx

	if {$result == ""} { set result "<null>" }
	foreach sline [split $result \n] {
		putserv "PRIVMSG $chan :( $arg ) = $sline"
	}
}

proc khtclq {nick host hand chan arg} {
	catch {eval $arg} result
}