Prechádzať zdrojové kódy

* Using calloc() now for malloc() with bzero.
* Fixed a bug from strdup() patch, channel_malloc->calloc()
* Fixed readuserfile() now calls tcl_channel_add() directly.
* Cleared out add_tcl_commands, which included a ton of tcl cmds.


svn: 600

Bryan Drewery 22 rokov pred
rodič
commit
8a9be52ad0

+ 5 - 5
src/botnet.c

@@ -994,9 +994,9 @@ int botlink(char *linker, int idx, char *nick)
       strcpy(dcc[i].nick, nick);
       strcpy(dcc[i].host, bi->address);
       dcc[i].u.dns->ibuf = idx;
-      dcc[i].u.dns->cptr = get_data_ptr(strlen(linker) + 1);
+      dcc[i].u.dns->cptr = calloc(1, strlen(linker) + 1);
       strcpy(dcc[i].u.dns->cptr, linker);
-      dcc[i].u.dns->host = get_data_ptr(strlen(dcc[i].host) + 1);
+      dcc[i].u.dns->host = calloc(1, strlen(dcc[i].host) + 1);
       strcpy(dcc[i].u.dns->host, dcc[i].host);
       dcc[i].u.dns->dns_success = botlink_resolve_success;
       dcc[i].u.dns->dns_failure = botlink_resolve_failure;
@@ -1169,13 +1169,13 @@ void tandem_relay(int idx, char *nick, register int i)
   dprintf(idx, "%s\n", BOT_BYEINFO1);
   dcc[idx].type = &DCC_PRE_RELAY;
   ci = dcc[idx].u.chat;
-  dcc[idx].u.relay = get_data_ptr(sizeof(struct relay_info));
+  dcc[idx].u.relay = calloc(1, sizeof(struct relay_info));
   dcc[idx].u.relay->chat = ci;
   dcc[idx].u.relay->old_status = dcc[idx].status;
   dcc[idx].u.relay->sock = dcc[i].sock;
   dcc[i].timeval = now;
   dcc[i].u.dns->ibuf = dcc[idx].sock;
-  dcc[i].u.dns->host = get_data_ptr(strlen(bi->address) + 1);
+  dcc[i].u.dns->host = calloc(1, strlen(bi->address) + 1);
   strcpy(dcc[i].u.dns->host, bi->address);
   dcc[i].u.dns->dns_success = tandem_relay_resolve_success;
   dcc[i].u.dns->dns_failure = tandem_relay_resolve_failure;
@@ -1223,7 +1223,7 @@ static void tandem_relay_resolve_success(int i)
 
   dcc[i].addr = dcc[i].u.dns->ip;
   changeover_dcc(i, &DCC_FORK_RELAY, sizeof(struct relay_info));
-  dcc[i].u.relay->chat = get_data_ptr(sizeof(struct chat_info));
+  dcc[i].u.relay->chat = calloc(1, sizeof(struct chat_info));
 
   dcc[i].u.relay->sock = sock;
   dcc[i].u.relay->port = dcc[i].port;

+ 2 - 2
src/chanprog.c

@@ -706,10 +706,10 @@ int isowner(char *name)
 
 int shouldjoin(struct chanset_t *chan)
 {
-  if (!strcmp(chan->dname, "#wtest2"))
+/*  if (!strcmp(chan->dname, "#wtest2"))
     return 1;
   else
-    return 0; 
+    return 0; */
 #ifdef G_BACKUP
   struct flag_record fr = { FR_CHAN | FR_ANYWH | FR_GLOBAL, 0, 0, 0, 0 };
 

+ 3 - 3
src/cmds.c

@@ -2878,9 +2878,9 @@ static void cmd_su(struct userrec *u, int idx, char *par)
 	 */
 	if (dcc[idx].u.chat->away != NULL)
 	  free(dcc[idx].u.chat->away);
-        dcc[idx].u.chat->away = get_data_ptr(strlen(dcc[idx].nick) + 1);
+        dcc[idx].u.chat->away = calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
-        dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
+        dcc[idx].u.chat->su_nick = calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -2897,7 +2897,7 @@ static void cmd_su(struct userrec *u, int idx, char *par)
 	dprintf(idx, STR("Setting your username to %s.\n"), par);
 	if (atr & USER_MASTER)
 	  dcc[idx].u.chat->con_flags = conmask;
-        dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
+        dcc[idx].u.chat->su_nick = calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);

+ 6 - 6
src/dcc.c

@@ -662,7 +662,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
     if (!egg_strcasecmp(buf, "elinkdone")) {
       free(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
-      dcc[idx].u.bot = get_data_ptr(sizeof(struct bot_info));
+      dcc[idx].u.bot = calloc(1, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "goodbye!\n");
       greet_new_bot(idx);
@@ -866,10 +866,10 @@ static void append_line(int idx, char *line)
     else
       for (q = c->buffer; q->next; q = q->next);
 
-    p = get_data_ptr(sizeof(struct msgq));
+    p = calloc(1, sizeof(struct msgq));
 
     p->len = l;
-    p->msg = get_data_ptr(l + 1);
+    p->msg = calloc(1, l + 1);
     p->next = NULL;
     strcpy(p->msg, line);
     if (q == NULL)
@@ -1457,7 +1457,7 @@ static void dcc_telnet_id(int idx, char *buf, int atr)
 
       ci = dcc[idx].u.chat;
       dcc[idx].type = &DCC_DUPWAIT;
-      dcc[idx].u.dupwait = get_data_ptr(sizeof(struct dupwait_info));
+      dcc[idx].u.dupwait = calloc(1, sizeof(struct dupwait_info));
       dcc[idx].u.dupwait->chat = ci;
       dcc[idx].u.dupwait->atr = atr;
       return;
@@ -1508,7 +1508,7 @@ static void dcc_telnet_pass(int idx, int atr)
     struct chat_info *ci;
 
     ci = dcc[idx].u.chat;
-    dcc[idx].u.file = get_data_ptr(sizeof(struct file_info));
+    dcc[idx].u.file = calloc(1, sizeof(struct file_info));
     dcc[idx].u.file->chat = ci;
   }
 
@@ -1803,7 +1803,7 @@ static void dcc_telnet_got_ident(int i, char *host)
   sockoptions(dcc[i].sock, EGG_OPTION_UNSET, SOCK_BUFFER);
 
   dcc[i].type = &DCC_TELNET_ID;
-  dcc[i].u.chat = get_data_ptr(sizeof(struct chat_info));
+  dcc[i].u.chat = calloc(1, sizeof(struct chat_info));
   egg_bzero(dcc[i].u.chat, sizeof(struct chat_info));
 
   /* Copy acceptable-nick/host mask */

+ 0 - 10
src/dccutil.c

@@ -455,16 +455,6 @@ void set_away(int idx, char *s)
   check_bind_away(botnetnick, dcc[idx].sock, s);
 }
 
-/* This helps the memory debugging
- */
-void *get_data_ptr(int size)
-{
-  char *p = malloc(size);
-  egg_bzero(p, size);
-  return p;
-}
-
-
 
 /* Make a password, 10-15 random letters and digits
  */

+ 1 - 1
src/dns.c

@@ -91,7 +91,7 @@ static void dns_dcchostbyip(IP ip, char *hostn, int ok, void *other)
         (dcc[idx].u.dns->ip == ip)) {
       if (dcc[idx].u.dns->host)
         free(dcc[idx].u.dns->host);
-      dcc[idx].u.dns->host = get_data_ptr(strlen(hostn) + 1);
+      dcc[idx].u.dns->host = calloc(1, strlen(hostn) + 1);
       strcpy(dcc[idx].u.dns->host, hostn);
       if (ok)
         dcc[idx].u.dns->dns_success(idx);

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

@@ -1027,7 +1027,6 @@ char *channels_start(Function * global_funcs)
   add_builtins("bot", channels_bot);
   add_builtins("chon", my_chon);
 
-  add_tcl_commands(channels_cmds);
 #ifdef S_AUTOLOCK
   add_cfg(&CFG_LOCKTHRESHOLD);
   add_cfg(&CFG_KILLTHRESHOLD);

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

@@ -84,7 +84,6 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
 			      int items, char **item);
 static int tcl_channel_add(Tcl_Interp * irp, char *, char *);
 static char *convert_element(char *src, char *dst);
-static void free_udef_chans(struct udef_chans *);
 static int getudef(struct udef_chans *, char *);
 static void initudef(int type, char *, int);
 static void setudef(struct udef_struct *, char *, int);

+ 0 - 550
src/mod/channels.mod/tclchan.c

@@ -4,322 +4,6 @@
  */
 
 
-static int tcl_channel_info(Tcl_Interp * irp, struct chanset_t *chan)
-{
-  char a[121], b[121], s[121];
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-  CONST char *args[2];
-#else
-  char *args[2];
-#endif
-  struct udef_struct *ul;
-
-  get_mode_protect(chan, s);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d", chan->idle_kick);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d", chan->limitraise);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d", chan->stopnethack_mode);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d", chan->revenge_mode);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d:%d", chan->flood_pub_thr, chan->flood_pub_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d:%d", chan->flood_ctcp_thr, chan->flood_ctcp_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d:%d", chan->flood_join_thr, chan->flood_join_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d:%d", chan->flood_kick_thr, chan->flood_kick_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d:%d", chan->flood_deop_thr, chan->flood_deop_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d:%d", chan->flood_nick_thr, chan->flood_nick_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d", chan->ban_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%s", chan->closed_ban);
-  Tcl_AppendElement(irp, s);
-/* Chanint template 
- *simple_sprintf(s, "%s", chan->temp);
- *Tcl_AppendElement(irp, s);
- */
-  simple_sprintf(s, "%d", chan->exempt_time);
-  Tcl_AppendElement(irp, s);
-  simple_sprintf(s, "%d", chan->invite_time);
-  Tcl_AppendElement(irp, s);
-  if (chan->status & CHAN_ENFORCEBANS)
-    Tcl_AppendElement(irp, "+enforcebans");
-  else
-    Tcl_AppendElement(irp, "-enforcebans");
-  if (chan->status & CHAN_DYNAMICBANS)
-    Tcl_AppendElement(irp, "+dynamicbans");
-  else
-    Tcl_AppendElement(irp, "-dynamicbans");
-  if (chan->status & CHAN_NOUSERBANS)
-    Tcl_AppendElement(irp, "-userbans");
-  else
-    Tcl_AppendElement(irp, "+userbans");
-  if (chan->status & CHAN_BITCH)
-    Tcl_AppendElement(irp, "+bitch");
-  else
-    Tcl_AppendElement(irp, "-bitch");
-  if (chan->status & CHAN_PROTECTOPS)
-    Tcl_AppendElement(irp, "+protectops");
-  else
-    Tcl_AppendElement(irp, "-protectops");
-  if (chan->status & CHAN_INACTIVE)
-    Tcl_AppendElement(irp, "+inactive");
-  else
-    Tcl_AppendElement(irp, "-inactive");
-  if (chan->status & CHAN_REVENGE)
-    Tcl_AppendElement(irp, "+revenge");
-  else
-    Tcl_AppendElement(irp, "-revenge");
-  if (chan->status & CHAN_REVENGEBOT)
-    Tcl_AppendElement(irp, "+revengebot");
-  else
-    Tcl_AppendElement(irp, "-revengebot");
-  if (chan->status & CHAN_SECRET)
-    Tcl_AppendElement(irp, "+secret");
-  else
-    Tcl_AppendElement(irp, "-secret");
-  if (chan->status & CHAN_CYCLE)
-    Tcl_AppendElement(irp, "+cycle");
-  else
-    Tcl_AppendElement(irp, "-cycle");
-  if (chan->ircnet_status& CHAN_DYNAMICEXEMPTS)
-    Tcl_AppendElement(irp, "+dynamicexempts");
-  else
-    Tcl_AppendElement(irp, "-dynamicexempts");
-  if (chan->ircnet_status& CHAN_NOUSEREXEMPTS)
-    Tcl_AppendElement(irp, "-userexempts");
-  else
-    Tcl_AppendElement(irp, "+userexempts");
-  if (chan->ircnet_status& CHAN_DYNAMICINVITES)
-    Tcl_AppendElement(irp, "+dynamicinvites");
-  else
-    Tcl_AppendElement(irp, "-dynamicinvites");
-  if (chan->ircnet_status& CHAN_NOUSERINVITES)
-    Tcl_AppendElement(irp, "-userinvites");
-  else
-    Tcl_AppendElement(irp, "+userinvites");
-  if (chan->status & CHAN_NODESYNCH)
-    Tcl_AppendElement(irp, "+nodesynch");
-  else
-    Tcl_AppendElement(irp, "-nodesynch");
-  if (chan->status & CHAN_CLOSED)
-    Tcl_AppendElement(irp, "+closed");
-  else
-    Tcl_AppendElement(irp, "-closed");
-  if (chan->status & CHAN_TAKE)
-    Tcl_AppendElement(irp, "+take");
-  else
-    Tcl_AppendElement(irp, "-take");
-  if (chan->status & CHAN_NOMOP)
-    Tcl_AppendElement(irp, "+nomop");
-  else
-    Tcl_AppendElement(irp, "-nomop");
-  if (chan->status & CHAN_MANOP)
-    Tcl_AppendElement(irp, "+manop");
-  else
-    Tcl_AppendElement(irp, "-manop");
-  if (chan->status & CHAN_VOICE)
-    Tcl_AppendElement(irp, "+voice");
-  else
-    Tcl_AppendElement(irp, "-voice");
-/* Chanflag template
- *if (chan->status & CHAN_TEMP)
- *  Tcl_AppendElement(irp, "+temp");
- *else
- *  Tcl_AppendElement(irp, "-temp");
- */
-  if (chan->status & CHAN_FASTOP)
-    Tcl_AppendElement(irp, "+fastop");
-  else
-    Tcl_AppendElement(irp, "-fastop");
-  if (chan->status & CHAN_PRIVATE)
-    Tcl_AppendElement(irp, "+private");
-  else
-    Tcl_AppendElement(irp, "-private");
-
-  for (ul = udef; ul; ul = ul->next) {
-      /* If it's undefined, skip it. */
-      if (!ul->defined || !ul->name) continue;
-
-      if (ul->type == UDEF_FLAG) {
-        simple_sprintf(s, "%c%s", getudef(ul->values, chan->dname) ? '+' : '-',
-		       ul->name);
-        Tcl_AppendElement(irp, s);
-      } else if (ul->type == UDEF_INT) {
-        char *x;
-        egg_snprintf(a, sizeof a, "%s", ul->name);
-        egg_snprintf(b, sizeof b, "%d", getudef(ul->values, chan->dname));
-        args[0] = a;
-        args[1] = b;
-        x = Tcl_Merge(2, args);
-        egg_snprintf(s, sizeof s, "%s", x);
-        Tcl_Free((char *) x);
-        Tcl_AppendElement(irp, s);
-      } else
-        debug1("UDEF-ERROR: unknown type %d", ul->type);
-    }
-  return TCL_OK;
-}
-
-static int tcl_channel_get(Tcl_Interp * irp, struct chanset_t *chan, char *setting)
-{
-  char s[121];
-  struct udef_struct *ul;
-
-#define CHECK(x) !strcmp(setting, x)
-
-#define CHKFLAG_POS(x,y,z) (!strcmp(setting, y)) { \
-                            if(z & x) simple_sprintf(s, "%d", 1); \
-                            else simple_sprintf(s, "%d", 0); }
-
-#define CHKFLAG_NEG(x,y,z) (!strcmp(setting, y)) { \
-                            if (z & x) simple_sprintf(s, "%d", 0); \
-                            else simple_sprintf(s, "%d", 1); }
-
-  if      (CHECK("chanmode"))      get_mode_protect(chan, s);
-  
-  else if (CHECK("addedby"))	   simple_sprintf(s, "%s", chan->added_by);
-  else if (CHECK("addedts"))       simple_sprintf(s, "%lu", chan->added_ts);
-  else if (CHECK("idle-kick"))     simple_sprintf(s, "%d", chan->idle_kick);
-  else if (CHECK("limit"))         simple_sprintf(s, "%d", chan->limitraise);
-  else if (CHECK("stop-net-hack")) simple_sprintf(s, "%d", chan->stopnethack_mode);
-  else if (CHECK("revenge-mode"))  simple_sprintf(s, "%d", chan->revenge_mode);
-  else if (CHECK("flood-chan"))    simple_sprintf(s, "%d %d", chan->flood_pub_thr, chan->flood_pub_time);
-  else if (CHECK("flood-ctcp"))    simple_sprintf(s, "%d %d", chan->flood_ctcp_thr, chan->flood_ctcp_time);
-  else if (CHECK("flood-join"))    simple_sprintf(s, "%d %d", chan->flood_join_thr, chan->flood_join_time);
-  else if (CHECK("flood-kick"))    simple_sprintf(s, "%d %d", chan->flood_kick_thr, chan->flood_kick_time);
-  else if (CHECK("flood-deop"))    simple_sprintf(s, "%d %d", chan->flood_deop_thr, chan->flood_deop_time);
-  else if (CHECK("flood-nick"))    simple_sprintf(s, "%d %d", chan->flood_nick_thr, chan->flood_nick_time);
-/* Chanint template
- *else if (CHECK("temp"))	   simple_sprintf(s, "%s", chan->temp);
- */
-  else if (CHECK("closed-ban"))    simple_sprintf(s, "%d", chan->closed_ban);
-  else if (CHECK("ban-time"))  	   simple_sprintf(s, "%d", chan->ban_time);
-  else if (CHECK("exempt-time"))   simple_sprintf(s, "%d", chan->exempt_time);
-  else if (CHECK("invite-time"))   simple_sprintf(s, "%d", chan->invite_time);
-  else if CHKFLAG_POS(CHAN_ENFORCEBANS,    "enforcebans",    chan->status)
-  else if CHKFLAG_POS(CHAN_DYNAMICBANS,    "dynamicbans",    chan->status)
-  else if CHKFLAG_NEG(CHAN_NOUSERBANS,     "userbans",       chan->status)
-  else if CHKFLAG_POS(CHAN_BITCH,          "bitch",          chan->status)
-  else if CHKFLAG_POS(CHAN_PROTECTOPS,     "protectops",     chan->status)
-  else if CHKFLAG_POS(CHAN_INACTIVE,       "inactive",       chan->status)
-  else if CHKFLAG_POS(CHAN_REVENGE,        "revenge",        chan->status)
-  else if CHKFLAG_POS(CHAN_REVENGEBOT,     "revengebot",     chan->status)
-  else if CHKFLAG_POS(CHAN_SECRET,         "secret",         chan->status)
-  else if CHKFLAG_POS(CHAN_CYCLE,          "cycle",          chan->status)
-  else if CHKFLAG_POS(CHAN_NODESYNCH,      "nodesynch",      chan->status)
-  else if CHKFLAG_POS(CHAN_DYNAMICEXEMPTS, "dynamicexempts", chan->ircnet_status)
-  else if CHKFLAG_NEG(CHAN_NOUSEREXEMPTS,  "userexempts",    chan->ircnet_status)
-  else if CHKFLAG_POS(CHAN_DYNAMICINVITES, "dynamicinvites", chan->ircnet_status)
-  else if CHKFLAG_NEG(CHAN_NOUSERINVITES,  "userinvites",    chan->ircnet_status)
-  else if CHKFLAG_POS(CHAN_CLOSED,	   "closed",         chan->status)
-  else if CHKFLAG_POS(CHAN_TAKE,	   "take",           chan->status)
-  else if CHKFLAG_POS(CHAN_NOMOP,	   "nomop",          chan->status)
-  else if CHKFLAG_POS(CHAN_MANOP,          "manop",          chan->status)
-  else if CHKFLAG_POS(CHAN_VOICE,          "voice",          chan->status)
-  else if CHKFLAG_POS(CHAN_FASTOP,         "fastop",         chan->status)
-  else if CHKFLAG_POS(CHAN_PRIVATE,        "private",        chan->status)
-/* Chanflag template
- *else if CHKFLAG_POS(CHAN_TEMP,	   "temp",		chan->status)
- */
-
-  else {
-    /* Hopefully it's a user-defined flag. */
-    for (ul = udef; ul && ul->name; ul = ul->next) {
-      if (!strcmp(setting, ul->name)) break;
-    }
-    if (!ul || !ul->name) {
-      /* Error if it wasn't found. */
-      Tcl_AppendResult(irp, "Unknown channel setting.", NULL);
-      return(TCL_ERROR);
-    }
-
-    /* Flag or int, all the same. */
-    simple_sprintf(s, "%d", getudef(ul->values, chan->dname));
-    Tcl_AppendResult(irp, s, NULL);
-    return(TCL_OK);
-  }
-
-  /* Ok, if we make it this far, the result is "s". */
-  Tcl_AppendResult(irp, s, NULL);
-  return(TCL_OK);
-}
-
-static int tcl_channel STDVAR
-{
-  struct chanset_t *chan;
-  char buf2[1024];
-  BADARGS(2, 999, " command ?options?");
-  if (!strcmp(argv[1], "add")) {
-    BADARGS(3, 4, " add channel-name ?options-list?");
-    if (argc == 3) {
-      
-      egg_snprintf(buf2, sizeof buf2, "cjoin %s", argv[2]);
-      if (!loading)
-        putallbots(buf2);
-      return tcl_channel_add(irp, argv[2], "");
-    }
-    egg_snprintf(buf2, sizeof buf2, "cjoin %s %s", argv[2], argv[3]);
-    if (!loading)
-      putallbots(buf2);
-    return tcl_channel_add(irp, argv[2], argv[3]);
-  }
-  if (!strcmp(argv[1], "set")) {
-    BADARGS(3, 999, " set channel-name ?options?");
-    chan = findchan_by_dname(argv[2]);
-    if (chan == NULL) {
-      if (loading == 1)
-	return TCL_OK;		/* Ignore channel settings for a static
-				 * channel which has been removed from
-				 * the config */
-      Tcl_AppendResult(irp, "no such channel record", NULL);
-      return TCL_ERROR;
-    }
-    do_chanset(chan, argv[3], 0);
-    return tcl_channel_modify(irp, chan, argc - 3, &argv[3]);
-  }
-  if (!strcmp(argv[1], "get")) {
-    BADARGS(4, 4, " get channel-name setting-name");
-    chan = findchan_by_dname(argv[2]);
-    if (chan == NULL) {
-      Tcl_AppendResult(irp, "no such channel record", NULL);
-      return TCL_ERROR;
-    }
-    return(tcl_channel_get(irp, chan, argv[3]));
-  }
-  if (!strcmp(argv[1], "info")) {
-    BADARGS(3, 3, " info channel-name");
-    chan = findchan_by_dname(argv[2]);
-    if (chan == NULL) {
-      Tcl_AppendResult(irp, "no such channel record", NULL);
-      return TCL_ERROR;
-    }
-    return tcl_channel_info(irp, chan);
-  }
-  if (!strcmp(argv[1], "remove")) {
-    BADARGS(3, 3, " remove channel-name");
-    chan = findchan_by_dname(argv[2]);
-
-    if (chan == NULL) {
-      Tcl_AppendResult(irp, "no such channel record", NULL);
-      return TCL_ERROR;
-    }
-    egg_snprintf(buf2, sizeof buf2, "cpart %s", argv[2]);
-    putallbots(buf2);
-    remove_channel(chan);
-    return TCL_OK;
-  }
-  Tcl_AppendResult(irp, "unknown channel command: should be one of: ",
-		   "add, set, get, info, remove", NULL);
-  return TCL_ERROR;
-}
-
 /* Parse options for a channel.
  */
 static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
@@ -697,137 +381,6 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
   return TCL_OK;
 }
 
-static int tcl_do_masklist(maskrec *m, Tcl_Interp *irp)
-{
-  char ts[21], ts1[21], ts2[21], *p;
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-  CONST char *list[6];
-#else
-  char *list[6];
-#endif
-
-  for (; m; m = m->next) {
-    list[0] = m->mask;
-    list[1] = m->desc;
-    sprintf(ts, "%lu", m->expire);
-    list[2] = ts;
-    sprintf(ts1, "%lu", m->added);
-    list[3] = ts1;
-    sprintf(ts2, "%lu", m->lastactive);
-    list[4] = ts2;
-    list[5] = m->user;
-    p = Tcl_Merge(6, list);
-    Tcl_AppendElement(irp, p);
-    Tcl_Free((char *) p);
-  }
-  return TCL_OK;
-}
-
-static int tcl_banlist STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(1, 2, " ?channel?");
-  if (argc == 2) {
-    chan = findchan_by_dname(argv[1]);
-    if (chan == NULL) {
-      Tcl_AppendResult(irp, "invalid channel: ", argv[1], NULL);
-      return TCL_ERROR;
-    }
-    return tcl_do_masklist(chan->bans, irp);
-  }
-
-  return tcl_do_masklist(global_bans, irp);
-}
-
-static int tcl_exemptlist STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(1, 2, " ?channel?");
-  if (argc == 2) {
-    chan = findchan_by_dname(argv[1]);
-    if (chan == NULL) {
-      Tcl_AppendResult(irp, "invalid channel: ", argv[1], NULL);
-      return TCL_ERROR;
-    }
-    return tcl_do_masklist(chan->exempts, irp);
-  }
-
-  return tcl_do_masklist(global_exempts, irp);
-}
-
-static int tcl_invitelist STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(1, 2, " ?channel?");
-  if (argc == 2) {
-    chan = findchan_by_dname(argv[1]);
-    if (chan == NULL) {
-      Tcl_AppendResult(irp, "invalid channel: ", argv[1], NULL);
-      return TCL_ERROR;
-    }
-    return tcl_do_masklist(chan->invites, irp);
-  }
-  return tcl_do_masklist(global_invites, irp);
-}
-
-static int tcl_channels STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(1, 1, "");
-  for (chan = chanset; chan; chan = chan->next) 
-    Tcl_AppendElement(irp, chan->dname);
-  return TCL_OK;
-}
-
-static int tcl_validchan STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL)
-    Tcl_AppendResult(irp, "0", NULL);
-  else
-    Tcl_AppendResult(irp, "1", NULL);
-  return TCL_OK;
-}
-
-static int tcl_getchaninfo STDVAR
-{
-  char s[161];
-  struct userrec *u;
-
-  BADARGS(3, 3, " handle channel");
-  u = get_user_by_handle(userlist, argv[1]);
-  if (!u || (u->flags & USER_BOT))
-    return TCL_OK;
-  get_handle_chaninfo(argv[1], argv[2], s);
-  Tcl_AppendResult(irp, s, NULL);
-  return TCL_OK;
-}
-
-static int tcl_setchaninfo STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(4, 4, " handle channel info");
-  chan = findchan_by_dname(argv[2]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "illegal channel: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  if (!egg_strcasecmp(argv[3], "none")) {
-    set_handle_chaninfo(userlist, argv[1], argv[2], NULL);
-    return TCL_OK;
-  }
-  set_handle_chaninfo(userlist, argv[1], argv[2], argv[3]);
-  return TCL_OK;
-}
-
 static void init_masklist(masklist *m)
 {
   m->mask = (char *)malloc(1);
@@ -1010,106 +563,3 @@ static int tcl_channel_add(Tcl_Interp *irp, char *newname, char *options)
   return ret;
 }
 
-static int tcl_setudef STDVAR
-{
-  int type;
-
-  BADARGS(3, 3, " type name");
-  if (!egg_strcasecmp(argv[1], "flag"))
-    type = UDEF_FLAG;
-  else if (!egg_strcasecmp(argv[1], "int"))
-    type = UDEF_INT;
-  else {
-    Tcl_AppendResult(irp, "invalid type. Must be one of: flag, int", NULL);
-    return TCL_ERROR;
-  }
-  initudef(type, argv[2], 1);
-  return TCL_OK;
-}
-
-static int tcl_renudef STDVAR
-{
-  struct udef_struct *ul;
-  int type, found = 0;
-
-  BADARGS(4, 4, " type oldname newname");
-  if (!egg_strcasecmp(argv[1], "flag"))
-    type = UDEF_FLAG;
-  else if (!egg_strcasecmp(argv[1], "int"))
-    type = UDEF_INT;
-  else {
-    Tcl_AppendResult(irp, "invalid type. Must be one of: flag, int", NULL);
-    return TCL_ERROR;
-  }
-  for (ul = udef; ul; ul = ul->next) {
-    if (ul->type == type && !egg_strcasecmp(ul->name, argv[2])) {
-      free(ul->name);
-      ul->name = strdup(argv[3]);
-      found = 1;
-    }
-  }
-  if (!found) {
-    Tcl_AppendResult(irp, "not found", NULL);
-    return TCL_ERROR;
-  } else
-    return TCL_OK;
-}
-
-static int tcl_deludef STDVAR
-{
-  struct udef_struct *ul, *ull;
-  int type, found = 0;
-
-  BADARGS(3, 3, " type name");
-  if (!egg_strcasecmp(argv[1], "flag"))
-    type = UDEF_FLAG;
-  else if (!egg_strcasecmp(argv[1], "int"))
-    type = UDEF_INT;
-  else {
-    Tcl_AppendResult(irp, "invalid type. Must be one of: flag, int", NULL);
-    return TCL_ERROR;
-  }
-  for (ul = udef; ul; ul = ul->next) {
-    ull = ul->next;
-    if (!ull)
-      break;
-    if (ull->type == type && !egg_strcasecmp(ull->name, argv[2])) {
-      ul->next = ull->next;
-      free(ull->name);
-      free_udef_chans(ull->values);
-      free(ull);
-      found = 1;
-    }
-  }
-  if (udef) {
-    if (udef->type == type && !egg_strcasecmp(udef->name, argv[2])) {
-      ul = udef->next;
-      free(udef->name);
-      free_udef_chans(udef->values);
-      free(udef);
-      udef = ul;
-      found = 1;
-    }
-  }
-  if (!found) {
-    Tcl_AppendResult(irp, "not found", NULL);
-    return TCL_ERROR;
-  } else
-    return TCL_OK;
-}
-
-static tcl_cmds channels_cmds[] =
-{
-  {"channel",		tcl_channel},
-  {"channels",		tcl_channels},
-  {"exemptlist",	tcl_exemptlist},
-  {"invitelist",	tcl_invitelist},
-  {"banlist",		tcl_banlist},
-  {"validchan",		tcl_validchan},
-  {"getchaninfo",	tcl_getchaninfo},
-  {"setchaninfo",	tcl_setchaninfo},
-  {"setudef",		tcl_setudef},
-  {"renudef",		tcl_renudef},
-  {"deludef",		tcl_deludef},
-  {NULL,		NULL}
-};

+ 0 - 10
src/mod/channels.mod/udefchan.c

@@ -82,13 +82,3 @@ static void initudef(int type, char *name, int defined)
     udef = ul;
 }
 
-static void free_udef_chans(struct udef_chans *ul)
-{
-  struct udef_chans *ull;
-
-  for (; ul; ul = ull) {
-    ull = ul->next;
-    free(ul->chan);
-    free(ul);
-  }
-}

+ 1 - 1
src/mod/compress.mod/Makefile

@@ -40,4 +40,4 @@ distclean: clean
  ../../../src/compat/strcasecmp.h ../../../src/compat/strftime.h \
  ../../../src/mod/modvals.h ../../../src/tandem.h \
  ../../../src/mod/share.mod/share.h \
- ../compress.mod/compress.h ../compress.mod/tclcompress.c
+ ../compress.mod/compress.h 

+ 0 - 3
src/mod/compress.mod/compress.c

@@ -58,8 +58,6 @@ static int compress_file(char *filename, int mode_num);
 static int uncompress_file(char *filename);
 static int is_compressedfile(char *filename);
 
-#include "tclcompress.c"
-
 
 /*
  *    Misc functions.
@@ -419,6 +417,5 @@ char *compress_start(Function *global_funcs)
 
   uff_addtable(compress_uff_table);
   add_tcl_ints(my_tcl_ints);
-  add_tcl_commands(my_tcl_cmds);
   return NULL;
 }

+ 0 - 116
src/mod/compress.mod/tclcompress.c

@@ -1,116 +0,0 @@
-/*
- * tclcompress.c -- part of compress.mod
- *   contains all tcl functions
- *
- * Written by Fabian Knittel <fknittel@gmx.de>
- *
- */
-/*
- * Copyright (C) 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-
-#define NEXT_ARG	{ curr_arg++; argc--; }
-
-static int tcl_compress_file STDVAR
-{
-  int	 mode_num = compress_level, result, curr_arg = 1;
-  char	*fn_src = NULL, *fn_target = NULL;
-
-  BADARGS(2, 5, " ?options...? src-file ?target-file?");
-  while ((argc > 1) && ((argv[curr_arg])[0] == '-')) {
-    if (!strcmp(argv[curr_arg], "-level")) {
-      argc--;
-      if (argc <= 1) {
-	Tcl_AppendResult(irp, "option `-level' needs parameter", NULL);
-	return TCL_ERROR;
-      }
-      curr_arg++;
-      mode_num = atoi(argv[curr_arg]);
-    } else {
-      Tcl_AppendResult(irp, "unknown option `", argv[curr_arg], "'", NULL);
-      return TCL_ERROR;
-    }
-    NEXT_ARG;
-  }
-  if (argc <= 1) {
-    Tcl_AppendResult(irp, "expecting src-filename as parameter", NULL);
-    return TCL_ERROR;
-  }
-  fn_src = argv[curr_arg];
-  NEXT_ARG;
-  if (argc > 1) {
-    fn_target = argv[curr_arg];
-    NEXT_ARG;
-  }
-  if (argc > 1) {
-    Tcl_AppendResult(irp, "trailing, unexpected parameter to command", NULL);
-    return TCL_ERROR;
-  }
-
-  if (fn_target)
-    result = compress_to_file(fn_src, fn_target, mode_num);
-  else
-    result = compress_file(fn_src, mode_num);
-
-  if (result)
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
-  return TCL_OK;
-}
-
-static int tcl_uncompress_file STDVAR
-{
-  int	 result;
-
-  BADARGS(2, 3, " src-file ?target-file?");
-  if (argc == 2)
-    result = uncompress_file(argv[1]);
-  else
-    result = uncompress_to_file(argv[1], argv[2]);
-
-  if (result)
-    Tcl_AppendResult(irp, "1", NULL);
-  else
-    Tcl_AppendResult(irp, "0", NULL);
-  return TCL_OK;
-}
-
-static int tcl_iscompressed STDVAR
-{
-  int	 result;
-
-  BADARGS(2, 2, " compressed-file");
-  result = is_compressedfile(argv[1]);
-  if (result == COMPF_UNCOMPRESSED)
-    Tcl_AppendResult(irp, "0", NULL);	/* Uncompressed.	*/
-  else if (result == COMPF_COMPRESSED)
-    Tcl_AppendResult(irp, "1", NULL);	/* Compressed.		*/
-  else
-    Tcl_AppendResult(irp, "2", NULL);	/* Failed to detect.	*/
-  return TCL_OK;
-}
-
-
-static tcl_cmds my_tcl_cmds[] =
-{
-  {"compressfile",	tcl_compress_file},
-  {"uncompressfile",	tcl_uncompress_file},
-  {"iscompressed",	tcl_iscompressed},
-  {NULL,		NULL}
-};

+ 1 - 2
src/mod/irc.mod/Makefile

@@ -42,5 +42,4 @@ distclean: clean
  ../../../src/mod/modvals.h ../../../src/tandem.h ../irc.mod/irc.h \
  ../../../src/mod/server.mod/server.h \
  ../../../src/mod/channels.mod/channels.h ../irc.mod/chan.c \
- ../irc.mod/mode.c ../irc.mod/cmdsirc.c ../irc.mod/msgcmds.c \
- ../irc.mod/tclirc.c
+ ../irc.mod/mode.c ../irc.mod/cmdsirc.c ../irc.mod/msgcmds.c 

+ 11 - 10
src/mod/irc.mod/irc.c

@@ -88,7 +88,6 @@ static int include_lk = 1;		/* For correct calculation
 #include "mode.c"
 #include "cmdsirc.c"
 #include "msgcmds.c"
-#include "tclirc.c"
 
 static void detect_autokick(char *nick, char *uhost, struct chanset_t *chan, char *msg)
 {
@@ -826,11 +825,12 @@ static void my_setkey(struct chanset_t *chan, char *k)
 {
   free(chan->channel.key);
   if (k == NULL) {
-    chan->channel.key = (char *) malloc(1);
+    chan->channel.key = (char *) calloc(1, 1);
     chan->channel.key[0] = 0;
     return;
   }
-  chan->channel.key = strdup(k);
+  chan->channel.key = (char *) calloc(1, strlen(k) + 1);
+  strcpy(chan->channel.key, k);
 }
 
 /* Adds a ban, exempt or invite mask to the list
@@ -842,13 +842,15 @@ static void newmask(masklist *m, char *s, char *who)
   if (m->mask[0])
     return;			/* Already existent mask */
 
-  m->next = (masklist *) malloc(sizeof(masklist));
+  m->next = (masklist *) calloc(1, sizeof(masklist));
   m->next->next = NULL;
-  m->next->mask = (char *) malloc(1);
+  m->next->mask = (char *) calloc(1, 1);
   m->next->mask[0] = 0;
   free(m->mask);
-  m->mask = strdup(s);
-  m->who = strdup(who);
+  m->mask = (char *) calloc(1, strlen(s) + 1);
+  strcpy(m->mask, s);
+  m->who = (char *) calloc(1, strlen(who) + 1);
+  strcpy(m->who, who);
   m->timer = now;
 }
 
@@ -885,7 +887,7 @@ static int killmember(struct chanset_t *chan, char *nick)
 	    chan->channel.members);
   }
   if (!chan->channel.member) {
-    chan->channel.member = (memberlist *) malloc(sizeof(memberlist));
+    chan->channel.member = (memberlist *) calloc(1, sizeof(memberlist));
     chan->channel.member->nick[0] = 0;
     chan->channel.member->next = NULL;
   }
@@ -949,7 +951,7 @@ static void reset_chan_info(struct chanset_t *chan)
     if (me_op(chan))
       opped += 1;
     free(chan->channel.key);
-    chan->channel.key = (char *) malloc(1);
+    chan->channel.key = (char *) calloc(1, 1);
     chan->channel.key[0] = 0;
     clear_channel(chan, 1);
     chan->status |= CHAN_PEND;
@@ -1683,7 +1685,6 @@ char *irc_start(Function * global_funcs)
   add_builtins("msgc", C_msgc);
 #endif /* S_AUTH */
 
-  add_tcl_commands(tclchan_cmds);
   do_nettype();
   return NULL;
 }

+ 11 - 6
src/mod/irc.mod/mode.c

@@ -390,7 +390,7 @@ static void real_add_mode(struct chanset_t *chan,
     for (i = 0; i < modesperline; i++)
       if (chan->cmode[i].type == 0) {
 	chan->cmode[i].type = type;
-	chan->cmode[i].op = (char *) malloc(l);
+	chan->cmode[i].op = (char *) calloc(1, l);
 	chan->bytes += l;	/* Add 1 for safety */
 	strcpy(chan->cmode[i].op, op);
 	break;
@@ -401,13 +401,15 @@ static void real_add_mode(struct chanset_t *chan,
   else if (plus == '+' && mode == 'k') {
     if (chan->key)
       free(chan->key);
-    chan->key = strdup(op);
+    chan->key = (char *) calloc(1, strlen(op) + 1);
+    strcpy(chan->key, op);
   }
   /* -k ? store removed key */
   else if (plus == '-' && mode == 'k') {
     if (chan->rmkey)
       free(chan->rmkey);
-    chan->rmkey = strdup(op);
+    chan->rmkey = (char *) calloc(1, strlen(op) + 1);
+    strcpy(chan->rmkey, op);
   }
   /* +l ? store limit */
   else if (plus == '+' && mode == 'l')
@@ -678,7 +680,7 @@ static void real_add_mode(struct chanset_t *chan,
     for (i = 0; i < modesperline; i++)
       if (chan->cmode[i].type == 0) {
         chan->cmode[i].type = type;
-        chan->cmode[i].op = (char *) malloc(l);
+        chan->cmode[i].op = (char *) calloc(1, l);
         chan->bytes += l;       /* Add 1 for safety */
         strcpy(chan->cmode[i].op, op);
         break;
@@ -689,13 +691,16 @@ static void real_add_mode(struct chanset_t *chan,
   else if (plus == '+' && mode == 'k') {
     if (chan->key)
       free(chan->key);
-    chan->key = strdup(op);
+    chan->key = (char *) calloc(1, strlen(op) + 1);
+    strcpy(chan->key, op);
+
   }
   /* -k ? store removed key */
   else if (plus == '-' && mode == 'k') {
     if (chan->rmkey)
       free(chan->rmkey);
-    chan->rmkey = strdup(op);
+    chan->rmkey = (char *) calloc(1, strlen(op) + 1);
+    strcpy(chan->rmkey, op);
   }
   /* +l ? store limit */
   else if (plus == '+' && mode == 'l')

+ 0 - 89
src/mod/irc.mod/tclirc.c

@@ -1,89 +0,0 @@
-#ifdef LEAF
-/*
- * tclirc.c -- part of irc.mod
- *
- */
-
-
-/* flushmode <chan> */
-static int tcl_flushmode STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "invalid channel: ", argv[1], NULL);
-    return TCL_ERROR;
-  }
-  flush_mode(chan, NORMAL);
-  return TCL_OK;
-}
-
-static int tcl_resetbans STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "invalid channel ", argv[1], NULL);
-    return TCL_ERROR;
-  }
-  resetbans(chan);
-  return TCL_OK;
-}
-
-static int tcl_resetexempts STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "invalid channel ", argv[1], NULL);
-    return TCL_ERROR;
-  }
-  resetexempts(chan);
-  return TCL_OK;
-}
-
-static int tcl_resetinvites STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "invalid channel ", argv[1], NULL);
-    return TCL_ERROR;
-  }
-  resetinvites(chan);
-  return TCL_OK;
-}
-
-static int tcl_resetchan STDVAR
-{
-  struct chanset_t *chan;
-
-  BADARGS(2, 2, " channel");
-  chan = findchan_by_dname(argv[1]);
-  if (chan == NULL) {
-    Tcl_AppendResult(irp, "invalid channel ", argv[1], NULL);
-    return TCL_ERROR;
-  }
-  reset_chan_info(chan);
-  return TCL_OK;
-}
-
-static tcl_cmds tclchan_cmds[] =
-{
-  {"flushmode",		tcl_flushmode},
-  {"resetbans",		tcl_resetbans},
-  {"resetexempts",	tcl_resetexempts},
-  {"resetinvites",	tcl_resetinvites},
-  {"resetchan",		tcl_resetchan},
-  {NULL,		NULL}
-};
-
-#endif /* LEAF */

+ 3 - 3
src/mod/module.h

@@ -109,8 +109,8 @@
 /* 12 - 15 */
 /* UNUSED 12 */
 /* UNUSED 13 */
-#define add_tcl_commands ((void (*) (tcl_cmds *))global[14])
-#define rem_tcl_commands ((void (*) (tcl_cmds *))global[15])
+/* UNUSED 14 */
+/* UNUSED 15 */
 /* 16 - 19 */
 #define add_tcl_ints ((void (*) (tcl_ints *))global[16])
 #define rem_tcl_ints ((void (*) (tcl_ints *))global[17])
@@ -203,7 +203,7 @@
 /* 84 - 87 */
 #define open_listen_by_af ((int (*) (int *, int))global[84])
 #define open_telnet_dcc ((int (*) (int,char *,char *))global[85])
-#define get_data_ptr(x) ((void *(*)(int))global[86])(x)
+/* UNUSED 86 */
 #define open_telnet ((int (*) (char *, int))global[87])
 /* 88 - 91 */
 #define check_bind_event ((void * (*) (const char *))global[88])

+ 1 - 1
src/mod/server.mod/Makefile

@@ -40,4 +40,4 @@ distclean: clean
  ../../../src/compat/strcasecmp.h ../../../src/compat/strftime.h \
  ../../../src/mod/modvals.h ../../../src/tandem.h \
  ../server.mod/server.h ../server.mod/servmsg.c \
- ../server.mod/cmdsserv.c ../server.mod/tclserv.c
+ ../server.mod/cmdsserv.c

+ 0 - 2
src/mod/server.mod/server.c

@@ -108,7 +108,6 @@ static struct msgq_head mq, hq, modeq;
 static int burst;
 
 #include "cmdsserv.c"
-#include "tclserv.c"
 
 
 /*
@@ -1644,7 +1643,6 @@ char *server_start(Function *global_funcs)
 
   my_tcl_ints[0].val = &use_console_r;
   add_tcl_ints(my_tcl_ints);
-  add_tcl_commands(my_tcl_cmds);
   add_hook(HOOK_SECONDLY, (Function) server_secondly);
   add_hook(HOOK_10SECONDLY, (Function) server_10secondly);
   add_hook(HOOK_5MINUTELY, (Function) server_5minutely);

+ 4 - 4
src/mod/server.mod/servmsg.c

@@ -107,7 +107,7 @@ static int check_bind_msg(char *cmd, char *nick, char *uhost, struct userrec *u,
 
   get_user_flagrec(u, &fr, NULL);
   x = check_bind(BT_msg, cmd, &fr, nick, uhost, u, args);
-  if (x & BIND_RET_LOG) putlog(LOG_CMDS, "*", "in check_bind_msg (%s!%s) !%s! %s %s", nick, uhost, u ? u->handle : "*" , args);
+  if (x & BIND_RET_LOG) putlog(LOG_CMDS, "*", "(%s!%s) !%s! %s %s", nick, uhost, u ? u->handle : "*" , args);
   if (x) return(1);
   else return(0);
 }
@@ -529,7 +529,7 @@ static int gotmsg(char *from, char *msg)
             result = check_bind_msg(code, nick, uhost, u, msg);
             
 	  if (!result)
-	    putlog(LOG_MSGS, "*", " in gotmsg [%s] %s %s", from, code, msg);
+	    putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
         }
 #ifdef S_AUTH
       }
@@ -1190,9 +1190,9 @@ static void connect_server(void)
 
     dcc[servidx].timeval = now;
     dcc[servidx].sock = -1;
-    dcc[servidx].u.dns->host = get_data_ptr(strlen(dcc[servidx].host) + 1);
+    dcc[servidx].u.dns->host = calloc(1, strlen(dcc[servidx].host) + 1);
     strcpy(dcc[servidx].u.dns->host, dcc[servidx].host);
-    dcc[servidx].u.dns->cbuf = get_data_ptr(strlen(pass) + 1);
+    dcc[servidx].u.dns->cbuf = calloc(1, strlen(pass) + 1);
     strcpy(dcc[servidx].u.dns->cbuf, pass);
     dcc[servidx].u.dns->dns_success = server_resolve_success;
     dcc[servidx].u.dns->dns_failure = server_resolve_failure;

+ 0 - 92
src/mod/server.mod/tclserv.c

@@ -1,92 +0,0 @@
-#ifdef LEAF
-/*
- * tclserv.c -- part of server.mod
- *
- */
-
-static int tcl_putquick STDVAR
-{
-  char s[511], *p;
-
-  BADARGS(2, 3, " text ?options?");
-  if ((argc == 3) &&
-      egg_strcasecmp(argv[2], "-next") && egg_strcasecmp(argv[2], "-normal")) {
-      Tcl_AppendResult(irp, "unknown putquick option: should be one of: ",
-		       "-normal -next", NULL);
-    return TCL_ERROR;
-  }
-  strncpy(s, argv[1], 510);
-  s[510] = 0;
-  p = strchr(s, '\n');
-  if (p != NULL)
-    *p = 0;
-   p = strchr(s, '\r');
-  if (p != NULL)
-    *p = 0;
-  if (argc == 3 && !egg_strcasecmp(argv[2], "-next"))
-    dprintf(DP_MODE_NEXT, "%s\n", s);
-  else
-    dprintf(DP_MODE, "%s\n", s);
-  return TCL_OK;
-}
-
-static int tcl_putserv STDVAR
-{
-  char s[511], *p;
-
-  BADARGS(2, 3, " text ?options?");
-  if ((argc == 3) &&
-    egg_strcasecmp(argv[2], "-next") && egg_strcasecmp(argv[2], "-normal")) {
-    Tcl_AppendResult(irp, "unknown putserv option: should be one of: ",
-		     "-normal -next", NULL);
-    return TCL_ERROR;
-  }
-  strncpy(s, argv[1], 510);
-  s[510] = 0;
-  p = strchr(s, '\n');
-  if (p != NULL)
-    *p = 0;
-   p = strchr(s, '\r');
-  if (p != NULL)
-    *p = 0;
-  if (argc == 3 && !egg_strcasecmp(argv[2], "-next"))
-    dprintf(DP_SERVER_NEXT, "%s\n", s);
-  else
-    dprintf(DP_SERVER, "%s\n", s);
-  return TCL_OK;
-}
-
-static int tcl_puthelp STDVAR
-{
-  char s[511], *p;
-
-  BADARGS(2, 3, " text ?options?");
-  if ((argc == 3) &&
-    egg_strcasecmp(argv[2], "-next") && egg_strcasecmp(argv[2], "-normal")) {
-    Tcl_AppendResult(irp, "unknown puthelp option: should be one of: ",
-		     "-normal -next", NULL);
-    return TCL_ERROR;
-  }
-  strncpy(s, argv[1], 510);
-  s[510] = 0;
-  p = strchr(s, '\n');
-  if (p != NULL)
-    *p = 0;
-   p = strchr(s, '\r');
-  if (p != NULL)
-    *p = 0;
-  if (argc == 3 && !egg_strcasecmp(argv[2], "-next"))
-    dprintf(DP_HELP_NEXT, "%s\n", s);
-  else
-    dprintf(DP_HELP, "%s\n", s);
-  return TCL_OK;
-}
-
-static tcl_cmds my_tcl_cmds[] =
-{
-  {"puthelp",		tcl_puthelp},
-  {"putserv",		tcl_putserv},
-  {"putquick",		tcl_putquick},
-  {NULL,		NULL},
-};
-#endif

+ 2 - 2
src/mod/transfer.mod/transfer.c

@@ -1416,11 +1416,11 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from,
   dcc[i].port = port;
   strcpy(dcc[i].nick, nick);
   strcpy(dcc[i].host, "irc");
-  dcc[i].u.xfer->filename = get_data_ptr(strlen(filename) + 1);
+  dcc[i].u.xfer->filename = calloc(1, strlen(filename) + 1);
   strcpy(dcc[i].u.xfer->filename, filename);
   if (strchr(nfn, ' '))
     nfn = buf = replace_spaces(nfn);
-  dcc[i].u.xfer->origname = get_data_ptr(strlen(nfn) + 1);
+  dcc[i].u.xfer->origname = calloc(1, strlen(nfn) + 1);
   strcpy(dcc[i].u.xfer->origname, nfn);
   strncpyz(dcc[i].u.xfer->from, from, NICKLEN);
   strncpyz(dcc[i].u.xfer->dir, dir, DIRLEN);

+ 3 - 3
src/modules.c

@@ -173,8 +173,8 @@ Function global_table[] =
   /* 12 - 15 */
   (Function) 0,
   (Function) 0,
-  (Function) add_tcl_commands,
-  (Function) rem_tcl_commands,
+  (Function) 0,
+  (Function) 0,
   /* 16 - 19 */
   (Function) add_tcl_ints,
   (Function) rem_tcl_ints,
@@ -263,7 +263,7 @@ Function global_table[] =
   /* 84 - 87 */
   (Function) open_listen_by_af,
   (Function) open_telnet_dcc,
-  (Function) get_data_ptr,
+  (Function) 0,
   (Function) open_telnet,
   /* 88 - 91 */
   (Function) check_bind_event,

+ 0 - 1
src/proto.h

@@ -141,7 +141,6 @@ void dupwait_notify(char *);
 char *rand_dccresp();
 
 /* dccutil.c */
-void *get_data_ptr(int);
 void dprintf EGG_VARARGS(int, arg1);
 void chatout EGG_VARARGS(char *, arg1);
 extern void (*shareout) ();

+ 0 - 90
src/tcl.c

@@ -292,96 +292,6 @@ static char *tcl_eggstr(ClientData cdata, Tcl_Interp *irp, char *name1,
   }
 }
 
-/* Add/remove tcl commands
- */
-
-#ifdef USE_BYTE_ARRAYS
-
-static int utf_converter(ClientData cdata, Tcl_Interp *myinterp, int objc,
-			 Tcl_Obj *CONST objv[])
-{
-  char **strings, *byteptr;
-  int i, len, retval, diff;
-  void **callback_data;
-  Function func;
-  ClientData cd;
-
-  objc += 5;
-  strings = (char **)malloc(sizeof(char *) * objc);
-  egg_memset(strings, 0, sizeof(char *) * objc);
-  diff = utftot;
-  utftot += sizeof(char *) * objc;
-  objc -= 5;
-  for (i = 0; i < objc; i++) {
-    byteptr = (char *)Tcl_GetByteArrayFromObj(objv[i], &len);
-    strings[i] = (char *)malloc(len+1);
-    utftot += len+1;
-    strncpy(strings[i], byteptr, len);
-    strings[i][len] = 0;
-  }
-  callback_data = (void **)cdata;
-  func = (Function) callback_data[0];
-  cd = (ClientData) callback_data[1];
-  diff -= utftot;
-  retval = func(cd, myinterp, objc, strings);
-  for (i = 0; i < objc; i++) free(strings[i]);
-  free(strings);
-  utftot += diff;
-  return(retval);
-}
-
-void cmd_delete_callback(ClientData cdata)
-{
-  free(cdata);
-  clientdata_stuff -= sizeof(void *) * 2;
-}
-
-void add_tcl_commands(tcl_cmds *table)
-{
-  void **cdata;
-
-  while (table->name) {
-    cdata = (void **)malloc(sizeof(void *) * 2);
-    clientdata_stuff += sizeof(void *) * 2;
-    cdata[0] = table->func;
-    cdata[1] = NULL;
-    Tcl_CreateObjCommand(interp, table->name, utf_converter, (ClientData) cdata,
-			 cmd_delete_callback);
-    table++;
-  }
-
-}
-
-#else
-
-void add_tcl_commands(tcl_cmds *table)
-{
-  int i;
-
-  for (i = 0; table[i].name; i++)
-    Tcl_CreateCommand(interp, table[i].name, table[i].func, NULL, NULL);
-}
-
-#endif
-
-void rem_tcl_commands(tcl_cmds *table)
-{
-  int i;
-
-  for (i = 0; table[i].name; i++)
-    Tcl_DeleteCommand(interp, table[i].name);
-}
-
-void add_tcl_objcommands(tcl_cmds *table)
-{
-#if (TCL_MAJOR_VERSION >= 8)
-  int i;
-
-  for (i = 0; table[i].name; i++)
-    Tcl_CreateObjCommand(interp, table[i].name, table[i].func, (ClientData) 0, NULL);
-#endif
-}
-
 /* Strings */
 static tcl_strings def_tcl_strings[] =
 {

+ 0 - 2
src/tclegg.h

@@ -54,8 +54,6 @@ typedef struct _tcl_cmds {
   Function func;
 } tcl_cmds;
 
-void add_tcl_commands(tcl_cmds *);
-void rem_tcl_commands(tcl_cmds *);
 void add_tcl_strings(tcl_strings *);
 void rem_tcl_strings(tcl_strings *);
 void add_tcl_coups(tcl_coups *);

+ 22 - 5
src/users.c

@@ -808,11 +808,28 @@ int readuserfile(char *file, struct userrec **ret)
 	  }
         } else if (!strcmp(code, "+")) {
          if (s[0] && lasthand[0] == '*' && lasthand[1] == CHANS_NAME[1]) {
-          if (Tcl_Eval(interp, s) != TCL_OK) {
-           putlog(LOG_MISC, "*", "Tcl error in userfile on line %d", line);
-           putlog(LOG_MISC, "*", "%s", Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY));
-           return 0;
-          }
+           module_entry *me = module_find("channels", 0, 0);
+           if (me) {
+             Function *func = me->funcs;
+             char *options = strdup(s), *chan = NULL, *my_ptr = NULL;
+             my_ptr = options;
+
+             newsplit(&options);
+             newsplit(&options);
+             chan = newsplit(&options);
+/* FIXME: THIS HACK FOR { } REMOVAL SHOULD JUST NOT WRITE THEM? */
+             newsplit(&options);
+             options[strlen(options) - 1] = 0;
+/* Above is a hack to remove { } */
+//             putlog(LOG_MISC, "*", "TCL_CHANNEL_ADD: (%s) %s", chan, options);
+             if ((func[37]) (interp, chan, options) != TCL_OK) {	/* tcl_channel_add() */
+               putlog(LOG_MISC, "*", "Tcl error in userfile on line %d", line);
+               putlog(LOG_MISC, "*", "%s", Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY));
+               free(my_ptr);
+               return 0;
+             }
+             free(my_ptr);
+           }
          }
 	} else if (!strncmp(code, "::", 2)) {
 	  /* channel-specific bans */