[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tcldrop/CVS] tcldrop/modules core.tcl dcc.tcl pkgIndex.tcl s...
From: |
Philip Moore |
Subject: |
[Tcldrop/CVS] tcldrop/modules core.tcl dcc.tcl pkgIndex.tcl s... |
Date: |
Wed, 28 May 2003 15:47:53 -0400 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Changes by: Philip Moore <address@hidden> 03/05/28 15:47:53
Modified files:
modules : core.tcl dcc.tcl pkgIndex.tcl
modules/server : server.tcl
Added files:
modules : ident.tcl
Log message:
Added an ident client, and updated the dcc module to use it.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/ident.tcl?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/core.tcl.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/pkgIndex.tcl.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/server/server.tcl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: tcldrop/modules/core.tcl
diff -u tcldrop/modules/core.tcl:1.12 tcldrop/modules/core.tcl:1.13
--- tcldrop/modules/core.tcl:1.12 Tue May 27 11:32:09 2003
+++ tcldrop/modules/core.tcl Wed May 28 15:47:53 2003
@@ -1,6 +1,6 @@
# modules/core.tcl --
#
-# $Id: core.tcl,v 1.12 2003/05/27 15:32:09 fireegl Exp $
+# $Id: core.tcl,v 1.13 2003/05/28 19:47:53 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -47,7 +47,7 @@
# Provide the users module:
variable version {0.3}
package provide tcldrop::core $version
- variable rcsid {$Id: core.tcl,v 1.12 2003/05/27 15:32:09 fireegl Exp $}
+ variable rcsid {$Id: core.tcl,v 1.13 2003/05/28 19:47:53 fireegl Exp $}
# Initialize variables:
variable Binds
variable Timers
@@ -441,7 +441,7 @@
puterrlog "$::errorInfo"
} else {
variable Modules
- if {[info exists "::tcldrop::${module}::version"]} { set modver
$"::tcldrop::${module}::version" } else { set modver 0.0 }
+ if {[info exists "::tcldrop::${module}::version"]} { set modver
[set "::tcldrop::${module}::version"] } else { set modver 0.0 }
set Modules($module) $modver
# Import the commands...
# This imports them into the tcldrop namespace:
@@ -560,6 +560,7 @@
# Load the required modules (the order here is important):
loadmodule users
loadmodule idx
+ package require ident
loadmodule dcc
# Rehash, (re)loads the config file (which in turn should load the
optional modules):
rehash $type
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.4 tcldrop/modules/dcc.tcl:1.5
--- tcldrop/modules/dcc.tcl:1.4 Tue May 27 11:32:09 2003
+++ tcldrop/modules/dcc.tcl Wed May 28 15:47:53 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.4 2003/05/27 15:32:09 fireegl Exp $
+# $Id: dcc.tcl,v 1.5 2003/05/28 19:47:53 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.4 2003/05/27 15:32:09 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.5 2003/05/28 19:47:53 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
@@ -199,28 +199,43 @@
# it shows the current socket connections.
proc ::tcldrop::dcc::dcclist {{type {}}} { set dcclist [list]
foreach {a d} [::tcldrop::idx::Info] {
+ array unset idxinfo
array set idxinfo $d
if {$type == {} || [string match -nocase $type $idxinfo(type)]}
{
- lappend dcclist [list $idxinfo(idx) $idxinfo(handle)
$idxinfo(hostname) $idxinfo(type) $idxinfo(other) $idxinfo(timestamp)]
+ lappend dcclist [list $idxinfo(idx) $idxinfo(handle)
$idxinfo(remote) $idxinfo(type) $idxinfo(other) $idxinfo(timestamp)]
}
}
return $dcclist
}
+proc ::tcldrop::dcc::Ident {idx id status response} {
+ foreach {a d} [::tcldrop::idx::Info $idx] { array set idxinfo $d }
+ if {$status == {ok}} {
+ ::tcldrop::idx::ChInfo $idx [list ident $response remote
address@hidden(hostname)]
+
+ } else {
+ ::tcldrop::idx::ChInfo $idx [list ident -telnet remote
address@hidden(hostname)]
+ }
+}
+
proc ::tcldrop::dcc::Connect {sock ip port} {
set idx [::tcldrop::idx::Assign]
- # FixMe: Do an ident lookup on them.
fileevent $sock writable [list ::tcldrop::dcc::Write $sock $idx]
fconfigure $sock -buffering line -blocking 0
fileevent $sock readable [list ::tcldrop::dcc::Read $sock $idx]
- # FixMe: The type may not sposta be TELNET_ID yet, need to find out:
- ::tcldrop::idx::Register $idx [list idx $idx sock $sock handle *
hostname address@hidden port $port type TELNET_ID other "t-in waited 1s"
timestamp [unixtime]]
+ # FixMe: The type may not sposta be called TELNET_ID yet, need to find
out:
+ set hostname [lindex [fconfigure $sock -peername] 1]
+ ::tcldrop::idx::Register $idx [list idx $idx sock $sock handle * ident
{-telnet} hostname $hostname ip $ip remote address@hidden port $port type
TELNET_ID other {t-in waited 1s} timestamp [unixtime]]
+ ::ident::ident -sock $sock -command [list ::tcldrop::dcc::Ident $idx]
}
proc ::tcldrop::dcc::Write {sock idx} {
fileevent $sock writable {}
::tcldrop::idx::ChInfo $idx [list type TELNET_ID other {t-in waited
2s} timestamp [unixtime]]
- if {$sock == {stdout}} { puts {### ENTERING DCC CHAT SIMULATION ###} }
+ if {$sock == {stdout}} {
+ puts {### ENTERING DCC CHAT SIMULATION ###}
+ ::tcldrop::idx::ChInfo $idx [list remote address@hidden
+ }
if {[countusers] == 0} {
# FixMe: Since there's no other users,
# skip to the part where we ask for the handle they want
to sign up with.
@@ -274,7 +289,7 @@
putidx $idx {Try another one
please: }
} else {
putidx $idx {Okay, now choose
and enter a password: }
- adduser $line
*!$chatinfo(hostname)
+ adduser $line
*!$chatinfo(ident)@$chatinfo(ip)
::tcldrop::idx::ChInfo $idx
[list handle $line type TELNET_PW other {newp waited 3s} timestamp [unixtime]]
}
}
@@ -351,7 +366,7 @@
if {![catch { socket -server ::tcldrop::dcc::Connect
$port } sock]} {
set idx [::tcldrop::idx::Assign]
fconfigure $sock -buffering line -blocking 0
- ::tcldrop::idx::Register $idx [list idx $idx
sock $sock handle ($type) hostname * port $port type TELNET other "lstn $port"
timestamp [unixtime]]
+ ::tcldrop::idx::Register $idx [list idx $idx
sock $sock handle ($type) remote {*} hostname * port $port type TELNET other
"lstn $port" timestamp [unixtime]]
putlog "Listening at telnet port $port ($type)"
return $port
} else {
@@ -406,7 +421,7 @@
# set handle {HQ}
#}
# FixMe: The type may not sposta be TELNET_ID yet, need to find
out:
- ::tcldrop::idx::Register $idx [list idx $idx sock stdout handle
* hostname address@hidden port 0 type TELNET_ID other "t-in waited 1s"
timestamp [unixtime]]
+ ::tcldrop::idx::Register $idx [list idx $idx sock stdout handle
* ident User hostname Console remote address@hidden port 0 type TELNET_ID other
"t-in waited 1s" timestamp [unixtime]]
# FixMe: Create a bind for when people successfully login and
set the console settings elsewhere:
console $idx
# Turn off logging to Stdout, because it's a dcc session now,
not a screen:
Index: tcldrop/modules/pkgIndex.tcl
diff -u tcldrop/modules/pkgIndex.tcl:1.3 tcldrop/modules/pkgIndex.tcl:1.4
--- tcldrop/modules/pkgIndex.tcl:1.3 Tue May 27 11:32:09 2003
+++ tcldrop/modules/pkgIndex.tcl Wed May 28 15:47:53 2003
@@ -12,3 +12,5 @@
package ifneeded tcldrop::core 0.3 [list source [file join $dir core.tcl]]
package ifneeded tcldrop::dcc 0.2 [list source [file join $dir dcc.tcl]]
package ifneeded tcldrop::idx 0.2 [list source [file join $dir idx.tcl]]
+package ifneeded ident 0.1 [list source [file join $dir ident.tcl]]
+
Index: tcldrop/modules/server/server.tcl
diff -u tcldrop/modules/server/server.tcl:1.5
tcldrop/modules/server/server.tcl:1.6
--- tcldrop/modules/server/server.tcl:1.5 Tue May 27 11:32:09 2003
+++ tcldrop/modules/server/server.tcl Wed May 28 15:47:53 2003
@@ -1,6 +1,6 @@
# server.tcl --
#
-# $Id: server.tcl,v 1.5 2003/05/27 15:32:09 fireegl Exp $
+# $Id: server.tcl,v 1.6 2003/05/28 19:47:53 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -27,7 +27,7 @@
namespace eval ::tcldrop::server {
variable version {0.2}
- variable rcsid {$Id: server.tcl,v 1.5 2003/05/27 15:32:09 fireegl Exp $}
+ variable rcsid {$Id: server.tcl,v 1.6 2003/05/28 19:47:53 fireegl Exp $}
# Provide the server module:
package provide tcldrop::server $version
# Initialize variables:
@@ -127,7 +127,7 @@
callevent connect-server
set fail [catch { connect $serv $port -timeout ${server-timeout}
-myaddr ${my-ip} -control ::tcldrop::server::Read -errors
::tcldrop::server::ConnectErrors -writable ::tcldrop::server::Write } idx]
if {!$fail} {
- ::tcldrop::idx::ChInfo $idx [list handle (server) hostname
$serv port $port type SERVER other serv timestamp [set timestamp [unixtime]]]
+ ::tcldrop::idx::ChInfo $idx [list handle (server) remote $serv
hostname $serv port $port type SERVER other serv timestamp [set timestamp
[unixtime]]]
# Eggdrop compatibility stuff:
set server "$serv:$port"
set server-online $timestamp
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tcldrop/CVS] tcldrop/modules core.tcl dcc.tcl pkgIndex.tcl s...,
Philip Moore <=