[cvslog] (2003-11-27 05:10:40 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Wed Nov 26 23:10:40 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2003-11-27 05:10:40 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     language/core.english.lang src/chanprog.c src/patch.h
     src/mod/irc.mod/msgcmds.c

Log message:

* Msg commands cosmetic cleanups.
* More status cleanups.
* Fixed a buffer overrun in msg_status().

---------------------- diff included ----------------------
Index: eggdrop1.6/language/core.english.lang
diff -u eggdrop1.6/language/core.english.lang:1.39 eggdrop1.6/language/core.english.lang:1.40
--- eggdrop1.6/language/core.english.lang:1.39	Wed Nov 26 21:20:24 2003
+++ eggdrop1.6/language/core.english.lang	Wed Nov 26 23:10:30 2003
@@ -1,7 +1,7 @@
 # core.english.lang
 #   core language messages for eggdrop
 #
-# $Id: core.english.lang,v 1.39 2003/11/27 03:20:24 wcc Exp $
+# $Id: core.english.lang,v 1.40 2003/11/27 05:10:30 wcc Exp $
 
 # General stuff
 0x001,Usage
@@ -69,7 +69,7 @@
 0x40e,Userfile creation not necessary--skipping
 0x40f,Rehashing...
 0x410,I don't know anyone by that name.\n
-0x411,No user record.
+0x411,No such user record.
 0x412,Backing up user file...
 0x413,Failed connection; aborted userfile transfer.
 0x414,Old style share request by
@@ -106,7 +106,7 @@
 0x521,Use:
 0x522,<address>:<port#>[/<relay-port#>]
 0x526,pending
-0x527,want ops
+0x527,need ops
 0x528,lurking
 0x529,background
 0x52a,terminal mode
@@ -181,7 +181,7 @@
 0x62b,Jumping servers...
 0x62c,Channel is currently hidden.
 0x62d,Now on channel
-0x62e,Never joined one of my channels.
+0x62e,Never seen on channel.
 0x62f,Last seen at
 0x630,I don't know you; please introduce yourself first.
 0x631,No help.
Index: eggdrop1.6/src/chanprog.c
diff -u eggdrop1.6/src/chanprog.c:1.43 eggdrop1.6/src/chanprog.c:1.44
--- eggdrop1.6/src/chanprog.c:1.43	Wed Nov 26 21:25:10 2003
+++ eggdrop1.6/src/chanprog.c	Wed Nov 26 23:10:30 2003
@@ -7,7 +7,7 @@
  *   telling the current programmed settings
  *   initializing a lot of stuff and loading the tcl scripts
  *
- * $Id: chanprog.c,v 1.43 2003/11/27 03:25:10 wcc Exp $
+ * $Id: chanprog.c,v 1.44 2003/11/27 05:10:30 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -262,7 +262,7 @@
   char s[256], s1[121], s2[81];
   char *vers_t, *uni_t;
   int i;
-  time_t now2, hr, min;
+  time_t now2 = now - online_since, hr, min;
 
 #if HAVE_GETRUSAGE
   struct rusage ru;
@@ -286,11 +286,10 @@
 #endif
 
   i = count_users(userlist);
-  dprintf(idx, "I am %s, running %s: %d user%s (mem: %uk)\n",
+  dprintf(idx, "I am %s, running %s: %d user%s (mem: %uk).\n",
           botnetnick, ver, i, i == 1 ? "" : "s",
           (int) (expected_memory() / 1024));
 
-  now2 = now - online_since;
   s[0] = 0;
   if (now2 > 86400) {
     /* days */
@@ -353,7 +352,7 @@
           TCL_PATCH_LEVEL ? TCL_PATCH_LEVEL : "*unknown*");
 
 #if HAVE_TCL_THREADS
-  dprintf(idx, "Tcl is threaded\n");
+  dprintf(idx, "Tcl is threaded.\n");
 #endif
 
 }
@@ -372,10 +371,13 @@
   dprintf(idx, "Userfile: %s\n", userfile);
   dprintf(idx, "Motd: %s\n",  motdfile);
   dprintf(idx, "Directories:\n");
-  dprintf(idx, "  Help    : %s\n", helpdir);
-  dprintf(idx, "  Temp    : %s\n", tempdir);
 #ifndef STATIC
-  dprintf(idx, "  Modules : %s\n", moddir);
+  dprintf(idx, "  Help   : %s\n", helpdir);
+  dprintf(idx, "  Temp   : %s\n", tempdir);
+  dprintf(idx, "  Modules: %s\n", moddir);
+#else
+  dprintf(idx, "  Help: %s\n", helpdir);
+  dprintf(idx, "  Temp: %s\n", tempdir);
 #endif
   fr.global = default_flags;
 
@@ -390,7 +392,7 @@
               logs[i].filename, logs[i].chname,
               masktype(logs[i].mask), maskname(logs[i].mask));
     }
-  dprintf(idx, "Ignores last %d minute%s\n", ignore_time,
+  dprintf(idx, "Ignores last %d minute%s.\n", ignore_time,
           (ignore_time != 1) ? "s" : "");
 }
 
Index: eggdrop1.6/src/mod/irc.mod/msgcmds.c
diff -u eggdrop1.6/src/mod/irc.mod/msgcmds.c:1.42 eggdrop1.6/src/mod/irc.mod/msgcmds.c:1.43
--- eggdrop1.6/src/mod/irc.mod/msgcmds.c:1.42	Wed Jul 30 21:50:20 2003
+++ eggdrop1.6/src/mod/irc.mod/msgcmds.c	Wed Nov 26 23:10:30 2003
@@ -2,7 +2,7 @@
  * msgcmds.c -- part of irc.mod
  *   all commands entered via /MSG
  *
- * $Id: msgcmds.c,v 1.42 2003/07/31 02:50:20 tothwolf Exp $
+ * $Id: msgcmds.c,v 1.43 2003/11/27 05:10:30 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -490,12 +490,12 @@
     dprintf(DP_HELP, "NOTICE %s :[%s] %s\n", nick, u2->handle, s2);
   for (xk = get_user(&USERENTRY_XTRA, u2); xk; xk = xk->next)
     if (!egg_strcasecmp(xk->key, "EMAIL"))
-      dprintf(DP_HELP, "NOTICE %s :[%s] email: %s\n", nick, u2->handle,
+      dprintf(DP_HELP, "NOTICE %s :[%s] E-mail: %s\n", nick, u2->handle,
               xk->data);
   ok = 0;
   for (chan = chanset; chan; chan = chan->next) {
     if (hand_on_chan(chan, u2)) {
-      egg_snprintf(s1, sizeof s1, "NOTICE %s :[%s] %s %s.", nick, u2->handle,
+      egg_snprintf(s1, sizeof s1, "NOTICE %s :[%s] %s: %s.", nick, u2->handle,
                    IRC_ONCHANNOW, chan->dname);
       ok = 1;
     } else {
@@ -515,13 +515,19 @@
   if (!ok)
     egg_snprintf(s1, sizeof s1, "NOTICE %s :[%s] %s", nick, u2->handle,
                  IRC_NEVERJOINED);
-  if (u2->flags & USER_OP)
-    strcat(s1, USER_ISGLOBALOP);
-  if (u2->flags & USER_BOT)
-    strcat(s1, USER_ISBOT);
-  if (u2->flags & USER_MASTER)
-    strcat(s1, USER_ISMASTER);
   dprintf(DP_HELP, "%s\n", s1);
+  if (u2->flags & USER_BOT)
+    dprintf(DP_HELP, "NOTICE %s :[%s] Status: bot\n", nick, u2->handle);
+  else if (u2->flags & USER_OWNER)
+    dprintf(DP_HELP, "NOTICE %s :[%s] Status: global owner\n", nick, u2->handle);
+  else if (u2->flags & USER_MASTER)
+    dprintf(DP_HELP, "NOTICE %s :[%s] Status: global master\n", nick, u2->handle);
+  else if (u2->flags & USER_BOTMAST)
+    dprintf(DP_HELP, "NOTICE %s :[%s] Status: botnet master\n", nick, u2->handle);
+  else if (u2->flags & USER_OP)
+    dprintf(DP_HELP, "NOTICE %s :[%s] Status: global op\n", nick, u2->handle);
+  else if (u2->flags & USER_VOICE)
+    dprintf(DP_HELP, "NOTICE %s :[%s] Status: global voice\n", nick, u2->handle);
   return 1;
 }
 
@@ -781,11 +787,10 @@
 
 static int msg_status(char *nick, char *host, struct userrec *u, char *par)
 {
-  char s[256];
-  char *ve_t, *un_t;
-  char *pass;
-  int i, l;
+  char s[256], *ve_t, *un_t, *pass;
+  int i;
   struct chanset_t *chan;
+  time_t now2 = now - online_since, hr, min;
 
 #ifdef HAVE_UNAME
   struct utsname un;
@@ -818,43 +823,54 @@
     return 1;
   }
   putlog(LOG_CMDS, "*", "(%s!%s) !%s! STATUS", nick, host, u->handle);
-  dprintf(DP_HELP, "NOTICE %s :I am %s, running %s.\n", nick, botnetnick,
-          Version);
-  dprintf(DP_HELP, "NOTICE %s :Running on %s %s\n", nick, un_t, ve_t);
+
+  i = count_users(userlist);
+  dprintf(DP_HELP, "NOTICE %s :I am %s, running %s: %d user%s  (mem: %uk).\n",
+          nick, botnetnick, Version, i, i == 1 ? "" : "s",
+         (int) (expected_memory() / 1024));
+
+  s[0] = 0;
+  if (now2 > 86400) {
+    /* days */
+    sprintf(s, "%d day", (int) (now2 / 86400));
+    if ((int) (now2 / 86400) >= 2)
+      strcat(s, "s");
+    strcat(s, ", ");
+    now2 -= (((int) (now2 / 86400)) * 86400);
+  }
+  hr = (time_t) ((int) now2 / 3600);
+  now2 -= (hr * 3600);
+  min = (time_t) ((int) now2 / 60);
+  sprintf(&s[strlen(s)], "%02d:%02d", (int) hr, (int) min);
+  dprintf(DP_HELP, "NOTICE %s :%s %s.\n", nick, MISC_ONLINEFOR, s);
+
   if (admin[0])
-    dprintf(DP_HELP, "NOTICE %s :Admin: %s\n", nick, admin);
-  /* Fixed previous lame code. Well it's still lame, will overflow the
-   * buffer with a long channel-name. <cybah>
-   */
-  strcpy(s, "Channels: ");
-  l = 10;
+    dprintf(DP_HELP, "NOTICE %s :Admin: %s.\n", nick, admin);
+  dprintf(DP_HELP, "NOTICE %s :OS: %s %s.\n", nick, un_t, ve_t);
+  dprintf(DP_HELP, "NOTICE %s :Config file: %s.\n", nick, configfile);
+  dprintf(DP_HELP, "NOTICE %s :Online as: %s!%s.\n", nick, botname, botuserhost);
+
+  /* This shouldn't overflow anymore -Wcc */
+  s[0] = 0;
+  strncpyz(s, "Channels: ", sizeof s);
   for (chan = chanset; chan; chan = chan->next) {
-    l += my_strcpy(s + l, chan->dname);
+    strncat(s, chan->dname, sizeof s);
     if (!channel_active(chan))
-      l += my_strcpy(s + l, " (trying)");
+      strncat(s, " (trying)", sizeof s);
     else if (channel_pending(chan))
-      l += my_strcpy(s + l, " (pending)");
+      strncat(s, " (pending)", sizeof s);
     else if (!me_op(chan))
-      l += my_strcpy(s + l, " (want ops!)");
-    s[l++] = ',';
-    s[l++] = ' ';
-    if (l > 70) {
-      s[l] = 0;
+      strncat(s, " (need ops)", sizeof s);
+    strncat(s, ", ", sizeof s);
+    if (strlen(s) > 140) {
+      s[strlen(s) - 2] = 0; /* remove ', ' */
       dprintf(DP_HELP, "NOTICE %s :%s\n", nick, s);
-      strcpy(s, "          ");
-      l = 10;
     }
   }
-  if (l > 10) {
-    s[l] = 0;
+  if (strlen(s) > 10) {
+    s[strlen(s) - 2] = 0; /* remove ', ' */
     dprintf(DP_HELP, "NOTICE %s :%s\n", nick, s);
   }
-  i = count_users(userlist);
-  dprintf(DP_HELP, "NOTICE %s :%d user%s  (mem: %uk)\n", nick, i,
-          i == 1 ? "" : "s", (int) (expected_memory() / 1024));
-  daysdur(now, server_online, s);
-  dprintf(DP_HELP, "NOTICE %s :Connected %s\n", nick, s);
-  dprintf(DP_HELP, "NOTICE %s :Online as: %s!%s\n", nick, botname, botuserhost);
   return 1;
 }
 
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.1015 eggdrop1.6/src/patch.h:1.1016
--- eggdrop1.6/src/patch.h:1.1015	Wed Nov 26 21:25:10 2003
+++ eggdrop1.6/src/patch.h	Wed Nov 26 23:10:30 2003
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.1015 2003/11/27 03:25:10 wcc Exp $
+ * $Id: patch.h,v 1.1016 2003/11/27 05:10:30 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1069903456");            /* current unixtime */
+patch("1069909823");            /* current unixtime */
 /*
  *
  *
  */
-patch("status-cosmetic1");
+patch("status-cosmetic2");
 /*
  *
  *
----------------------- End of diff -----------------------


More information about the Changes mailing list