/[tcldrop]/tcldrop/modules/core.tcl
ViewVC logotype

Diff of /tcldrop/modules/core.tcl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by fireegl, Sat Nov 22 02:52:36 2003 UTC revision 1.21 by fireegl, Sat Nov 22 05:01:56 2003 UTC
# Line 482  proc ::tcldrop::isbotnetnick {nick} { st Line 482  proc ::tcldrop::isbotnetnick {nick} { st
482    
483  proc ::tcldrop::traffic {{type {*}} {direction {}} {bytes {0}}} {  proc ::tcldrop::traffic {{type {*}} {direction {}} {bytes {0}}} {
484          variable Traffic          variable Traffic
485          if {$type != {*}} {          if {$type != {}} {
486                  if {[info exists Traffic($type)]} {                  if {[info exists Traffic($type)]} {
487                          # Set the info array to the current counts.                          # Set the info array to the current counts.
488                          array set info $Traffic($type)                          array set info $Traffic($type)
# Line 492  proc ::tcldrop::traffic {{type {*}} {dir Line 492  proc ::tcldrop::traffic {{type {*}} {dir
492                  }                  }
493                  # Increase the counters:                  # Increase the counters:
494                  if {($bytes) && ($direction == {in} || $direction == {out})} {                  if {($bytes) && ($direction == {in} || $direction == {out})} {
495                          array set info [list total-$direction [incr info(total-$direction) $bytes] daily-$direction [incr info(daily-$direction) $bytes]]                          incr info(total-$direction) $bytes
496                            incr info(daily-$direction) $bytes
497                  }                  }
498                  # See if 24 hours have elapsed, and if it has then clear the daily counts.                  # See if 24 hours have elapsed, and if it has then clear the daily counts.
499                  if {[expr { [unixtime] - $info(restart) > 86400 }]} {                  if {[expr { [unixtime] - $info(restart) > 86400 }]} {
# Line 509  proc ::tcldrop::traffic {{type {*}} {dir Line 510  proc ::tcldrop::traffic {{type {*}} {dir
510                  }                  }
511          } else {          } else {
512                  # Show them all the traffic stats.                  # Show them all the traffic stats.
513                  set out [list]                  array set total [list total-out 0 total-in 0 daily-out 0 daily-in 0]
514                  foreach t [array names Traffic] {                  foreach t [array names Traffic] {
515                          array set info $Traffic($t)                          array set info $Traffic($t)
516                          lappend out [list $t $info(daily-in) $info(total-in) $info(daily-out) $info(total-out)]                          lappend out [list $t $info(daily-in) $info(total-in) $info(daily-out) $info(total-out)]
517                            incr total(total-out) $info(total-out)
518                            incr total(total-in) $info(total-in)
519                            incr total(daily-out) $info(daily-out)
520                            incr total(daily-in) $info(daily-in)
521                  }                  }
522                    lappend out [list Total $total(daily-in) $total(total-in) $total(daily-out) $total(total-out)]
523                  return $out                  return $out
524          }          }
525  }  }

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26