[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tcldrop/CVS] tcldrop/modules dcc.tcl
From: |
Philip Moore |
Subject: |
[Tcldrop/CVS] tcldrop/modules dcc.tcl |
Date: |
Fri, 31 Oct 2003 15:59:49 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/10/31 15:59:49
Modified files:
modules : dcc.tcl
Log message:
Another inch towards botnet support...
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.7 tcldrop/modules/dcc.tcl:1.8
--- tcldrop/modules/dcc.tcl:1.7 Fri Oct 17 06:23:25 2003
+++ tcldrop/modules/dcc.tcl Fri Oct 31 15:59:49 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.7 2003/10/17 10:23:25 fireegl Exp $
+# $Id: dcc.tcl,v 1.8 2003/10/31 20:59:49 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -32,10 +32,10 @@
# Provide the users module:
variable version {0.2}
package provide tcldrop::dcc $version
- variable rcsid {$Id: dcc.tcl,v 1.7 2003/10/17 10:23:25 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.8 2003/10/31 20:59:49 fireegl Exp $}
#checkmodule console
# Export all the commands that should be available to 3rd-party
scripters:
- 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
::tcldrop::SetDefault open-telnets 1
::tcldrop::SetDefault console-autosave 1
::tcldrop::SetDefault force-channel 0
@@ -337,7 +337,8 @@
catch { setlaston $chatinfo(handle)
[unixtime] partyline }
}
{BOT} {
- # Similar to CHAT above, this is for
bot connections.
+ # Similar to CHAT above, but this is
for bot connections.
+ BOT $chatinfo(handle) [string trim
[lindex [split $line] 0]] [string trimleft [join [lrange $line 1 end]]]
}
{default} { }
}
@@ -402,8 +403,22 @@
set retval
}
-proc ::tcldrop::dcc::BOT {handle idx arg} {
- # FixMe: Complete.
+proc ::tcldrop::dcc::BOT {handle cmd arg} {
+ # retval will be the number of binds that were triggered..
+ set retval 0
+ foreach a [binds bot] {
+ foreach {type flags mask count proc} $a {}
+ if {[string equal -nocase $cmd $mask] && [matchattr
$handle $flags]} {
+ incr retval
+ if {[catch { $proc $handle $cmd $arg } err]} {
+ putlog "error in script: $proc: $err"
+ } elseif {[string equal $err {1}]} {
+ # Abort processing further binds if
they return 1.
+ #break
+ }
+ }
+ }
+ set retval
}
proc ::tcldrop::dcc::putdcc {idx text} { putidx $idx $text }
@@ -457,4 +472,21 @@
bind dcc - help ::tcldrop::dcc::HELP
proc ::tcldrop::dcc::HELP {handle idx text} {
putdcc $idx "There's no help here! FixMe!"
+}
+
+# bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots
+proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} {
+ foreach b [userlist b] {
+ # FixMe: This should only link bots with +h or +a botflags.
+ if {![islinked $b]} {
+ link $b
+ }
+ }
+}
+
+proc ::tcldrop::dcc::link {viabot {bot {}}} {
+ if {$bot == {}} {
+ set bot $viabot
+ set viabot {}
+ }
}