Bryan Drewery 22 lat temu
rodzic
commit
79923c2798

+ 0 - 9
src/mod/channels.mod/channels.c

@@ -650,15 +650,6 @@ static int channels_chon(char *handle, int idx)
   return 0;
 }
 
-static char *convert_element(char *src, char *dst)
-{
-  int flags;
-
-  Tcl_ScanElement(src, &flags);
-  Tcl_ConvertElement(src, dst, flags);
-  return dst;
-}
-
 static cmd_t my_chon[] =
 {
   {"*",		"",	(Function) channels_chon,	"channels:chon"},

+ 0 - 1
src/mod/channels.mod/channels.h

@@ -82,7 +82,6 @@ static int ismasked(masklist *m, char *user);
 static int ismodeline(masklist *m, char *user);
 static int tcl_channel_modify(char *result, struct chanset_t *chan, int items, char **item);
 static int tcl_channel_add(char *result, char *, char *);
-static char *convert_element(char *src, char *dst);
 static int getudef(struct udef_chans *, char *);
 static void initudef(int type, char *, int);
 static void setudef(struct udef_struct *, char *, int);

+ 9 - 12
src/mod/channels.mod/tclchan.c

@@ -459,10 +459,8 @@ static int tcl_channel_add(char *result, char *newname, char *options)
   int items;
   int ret = TCL_OK;
   int join = 0;
-  char buf[2048] = "", buf2[256] = "";
-//  char **item = NULL;
-  CONST char **item;
-
+  char buf[3001] = "";
+  CONST char **item = NULL;
 
   if (!newname || !newname[0] || !strchr(CHANMETA, newname[0])) {
     if (result)
@@ -476,14 +474,14 @@ static int tcl_channel_add(char *result, char *newname, char *options)
     return TCL_ERROR;
   }
 
-  convert_element(glob_chanmode, buf2);
-  simple_sprintf(buf, "chanmode %s ", buf2);
-  strncat(buf, glob_chanset, 2047 - strlen(buf));
-  strncat(buf, options, 2047 - strlen(buf));
-  buf[2047] = 0;
+  simple_sprintf(buf, "chanmode %s ", glob_chanmode);
+  strcat(buf, glob_chanset);
+  strcat(buf, options);
+  buf[sizeof(buf) - 1] = 0;
 
   if (Tcl_SplitList(NULL, buf, &items, &item) != TCL_OK)
     return TCL_ERROR;
+
   if ((chan = findchan_by_dname(newname))) {
     /* Already existing channel, maybe a reload of the channel file */
     chan->status &= ~CHAN_FLAGGED;	/* don't delete me! :) */
@@ -530,8 +528,7 @@ static int tcl_channel_add(char *result, char *newname, char *options)
      * any code later on. chan->name gets updated with the channel name as
      * the server knows it, when we join the channel. <cybah>
      */
-    strncpy(chan->dname, newname, 81);
-    chan->dname[80] = 0;
+    strncpyz(chan->dname, newname, 81);
 
     /* Initialize chan->channel info */
     init_channel(chan, 0);
@@ -551,6 +548,6 @@ static int tcl_channel_add(char *result, char *newname, char *options)
 #ifdef LEAF
   if (join && shouldjoin(chan) && module_find("irc", 0, 0))
     dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
-#endif
+#endif /* LEAF */
   return ret;
 }

+ 12 - 40
src/mod/channels.mod/userchan.c

@@ -1258,13 +1258,8 @@ static int write_invites(FILE *f, int idx)
  */
 static int write_chans(FILE *f, int idx)
 {
-  char w[1024] = "", w2[1024] = "", name[163] = "";
-/*  char udefs[2048] = "", buf[2048]; */
-/* Chanchar template
- *char temp[121];
- */
+  char w[1024] = "";
   struct chanset_t *chan = NULL;
-/*  struct udef_struct *ul; */
 
   putlog(LOG_DEBUG, "*", "Writing channels..");
 
@@ -1281,41 +1276,18 @@ static int write_chans(FILE *f, int idx)
 
      putlog(LOG_DEBUG, "*", "writing channel %s to userfile..", chan->dname);
 
-/*     egg_memset(udefs,'\0',2048); */
-     convert_element(chan->dname, name);
      get_mode_protect(chan, w);
-     convert_element(w, w2);
-/* Chanchar template
- *   convert_element(chan->temp, temp);
- */
-/* fuck these for now
-     for (ul = udef; ul; ul = ul->next) { //put the udefs into one string
-       egg_memset(buf,'\0',2048);
-       if (ul->defined && ul->name) { 
-	if (ul->type == UDEF_FLAG)
-	 sprintf(buf, "%c%s%s ", getudef(ul->values, chan->dname) ? '+' : '-', "udef-flag-", ul->name);
-	else if (ul->type == UDEF_INT)
-	  sprintf(buf, "%s%s %d ", "udef-int-", ul->name, getudef(ul->values, chan->dname));
-	else
-	  debug1("UDEF-ERROR: unknown type %d", ul->type);
-        strcat(udefs,buf);
-       }
-     }
-*/
-     if (lfprintf(f, "+ channel add %s { chanmode %s addedby %s addedts %lu idle-kick %d limit %d stopnethack-mode %d \
-revenge-mode %d \
-flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d \
-flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d \
-closed-ban %d \
-ban-time %d exempt-time %d invite-time %d \
-%cenforcebans %cdynamicbans %cuserbans %cbitch \
-%cprotectops %crevenge %crevengebot \
-%cprivate %ccycle %cinactive %cdynamicexempts \
-%cuserexempts %cdynamicinvites %cuserinvites \
-%cnodesynch %cclosed %ctake %cmanop %cvoice \
-%cfastop }\n",
-	name,
-	w2,
+
+     if (lfprintf(f, "+ channel add %s { chanmode %s addedby %s addedts %lu idle-kick %d \
+                      limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d \
+                      flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d flood-deop %d:%d \
+                      flood-nick %d:%d closed-ban %d ban-time %d exempt-time %d invite-time %d \
+                      %cenforcebans %cdynamicbans %cuserbans %cbitch %cprotectops %crevenge \
+                      %crevengebot %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
+                      %cdynamicinvites %cuserinvites %cnodesynch %cclosed %ctake %cmanop %cvoice \
+                      %cfastop }\n",
+	chan->dname,
+	w,
         chan->added_by,
         chan->added_ts,
 /* Chanchar template