35 |
variable rcsid {$Id$} |
variable rcsid {$Id$} |
36 |
#checkmodule console |
#checkmodule console |
37 |
# Export all the commands that should be available to 3rd-party scripters: |
# Export all the commands that should be available to 3rd-party scripters: |
38 |
namespace export dcclist listen putdcc getchan setchan console echo strip idx2hand hand2idx |
namespace export dcclist listen putdcc getchan setchan console echo strip idx2hand hand2idx link |
39 |
::tcldrop::SetDefault open-telnets 1 |
::tcldrop::SetDefault open-telnets 1 |
40 |
::tcldrop::SetDefault console-autosave 1 |
::tcldrop::SetDefault console-autosave 1 |
41 |
::tcldrop::SetDefault force-channel 0 |
::tcldrop::SetDefault force-channel 0 |
337 |
catch { setlaston $chatinfo(handle) [unixtime] partyline } |
catch { setlaston $chatinfo(handle) [unixtime] partyline } |
338 |
} |
} |
339 |
{BOT} { |
{BOT} { |
340 |
# Similar to CHAT above, this is for bot connections. |
# Similar to CHAT above, but this is for bot connections. |
341 |
|
BOT $chatinfo(handle) [string trim [lindex [split $line] 0]] [string trimleft [join [lrange $line 1 end]]] |
342 |
} |
} |
343 |
{default} { } |
{default} { } |
344 |
} |
} |
403 |
set retval |
set retval |
404 |
} |
} |
405 |
|
|
406 |
proc ::tcldrop::dcc::BOT {handle idx arg} { |
proc ::tcldrop::dcc::BOT {handle cmd arg} { |
407 |
# FixMe: Complete. |
# retval will be the number of binds that were triggered.. |
408 |
|
set retval 0 |
409 |
|
foreach a [binds bot] { |
410 |
|
foreach {type flags mask count proc} $a {} |
411 |
|
if {[string equal -nocase $cmd $mask] && [matchattr $handle $flags]} { |
412 |
|
incr retval |
413 |
|
if {[catch { $proc $handle $cmd $arg } err]} { |
414 |
|
putlog "error in script: $proc: $err" |
415 |
|
} elseif {[string equal $err {1}]} { |
416 |
|
# Abort processing further binds if they return 1. |
417 |
|
#break |
418 |
|
} |
419 |
|
} |
420 |
|
} |
421 |
|
set retval |
422 |
} |
} |
423 |
|
|
424 |
proc ::tcldrop::dcc::putdcc {idx text} { putidx $idx $text } |
proc ::tcldrop::dcc::putdcc {idx text} { putidx $idx $text } |
472 |
bind dcc - help ::tcldrop::dcc::HELP |
bind dcc - help ::tcldrop::dcc::HELP |
473 |
proc ::tcldrop::dcc::HELP {handle idx text} { |
proc ::tcldrop::dcc::HELP {handle idx text} { |
474 |
putdcc $idx "There's no help here! FixMe!" |
putdcc $idx "There's no help here! FixMe!" |
475 |
|
} |
476 |
|
|
477 |
|
# bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots |
478 |
|
proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} { |
479 |
|
foreach b [userlist b] { |
480 |
|
# FixMe: This should only link bots with +h or +a botflags. |
481 |
|
if {![islinked $b]} { |
482 |
|
link $b |
483 |
|
} |
484 |
|
} |
485 |
|
} |
486 |
|
|
487 |
|
proc ::tcldrop::dcc::link {viabot {bot {}}} { |
488 |
|
if {$bot == {}} { |
489 |
|
set bot $viabot |
490 |
|
set viabot {} |
491 |
|
} |
492 |
} |
} |