tcldrop-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tcldrop/CVS] tcldrop/modules dcc.tcl idx.tcl


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop/modules dcc.tcl idx.tcl
Date: Mon, 03 Nov 2003 22:17:16 -0500

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/11/03 22:17:16

Modified files:
        modules        : dcc.tcl idx.tcl 

Log message:
        First successful bot link to an Eggdrop. =D

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/idx.tcl.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.10 tcldrop/modules/dcc.tcl:1.11
--- tcldrop/modules/dcc.tcl:1.10        Mon Nov  3 15:19:28 2003
+++ tcldrop/modules/dcc.tcl     Mon Nov  3 22:17:16 2003
@@ -1,6 +1,6 @@
 # dcc.tcl --
 #
-# $Id: dcc.tcl,v 1.10 2003/11/03 20:19:28 fireegl Exp $
+# $Id: dcc.tcl,v 1.11 2003/11/04 03:17:16 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.10 2003/11/03 20:19:28 fireegl Exp $}
+       variable rcsid {$Id: dcc.tcl,v 1.11 2003/11/04 03:17:16 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
@@ -262,18 +262,41 @@
                                }
                        } else {
                                if {[validuser $line] && ![passwdok $line -]} {
-                                       putidx $idx {Password.}
+                                       if {[matchattr $line b]} {
+                                               putidx $idx {passreq}
+                                       } else {
+                                               putidx $idx {Password.}
+                                       }
                                        ::tcldrop::idx::ChInfo $idx [list 
handle $line type CHAT_PASS other {pass  waited 3s} timestamp [unixtime]]
                                } else {
-                                       putidx $idx {You don't have access.}
+                                       if {[matchattr $line b]} {
+                                               # FixMe: putidx $idx {FixMe: 
Make sure bots without passwords can link the first time.}
+                                       } else {
+                                               putidx $idx {You don't have 
access.}
+                                       }
                                }
                        }
                }
                {CHAT_PASS} {
+                       # FixMe: For bots, this should send "*hello" and 
"version ",
+                       #        and change the type to "BOT".
                        if {[passwdok $chatinfo(handle) $line]} {
-                               ::tcldrop::idx::ChInfo $idx [list type CHAT 
other {chat  flags: ?/0} timestamp [unixtime]]
-                               putidx $idx {Welcome!}
-                               # FixMe: Show the MOTD and whatnot here.
+                               if {[matchattr $chatinfo(handle) b]} {
+                                       putidx $idx {*hello}
+                                       putidx $idx {version }
+                                       ::tcldrop::idx::ChInfo $idx [list type 
BOT other {bot  flags: } timestamp [unixtime]]
+                               } else {
+                                       putidx $idx {Welcome!}
+                                       ::tcldrop::idx::ChInfo $idx [list type 
CHAT other {chat  flags: ?/0} timestamp [unixtime]]
+                                       # FixMe: Show the MOTD and whatnot here.
+                               }
+                       } else {
+                               if {[matchattr $chatinfo(handle) b]} {
+                                       putidx $idx {badpass}
+                               } else {
+                                       putidx $idx {Bad password!}
+                               }
+                               killidx $idx
                        }
                }
                {TELNET_NEW} {
@@ -330,13 +353,14 @@
                        # 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}]
+               {FORK_BOT} {
+                       if {$line != {}} {
+                               # This is when the remote bot is asking what 
our handle is.
+                               putidx $idx ${::botnet-nick}
+                               ::tcldrop::idx::ChInfo $idx [list type BOT_NEW 
other {bot_new}]
+                       }
                }
-               {BOT_PASS} {
+               {BOT_NEW} {
                        # 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]
@@ -349,7 +373,7 @@
                {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]} {
+                       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: }]
@@ -523,7 +547,7 @@
        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]
+       set fail [catch { connect $host $port -timeout 99 -myaddr ${my-ip} 
-control ::tcldrop::dcc::Read -errors ::tcldrop::dcc::BOTConnectErrors } 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]]
Index: tcldrop/modules/idx.tcl
diff -u tcldrop/modules/idx.tcl:1.6 tcldrop/modules/idx.tcl:1.7
--- tcldrop/modules/idx.tcl:1.6 Wed Jun  4 17:02:38 2003
+++ tcldrop/modules/idx.tcl     Mon Nov  3 22:17:16 2003
@@ -1,6 +1,6 @@
 # idx.tcl --
 #
-# $Id: idx.tcl,v 1.6 2003/06/04 21:02:38 fireegl Exp $
+# $Id: idx.tcl,v 1.7 2003/11/04 03:17:16 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -50,7 +50,6 @@
 proc ::tcldrop::idx::Register {idx info} {
        variable idxlist
        set idxlist($idx) $info
-       array set idxinfo $info
 }
 
 # Unregisters all connections matching idxmask:
@@ -70,14 +69,14 @@
 # FixMe: Should this be doing error checking/returning errors?
 proc ::tcldrop::idx::GetInfo {idx infotype} {
        if {![valididx $idx]} {
-               error "invalid idx: $idx"
+               return -code error "invalid idx: $idx"
        } else {
                variable idxlist
                array set idxinfo $idxlist($idx)
                if {[info exists idxinfo($infotype)]} {
                        return $idxinfo($infotype)
                } else {
-                       error "no such type: $infotype"
+                       return -code error "no such type: $infotype"
                }
        }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]