[cvslog] Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Thu Dec 20 01:52:01 CST 2001


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2001-12-20 07:51:36 UTC
Commited by: Jeff Fisher <guppy at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 doc/tcl-commands.doc src/patch.h src/tcldcc.c
     src/tclmisc.c

Log message:

added stdarg's tcl_traffic patch (which was modified by yours truly)

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.260 eggdrop1.6/doc/UPDATES1.6:1.261
--- eggdrop1.6/doc/UPDATES1.6:1.260	Thu Dec 20 00:53:15 2001
+++ eggdrop1.6/doc/UPDATES1.6	Thu Dec 20 01:51:26 2001
@@ -1,10 +1,12 @@
-$Id: UPDATES1.6,v 1.260 2001/12/20 06:53:15 guppy Exp $
+$Id: UPDATES1.6,v 1.261 2001/12/20 07:51:26 guppy Exp $
 
 Changes in eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.8
 Found by  Fixed by  What...
+various   stdarg/   added tcl_traffic (a modified copy of stdarg's original patch)
+          guppy/
 Tothwolf  guppy     .servers doesn't trunicate server names anymore
 Wcc       guppy     made cmd_modules work locally as well as remotely
           guppy     made show_banner reset the help_subst arguments like show_motd does
Index: eggdrop1.6/doc/tcl-commands.doc
diff -u eggdrop1.6/doc/tcl-commands.doc:1.60 eggdrop1.6/doc/tcl-commands.doc:1.61
--- eggdrop1.6/doc/tcl-commands.doc:1.60	Wed Dec 19 18:10:43 2001
+++ eggdrop1.6/doc/tcl-commands.doc	Thu Dec 20 01:51:26 2001
@@ -948,9 +948,14 @@
   md5 <string>
     returns: the 128 bit MD5 message-digest of the specified string.
 
- callevent <event>
-   Triggers the evnt bind manually for a certain event. For example:
-     callevent rehash
+  callevent <event>
+    Triggers the evnt bind manually for a certain event. For example:
+    callevent rehash
+
+| traffic
+|   returns: a list of sublists containing information about the bot's
+|     traffic usage in bytes. Each sublist contains five elements: type, 
+|     in-traffic today, in-traffic total, out-traffic today, out-traffic total.
 
 GLOBAL VARIABLES:
   (All config-file variables are global, too. But these variables
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.637 eggdrop1.6/src/patch.h:1.638
--- eggdrop1.6/src/patch.h:1.637	Thu Dec 20 00:53:15 2001
+++ eggdrop1.6/src/patch.h	Thu Dec 20 01:51:26 2001
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.637 2001/12/20 06:53:15 guppy Exp $
+ * $Id: patch.h,v 1.638 2001/12/20 07:51:26 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1008831073");		/* current unixtime */
+patch("1008834494");		/* current unixtime */
 /*
  *
  *
  */
-patch("cmd_servers");
+patch("tcl_traffic");
 /*
  *
  *
Index: eggdrop1.6/src/tcldcc.c
diff -u eggdrop1.6/src/tcldcc.c:1.30 eggdrop1.6/src/tcldcc.c:1.31
--- eggdrop1.6/src/tcldcc.c:1.30	Wed Oct 31 15:07:31 2001
+++ eggdrop1.6/src/tcldcc.c	Thu Dec 20 01:51:26 2001
@@ -2,7 +2,7 @@
  * tcldcc.c -- handles:
  *   Tcl stubs for the dcc commands
  *
- * $Id: tcldcc.c,v 1.30 2001/10/31 21:07:31 guppy Exp $
+ * $Id: tcldcc.c,v 1.31 2001/12/20 07:51:26 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -38,6 +38,8 @@
 extern tand_t		*tandbot;
 extern time_t		 now;
 
+/* Traffic stuff. */
+extern unsigned long otraffic_irc, otraffic_irc_today, itraffic_irc, itraffic_irc_today, otraffic_bn, otraffic_bn_today, itraffic_bn, itraffic_bn_today, otraffic_dcc, otraffic_dcc_today, itraffic_dcc, itraffic_dcc_today, otraffic_trans, otraffic_trans_today, itraffic_trans, itraffic_trans_today, otraffic_unknown, otraffic_unknown_today, itraffic_unknown, itraffic_unknown_today;
 
 int			 enable_simul = 0;
 static struct portmap	*root = NULL;
@@ -1023,6 +1025,52 @@
   return TCL_OK;
 }
 
+static int tcl_traffic STDVAR
+{
+  char buf[1024];
+  unsigned long out_total_today, out_total;
+  unsigned long in_total_today, in_total;
+
+  /* IRC traffic */
+  sprintf(buf, "irc %ld %ld %ld %ld", itraffic_irc_today, itraffic_irc +
+	  itraffic_irc_today, otraffic_irc_today, otraffic_irc + otraffic_irc_today);
+  Tcl_AppendElement(irp, buf);  
+
+  /* Botnet traffic */
+  sprintf(buf, "botnet %ld %ld %ld %ld", itraffic_bn_today, itraffic_bn +
+          itraffic_bn_today, otraffic_bn_today, otraffic_bn + otraffic_bn_today);
+  Tcl_AppendElement(irp, buf);
+
+  /* Partyline */
+  sprintf(buf, "partyline %ld %ld %ld %ld", itraffic_dcc_today, itraffic_dcc +  
+          itraffic_dcc_today, otraffic_dcc_today, otraffic_dcc + otraffic_dcc_today);    
+  Tcl_AppendElement(irp, buf);
+
+  /* Transfer */
+  sprintf(buf, "transfer %ld %ld %ld %ld", itraffic_trans_today, itraffic_trans +  
+          itraffic_trans_today, otraffic_trans_today, otraffic_trans + otraffic_trans_today);    
+  Tcl_AppendElement(irp, buf);
+
+  /* Misc traffic */
+  sprintf(buf, "misc %ld %ld %ld %ld", itraffic_unknown_today, itraffic_unknown +  
+          itraffic_unknown_today, otraffic_unknown_today, otraffic_unknown + 
+	  otraffic_unknown_today);    
+  Tcl_AppendElement(irp, buf);
+
+  /* Totals */
+  in_total_today = itraffic_irc_today + itraffic_bn_today + itraffic_dcc_today + 
+		itraffic_trans_today + itraffic_unknown_today,
+  in_total = in_total_today + itraffic_irc + itraffic_bn + itraffic_dcc + 
+	      itraffic_trans + itraffic_unknown;
+  out_total_today = otraffic_irc_today + otraffic_bn_today + otraffic_dcc_today +
+                itraffic_trans_today + otraffic_unknown_today,
+  out_total = out_total_today + otraffic_irc + otraffic_bn + otraffic_dcc +
+              otraffic_trans + otraffic_unknown;	  
+  sprintf(buf, "total %ld %ld %ld %ld", in_total_today, in_total, out_total_today, out_total);
+  Tcl_AppendElement(irp, buf);
+  return(TCL_OK);
+}
+
 tcl_cmds tcldcc_cmds[] =
 {
   {"putdcc",		tcl_putdcc},
@@ -1060,5 +1108,6 @@
   {"boot",		tcl_boot},
   {"rehash",		tcl_rehash},
   {"restart",		tcl_restart},
+  {"traffic",		tcl_traffic},
   {NULL,		NULL}
 };
Index: eggdrop1.6/src/tclmisc.c
diff -u eggdrop1.6/src/tclmisc.c:1.26 eggdrop1.6/src/tclmisc.c:1.27
--- eggdrop1.6/src/tclmisc.c:1.26	Sat Sep 29 01:33:21 2001
+++ eggdrop1.6/src/tclmisc.c	Thu Dec 20 01:51:26 2001
@@ -1,9 +1,8 @@
 /*
  * tclmisc.c -- handles:
- *   Tcl stubs for file system commands
  *   Tcl stubs for everything else
  *
- * $Id: tclmisc.c,v 1.26 2001/09/29 06:33:21 guppy Exp $
+ * $Id: tclmisc.c,v 1.27 2001/12/20 07:51:26 guppy Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
----------------------- End of diff -----------------------



More information about the Changes mailing list