tclserv

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5c63a29c6301c19374365bec11c4676bdf4e6955
parent b4608531f574ddb6a4fbbea1d646d38a9f4e9347
Author: Ellenor Malik <ellenor@umbrellix.net>
Date:   Tue, 15 Oct 2019 17:40:32 -0700

General Maintenance

Diffstat:
Mcore/0000-callbacks.tcl | 7+++++--
Mcore/0999-conn.tcl | 2++
Mcore/4000-convenience.tcl | 7++++---
Mmain.tcl | 1-
Mmodules/debugserv.tcl | 5+++++
5 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/core/0000-callbacks.tcl b/core/0000-callbacks.tcl @@ -21,7 +21,7 @@ proc unllbindall {sock type client comd} { proc firellbind {sock type client comd args} { # puts stdout "$sock $type $client [ndcenc $comd] $args" global globuctx globctx - set globctx $::netname($sock) + if {$sock == "-"} {} {set globctx $::netname($sock)} set oldglobuctx $globuctx if {$client == "-"} {set globuctx ""} {set globuctx $client} if {""!=[tnda get "llbinds/$::netname($sock)/$type/$client/[ndcenc $comd]"]} { @@ -50,7 +50,7 @@ proc firellbind {sock type client comd args} { proc firellmbind {sock type client comd args} { # puts stdout "$sock $type $client [ndcenc $comd] $args" global globuctx globctx - set globctx $::netname($sock) + if {$sock == "-"} {} {set globctx $::netname($sock)} set oldglobuctx $globuctx if {$client == "-"} {set globuctx ""} {set globuctx $client} foreach {comde scripts} [tnda get "llbinds/$::netname($sock)/$type/$client"] { @@ -77,6 +77,8 @@ proc firellmbind {sock type client comd args} { #if {""!=[tnda get "llbinds/$type/-/[ndcenc $comd]"]} {foreach {id script} [tnda get "llbinds/$type/-/[ndcenc $comd]"] {$script [lindex $args 0] [lrange $args 1 end]};return} } proc putloglev {lev ch msg} { + global globuctx globctx + set oldglobuctx $globuctx # punt foreach level [split $lev {}] { firellmbind [curctx sock] log - [format "%s %s" $ch $level] $level $ch $msg @@ -84,5 +86,6 @@ proc putloglev {lev ch msg} { firellmbind - log - [format "%s %s" $ch $level] [curctx net] $level $ch $msg firellbind - logall - - [curctx net] $level $ch $msg } + set globuctx $oldglobuctx } proc putlog {msg} {putloglev o * $msg} diff --git a/core/0999-conn.tcl b/core/0999-conn.tcl @@ -3,6 +3,8 @@ package require tls # just to have sanity here. don't want a {} dict or a bum array # this is for the logging algorithm to work once implemented, too, among other important things set ::netname(-) - +#set ::nettype(-) - +#set ::sock(-) - proc connect {addr port script} { if {[string index $port 0] == "+"} { set port [string range $port 1 end] ; set comd ::tls::socket } {set comd socket} diff --git a/core/4000-convenience.tcl b/core/4000-convenience.tcl @@ -259,7 +259,7 @@ proc timers {} {set t {}; foreach a [after info] {lappend t "0 [lindex [after in proc killtimer id {return [after cancel $id]} proc killutimer id {return [after cancel $id]} -proc isbotnick {n} {return [expr {$n == $::globuctx}]} +proc isbotnick {n} {return [expr {$n == [curctx user] || $n == [curctx uid]}]} proc setctx {ctx} { global globctx @@ -740,7 +740,7 @@ proc bind {type flag text script} { set ctxuser [curctx unum] if {[lsearch -exact $::nonusertypes [string tolower $type]] != -1} {set binduser "-"} {set binduser $ctxuser} if {[lsearch -exact $::lowertypes [string tolower $type]] != -1} {set text [string tolower $text]} - puts stdout [list llbind $ctxsock $type $binduser $text [list isetupthenrun [list [curctx net] $ctxsock $type $ctxuser $flag $text] $script]] + #puts stdout [list llbind $ctxsock $type $binduser $text [list isetupthenrun [list [curctx net] $ctxsock $type $ctxuser $flag $text] $script]] return [llbind $ctxsock $type $binduser $text [list isetupthenrun [list [curctx net] $ctxsock $type $ctxuser $flag $text] $script]] } @@ -765,8 +765,9 @@ proc unbind {type flag text {scrip ""}} { proc setupthenrun {opts script args} { lassign $opts netctx sockctx type userctx flags text + global globuctx setctx $netctx - setuctx [% uid2nick $userctx] + set globuctx $userctx foreach {a} $args { lappend script $a } diff --git a/main.tcl b/main.tcl @@ -84,7 +84,6 @@ if {[file exists services.db]} { set nd [readbfile services.db] puts stdout $nd } -set nd [readbfile services.db] set globwd [pwd] set gettext [list] diff --git a/modules/debugserv.tcl b/modules/debugserv.tcl @@ -1,6 +1,11 @@ blocktnd debugserv llbind - evnt - alive debugserv.connect +llbind - logall - - debug.logall + +proc debug.logall {args} { + puts stdout [format "%s: %s" "DEBUGSERV LOGALL" [join $args]] +} proc debugserv.connect {arg} { puts stdout [format "there are %s debugserv blocks" [set blocks [tnda get "openconf/[ndcenc debugserv]/blocks"]]]