[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: |
Sat, 01 Nov 2003 21:57:41 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/11/01 21:57:41
Modified files:
modules : dcc.tcl
Log message:
Most of the bot linking protocol written.. Untested so far.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.8 tcldrop/modules/dcc.tcl:1.9
--- tcldrop/modules/dcc.tcl:1.8 Fri Oct 31 15:59:49 2003
+++ tcldrop/modules/dcc.tcl Sat Nov 1 21:57:41 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.8 2003/10/31 20:59:49 fireegl Exp $
+# $Id: dcc.tcl,v 1.9 2003/11/02 02:57:41 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -32,7 +32,7 @@
# Provide the users module:
variable version {0.2}
package provide tcldrop::dcc $version
- variable rcsid {$Id: dcc.tcl,v 1.8 2003/10/31 20:59:49 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.9 2003/11/02 02:57:41 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 link
@@ -336,9 +336,34 @@
# Update their laston info:
catch { setlaston $chatinfo(handle)
[unixtime] partyline }
}
+ {BOT_NEW} {
+ # This is when the remote bot is asking
what our handle is.
+ global botnet-nick
+ putidx $idx ${botnet-nick}
+ ::tcldrop::idx::ChInfo $idx [list type
BOT_PASS other {bot_pass}]
+ }
+ {BOT_PASS} {
+ # This is when the remote bot is asking
what our password (or password hash) is.
+ if {[string match -nocase {passreq*}
$line]} {
+ putidx $idx [getuser
$chatinfo(handle) PASS]
+ ::tcldrop::idx::ChInfo $idx
[list type BOT_HELLO other {bot_hello}]
+ } else {
+ # Abort since it's not a valid
responce to our handle.
+ Close $sock $idx NON_BOT
+ }
+ }
+ {BOT_HELLO} {
+ # This is after we've send our handle
and password to the remote bot,
+ # so now we send our version and
whatever else needs to be sent to start with.
+ if {[string match -nocase {version *}
$line]} {
+ # FixMe: Add proper version
info here.
+ putidx $idx "version "
+ ::tcldrop::idx::ChInfo $idx
[list type BOT other {bot flags: }]
+ }
+ }
{BOT} {
# 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]]]
+ RAWBOT $chatinfo(handle) [string trim
[lindex [split $line] 0]] [string trimleft [join [lrange $line 1 end]]]
}
{default} { }
}
@@ -403,10 +428,10 @@
set retval
}
-proc ::tcldrop::dcc::BOT {handle cmd arg} {
+proc ::tcldrop::dcc::RAWBOT {handle cmd arg} {
# retval will be the number of binds that were triggered..
set retval 0
- foreach a [binds bot] {
+ foreach a [binds rawbot] {
foreach {type flags mask count proc} $a {}
if {[string equal -nocase $cmd $mask] && [matchattr
$handle $flags]} {
incr retval
@@ -489,4 +514,17 @@
set bot $viabot
set viabot {}
}
+ set botaddr [getuser $bot BOTADDR]
+ set host [lindex $botaddr 0]
+ set port [lindex $botaddr 1]
+ global my-ip
+ set fail [catch { connect $host $port -timeout 99 -myaddr ${my-ip}
-control ::tcldrop::dcc::BOTRead -errors ::tcldrop::dcc::BOTConnectErrors
-writable ::tcldrop::dcc::BOTWrite } idx]
+ if {!$fail} {
+ ::tcldrop::idx::ChInfo $idx [list handle $bot remote $host
hostname $host port $port type FORK_BOT other {conn bot} timestamp [set
timestamp [unixtime]]]
+ #set TimerID [utimer 99 [list ::tcldrop::dcc::BOTConnectTimeout
$idx]]
+ }
+}
+
+proc ::tcldrop::dcc::BOTWrite {idx} {
+ ::tcldrop::idx::ChInfo $idx [list type BOT_NEW other {bot*}]
}
- [Tcldrop/CVS] tcldrop/modules dcc.tcl,
Philip Moore <=
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/04
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/04
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/10
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/14
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/15
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/17
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/18
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/19
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/19
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/19