boilerplate.tcl (1067B)
1 2 3 proc confighandler {servicename defdbname headline block} { 4 set net [lindex $headline 0] 5 set nsock $::sock($net) 6 dictassign $block nick nick ident ident host host realname realname 7 if {[llength [tnda get "service/$net/$servicename/config"]] != 0} { 8 return -code error "<$servicename> O damn, I'm already loaded for $net! 9 } 10 tnda set "service/$net/$servicename/config" $block 11 if {[tnda get "service/$net/$servicename/config/dbname"] == ""} { 12 tnda set "service/$net/$servicename/dbname" $defdbname 13 } 14 setctx $net 15 if {[% intclient2uid [tnda get "service/$net/$servicename/ourid"]] == ""} {% sendUid $nick $ident $host $host [set ourid [% getfreeuid]] [expr {($realname == "") ? "* $servicename *" : $realname}] $modes; set connected "Connected"} {set connected "Already connected"} 16 set ouroid [tnda get "service/$net/$servicename/ourid"] 17 if {[info exists ourid]} {tnda set "service/$net/$servicename/ourid" $ourid} {set ourid [tnda get "service/$net/$servicename/ourid"]} 18 puts stdout [format "%s for %s: %s %s %s" $connected $net $nick $ident $host] 19 } 20