[eggheads-patches] PATCH: chanset.patch

Fabian Knittel fknittel at gmx.de
Fri Oct 8 22:42:51 CST 1999


[ chanset.patch ]

chanset wasn't responding with a full acknowledgement in certain
cases:

> dcc(blob)] .chanset #test chanmode {+l 100}
> [blob(dcc)] Successfully set modes { chanmode { {+l } } on #test.

This patch makes it display correctly:

> [blob(dcc)] Successfully set modes { chanmode { {+l 100} } on #test.

Fabian
-------------- next part --------------
diff -urN eggdrop1.3~/doc/UPDATES1.3 eggdrop1.3/doc/UPDATES1.3
--- eggdrop1.3~/doc/UPDATES1.3	Sat Oct  9 01:56:27 1999
+++ eggdrop1.3/doc/UPDATES1.3	Sat Oct  9 02:23:11 1999
@@ -4,6 +4,7 @@
 
 1.3.29
 Foundby   Fixedby   What....
+dw	  Fabian    .chanset wasn't displaying channel limits correctly
 ranjha	  Fabian    .help * is now converted to .help all
 Ben	  Fabian    .su doesn't expect a pwd for the target user anymore, if
 		    called as an owner
diff -urN eggdrop1.3~/src/mod/channels.mod/cmdschan.c eggdrop1.3/src/mod/channels.mod/cmdschan.c
--- eggdrop1.3~/src/mod/channels.mod/cmdschan.c	Fri Oct  8 12:50:18 1999
+++ eggdrop1.3/src/mod/channels.mod/cmdschan.c	Sat Oct  9 02:26:05 1999
@@ -1256,7 +1256,7 @@
 
 static void cmd_chanset(struct userrec *u, int idx, char *par)
 {
-  char *chname = NULL, answers[512];
+  char *chname = NULL, answers[512], *parcpy;
   char *list[2];
   struct chanset_t *chan = NULL;
 
@@ -1306,14 +1306,19 @@
 	    return;
 	  }
 	  list[1] = par;
+	  /* par gets modified in tcl_channel_modify under some
+	   * circumstances, so save it now */
+	  parcpy = nmalloc(strlen(par) + 1);
+	  strcpy(parcpy, par);
 	  if (tcl_channel_modify(0, chan, 2, list) == TCL_OK) {
 	    strcat(answers, list[0]);
 	    strcat(answers, " { ");
-	    strcat(answers, par);
+	    strcat(answers, parcpy);
 	    strcat(answers, " }");
 	  } else
 	    dprintf(idx, "Error trying to set %s for %s, invalid option\n",
 		    list[0], chname);
+	  nfree(parcpy);
 	}
 	break;
       }


More information about the Patches mailing list