[cvslog] (2003-01-20 08:51:29 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Mon Jan 20 02:52:00 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2003-01-20 08:51:29 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 src/modules.c src/patch.h src/proto.h
     src/userrec.c src/mod/module.h src/mod/channels.mod/userchan.c
     src/mod/share.mod/share.c

Log message:

Ignores are now saved if channels.mod is not loaded. Fixes bug 285.
Found by BarkerJr.

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.444 eggdrop1.6/doc/UPDATES1.6:1.445
--- eggdrop1.6/doc/UPDATES1.6:1.444	Fri Jan 17 19:58:05 2003
+++ eggdrop1.6/doc/UPDATES1.6	Mon Jan 20 02:51:19 2003
@@ -1,10 +1,11 @@
-$Id: UPDATES1.6,v 1.444 2003/01/18 01:58:05 wcc Exp $
+$Id: UPDATES1.6,v 1.445 2003/01/20 08:51:19 wcc Exp $
 
 Changes in Eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.14
 Found by  Fixed by  What...
+BarkerJr  Wcc       ignores are now saved if channels.mod is not loaded
 fbs       fbs/      open file descriptors are now closed when the killdcc Tcl
           Wcc       command is used on a transfer socket
 never     Wcc       unixtime was not increased when eggdrop was blocked during
Index: eggdrop1.6/src/mod/channels.mod/userchan.c
diff -u eggdrop1.6/src/mod/channels.mod/userchan.c:1.29 eggdrop1.6/src/mod/channels.mod/userchan.c:1.30
--- eggdrop1.6/src/mod/channels.mod/userchan.c:1.29	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/channels.mod/userchan.c	Mon Jan 20 02:51:19 2003
@@ -1,7 +1,7 @@
 /*
  * userchan.c -- part of channels.mod
  *
- * $Id: userchan.c,v 1.29 2002/12/24 02:30:06 wcc Exp $
+ * $Id: userchan.c,v 1.30 2003/01/20 08:51:19 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1061,25 +1061,8 @@
 {
   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)
-	nfree(mask);
-      return 0;
-    }
-    nfree(mask);
-  }
   if (global_bans)
     if (fprintf(f, BAN_NAME " - -\n") == EOF)	/* Daemus */
       return 0;
Index: eggdrop1.6/src/mod/module.h
diff -u eggdrop1.6/src/mod/module.h:1.64 eggdrop1.6/src/mod/module.h:1.65
--- eggdrop1.6/src/mod/module.h:1.64	Fri Jan 17 19:58:05 2003
+++ eggdrop1.6/src/mod/module.h	Mon Jan 20 02:51:19 2003
@@ -1,7 +1,7 @@
 /*
  * module.h
  *
- * $Id: module.h,v 1.64 2003/01/18 01:58:05 wcc Exp $
+ * $Id: module.h,v 1.65 2003/01/20 08:51:19 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -460,6 +460,7 @@
 /* 280 - 283 */
 #define wild_match_per ((int (*)(const char *, const char *))global[280])
 #define killtransfer ((void(*)(int))global[281])
+#define write_ignores ((int (*)(FILE *, int))global[282])
 
 /* This is for blowfish module, couldnt be bothered making a whole new .h
  * file for it ;)
Index: eggdrop1.6/src/mod/share.mod/share.c
diff -u eggdrop1.6/src/mod/share.mod/share.c:1.67 eggdrop1.6/src/mod/share.mod/share.c:1.68
--- eggdrop1.6/src/mod/share.mod/share.c:1.67	Mon Dec 23 20:30:08 2002
+++ eggdrop1.6/src/mod/share.mod/share.c	Mon Jan 20 02:51:19 2003
@@ -1,7 +1,7 @@
 /*
  * share.c -- part of share.mod
  *
- * $Id: share.c,v 1.67 2002/12/24 02:30:08 wcc Exp $
+ * $Id: share.c,v 1.68 2003/01/20 08:51:19 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -1596,15 +1596,16 @@
   struct userrec *u;
   int ok = 0;
 
-  if (!(f = fopen(fn, "wb")))
-    putlog(LOG_MISC, "*", USERF_ERRWRITE2);
-  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
@@ -1612,18 +1613,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, "*", USERF_ERRWRITE2);
   }
+  if (!ok)
+    putlog(LOG_MISC, "*", USERF_ERRWRITE2);
   return ok;
 }
 
Index: eggdrop1.6/src/modules.c
diff -u eggdrop1.6/src/modules.c:1.72 eggdrop1.6/src/modules.c:1.73
--- eggdrop1.6/src/modules.c:1.72	Fri Jan 17 19:58:05 2003
+++ eggdrop1.6/src/modules.c	Mon Jan 20 02:51:19 2003
@@ -4,7 +4,7 @@
  * 
  * by Darrin Smith (beldin at light.iinet.net.au)
  * 
- * $Id: modules.c,v 1.72 2003/01/18 01:58:05 wcc Exp $
+ * $Id: modules.c,v 1.73 2003/01/20 08:51:19 wcc Exp $
  */
 /* 
  * Copyright (C) 1997 Robey Pointer
@@ -547,7 +547,8 @@
   (Function) MD5_Final,
   /* 280 - 283 */
   (Function) _wild_match_per,
-  (Function) killtransfer
+  (Function) killtransfer,
+  (Function) write_ignores
 };
 
 void init_modules(void)
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.874 eggdrop1.6/src/patch.h:1.875
--- eggdrop1.6/src/patch.h:1.874	Fri Jan 17 22:30:54 2003
+++ eggdrop1.6/src/patch.h	Mon Jan 20 02:51:19 2003
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.874 2003/01/18 04:30:54 wcc Exp $
+ * $Id: patch.h,v 1.875 2003/01/20 08:51:19 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1042864172");		/* current unixtime */
+patch("1043052497");		/* current unixtime */
 /*
  *
  *
  */
-patch("logblocking");
+patch("write_ignores");
 /*
  *
  *
Index: eggdrop1.6/src/proto.h
diff -u eggdrop1.6/src/proto.h:1.52 eggdrop1.6/src/proto.h:1.53
--- eggdrop1.6/src/proto.h:1.52	Fri Jan 17 19:58:05 2003
+++ eggdrop1.6/src/proto.h	Mon Jan 20 02:51:19 2003
@@ -7,7 +7,7 @@
  * because they use structures in those
  * (saves including those .h files EVERY time) - Beldin
  *
- * $Id: proto.h,v 1.52 2003/01/18 01:58:05 wcc Exp $
+ * $Id: proto.h,v 1.53 2003/01/20 08:51:19 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -289,7 +289,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(char *);
 void touch_laston(struct userrec *, char *, time_t);
Index: eggdrop1.6/src/userrec.c
diff -u eggdrop1.6/src/userrec.c:1.41 eggdrop1.6/src/userrec.c:1.42
--- eggdrop1.6/src/userrec.c:1.41	Mon Dec 23 20:30:05 2002
+++ eggdrop1.6/src/userrec.c	Mon Jan 20 02:51:19 2003
@@ -4,7 +4,7 @@
  *   a bunch of functions to find and change user records
  *   change and check user (and channel-specific) flags
  *
- * $Id: userrec.c,v 1.41 2002/12/24 02:30:05 wcc Exp $
+ * $Id: userrec.c,v 1.42 2003/01/20 08:51:19 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -439,6 +439,30 @@
   return 1;
 }
 
+int write_ignores(FILE *f, int idx)
+{
+  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)
+        nfree(mask);
+      return 0;
+    }
+    nfree(mask);
+  }
+  return 1;
+}
+
 int sort_compare(struct userrec *a, struct userrec *b)
 {
   /* Order by flags, then alphabetically
@@ -549,7 +573,7 @@
   ok = 1;
   for (u = userlist; u && ok; u = u->next)
     ok = write_user(u, f, idx);
-  if (!ok || fflush(f)) {
+  if (!ok || !write_ignores(f, -1) || fflush(f)) {
     putlog(LOG_MISC, "*", "%s (%s)", USERF_ERRWRITE, strerror(ferror(f)));
     fclose(f);
     nfree(new_userfile);
----------------------- End of diff -----------------------



More information about the Changes mailing list