[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tcldrop/CVS] tcldrop/modules dcc.tcl idx.tcl server/server.tcl
From: |
Philip Moore |
Subject: |
[Tcldrop/CVS] tcldrop/modules dcc.tcl idx.tcl server/server.tcl |
Date: |
Fri, 21 Nov 2003 23:34:58 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/11/21 23:34:58
Modified files:
modules : dcc.tcl idx.tcl
modules/server : server.tcl
Log message:
Track all outgoing traffic bytes from the putidx command.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/idx.tcl.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/server/server.tcl.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
Patches:
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.25 tcldrop/modules/dcc.tcl:1.26
--- tcldrop/modules/dcc.tcl:1.25 Fri Nov 21 17:26:52 2003
+++ tcldrop/modules/dcc.tcl Fri Nov 21 23:34:56 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.25 2003/11/21 22:26:52 fireegl Exp $
+# $Id: dcc.tcl,v 1.26 2003/11/22 04:34:56 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.25 2003/11/21 22:26:52 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.26 2003/11/22 04:34:56 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 bots islinked putbot putallbots sock2idx idx2sock
@@ -238,12 +238,12 @@
set idx [controlsock $sock -control ::tcldrop::dcc::Read -writable
::tcldrop::dcc::Write]
# FixMe: The type may not sposta be called TELNET_ID yet, need to find
out:
set hostname [lindex [fconfigure $sock -peername] 1]
- ::tcldrop::idx::ChInfo $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]]
+ ::tcldrop::idx::ChInfo $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] traffictype misc]
::ident::ident -sock $sock -timeout [expr { ${::ident-timeout} * 1000
}] -command [list ::tcldrop::dcc::Ident $idx]
}
proc ::tcldrop::dcc::Write {idx} {
- ::tcldrop::idx::ChInfo $idx [list type TELNET_ID other {t-in waited
2s} timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list type TELNET_ID other {t-in waited
2s} timestamp [unixtime] traffictype misc]
if {[countusers] == 0} { putidx $idx {You will be the owner once you
set up an account... Type 'NEW' here...} }
putidx $idx {Nickname.}
if {${::open-telnets}} { putidx $idx {(If you are new, enter 'NEW'
here.)} }
@@ -258,7 +258,7 @@
if {${::open-telnets} || [countusers] == 0} {
# Let them.
putidx $idx {Enter the handle you would
like to use.}
- ::tcldrop::idx::ChInfo $idx [list type
TELNET_NEW other {new waited 2s} timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list type
TELNET_NEW other {new waited 2s} timestamp [unixtime] traffictype partyline]
} else {
# Denied!
putidx $idx {You don't have access.
(not accepting 'new' users)}
@@ -271,7 +271,7 @@
} else {
putidx $idx {Password.}
}
- ::tcldrop::idx::ChInfo $idx [list
handle $line type CHAT_PASS other {pass waited 3s} timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list
handle $line type CHAT_PASS other {pass waited 3s} timestamp [unixtime]
traffictype partyline]
} else {
if {[matchattr $line b]} {
# FixMe: putidx $idx {FixMe:
Make sure bots without passwords can link the first time.}
@@ -286,12 +286,12 @@
# and change the type to "BOT".
if {[passwdok $chatinfo(handle) $line]} {
if {[matchattr $chatinfo(handle) b]} {
+ ::tcldrop::idx::ChInfo $idx [list type
BOT other {bot flags: } timestamp [unixtime] traffictype botnet]
putidx $idx {*hello}
putidx $idx {version }
- ::tcldrop::idx::ChInfo $idx [list type
BOT other {bot flags: } timestamp [unixtime]]
} else {
+ ::tcldrop::idx::ChInfo $idx [list type
CHAT other {chat flags: ?/0} timestamp [unixtime] traffictype partyline]
putidx $idx {Welcome!}
- ::tcldrop::idx::ChInfo $idx [list type
CHAT other {chat flags: ?/0} timestamp [unixtime]]
# FixMe: Show the MOTD and whatnot here.
}
} else {
@@ -311,20 +311,20 @@
} else {
putidx $idx {Okay, now choose and enter a
password: }
adduser $line *!$chatinfo(ident)@$chatinfo(ip)
- ::tcldrop::idx::ChInfo $idx [list handle $line
type TELNET_PW other {newp waited 3s} timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list handle $line
type TELNET_PW other {newp waited 3s} timestamp [unixtime] traffictype
partyline]
}
}
{TELNET_PW} {
if {[string length $line] < 4} {
putidx $idx {Try to use at least 4 characters
in your password.}
putidx $idx {Choose and enter a password: }
- ::tcldrop::idx::ChInfo $idx [list timestamp
[unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list timestamp
[unixtime] traffictype partyline]
} else {
setuser $chatinfo(handle) pass $line
putidx $idx {Remember that! You'll need it
next time you log in.}
putidx $idx "You now have an account"
chattr $chatinfo(handle) +pnmofvtxj
- ::tcldrop::idx::ChInfo $idx [list type CHAT
other {chat flags: ?/0} timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list type CHAT
other {chat flags: ?/0} timestamp [unixtime] traffictype partyline]
# FixMe: Show the MOTD or whatever here.
}
}
@@ -354,22 +354,24 @@
#CHAT $chatinfo(handle) $channel $line
}
# Update the info for last idle:
- ::tcldrop::idx::ChInfo $idx [list timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list timestamp [unixtime]
traffictype partyline]
# Update their laston info:
catch { setlaston $chatinfo(handle) [unixtime]
partyline }
+ # FixMe: I'm not sure, but I think Eggdrop counts dcc
commands as part of the partyline traffic.. So we'll do that here, unless it's
found to be otherwise:
+ traffic partyline in [string length $line]
}
{BOT_NEW} {
if {$line != {}} {
# This is when the remote bot is asking what
our handle is.
+ ::tcldrop::idx::ChInfo $idx [list type BOT_PASS
other {bot_pass} traffictype botnet]
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}]
+ ::tcldrop::idx::ChInfo $idx [list type
BOT_HELLO other {bot_hello} traffictype botnet]
} else {
# Abort since it's not a valid responce to our
handle.
killidx $idx
@@ -381,19 +383,20 @@
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: }]
+ ::tcldrop::idx::ChInfo $idx [list type BOT
other {bot flags: } traffictype botnet]
}
}
{BOT} {
# Similar to CHAT above, but this is for bot
connections.
RAWBOT $chatinfo(handle) $idx [string trim [lindex
[split $line] 0]] [string trimleft [join [lrange $line 1 end]]]
+ traffic botnet in [string length $line]
}
{default} { }
}
}
proc ::tcldrop::dcc::BOTWrite {idx} {
- ::tcldrop::idx::ChInfo $idx [list type BOT_NEW other {bot*} timestamp
[unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list type BOT_NEW other {bot*} timestamp
[unixtime] traffictype botnet]
}
proc ::tcldrop::dcc::listen {port type args} {
@@ -519,7 +522,7 @@
# Special proc for the console (stdout):
proc ::tcldrop::dcc::ConsoleWrite {idx} {
fileevent stdout writable {}
- ::tcldrop::idx::ChInfo $idx [list remote address@hidden type TELNET_ID
other {t-in waited 2s} timestamp [unixtime]]
+ ::tcldrop::idx::ChInfo $idx [list remote address@hidden type TELNET_ID
other {t-in waited 2s} timestamp [unixtime] traffictype partyline]
puts {### ENTERING DCC CHAT SIMULATION ###}
if {[countusers] == 0} {
# FixMe: Since there's no other users,
@@ -884,7 +887,7 @@
set port [lindex $botaddr 1]
set fail [catch { connect $host $port -timeout ${::connect-timeout}
-myaddr ${::my-ip} -control ::tcldrop::dcc::Read -writable
::tcldrop::dcc::BOTWrite -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]]]
+ ::tcldrop::idx::ChInfo $idx [list handle $bot remote $host
hostname $host port $port type FORK_BOT other {conn bot} timestamp [set
timestamp [unixtime]] traffictype botnet]
#set TimerID [utimer 99 [list ::tcldrop::dcc::BOTConnectTimeout
$idx]]
}
if {!$fail} { return 1 } else { return 0 }
Index: tcldrop/modules/idx.tcl
diff -u tcldrop/modules/idx.tcl:1.8 tcldrop/modules/idx.tcl:1.9
--- tcldrop/modules/idx.tcl:1.8 Fri Nov 14 10:58:47 2003
+++ tcldrop/modules/idx.tcl Fri Nov 21 23:34:57 2003
@@ -1,6 +1,6 @@
# idx.tcl --
#
-# $Id: idx.tcl,v 1.8 2003/11/14 15:58:47 fireegl Exp $
+# $Id: idx.tcl,v 1.9 2003/11/22 04:34:57 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -131,6 +131,7 @@
array set idxinfo $d
if {[catch { puts $idxinfo(sock) $text }]} { return 0 } else {
flush $idxinfo(sock)
+ traffic $idxinfo(traffictype) out [string length $text]
return 1
}
}
Index: tcldrop/modules/server/server.tcl
diff -u tcldrop/modules/server/server.tcl:1.11
tcldrop/modules/server/server.tcl:1.12
--- tcldrop/modules/server/server.tcl:1.11 Fri Nov 21 22:32:05 2003
+++ tcldrop/modules/server/server.tcl Fri Nov 21 23:34:57 2003
@@ -1,6 +1,6 @@
# server.tcl --
#
-# $Id: server.tcl,v 1.11 2003/11/22 03:32:05 fireegl Exp $
+# $Id: server.tcl,v 1.12 2003/11/22 04:34:57 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.11 2003/11/22 03:32:05 fireegl Exp
$}
+ variable rcsid {$Id: server.tcl,v 1.12 2003/11/22 04:34:57 fireegl Exp
$}
# Provide the server module:
package provide tcldrop::server $version
# Initialize variables:
@@ -130,7 +130,7 @@
catch { killutimer $TimerID }
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) remote $serv
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 traffictype irc timestamp [set
timestamp [unixtime]]]
# Eggdrop compatibility stuff:
set server "$serv:$port"
set server-online $timestamp
@@ -332,7 +332,6 @@
proc ::tcldrop::server::putnow {text} {
if {[valididx ${::server-idx}]} {
putidx ${::server-idx} $text
- traffic irc out [string length $text]
} else {
clearqueue {all}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tcldrop/CVS] tcldrop/modules dcc.tcl idx.tcl server/server.tcl,
Philip Moore <=