[cvslog] (2006-08-22 01:41:38 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Mon Aug 21 19:41:38 CST 2006


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2006-08-22 01:41:38 UTC
Commited by: sven

Modified files:
     lib/eggdrop/partychan.c lib/eggdrop/partyline.h
     lib/eggdrop/partymember.c src/core_party.c

Log message:

 * Fixed memory corruption in the .chhand partyline command
 * added new bindtables partynew and partyquit similar to the 1.6 binds CHON and CHOF

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/partychan.c
diff -u eggdrop1.9/lib/eggdrop/partychan.c:1.21 eggdrop1.9/lib/eggdrop/partychan.c:1.22
--- eggdrop1.9/lib/eggdrop/partychan.c:1.21	Sun Nov 13 22:44:43 2005
+++ eggdrop1.9/lib/eggdrop/partychan.c	Mon Aug 21 20:41:28 2006
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: partychan.c,v 1.21 2005-11-14 04:44:43 wcc Exp $";
+static const char rcsid[] = "$Id: partychan.c,v 1.22 2006-08-22 01:41:28 sven Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -26,9 +26,6 @@
 /* When does cid wrap around? This lets cids get up to 99999. */
 #define CID_WRAPAROUND 100000
 
-/* Flags for partyline members. */
-#define PARTY_DELETED 1
-
 static hash_table_t *cid_ht = NULL;
 static partychan_t *partychan_head = NULL;
 static int g_cid = 0; /* Keep track of next available cid. */
@@ -37,7 +34,7 @@
 /* Some bind tables for partyline channels. */
 static bind_table_t *BT_partyjoin = NULL,
 	*BT_partypart = NULL,
-	*BT_partypub = NULL;;
+	*BT_partypub = NULL;
 
 int partychan_init(void)
 {
Index: eggdrop1.9/lib/eggdrop/partyline.h
diff -u eggdrop1.9/lib/eggdrop/partyline.h:1.23 eggdrop1.9/lib/eggdrop/partyline.h:1.24
--- eggdrop1.9/lib/eggdrop/partyline.h:1.23	Sun Oct 17 00:14:06 2004
+++ eggdrop1.9/lib/eggdrop/partyline.h	Mon Aug 21 20:41:28 2006
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: partyline.h,v 1.23 2004-10-17 05:14:06 stdarg Exp $
+ * $Id: partyline.h,v 1.24 2006-08-22 01:41:28 sven Exp $
  */
 
 #ifndef _EGG_PARTYLINE_H_
@@ -27,6 +27,8 @@
 #define PARTY_SELECTED	2
 
 /* Bind table names for partyline events */
+#define BTN_PARTYLINE_NEW  "partynew"
+#define BTN_PARTYLINE_QUIT  "partyquit"
 #define BTN_PARTYLINE_JOIN	"partyjoin"
 #define BTN_PARTYLINE_NICK	"partynick"
 #define BTN_PARTYLINE_PART	"partypart"
Index: eggdrop1.9/lib/eggdrop/partymember.c
diff -u eggdrop1.9/lib/eggdrop/partymember.c:1.19 eggdrop1.9/lib/eggdrop/partymember.c:1.20
--- eggdrop1.9/lib/eggdrop/partymember.c:1.19	Sun Oct 17 00:14:06 2004
+++ eggdrop1.9/lib/eggdrop/partymember.c	Mon Aug 21 20:41:28 2006
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: partymember.c,v 1.19 2004-10-17 05:14:06 stdarg Exp $";
+static const char rcsid[] = "$Id: partymember.c,v 1.20 2006-08-22 01:41:28 sven Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -38,13 +38,15 @@
 	{0}
 };
 
-static bind_table_t *BT_nick = NULL;
+static bind_table_t *BT_nick = NULL, *BT_new = NULL, *BT_quit = NULL;
 
 int partymember_init(void)
 {
 	pid_ht = hash_table_create(NULL, NULL, 13, HASH_TABLE_INTS);
 	bind_add_list(BTN_USER_DELETE, partymember_udelete_binds);
 	BT_nick = bind_table_add(BTN_PARTYLINE_NICK, 3, "Pss", MATCH_NONE, BIND_STACKABLE);
+	BT_new = bind_table_add(BTN_PARTYLINE_NEW, 1, "P", MATCH_MASK, BIND_STACKABLE);
+	BT_quit = bind_table_add(BTN_PARTYLINE_QUIT, 2, "Ps", MATCH_MASK, BIND_STACKABLE);
 	return(0);
 }
 
@@ -52,6 +54,8 @@
 {
 	bind_rem_list(BTN_USER_DELETE, partymember_udelete_binds);
 	bind_table_del(BT_nick);
+	bind_table_del(BT_new);
+	bind_table_del(BT_quit);
 
 	/* force a garbage run since we might have some partymembers 
  	 * marked as deleted and w/o a garbage_run we may not destroy
@@ -140,6 +144,7 @@
 	party_head = mem;
 	hash_table_insert(pid_ht, (void *)pid, mem);
 	npartymembers++;
+	bind_check(BT_new, &user->settings[0].flags, user->handle, mem);
 	return(mem);
 }
 
@@ -151,6 +156,8 @@
 
 	if (p->flags & PARTY_DELETED) return(-1);
 
+	bind_check(BT_quit, &p->user->settings[0].flags, p->user->handle, p, text);
+
 	/* Mark it as deleted so it doesn't get reused before it's free. */
 	p->flags |= PARTY_DELETED;
 	garbage_add(partymember_cleanup, NULL, GARBAGE_ONCE);
Index: eggdrop1.9/src/core_party.c
diff -u eggdrop1.9/src/core_party.c:1.49 eggdrop1.9/src/core_party.c:1.50
--- eggdrop1.9/src/core_party.c:1.49	Mon Jun 19 10:47:33 2006
+++ eggdrop1.9/src/core_party.c	Mon Aug 21 20:41:28 2006
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: core_party.c,v 1.49 2006-06-19 15:47:33 stdarg Exp $";
+static const char rcsid[] = "$Id: core_party.c,v 1.50 2006-08-22 01:41:28 sven Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -677,28 +677,27 @@
 		if (old) free(old);
 		if (newh) free(newh);
 		partymember_printf(p, _("Syntax: chhandle <old_handle> <new_handle>"));
-		goto chhandleend;
+		return 0;
 	}
 
 	dest = user_lookup_by_handle(old);
 	if (!dest) {
+		partymember_printf(p, _("Error: User '%s' does not exist."), old);
 		free(old);
 		free(newh);
-		partymember_printf(p, _("Error: User '%s' does not exist."), old);
-		goto chhandleend;
+		return 0;
 	}
 
 	if (user_lookup_by_handle(newh)) {
+		partymember_printf(p, _("Error: User '%s' already exists."), newh);
 		free(old);
 		free(newh);
-		partymember_printf(p, _("Error: User '%s' already exists."), newh);
 		return 0;
 	}
 
 	if (!user_change_handle(dest, newh))
 		partymember_printf(p, _("Ok, changed."));
 
-chhandleend:
 	free(newh);
 	free(old);
 
----------------------- End of diff -----------------------



More information about the Changes mailing list