# tcleval.tcl # weechat plugin that adds the command /tcleval to evalute tcl scripts on the fly. # Also adds a tcl-command putlog that will print given argument to current buffer. # (c) Gotisch , 2009-12-06 # GPL namespace eval weechat::script { weechat::register "tcleval" {Gotisch gotisch@gmail.com} 1.0 GPL3 {Evaluate tcl code on the fly} {} {} proc tcleval_cmd {data buffer args} { set cmd [join $args] if {[catch "uplevel #0 { $cmd }" result] == 1} { weechat::print $buffer "Error: $result" } else { weechat::print $buffer "Result: $result" } return $::weechat::WEECHAT_RC_OK } ::weechat::hook_command "tcleval" {evalutes a tcl script} {} {} {} [namespace current]::tcleval_cmd {} } proc putlog {text} { weechat::print [weechat::current_buffer] $text }