[cvslog] (2003-01-29 07:43:00 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Wed Jan 29 01:44:00 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2003-01-29 07:43:00 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     lib/eggdrop/memutil.c lib/eggdrop/module.h
     modules/channels/channels.c modules/channels/userchan.c
     modules/filesys/dbcompat.c modules/filesys/filedb3.h
     modules/irc/chan.c modules/irc/msgcmds.c modules/share/share.c
     modules/transfer/transfer.c modules/transfer/transfer.h
     src/dccutil.c src/egg.h src/main.c src/modules.c src/patch.h
     src/tcl.c src/tclmisc.c src/userrec.c src/userrec.h

Log message:

* Synch 1.6: save_ignores, save_ignores2, killtransfer-segv,
             bugfixes (whatever applied), header-fixes, hello.

---------------------- diff included ----------------------
Index: eggdrop1.7/lib/eggdrop/memutil.c
diff -u eggdrop1.7/lib/eggdrop/memutil.c:1.11 eggdrop1.7/lib/eggdrop/memutil.c:1.12
--- eggdrop1.7/lib/eggdrop/memutil.c:1.11	Thu Jan  2 15:33:13 2003
+++ eggdrop1.7/lib/eggdrop/memutil.c	Wed Jan 29 01:42:49 2003
@@ -23,7 +23,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: memutil.c,v 1.11 2003/01/02 21:33:13 wcc Exp $";
+static const char rcsid[] = "$Id: memutil.c,v 1.12 2003/01/29 07:42:49 wcc Exp $";
 #endif
 
 #include <stdio.h>
@@ -221,7 +221,7 @@
   char           buf[3];
   register char *s, *p;
 
-  buf[3] = 0;
+  buf[2] = 0;
   for (s = p = str; *s; s++, p++) {
     if (*s == esc_char) {       /* Found escape character.              */
       /* Convert code to character. */
Index: eggdrop1.7/lib/eggdrop/module.h
diff -u eggdrop1.7/lib/eggdrop/module.h:1.35 eggdrop1.7/lib/eggdrop/module.h:1.36
--- eggdrop1.7/lib/eggdrop/module.h:1.35	Sat Jan 18 16:36:52 2003
+++ eggdrop1.7/lib/eggdrop/module.h	Wed Jan 29 01:42:49 2003
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: module.h,v 1.35 2003/01/18 22:36:52 wcc Exp $
+ * $Id: module.h,v 1.36 2003/01/29 07:42:49 wcc Exp $
  */
 
 #ifndef _EGG_MOD_MODULE_H
@@ -363,6 +363,8 @@
 /* 280 - 283 */
 #define egg_timeval_now (*(egg_timeval_t *)egg->global[281])
 #define killtransfer ((void(*)(int))global[283])
+#define write_ignores ((int (*)(FILE *, int))global[284])
+#define copy_to_tmp (*(int *)(global[285]))
 
 /* This is for blowfish module, couldnt be bothered making a whole new .h
  * file for it ;)
Index: eggdrop1.7/modules/channels/channels.c
diff -u eggdrop1.7/modules/channels/channels.c:1.20 eggdrop1.7/modules/channels/channels.c:1.21
--- eggdrop1.7/modules/channels/channels.c:1.20	Thu Jan  2 15:33:14 2003
+++ eggdrop1.7/modules/channels/channels.c	Wed Jan 29 01:42:49 2003
@@ -23,7 +23,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: channels.c,v 1.20 2003/01/02 21:33:14 wcc Exp $";
+static const char rcsid[] = "$Id: channels.c,v 1.21 2003/01/29 07:42:49 wcc Exp $";
 #endif
 
 #define MODULE_NAME "channels"
@@ -163,11 +163,10 @@
 static void get_mode_protect(struct chanset_t *chan, char *s)
 {
   char *p = s, s1[121];
-  int ok = 0, i, tst;
+  int i, tst;
 
   s1[0] = 0;
   for (i = 0; i < 2; i++) {
-    ok = 0;
     if (i == 0) {
       tst = chan->mode_pls_prot;
       if ((tst) || (chan->limit_prot != 0) || (chan->key_prot[0]))
Index: eggdrop1.7/modules/channels/userchan.c
diff -u eggdrop1.7/modules/channels/userchan.c:1.11 eggdrop1.7/modules/channels/userchan.c:1.12
--- eggdrop1.7/modules/channels/userchan.c:1.11	Thu Jan  2 15:33:14 2003
+++ eggdrop1.7/modules/channels/userchan.c	Wed Jan 29 01:42:49 2003
@@ -22,7 +22,7 @@
 
 /* FIXME: #include mess
 #ifndef lint
-static const char rcsid[] = "$Id: userchan.c,v 1.11 2003/01/02 21:33:14 wcc Exp $";
+static const char rcsid[] = "$Id: userchan.c,v 1.12 2003/01/29 07:42:49 wcc Exp $";
 #endif
 */
 
@@ -841,31 +841,13 @@
     dprintf(idx, "%s.\n", _("Use .invites all to see the total list"));
 }
 
-/* Write the ban lists and the ignore list to a file.
- */
+/* Write the ban lists and the ignore list to a file. */
 static int write_bans(FILE *f, int idx)
 {
   struct chanset_t *chan;
   maskrec *b;
-  struct igrec *i;
   char	*mask;
 
-  if (global_ign)
-    if (fprintf(f, IGNORE_NAME " - -\n") == EOF)	/* Daemus */
-      return 0;
-  for (i = global_ign; i; i = i->next) {
-    mask = str_escape(i->igmask, ':', '\\');
-    if (!mask ||
-	fprintf(f, "- %s:%s%lu:%s:%lu:%s\n", mask,
-		(i->flags & IGREC_PERM) ? "+" : "", i->expire,
-		i->user ? i->user : botnetnick, i->added,
-		i->msg ? i->msg : "") == EOF) {
-      if (mask)
-	free(mask);
-      return 0;
-    }
-    free(mask);
-  }
   if (global_bans)
     if (fprintf(f, BAN_NAME " - -\n") == EOF)	/* Daemus */
       return 0;
Index: eggdrop1.7/modules/filesys/dbcompat.c
diff -u eggdrop1.7/modules/filesys/dbcompat.c:1.4 eggdrop1.7/modules/filesys/dbcompat.c:1.5
--- eggdrop1.7/modules/filesys/dbcompat.c:1.4	Thu Jan  2 15:33:14 2003
+++ eggdrop1.7/modules/filesys/dbcompat.c	Wed Jan 29 01:42:49 2003
@@ -26,7 +26,7 @@
 
 /* FIXME: #include mess
 #ifndef lint
-static const char rcsid[] = "$Id: dbcompat.c,v 1.4 2003/01/02 21:33:14 wcc Exp $";
+static const char rcsid[] = "$Id: dbcompat.c,v 1.5 2003/01/29 07:42:49 wcc Exp $";
 #endif
 */
 
@@ -153,12 +153,10 @@
  */
 static void convert_version1(FILE *fdb_s, FILE *fdb_t)
 {
-  long where;
   filedb1 fdb1;
 
   fseek(fdb_s, 0L, SEEK_SET);
   while (!feof(fdb_s)) {
-    where = ftell(fdb_s);
     fread(&fdb1, sizeof(filedb1), 1, fdb_s);
     if (!feof(fdb_s)) {
       if (!(fdb1.stat & FILE_UNUSED)) {
@@ -190,12 +188,10 @@
  */
 static void convert_version2(FILE *fdb_s, FILE *fdb_t)
 {
-  long where;
   filedb2 fdb2;
 
   fseek(fdb_s, 0L, SEEK_SET);
   while (!feof(fdb_s)) {
-    where = ftell(fdb_s);
     fread(&fdb2, sizeof(filedb2), 1, fdb_s);
     if (!feof(fdb_s)) {
       if (!(fdb2.stat & FILE_UNUSED)) {
Index: eggdrop1.7/modules/filesys/filedb3.h
diff -u eggdrop1.7/modules/filesys/filedb3.h:1.4 eggdrop1.7/modules/filesys/filedb3.h:1.5
--- eggdrop1.7/modules/filesys/filedb3.h:1.4	Thu Jan  2 15:33:14 2003
+++ eggdrop1.7/modules/filesys/filedb3.h	Wed Jan 29 01:42:49 2003
@@ -23,13 +23,30 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: filedb3.h,v 1.4 2003/01/02 21:33:14 wcc Exp $
+ * $Id: filedb3.h,v 1.5 2003/01/29 07:42:49 wcc Exp $
  */
 
 #ifndef _EGG_MOD_FILESYS_FILEDB3_H
 #define _EGG_MOD_FILESYS_FILEDB3_H
 
-#include <time.h>	/* for time_t */
+/*
+ * FIXME: These really should be in the .c files that include this header
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+/* for time_t */
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
 
 /* Top of each DB */
 typedef struct {
Index: eggdrop1.7/modules/irc/chan.c
diff -u eggdrop1.7/modules/irc/chan.c:1.29 eggdrop1.7/modules/irc/chan.c:1.30
--- eggdrop1.7/modules/irc/chan.c:1.29	Sat Jan 18 16:36:52 2003
+++ eggdrop1.7/modules/irc/chan.c	Wed Jan 29 01:42:49 2003
@@ -28,7 +28,7 @@
 
 /* FIXME: #include mess
 #ifndef lint
-static const char rcsid[] = "$Id: chan.c,v 1.29 2003/01/18 22:36:52 wcc Exp $";
+static const char rcsid[] = "$Id: chan.c,v 1.30 2003/01/29 07:42:49 wcc Exp $";
 #endif
 */
 
@@ -230,8 +230,8 @@
       return 0;
   }
   if (irccmp(chan->floodwho[which], p)) {	/* new */
-    strncpy(chan->floodwho[which], p, 81);
-    chan->floodwho[which][81] = 0;
+    strncpy(chan->floodwho[which], p, 80);
+    chan->floodwho[which][80] = 0;
     chan->floodtime[which] = now;
     chan->floodnum[which] = 1;
     return 0;
Index: eggdrop1.7/modules/irc/msgcmds.c
diff -u eggdrop1.7/modules/irc/msgcmds.c:1.11 eggdrop1.7/modules/irc/msgcmds.c:1.12
--- eggdrop1.7/modules/irc/msgcmds.c:1.11	Thu Jan  2 15:33:15 2003
+++ eggdrop1.7/modules/irc/msgcmds.c	Wed Jan 29 01:42:49 2003
@@ -24,7 +24,7 @@
 
 /* FIXME: #include mess
 #ifndef lint
-static const char rcsid[] = "$Id: msgcmds.c,v 1.11 2003/01/02 21:33:15 wcc Exp $";
+static const char rcsid[] = "$Id: msgcmds.c,v 1.12 2003/01/29 07:42:49 wcc Exp $";
 #endif
 */
 
@@ -34,7 +34,6 @@
   char *p1;
   int atr = 0;
   struct chanset_t *chan;
-  struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
 
   if (!learn_users && !make_userfile)
     return 0;
@@ -48,9 +47,6 @@
   }
   strlcpy(handle, nick, sizeof handle);
   if (get_user_by_handle(userlist, handle)) {
-    struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
-    fr.global = atr;
-
     dprintf(DP_HELP, _("NOTICE %s :I dont recognize you from that host.\n"), nick);
     dprintf(DP_HELP, _("NOTICE %s :Either you are using someone elses nickname or you need to type: /MSG %s IDENT (password)\n"), nick, botname);
     return 1;
@@ -79,8 +75,6 @@
   dprintf(DP_HELP, _("NOTICE %s :Ill recognize you by hostmask %s from now on.\n"), nick, host);
 
   if (make_userfile) {
-    fr.global = sanity_check(default_flags | USER_OWNER);
-
     dprintf(DP_HELP, "NOTICE %s :%s\n", nick, _("YOU ARE THE OWNER ON THIS BOT NOW"));
     dprintf(DP_HELP, _("NOTICE %s :As master you really need to set a password: with /MSG %s pass <your-chosen-password>.\n"), nick, botname);
     dprintf(DP_HELP, _("NOTICE %s :All major commands are used from DCC chat. From now on, you dont need to use the -m option when starting the bot.  Enjoy !!!\n"), nick);
@@ -488,13 +482,19 @@
 
   if (match_my_nick(nick))
     return 1;
+
   if (!u) {
     if (!quiet_reject) {
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, _("I dont know you; please introduce yourself first."));
-      dprintf(DP_HELP, "NOTICE %s :/MSG %s hello\n", nick, botname);
+      if (!learn_users)
+        dprintf(DP_HELP, "NOTICE %s :No access\n", nick);
+      else {
+        dprintf(DP_HELP, "NOTICE %s :%s\n", nick, _("I dont know you; please introduce yourself first."));
+        dprintf(DP_HELP, "NOTICE %s :/MSG %s hello\n", nick, botname);
+      }
     }
     return 0;
   }
+
   if (helpdir[0]) {
     struct flag_record fr = {FR_ANYWH | FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
 
@@ -509,6 +509,7 @@
     }
   } else
     dprintf(DP_HELP, "NOTICE %s :%s\n", nick, _("No help."));
+
   return 1;
 }
 
Index: eggdrop1.7/modules/share/share.c
diff -u eggdrop1.7/modules/share/share.c:1.18 eggdrop1.7/modules/share/share.c:1.19
--- eggdrop1.7/modules/share/share.c:1.18	Thu Jan  2 15:33:15 2003
+++ eggdrop1.7/modules/share/share.c	Wed Jan 29 01:42:49 2003
@@ -21,7 +21,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: share.c,v 1.18 2003/01/02 21:33:15 wcc Exp $";
+static const char rcsid[] = "$Id: share.c,v 1.19 2003/01/29 07:42:49 wcc Exp $";
 #endif
 
 #define MODULE_NAME "share"
@@ -1587,15 +1587,16 @@
   struct userrec *u;
   int ok = 0;
 
-  if (!(f = fopen(fn, "wb")))
-    putlog(LOG_MISC, "*", _("ERROR writing user file to transfer."));
-  else {
+  if ((f = fopen(fn, "wb"))) {
     chmod(fn, 0600);		/* make it -rw------- */
     fprintf(f, "#4v: %s -- %s -- transmit\n", ver, botnetnick);
     ok = 1;
     for (u = bu; u && ok; u = u->next)
       ok = write_user(u, f, idx);
-    ok = write_bans(f, idx);
+    if(!write_ignores(f, idx))
+      ok = 0;
+    if(!write_bans(f, idx))
+      ok = 0;
     /* Only share with bots which support exempts and invites.
      *
      * If UFF is supported, we also check the UFF flags before sharing. If
@@ -1603,18 +1604,22 @@
      */
     if (dcc[idx].u.bot->numver >= min_exemptinvite) {
       if ((dcc[idx].u.bot->uff_flags & UFF_EXEMPT) ||
-	  (dcc[idx].u.bot->numver < min_uffeature))
-	ok = write_exempts(f, idx);
+          (dcc[idx].u.bot->numver < min_uffeature)) {
+        if (!write_exempts(f, idx))
+          ok = 0;
+      }
       if ((dcc[idx].u.bot->uff_flags & UFF_INVITE) ||
-	  (dcc[idx].u.bot->numver < min_uffeature))
-	ok = write_invites(f, idx);
+	  (dcc[idx].u.bot->numver < min_uffeature)) {
+	if (!write_invites(f, idx))
+          ok = 0;
+      }
     } else
       putlog(LOG_BOTS, "*", "%s is too old: not sharing exempts and invites.",
              dcc[idx].nick);
     fclose(f);
-    if (!ok)
-      putlog(LOG_MISC, "*", _("ERROR writing user file to transfer."));
   }
+  if (!ok)
+    putlog(LOG_MISC, "*", USERF_ERRWRITE2);
   return ok;
 }
 
Index: eggdrop1.7/modules/transfer/transfer.c
diff -u eggdrop1.7/modules/transfer/transfer.c:1.19 eggdrop1.7/modules/transfer/transfer.c:1.20
--- eggdrop1.7/modules/transfer/transfer.c:1.19	Thu Jan  2 15:33:15 2003
+++ eggdrop1.7/modules/transfer/transfer.c	Wed Jan 29 01:42:50 2003
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: transfer.c,v 1.19 2003/01/02 21:33:15 wcc Exp $";
+static const char rcsid[] = "$Id: transfer.c,v 1.20 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
 #define MODULE_NAME "transfer"
@@ -47,15 +47,13 @@
 
 static eggdrop_t *egg = NULL;
 
-static int copy_to_tmp = 1;	/* Copy files to /tmp before transmitting? */
-static int wait_dcc_xfer = 300;	/* Timeout time on DCC xfers */
-static bind_table_t *BT_rcvd, *BT_sent, *BT_lost, *BT_tout;
-static int dcc_limit = 3;	/* Maximum number of simultaneous file
-				   downloads allowed */
-static int dcc_block = 0;	/* Size of one dcc block */
+static int wait_dcc_xfer = 300; /* Timeout time on DCC xfers */
+static int dcc_limit = 3;       /* Max simultaneous downloads allowed */
+static int dcc_block = 0;       /* Size of one dcc block */
 static int quiet_reject;        /* Quietly reject dcc chat or sends from
-                                   users without access? */
-
+                                 * users without access? */
+static int quiet_reject;        /* Quietly reject dcc chat or sends from users
+                                 * without access? */
 /*
  * Prototypes
  */
@@ -1456,7 +1454,6 @@
 {
   {"max_dloads",	&dcc_limit},
   {"dcc_block",		&dcc_block},
-  {"copy_to_tmp",	&copy_to_tmp},
   {"xfer_timeout",	&wait_dcc_xfer},
   {NULL,		NULL}
 };
@@ -1852,7 +1849,7 @@
   /* 4- 7 */
   (Function) & DCC_FORK_SEND,		/* struct dcc_table		*/
   (Function) at_limit,
-  (Function) & copy_to_tmp,		/* int				*/
+  (Function) 0,
   (Function) fileq_cancel,
   /* 8 - 11 */
   (Function) queue_file,
Index: eggdrop1.7/modules/transfer/transfer.h
diff -u eggdrop1.7/modules/transfer/transfer.h:1.5 eggdrop1.7/modules/transfer/transfer.h:1.6
--- eggdrop1.7/modules/transfer/transfer.h:1.5	Thu Jan  2 15:33:15 2003
+++ eggdrop1.7/modules/transfer/transfer.h	Wed Jan 29 01:42:50 2003
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: transfer.h,v 1.5 2003/01/02 21:33:15 wcc Exp $
+ * $Id: transfer.h,v 1.6 2003/01/29 07:42:50 wcc Exp $
  */
 
 #ifndef _EGG_MOD_TRANSFER_TRANSFER_H
@@ -54,7 +54,7 @@
 /* 4 - 7 */
 #define DCC_FORK_SEND (*(struct dcc_table *)(transfer_funcs[4]))
 #define at_limit(a) (((int (*) (char *))transfer_funcs[5])(a))
-#define copy_to_tmp (*(int *)(transfer_funcs[6]))
+
 #define fileq_cancel(a,b) (((void (*) (int,char *))transfer_funcs[7])(a,b))
 /* 8 - 11 */
 #define queue_file(a,b,c,d) (((void (*)(char *,char *,char *,char *))transfer_funcs[8])(a,b,c,d))
Index: eggdrop1.7/src/dccutil.c
diff -u eggdrop1.7/src/dccutil.c:1.58 eggdrop1.7/src/dccutil.c:1.59
--- eggdrop1.7/src/dccutil.c:1.58	Sat Jan 18 16:36:52 2003
+++ eggdrop1.7/src/dccutil.c	Wed Jan 29 01:42:50 2003
@@ -27,7 +27,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: dccutil.c,v 1.58 2003/01/18 22:36:52 wcc Exp $";
+static const char rcsid[] = "$Id: dccutil.c,v 1.59 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
 #include <sys/stat.h>
@@ -239,9 +239,23 @@
 /* Closes an open FD for transfer sockets. */
 void killtransfer(int n)
 {
-	if (dcc[n].u.xfer->f) {
-		fclose(dcc[n].u.xfer->f);
-		dcc[n].u.xfer->f = NULL;
+	int i, ok = 1;
+
+	if (dcc[n].type->flags & DCT_FILETRAN) {
+		if (dcc[n].u.xfer->f) {
+			fclose(dcc[n].u.xfer->f);
+			dcc[n].u.xfer->f = NULL;
+		}
+		if (dcc[n].u.xfer->filename) {
+			for (i = 0; i < dcc_total; i++) {
+				if ((i != n) && (dcc[i].type->flags & DCT_FILETRAN) && (dcc[i].u.xfer->filename) && (!strcmp(dcc[i].u.xfer->filename, dcc[n].u.xfer->filename))) {
+					ok = 0;
+					break;
+				}
+			}
+			if (ok)
+			unlink(dcc[n].u.xfer->filename);
+		}
 	}
  }
 
Index: eggdrop1.7/src/egg.h
diff -u eggdrop1.7/src/egg.h:1.12 eggdrop1.7/src/egg.h:1.13
--- eggdrop1.7/src/egg.h:1.12	Thu Jan  2 15:33:16 2003
+++ eggdrop1.7/src/egg.h	Wed Jan 29 01:42:50 2003
@@ -24,7 +24,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: egg.h,v 1.12 2003/01/02 21:33:16 wcc Exp $
+ * $Id: egg.h,v 1.13 2003/01/29 07:42:50 wcc Exp $
  */
 
 #ifndef _EGG_EGG_H
@@ -110,11 +110,11 @@
 #endif
 
 /* Almost every module needs some sort of time thingy, so... */
-#if TIME_WITH_SYS_TIME
+#ifdef TIME_WITH_SYS_TIME
 #  include <sys/time.h>
 #  include <time.h>
 #else
-#  if HAVE_SYS_TIME_H
+#  ifdef HAVE_SYS_TIME_H
 #    include <sys/time.h>
 #  else
 #    include <time.h>
Index: eggdrop1.7/src/main.c
diff -u eggdrop1.7/src/main.c:1.128 eggdrop1.7/src/main.c:1.129
--- eggdrop1.7/src/main.c:1.128	Thu Jan  2 15:33:16 2003
+++ eggdrop1.7/src/main.c	Wed Jan 29 01:42:50 2003
@@ -30,13 +30,22 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: main.c,v 1.128 2003/01/02 21:33:16 wcc Exp $";
+static const char rcsid[] = "$Id: main.c,v 1.129 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
 #include "main.h"
 #include <fcntl.h>
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
 #include <errno.h>
 #include <signal.h>
 #include <netdb.h>
@@ -800,7 +809,7 @@
     } else if (xx == -2 && errno != EINTR) {	/* select() error */
       putlog(LOG_MISC, "*", "* Socket error #%d; recovering.", errno);
       for (i = 0; i < dcc_total; i++) {
-	if ((fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno = EBADF)) {
+	if ((fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno == EBADF)) {
 	  putlog(LOG_MISC, "*",
 		 "DCC socket %d (type %d, name '%s') expired -- pfft",
 		 dcc[i].sock, dcc[i].type, dcc[i].nick);
Index: eggdrop1.7/src/modules.c
diff -u eggdrop1.7/src/modules.c:1.124 eggdrop1.7/src/modules.c:1.125
--- eggdrop1.7/src/modules.c:1.124	Tue Jan 28 14:38:46 2003
+++ eggdrop1.7/src/modules.c	Wed Jan 29 01:42:50 2003
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: modules.c,v 1.124 2003/01/28 20:38:46 wcc Exp $";
+static const char rcsid[] = "$Id: modules.c,v 1.125 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -79,7 +79,8 @@
 			 debug_output, make_userfile, default_flags,
 			 max_dcc, share_greet, password_timeout,
 			 use_invites, use_exempts, force_expire, do_restart,
-			 protect_readonly, reserved_port_min, reserved_port_max;
+			 protect_readonly, reserved_port_min, reserved_port_max,
+                         copy_to_tmp;
 extern time_t now, online_since;
 extern egg_timeval_t egg_timeval_now;
 extern struct chanset_t *chanset;
@@ -524,6 +525,8 @@
   (Function) &egg_timeval_now,
   0,
   (Function) killtransfer,
+  (Function) write_ignores,
+  (Function) &copy_to_tmp,
 };
 
 static bind_table_t *BT_load, *BT_unload;
Index: eggdrop1.7/src/patch.h
diff -u eggdrop1.7/src/patch.h:1.596 eggdrop1.7/src/patch.h:1.597
--- eggdrop1.7/src/patch.h:1.596	Sat Jan 18 16:36:52 2003
+++ eggdrop1.7/src/patch.h	Wed Jan 29 01:42:50 2003
@@ -30,7 +30,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: patch.h,v 1.596 2003/01/18 22:36:52 wcc Exp $
+ * $Id: patch.h,v 1.597 2003/01/29 07:42:50 wcc Exp $
  */
 
 #ifndef _EGG_PATCH_H
@@ -44,12 +44,12 @@
  *
  *
  */
-patch("1042929232");          /* current unixtime */
+patch("1043825892");          /* current unixtime */
   /*
    *
    *
    */
-patch("synch1.6-01-18-03");
+patch("synch1.6-01-29-03");
 /*
  *
  *
Index: eggdrop1.7/src/tcl.c
diff -u eggdrop1.7/src/tcl.c:1.88 eggdrop1.7/src/tcl.c:1.89
--- eggdrop1.7/src/tcl.c:1.88	Thu Jan  2 15:33:16 2003
+++ eggdrop1.7/src/tcl.c	Wed Jan 29 01:42:50 2003
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tcl.c,v 1.88 2003/01/02 21:33:16 wcc Exp $";
+static const char rcsid[] = "$Id: tcl.c,v 1.89 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
 #include <stdlib.h>		/* getenv()				*/
@@ -72,6 +72,7 @@
 int	    use_invites = 0;		/* Jason/drummer */
 int	    use_exempts = 0;		/* Jason/drummer */
 int	    force_expire = 0;		/* Rufus */
+int	    copy_to_tmp = 0;
 int	    remote_boots = 2;
 int	    allow_dk_cmds = 1;
 int	    par_telnet_flood = 1;       /* trigger telnet flood for +f
@@ -290,8 +291,6 @@
 {
   {"ignore_time",		&ignore_time,		0},
   {"handlen",                   &handlen,               2},
-  /* FIXME: remove this later ... before first stable release */
-  {"hand_len",			&handlen,		2},
   {"hourly_updates",		&notify_users_at,	0},
   {"learn_users",		&learn_users,		0},
   {"uptime",			(int *) &online_since,	2},
@@ -309,6 +308,7 @@
   {"force_expire",		&force_expire,		0},			/* Rufus */
   {"strict_host",		&strict_host,		0}, 			/* drummer */
   {"userfile_perm",		&userfile_perm,		0},
+  {"copy-to-tmp",		&copy_to_tmp,		0},
   {NULL,			NULL,			0}	/* arthur2 */
 };
 
@@ -447,6 +447,7 @@
     tmp = protect_readonly;
     protect_readonly = 0;
     tcl_eggstr((ClientData) st, interp, list[i].name, NULL, TCL_TRACE_WRITES);
+    protect_readonly = tmp;
     tcl_eggstr((ClientData) st, interp, list[i].name, NULL, TCL_TRACE_READS);
     Tcl_TraceVar(interp, list[i].name, TCL_TRACE_READS | TCL_TRACE_WRITES |
 		 TCL_TRACE_UNSETS, tcl_eggstr, (ClientData) st);
Index: eggdrop1.7/src/tclmisc.c
diff -u eggdrop1.7/src/tclmisc.c:1.59 eggdrop1.7/src/tclmisc.c:1.60
--- eggdrop1.7/src/tclmisc.c:1.59	Sat Jan 18 16:36:52 2003
+++ eggdrop1.7/src/tclmisc.c	Wed Jan 29 01:42:50 2003
@@ -23,13 +23,22 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: tclmisc.c,v 1.59 2003/01/18 22:36:52 wcc Exp $";
+static const char rcsid[] = "$Id: tclmisc.c,v 1.60 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
-#include <sys/stat.h>
-#include <time.h>
 #include "main.h"
 #include "modules.h"
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <sys/stat.h>
 #include "core_binds.h"
 #include "logfile.h"
 #include "misc.h"
Index: eggdrop1.7/src/userrec.c
diff -u eggdrop1.7/src/userrec.c:1.54 eggdrop1.7/src/userrec.c:1.55
--- eggdrop1.7/src/userrec.c:1.54	Thu Jan  2 15:33:17 2003
+++ eggdrop1.7/src/userrec.c	Wed Jan 29 01:42:50 2003
@@ -25,7 +25,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: userrec.c,v 1.54 2003/01/02 21:33:17 wcc Exp $";
+static const char rcsid[] = "$Id: userrec.c,v 1.55 2003/01/29 07:42:50 wcc Exp $";
 #endif
 
 #include <sys/stat.h>
@@ -345,6 +345,29 @@
   return 1;
 }
 
+int write_ignores(FILE *f, int idx)
+{
+  struct igrec *i;
+  char *mask;
+
+  if ((global_ign) && (fprintf(f, IGNORE_NAME " - -\n") == EOF))
+    return 0;
+
+  for (i = global_ign; i; i = i->next) {
+    mask = str_escape(i->igmask, ':', '\\');
+    if (!mask || fprintf(f, "- %s:%s%lu:%s:%lu:%s\n", mask,
+                (i->flags & IGREC_PERM) ? "+" : "", i->expire,
+                i->user ? i->user : botnetnick, i->added,
+                i->msg ? i->msg : "") == EOF) {
+      if (mask)
+        nfree(mask);
+      return 0;
+    }
+    nfree(mask);
+  }
+  return 1;
+}
+
 /* Rewrite the entire user file. Call USERFILE hook as well, probably
  * causing the channel file to be rewritten as well.
  */
@@ -377,8 +400,9 @@
   fprintf(f, "#4v: %s -- %s -- written %s", ver, botnetnick, s1);
   ok = 1;
   for (u = userlist; u && ok; u = u->next)
-    ok = write_user(u, f, idx);
-  if (!ok || fflush(f)) {
+    if (!write_user(u, f, idx))
+      ok = 0;
+  if (!ok || !write_ignores(f, -1) || fflush(f)) {
     putlog(LOG_MISC, "*", "%s (%s)", _("ERROR writing user file."), strerror(ferror(f)));
     fclose(f);
     free(new_userfile);
Index: eggdrop1.7/src/userrec.h
diff -u eggdrop1.7/src/userrec.h:1.4 eggdrop1.7/src/userrec.h:1.5
--- eggdrop1.7/src/userrec.h:1.4	Thu Jan  2 15:33:17 2003
+++ eggdrop1.7/src/userrec.h	Wed Jan 29 01:42:50 2003
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 /*
- * $Id: userrec.h,v 1.4 2003/01/02 21:33:17 wcc Exp $
+ * $Id: userrec.h,v 1.5 2003/01/29 07:42:50 wcc Exp $
  */
 
 #ifndef _EGG_USERREC_H
@@ -40,7 +40,8 @@
 void freeuser(struct userrec *);
 int change_handle(struct userrec *, char *);
 void correct_handle(char *);
-int write_user(struct userrec *u, FILE * f, int shr);
+int write_user(struct userrec *, FILE *, int);
+int write_ignores(FILE *f, int);
 void write_userfile(int);
 struct userrec *check_dcclist_hand(const char *);
 void touch_laston(struct userrec *, char *, time_t);
----------------------- End of diff -----------------------



More information about the Changes mailing list