tcldrop-commits
[Top][All Lists]
Advanced

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

[Tcldrop/CVS] tcldrop ./README.txt ./tcldrop doc/TODO.txt mod...


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop ./README.txt ./tcldrop doc/TODO.txt mod...
Date: Wed, 04 Jun 2003 17:02:39 -0400

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Changes by:     Philip Moore <address@hidden>   03/06/04 17:02:38

Modified files:
        .              : README.txt tcldrop 
        doc            : TODO.txt 
        modules        : conn.tcl core.tcl ident.tcl idx.tcl 
        modules/irc    : irc.tcl 
        modules/server : server.tcl 

Log message:
        I added background support (which depends on either the Expect or TclX 
extensions).
        And lots of minor tweaks to other files..

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/README.txt.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/tcldrop.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/doc/TODO.txt.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/conn.tcl.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/core.tcl.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/ident.tcl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/idx.tcl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/irc/irc.tcl.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/server/server.tcl.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: tcldrop/README.txt
diff -u tcldrop/README.txt:1.4 tcldrop/README.txt:1.5
--- tcldrop/README.txt:1.4      Tue May 20 10:53:58 2003
+++ tcldrop/README.txt  Wed Jun  4 17:02:38 2003
@@ -9,6 +9,14 @@
    or it can be run from inside an Eggdrop.
    You can run as many Tcldrops in one process as you want.
 
+Requirements:
+   At least Tcl v8.3 is needed.  (http://Tcl.Tk/)
+   For background mode to work you'll need either
+   Expect (http://Expect.nist.gov/expect.tar.gz)
+   or TclX (http://SF.Net/projects/tclx)
+   for their [fork] command.
+   Cygwin users will also need run.exe (FixMe: Find the URL to it!)
+
 Notes:
    This project has yet to be officially announced..
    And it's not currently in a useful state, but if you want to
Index: tcldrop/doc/TODO.txt
diff -u tcldrop/doc/TODO.txt:1.13 tcldrop/doc/TODO.txt:1.14
--- tcldrop/doc/TODO.txt:1.13   Tue May 27 00:29:04 2003
+++ tcldrop/doc/TODO.txt        Wed Jun  4 17:02:38 2003
@@ -15,3 +15,5 @@
 
 Provide Yahoo! support using TclYahoo's yahoo.tcl:
 http://9MM.Com/~ogl/tclyahoo/
+
+http://www.xdobry.de/mysqltcl/
Index: tcldrop/modules/conn.tcl
diff -u tcldrop/modules/conn.tcl:1.3 tcldrop/modules/conn.tcl:1.4
--- tcldrop/modules/conn.tcl:1.3        Tue May 27 11:32:08 2003
+++ tcldrop/modules/conn.tcl    Wed Jun  4 17:02:38 2003
@@ -1,33 +1,30 @@
 # conn.tcl --
+#      Provides:
+#              * The connect and control commands, used for all outgoing 
connections.
+#      Depends: idx.
 #
-# $Id: conn.tcl,v 1.3 2003/05/27 15:32:08 fireegl Exp $
+# $Id: conn.tcl,v 1.4 2003/06/04 21:02:38 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 #
-#      conn module for Tcldrop.
-#      Depends on: idx.
-#
-# Provides the connect and control commands.
-# (connect is used for all outgoing connections)
-#
 
 namespace eval ::tcldrop::conn {
        variable version {0.1}
@@ -57,11 +54,20 @@
        # the previously saved defaults for $type:
        if {[info exists Defaults($type)]} { array set options $Defaults($type) 
}
        # Finally override those with the ones provided in $connoptions:
-       foreach o $connoptions {
-               switch -glob -- $o {
-                       {-noasync} { set options(async) 0 }
-                       {-*} { set options([set opt [string range $o 1 end]]) 1 
}
-                       {default} { set options($opt) $o }
+       set proxynum 0
+       foreach {o v} $connoptions {
+               switch -- $o {
+                       {-proxy} {
+                               incr proxynum
+                               set options(proxy${proxynum},type) $v
+                       }
+                       {default} {
+                               if {$proxynum} {
+                                       lappend options(proxy${proxynum},args) 
$o $v
+                               } else {
+                                       set options([string range $o 1 end]) $v
+                               }
+                       }
                }
        }
        # Store the new defaults for $type:
@@ -78,16 +84,16 @@
        ::tcldrop::idx::ChInfo $idx [array get options]
        if {$options(async)} { set async {-async} } else { set async {} }
        if {[info exists options(myaddr)] && $options(myaddr) != {}} {
-               set fail [catch { eval socket $async {-myaddr} 
{$options(myaddr)} {$address} {$port} } sock]
+               set fail [catch { eval {socket} $async {-myaddr} 
{$options(myaddr)} {$address} {$port} } sock]
        } else {
-               set fail [catch { eval socket $async {$address} {$port} } sock]
+               set fail [catch { eval {socket} $async {$address} {$port} } 
sock]
        }
        if {!$fail} {
                ::tcldrop::idx::ChInfo $idx [list sock $sock]
                fconfigure $sock -buffering $options(buffering) -blocking 
$options(blocking)
                fileevent $sock writable [list ::tcldrop::conn::Write $idx]
                fileevent $sock readable [list ::tcldrop::conn::Read $idx]
-               utimer $options(timeout) [list ::tcldrop::conn::ConnectTimeout 
$idx]
+               ::tcldrop::idx::ChInfo $idx [list connecttimer [utimer 
$options(timeout) [list ::tcldrop::conn::ConnectTimeout $idx]]]
                return $idx
        } else {
                killidx $idx
@@ -95,8 +101,7 @@
        }
 }
 
-# This command is no longer really necessary, as you can
-# tell connect what command to use with the -control option.
+# Note that you can tell connect what command to use with the -control option.
 proc ::tcldrop::conn::control {idx command} {
        ::tcldrop::idx::ChInfo $idx [list control $command]
 }
@@ -104,18 +109,15 @@
 proc ::tcldrop::conn::Read {idx} {
        foreach {a d} [::tcldrop::idx::Info $idx] { array set idxinfo $d }
        if {![info exists idxinfo(control)]} { return }
-       # Note, We need to add a new command "getidx" and use it instead of 
"read" here.
-       # "getidx" and "putidx" should both go through the connection filter 
(for things like SSL I guess), if one exists.
-       # Note, we also need to be aware of the buffering setting, and not 
always read a line at a time.
        # For speed, we read in all available lines (This is absolutely 
necessary when running inside an Eggdrop, because Eggdrop's event loops are 1 
second apart.):
-       if {![catch { read $idxinfo(sock) } lines]} {
-               foreach line [split [string trimright $lines \n] \n] {
+       if {![catch { read -nonewline $idxinfo(sock) } lines]} {
+               foreach line [split $lines \n] {
                        $idxinfo(control) $idx $line
                }
        } else {
-               # Send "" to the control proc and kill the sock/idx.
+               # Send {} to the control proc and kill the sock/idx.
                # Note, A check on valididx (from the control proc) is one way 
to tell wether or not an EOF has actually been received.
-               $idxinfo(control) $idx ""
+               $idxinfo(control) $idx {}
                killidx $idx
        }
 }
@@ -123,15 +125,12 @@
 proc ::tcldrop::conn::Write {idx} {
        foreach {a d} [::tcldrop::idx::Info $idx] {
                array set idxinfo $d
+               catch { killutimer $idxinfo(connecttimer) }
                fileevent $idxinfo(sock) writable {}
-               # FixMe: Set a variable here so that ConnectTimeout can look 
for it and know the connection was successful.
                if {[info exists idxinfo(writable)]} {
                        $idxinfo(writable) $idx
                }
        }
 }
 
-proc ::tcldrop::conn::ConnectTimeout {idx} {
-       # FixMe: See last FixMe.
-       #killidx $idx
-}
+proc ::tcldrop::conn::ConnectTimeout {idx} {   killidx $idx }
Index: tcldrop/modules/core.tcl
diff -u tcldrop/modules/core.tcl:1.13 tcldrop/modules/core.tcl:1.14
--- tcldrop/modules/core.tcl:1.13       Wed May 28 15:47:53 2003
+++ tcldrop/modules/core.tcl    Wed Jun  4 17:02:38 2003
@@ -1,24 +1,24 @@
-# modules/core.tcl --
+# core.tcl --
 #
-# $Id: core.tcl,v 1.13 2003/05/28 19:47:53 fireegl Exp $
+# $Id: core.tcl,v 1.14 2003/06/04 21:02:38 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 
@@ -47,7 +47,7 @@
        # Provide the users module:
        variable version {0.3}
        package provide tcldrop::core $version
-       variable rcsid {$Id: core.tcl,v 1.13 2003/05/28 19:47:53 fireegl Exp $}
+       variable rcsid {$Id: core.tcl,v 1.14 2003/06/04 21:02:38 fireegl Exp $}
        # Initialize variables:
        variable Binds
        variable Timers
@@ -475,7 +475,7 @@
                set out [format $::tcldrop::lang(0x207)]
        } else {
                putlog "[format $::tcldrop::lang(0x206)] $module"
-               
+
        }
        package forget "tcldrop-$module"
        set out
Index: tcldrop/modules/ident.tcl
diff -u tcldrop/modules/ident.tcl:1.1 tcldrop/modules/ident.tcl:1.2
--- tcldrop/modules/ident.tcl:1.1       Wed May 28 15:47:53 2003
+++ tcldrop/modules/ident.tcl   Wed Jun  4 17:02:38 2003
@@ -1,46 +1,78 @@
 # ident.tcl --
 #
-#      Ident client for Tcl.
+#      Ident client for Tcl (See RFC 1413).
 #
 # Copyright (C) 2003 by Philip Moore <address@hidden>
 # This code may be distributed under the same terms as Tcl.
 #
-# RCS: @(#) $Id: ident.tcl,v 1.1 2003/05/28 19:47:53 fireegl Exp $
-
-# Options:
-# -lhost       Specifies the -myaddr to use with the socket command. 
(optional, defaults to the systems default)
-# -lport       Specifies the local port that's currently connected to the 
remote (required).
-# -rhost       Specifies the remote host that we're currently connected to. 
(required)
-# -rport       Specifies the remote port that we're currently connected to. 
(required)
-# -timeout     Specifies the timeout (in milliseconds) to use for the ident 
request. (optional, defaults to 30000)
-# -command     Specifies the command used as a callback when the ident request 
is complete. (optional)
-# -authport    Specifies the identd (auth) port to use on the remote (normally 
port 113). (optional, defaults to 113)
-# -sock        Specifies the socket that's currently connected to the remote 
host. (optional)
-#              Note, If -sock is used it takes the place of the -lhost, 
-lport, -rhost, -rport options.
-
-# There's also some alias and convenience options..
-# -localhost is the same as -lhost
-# -localport is the same as -lport
-# -remotehost is the same as -rhost
-# -remoteport is the same as -rport
-# -socket is the same as -sock
-# -local can be used to specify the local host and port separated by a colon.
-# -remote can be used to specify the remote host and port separated by a colon.
-# There's actually more aliases than this.. I got carried away..sorry.  Remove 
them if you want.
-
-# Example Usage:
-# 1. This one specifies a callback command that receives the results of the 
ident request when it's ready:
-#    ::ident::ident -sock sock7 -timeout 7000 -command [list yourcallback 
yourargs]
-#    Returns the token to be used by your callback command.
-#    When the ident request completes your callback command will recieve
-#    three arguments appended to yourargs.. <token> <status> <username/or the 
error message>
-#    The status will be either "ok" or "error".
-#
-# 2. This one waits for the ident reqest to complete and returns the results..
-#    ::ident::ident -lport 1234 -rhost remotehost -rport remoteport
-#    Returns a list with two elements, the first element is the status (either 
"ok" or "error").
-#    The second element is the users ident if the status is "ok",
-#    or the error message if the status is "error".
+# RCS: @(#) $Id: ident.tcl,v 1.2 2003/06/04 21:02:38 fireegl Exp $
+#
+# This package provides an ident client (See RFC 1413),
+# used for querying a remote system to find the username
+# that's connected to a port on the local machine.
+#
+# Usage:
+#
+#      ::ident::ident -option value ?-option value? ...
+#
+# The possible options are listed below..
+#
+# -authport 
+#      Specifies the identd (auth) port to use on the remote (normally port 
113).
+#      (optional, defaults to 113)
+#
+# -sock 
+#      Specifies the socket that's currently connected to the remote host.
+#      (optional, if it's not specified, you must use -lport, -rhost, and 
-rport)
+#      Note, if -sock is used it takes the place of the -lhost, -lport, 
-rhost, -rport options.
+#
+# -lhost 
+#      Specifies the local hostname (or ip) to use for creating the socket to 
the remote.
+#      (optional, defaults to the systems default)
+#
+# -lport 
+#      Specifies the local port that's currently connected to the remote.
+#      (required, unless you use the -sock option)
+#
+# -rhost 
+#      Specifies the remote host that we're currently connected to.
+#      (required, unless you use the -sock option)
+#
+# -rport 
+#      Specifies the remote port that we're currently connected to.
+#      (required, unless you use the -sock option)
+#
+# -timeout 
+#      Specifies the timeout (in milliseconds) to use for the ident request.
+#      (optional, defaults to 30000)
+#
+# -command 
+#      Specifies the command used as a callback when the ident request is 
complete.
+#      (optional, without this, the script blocks until the ident request 
fails/succeeds)
+#      ::ident::ident will immediately return a unique ID used to identify 
+#      this ident request, and will later be passed to your callback command
+#      when the lookup fails/succeeds.
+# 
+#      When the ident request completes, your callback command will recieve
+#      three arguments in addition to the arguments you specified for the 
command:
+#      <id> <status> <username/or the error message>
+#      The status will be either "ok" or "error".
+# 
+#      If -command isn't used, ::ident::ident blocks until the ident request 
fails or succeeds,
+#      and then returns a list with two elements..
+#      The first element will be either "ok" or "error" to indicate whether 
the ident succeeded or failed.
+#       If the first element is "ok", the second element will the username on 
the remote.
+#      If the first element is "error", the second element will be the reason 
it failed.
+# 
+# 
+# There's also some alias and convenience options...
+#      -localhost or -myaddr is the same as -lhost
+#      -localport is the same as -lport
+#      -remotehost is the same as -rhost
+#      -remoteport is the same as -rport
+#      -socket is the same as -sock
+#      -local can be used to specify the local host and port separated by a 
colon.
+#      -remote can be used to specify the remote host and port separated by a 
colon.
 #
 
 package require Tcl 8.2
@@ -48,7 +80,7 @@
 
 namespace eval ::ident {
        variable version {0.1}
-       variable rcsid {$Id: ident.tcl,v 1.1 2003/05/28 19:47:53 fireegl Exp $}
+       variable rcsid {$Id: ident.tcl,v 1.2 2003/06/04 21:02:38 fireegl Exp $}
        variable Count 0
        namespace export ident
 }
@@ -68,7 +100,7 @@
                                        set info(lport) [lindex $sockinfo 2]
                                }
                        }
-                       {-lhost} - {-localhost} - {-chost} - {-clienthost} { 
set info(lhost) $d }
+                       {-lhost} - {-localhost} - {-chost} - {-clienthost} - 
{-myaddr} { set info(lhost) $d }
                        {-lport} - {-localport} - {-cport} - {-clientport} { 
set info(lport) $d }
                        {-rhost} - {-remotehost} - {-phost} - {-peerhost} - 
{-shost} - {-serverhost} { set info(rhost) $d }
                        {-rport} - {-remoteport} - {-pport} - {-peerport} - 
{-sport} - {-serverport} { set info(rport) $d }
@@ -99,7 +131,8 @@
        } else {
                # We wait here and return the results when it's ready.
                vwait "::ident::$id\(status)"
-               return [list $info(status) $info(ident)]
+               # Returns the status and ident/error:
+               list $info(status) $info(ident)
        }
 }
 
@@ -128,21 +161,13 @@
 proc ::ident::Read {sock id} {
        fileevent $sock readable {}
        upvar 0 ::ident::$id info
-       if {[set code [catch {gets $sock line} err]] || $err == -1} {
+       if {[catch {gets $sock line} err] || $err == -1} {
                Finish $id {error} {SOCKET-ERROR}
        } else {
-               set line [split $line :]
-               set code [string toupper [string trim [lindex $line 1]]]
-               switch -- $code {
-                       {ERROR} {
-                               Finish $id {error} [string trim [lindex $line 
2]]
-                       }
-                       {USERID} {
-                               Finish $id {ok} [string trim [lindex $line 3]]
-                       }
-                       {default} {
-                               Finish $id {error} {UNKNOWN-RESPONSE}
-                       }
+               switch -- [string toupper [string trim [lindex [set line [split 
$line :]] 1]]] {
+                       {ERROR} { Finish $id {error} [string trim [lindex $line 
2]] }
+                       {USERID} { Finish $id {ok} [string trim [lindex $line 
3]] }
+                       {default} { Finish $id {error} {UNKNOWN-RESPONSE} }
                }
        }
        catch { close $sock }
Index: tcldrop/modules/idx.tcl
diff -u tcldrop/modules/idx.tcl:1.5 tcldrop/modules/idx.tcl:1.6
--- tcldrop/modules/idx.tcl:1.5 Tue May 27 11:32:09 2003
+++ tcldrop/modules/idx.tcl     Wed Jun  4 17:02:38 2003
@@ -1,24 +1,24 @@
 # idx.tcl --
 #
-# $Id: idx.tcl,v 1.5 2003/05/27 15:32:09 fireegl Exp $
+# $Id: idx.tcl,v 1.6 2003/06/04 21:02:38 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 #
@@ -130,7 +130,10 @@
 proc ::tcldrop::idx::putidx {idx text} {
        foreach {a d} [Info $idx] {
                array set idxinfo $d
-               if {[catch { puts $idxinfo(sock) $text }]} { return 0 } else { 
return 1 }
+               if {[catch { puts $idxinfo(sock) $text }]} { return 0 } else {
+                       flush $idxinfo(sock)
+                       return 1
+               }
        }
 }
 
Index: tcldrop/modules/irc/irc.tcl
diff -u tcldrop/modules/irc/irc.tcl:1.17 tcldrop/modules/irc/irc.tcl:1.18
--- tcldrop/modules/irc/irc.tcl:1.17    Tue May 27 11:32:09 2003
+++ tcldrop/modules/irc/irc.tcl Wed Jun  4 17:02:38 2003
@@ -1,34 +1,36 @@
 # irc.tcl --
+#      Handles:
+#              * All IRC related binds.
+#              * All IRC related commands.
+#      Depends: core, server, channels.
 #
-# $Id: irc.tcl,v 1.17 2003/05/27 15:32:09 fireegl Exp $
+# $Id: irc.tcl,v 1.18 2003/06/04 21:02:38 fireegl Exp $
+#
+# Copyright (C) 2003 Tcldrop Development Team <Tcldrop-Devel>
 #
-# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 #
-#      irc module for tcldrop.
-#      Depends on: server, channels.
 
 namespace eval ::tcldrop::irc {
        # Provide the users module:
        variable version {0.2}
-       variable rcsid {$Id: irc.tcl,v 1.17 2003/05/27 15:32:09 fireegl Exp $}
+       variable rcsid {$Id: irc.tcl,v 1.18 2003/06/04 21:02:38 fireegl Exp $}
        package provide tcldrop::irc $version
        # Initialize variables:
        variable Nicks
@@ -253,7 +255,7 @@
                putserv "WHOIS $nick"
                array set blabla [list nick $nick op 0 voice 0 halfop 0 "join" 
[set m [clock seconds]] "idle" $m]
                set ChannelNicks($element) [array get blabla]
-       } 
+       }
        # Call all the join binds:
        foreach b [binds join] {
                foreach {type flags mask count proc} $b {}
@@ -276,7 +278,7 @@
        set creator [lindex $larg 3]
        set created [lindex $larg 4]
        # FixMe: Complete this.
-       # We need to make a second ban-array to seperate the bans on channel, 
and the 
+       # We need to make a second ban-array to seperate the bans on channel, 
and the
        # internal bans set by the bot (active or not)
        variable Bans
        set element [string tolower $channel,$ban]
@@ -383,7 +385,7 @@
 proc ::tcldrop::irc::NICK {from key arg} {
        global botnick
        set oldnick [lindex [split $from !] 0]
-       if {![string equal $::botnick $::nick] && [string equal -nocase 
$oldnick $::nick]} { 
+       if {![string equal $::botnick $::nick] && [string equal -nocase 
$oldnick $::nick]} {
                putserv "NICK $::nick"
                set botnick $::nick
        }
@@ -760,7 +762,7 @@
 #      a sublist of the form {<invites> <bywho> <age>}. age is seconds from the
 #      bot's POV.
 #    Module: irc
-proc ::tcldrop::irc::chaninvites {channel} { 
+proc ::tcldrop::irc::chaninvites {channel} {
 }
 
 #  resetbans <channel>
Index: tcldrop/modules/server/server.tcl
diff -u tcldrop/modules/server/server.tcl:1.6 
tcldrop/modules/server/server.tcl:1.7
--- tcldrop/modules/server/server.tcl:1.6       Wed May 28 15:47:53 2003
+++ tcldrop/modules/server/server.tcl   Wed Jun  4 17:02:38 2003
@@ -1,24 +1,24 @@
 # server.tcl --
 #
-# $Id: server.tcl,v 1.6 2003/05/28 19:47:53 fireegl Exp $
+# $Id: server.tcl,v 1.7 2003/06/04 21:02:38 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 #
@@ -27,7 +27,7 @@
 
 namespace eval ::tcldrop::server {
        variable version {0.2}
-       variable rcsid {$Id: server.tcl,v 1.6 2003/05/28 19:47:53 fireegl Exp $}
+       variable rcsid {$Id: server.tcl,v 1.7 2003/06/04 21:02:38 fireegl Exp $}
        # Provide the server module:
        package provide tcldrop::server $version
        # Initialize variables:
@@ -76,7 +76,7 @@
                # Note, we set ::server-idx everytime we read from a server 
socket,
                # so that we can have basic support for multiple server 
connections.
                set ::server-idx $idx
-               RAW $from $key $arg
+               callraw $from $key $arg
        } else {
                Error {EOF} {Got EOF From Server}
        }
@@ -163,7 +163,7 @@
 
 # This runs all the RAW IRC binds:
 # (They should return 0 if they want tcldrop to continue processing, 1 if not.)
-proc ::tcldrop::server::RAW {from key arg} {
+proc ::tcldrop::server::callraw {from key arg} {
        foreach a [binds raw] {
                foreach {type flags mask count proc} $a {}
                if {[string equal -nocase $mask $key]} {
Index: tcldrop/tcldrop
diff -u tcldrop/tcldrop:1.2 tcldrop/tcldrop:1.3
--- tcldrop/tcldrop:1.2 Wed May 21 00:26:22 2003
+++ tcldrop/tcldrop     Wed Jun  4 17:02:38 2003
@@ -1,26 +1,26 @@
 #! /bin/sh
 # The next line restarts using tclsh \
-exec tclsh8.4 "$0" ${1+"$@"}
+exec tclsh8.3 "$0" ${1+"$@"}
 
-# $Id: tcldrop,v 1.2 2003/05/21 04:26:22 fireegl Exp $
+# $Id: tcldrop,v 1.3 2003/06/04 21:02:38 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-# 
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program (see gpl.txt); if not, write to the
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
02111-1307, USA.
 # Or visit http://www.GNU.Org/licenses/gpl.html
-# 
+#
 # The author of this project can be reached at address@hidden
 # Or can be found on IRC (EFNet or FreeNode) as FireEgl.
 
@@ -77,14 +77,27 @@
                }
        }
        if {${background}} {
-               #puts "Launched into the background  (pid: ?)"
-               # FixMe: Expect's [fork] command should do what I want here 
right?
-               #        Well, I tried it, and it does..sorta..
-               #        but fileevent's are never triggered when it's running 
in the background,
-               #        other than that everything works.
-               #        It was probably a bug in the Expect version I tried 
(5.38).
-               puts "Sorry, background mode doesn't work yet. =("
-               puts "Please re-run with the -n option."
+               if {![catch { package require Tclx }]} {
+                       if {[set pid [fork]] != 0} {
+                               puts "Launched into the background (using TclX) 
 (pid: $pid)"
+                               exit
+                       } else {
+                               vwait forever
+                       }
+               } elseif {![catch { package require Expect }]} {
+                       if {[set pid [fork]] != 0} {
+                               puts "Launched into the background (using 
Expect)  (pid: $pid)"
+                               exit
+                       } else {
+                               disconnect
+                               vwait forever
+                       }
+               } else {
+                       puts {NOTICE: Running in foreground mode.}
+                       puts {You need either Expect or TclX for background 
mode to work.}
+                       puts {main: entering loop}
+                       vwait forever
+               }
        } else {
                puts {main: entering loop}
                vwait forever




reply via email to

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