Quellcode durchsuchen

* Removed some tcl stuff

svn: 599
Bryan Drewery vor 22 Jahren
Ursprung
Commit
b8ecfc079d
8 geänderte Dateien mit 4 neuen und 798 gelöschten Zeilen
  1. 2 17
      src/Makefile.in
  2. 1 1
      src/mod/module.h
  3. 1 1
      src/modules.c
  4. 0 1
      src/proto.h
  5. 0 15
      src/tcl.c
  6. 0 274
      src/tcldcc.c
  7. 0 103
      src/tclmisc.c
  8. 0 386
      src/tcluser.c

+ 2 - 17
src/Makefile.in

@@ -16,8 +16,8 @@ CPPFLAGS = @CPPFLAGS@
 eggdrop_objs = auth.o bg.o botcmd.o botmsg.o botnet.o \
 chanprog.o cmds.o config.o core_binds.o crypt.o dcc.o dccutil.o debug.o \
 dns.o egg_timer.o flags.o main.o mem.o misc.o misc_file.o modules.o net.o \
-rfc1459.o settings.o tcl.o tcldcc.o tclhash.o tclmisc.o \
-tcluser.o userent.o userrec.o users.o
+rfc1459.o settings.o tcl.o tclhash.o \
+userent.o userrec.o users.o
 
 MAKE_GENERIC = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)'
@@ -213,26 +213,11 @@ tcl.o: tcl.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h proto.
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h
-tcldcc.o: tcldcc.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
- proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
- users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
- compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h tandem.h modules.h mod/modvals.h
 tclhash.o: tclhash.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
  compat/strftime.h match.c egg_timer.h egg_timer.c
-tclmisc.o: tclmisc.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
- proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
- users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
- compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h modules.h mod/modvals.h tandem.h 
-tcluser.o: tcluser.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
- proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
- users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
- compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
- compat/strftime.h tandem.h
 userent.o: userent.c stringfix main.h ../config.h conf.h lang.h eggdrop.h flags.h \
  proto.h ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h \
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \

+ 1 - 1
src/mod/module.h

@@ -281,7 +281,7 @@
 #define movefile ((int (*) (char *, char *))global[146])
 #define copyfile ((int (*) (char *, char *))global[147])
 /* 148 - 151 */
-#define do_tcl ((void (*)(char *, char *))global[148])
+/* UNUSED 148 */
 #define encrypt_string ((char *(*)(const char *, char *))global[149])
 #define decrypt_string ((char *(*)(const char *, char *))global[150])
 #define def_get ((void *(*)(struct userrec *, struct user_entry *))global[151])

+ 1 - 1
src/modules.c

@@ -341,7 +341,7 @@ Function global_table[] =
   (Function) movefile,
   (Function) copyfile,
   /* 148 - 151 */
-  (Function) do_tcl,
+  (Function) 0,
   (Function) encrypt_string,
   (Function) decrypt_string,
   (Function) def_get,

+ 0 - 1
src/proto.h

@@ -341,7 +341,6 @@ int flush_inbuf(int idx);
 /* tcl.c */
 void protect_tcl();
 void unprotect_tcl();
-void do_tcl(char *, char *);
 int findidx(int);
 int findanyidx(int);
 

+ 0 - 15
src/tcl.c

@@ -555,24 +555,9 @@ resetPath:
   Context;
 
   init_traces();
-  /* Add new commands */
-  add_tcl_commands(tcluser_cmds);
-  add_tcl_commands(tcldcc_cmds);
-  add_tcl_commands(tclmisc_cmds);
   Context;
 }
 
-void do_tcl(char *whatzit, char *script)
-{
-  int code;
-
-  code = Tcl_Eval(interp, script);
-  if (code != TCL_OK) {
-    putlog(LOG_MISC, "*", "Tcl error in script for '%s':", whatzit);
-    putlog(LOG_MISC, "*", "%s", interp->result);
-  }
-}
-
 void add_tcl_strings(tcl_strings *list)
 {
   int i;

+ 0 - 274
src/tcldcc.c

@@ -1,274 +0,0 @@
-/*
- * tcldcc.c -- handles:
- *   Tcl stubs for the dcc commands
- *
- */
-
-#include "main.h"
-#include "tandem.h"
-#include "modules.h"
-
-#include <sys/stat.h>
-
-extern Tcl_Interp	*interp;
-extern struct dcc_t	*dcc;
-
-extern int		 dcc_total, backgrd, parties,
-			 do_restart, remote_boots, max_dcc, hub, leaf;
-
-extern char		 botnetnick[], *binname;
-extern party_t		*party;
-extern tand_t		*tandbot;
-extern time_t		 now;
-
-/* Traffic stuff. */
-extern unsigned long otraffic_irc, otraffic_irc_today, itraffic_irc, itraffic_irc_today, otraffic_bn, otraffic_bn_today, itraffic_bn, itraffic_bn_today, otraffic_dcc, otraffic_dcc_today, itraffic_dcc, itraffic_dcc_today, otraffic_trans, otraffic_trans_today, itraffic_trans, itraffic_trans_today, otraffic_unknown, otraffic_unknown_today, itraffic_unknown, itraffic_unknown_today;
-
-int			 enable_simul = 0;
-
-/***********************************************************************/
-
-static int tcl_putdcc STDVAR
-{
-  int i, j;
-
-  BADARGS(3, 3, " idx text");
-  i = atoi(argv[1]);
-  j = findidx(i);
-  if (j < 0) {
-    Tcl_AppendResult(irp, "invalid idx", NULL);
-    return TCL_ERROR;
-  }
-  dumplots(-i, "", argv[2]);
-  return TCL_OK;
-}
-
-static int tcl_hand2idx STDVAR
-{
-  int i;
-  char s[11];
-
-  BADARGS(2, 2, " nickname");
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type->flags & DCT_SIMUL) &&
-        !egg_strcasecmp(argv[1], dcc[i].nick)) {
-      egg_snprintf(s, sizeof s, "%ld", dcc[i].sock);
-      Tcl_AppendResult(irp, s, NULL);
-      return TCL_OK;
-    }
-  Tcl_AppendResult(irp, "-1", NULL);
-  return TCL_OK;
-}
-
-static int tcl_valididx STDVAR
-{
-  int idx;
-
-  BADARGS(2, 2, " idx");
-  idx = findidx(atoi(argv[1]));
-  if (idx < 0 || !(dcc[idx].type->flags & DCT_VALIDIDX))
-     Tcl_AppendResult(irp, "0", NULL);
-  else
-     Tcl_AppendResult(irp, "1", NULL);
-   return TCL_OK;
-}
-
-static int tcl_putbot STDVAR
-{
-  int i;
-  char msg[SGRAB-110];
-
-  BADARGS(3, 3, " botnick message");
-  i = nextbot(argv[1]);
-  if (i < 0) {
-    Tcl_AppendResult(irp, "bot is not in the botnet", NULL);
-    return TCL_ERROR;
-  }
-  strncpyz(msg, argv[2], sizeof msg);
-  botnet_send_zapf(i, botnetnick, argv[1], msg);
-  return TCL_OK;
-}
-
-static int tcl_putallbots STDVAR
-{
-  char msg[SGRAB-110];
-
-  BADARGS(2, 2, " message");
-  strncpyz(msg, argv[1], sizeof msg);
-  botnet_send_zapf_broad(-1, botnetnick, NULL, msg);
-  return TCL_OK;
-}
-
-static int tcl_idx2hand STDVAR
-{
-  int idx;
-
-  BADARGS(2, 2, " idx");
-  idx = findidx(atoi(argv[1]));
-  if (idx < 0) {
-    Tcl_AppendResult(irp, "invalid idx", NULL);
-    return TCL_ERROR;
-  }
-  Tcl_AppendResult(irp, dcc[idx].nick, NULL);
-  return TCL_OK;
-}
-
-static int tcl_islinked STDVAR
-{
-  int i;
-
-  BADARGS(2, 2, " bot");
-  i = nextbot(argv[1]);
-  if (i < 0)
-     Tcl_AppendResult(irp, "0", NULL);
-  else
-     Tcl_AppendResult(irp, "1", NULL);
-   return TCL_OK;
-}
-
-static int tcl_randstring STDVAR
-{
- int length = atoi(argv[1]);
- char s[length+1];
-
- BADARGS(2, 2, " length");
- if (length) {
-  make_rand_str(s,length);
-  Tcl_AppendResult(irp, s, NULL);
- } else
-  Tcl_AppendResult(irp, "", NULL);
- return TCL_OK;
-}
-
-static int tcl_binname STDVAR
-{
- Tcl_AppendResult(irp, binname, NULL);
- return TCL_OK;
-}
-
-static int tcl_bots STDVAR
-{
-  tand_t *bot;
-
-  BADARGS(1, 1, "");
-  for (bot = tandbot; bot; bot = bot->next)
-     Tcl_AppendElement(irp, bot->bot);
-   return TCL_OK;
-}
-
-static int tcl_botlist STDVAR
-{
-  tand_t *bot;
-  char *p;
-  char sh[2], string[20];
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-    CONST char *list[4];
-#else
-    char *list[4];
-#endif
-
-  BADARGS(1, 1, "");
-  sh[1] = 0;
-  list[3] = sh;
-  list[2] = string;
-  for (bot = tandbot; bot; bot = bot->next) {
-    list[0] = bot->bot;
-    list[1] = (bot->uplink == (tand_t *) 1) ? botnetnick : bot->uplink->bot;
-    strncpyz(string, int_to_base10(bot->ver), sizeof string);
-    sh[0] = bot->share;
-    p = Tcl_Merge(4, list);
-    Tcl_AppendElement(irp, p);
-    Tcl_Free((char *) p);
-  }
-  return TCL_OK;
-}
-
-static int tcl_link STDVAR
-{
-  int x, i;
-  char bot[HANDLEN + 1], bot2[HANDLEN + 1];
-
-  BADARGS(2, 3, " ?via-bot? bot");
-  strncpyz(bot, argv[1], sizeof bot);
-  if (argc == 3) {
-    x = 1;
-    strncpyz(bot2, argv[2], sizeof bot2);
-    i = nextbot(bot);
-    if (i < 0)
-      x = 0;
-    else
-      botnet_send_link(i, botnetnick, bot, bot2);
-  } else
-     x = botlink("", -2, bot);
-  egg_snprintf(bot, sizeof bot, "%d", x);
-  Tcl_AppendResult(irp, bot, NULL);
-  return TCL_OK;
-}
-
-static int tcl_unlink STDVAR
-{
-  int i, x;
-  char bot[HANDLEN + 1];
-
-  BADARGS(2, 3, " bot ?comment?");
-  strncpyz(bot, argv[1], sizeof bot);
-  i = nextbot(bot);
-  if (i < 0)
-     x = 0;
-  else {
-    x = 1;
-    if (!egg_strcasecmp(bot, dcc[i].nick))
-      x = botunlink(-2, bot, argv[2]);
-    else
-      botnet_send_unlink(i, botnetnick, lastbot(bot), bot, argv[2]);
-  }
-  egg_snprintf(bot, sizeof bot, "%d", x);
-  Tcl_AppendResult(irp, bot, NULL);
-  return TCL_OK;
-}
-
-static int tcl_rehash STDVAR
-{
-  BADARGS(1, 1, " ");
-#ifdef HUB
-  write_userfile(-1);
-#endif
-  putlog(LOG_MISC, "*", USERF_REHASHING);
-  do_restart = -2;
-  return TCL_OK;
-}
-
-static int tcl_restart STDVAR
-{
-  BADARGS(1, 1, " ");
-  if (!backgrd) {
-    Tcl_AppendResult(interp, "You can't restart a -n bot", NULL);
-    return TCL_ERROR;
-  }
-#ifdef HUB
-  write_userfile(-1);
-#endif
-  putlog(LOG_MISC, "*", MISC_RESTARTING);
-  do_restart = -1;
-  return TCL_OK;
-}
-
-tcl_cmds tcldcc_cmds[] =
-{
-  {"binname",		tcl_binname},
-  {"putidx",		tcl_putdcc},
-  {"hand2idx",		tcl_hand2idx},
-  {"valididx",		tcl_valididx},
-  {"putbot",		tcl_putbot},
-  {"putallbots",	tcl_putallbots},
-  {"idx2hand",		tcl_idx2hand},
-  {"bots",		tcl_bots},
-  {"botlist",		tcl_botlist},
-  {"islinked",		tcl_islinked},
-  {"randstring",        tcl_randstring},
-  {"link",		tcl_link},
-  {"unlink",		tcl_unlink},
-  {"rehash",		tcl_rehash},
-  {"restart",		tcl_restart},
-  {NULL,		NULL}
-};

+ 0 - 103
src/tclmisc.c

@@ -1,103 +0,0 @@
-/*
- * tclmisc.c -- handles:
- *   Tcl stubs for everything else
- *
- */
-
-#include <sys/stat.h>
-#include "main.h"
-#include "modules.h"
-#include "tandem.h"
-
-extern struct dcc_t	*dcc;
-extern char		 origbotname[], botnetnick[], quit_msg[];
-extern struct userrec	*userlist;
-extern time_t		 now;
-extern module_entry	*module_list;
-extern int timesync;
-extern Tcl_Interp *interp;
-
-static int tcl_putlog STDVAR
-{
-  char logtext[501];
-
-  BADARGS(2, 2, " text");
-  strncpyz(logtext, argv[1], sizeof logtext);
-  putlog(LOG_MISC, "*", "%s", logtext);
-  return TCL_OK;
-}
-
-static int tcl_unixtime STDVAR
-{
-  char s[11];
-
-  BADARGS(1, 1, "");
-  egg_snprintf(s, sizeof s, "%lu", (unsigned long) now);
-  Tcl_AppendResult(irp, s, NULL);
-  return TCL_OK;
-}
-
-static int tcl_ctime STDVAR
-{
-  time_t tt;
-  char s[25];
-
-  BADARGS(2, 2, " unixtime");
-  tt = (time_t) atol(argv[1]);
-  strncpyz(s, ctime(&tt), sizeof s);
-  Tcl_AppendResult(irp, s, NULL);
-  return TCL_OK;
-}
-
-static int tcl_rand STDVAR
-{
-  unsigned long x;
-  char s[11];
-
-  BADARGS(2, 2, " limit");
-  if (atol(argv[1]) <= 0) {
-    Tcl_AppendResult(irp, "random limit must be greater than zero", NULL);
-    return TCL_ERROR;
-  }
-  x = random() % (unsigned long) (atol(argv[1]));
-  egg_snprintf(s, sizeof s, "%lu", x);
-  Tcl_AppendResult(irp, s, NULL);
-  return TCL_OK;
-}
-
-static int tcl_timesync STDVAR
-{
-  char buf[50];
-
-  egg_snprintf(buf, sizeof buf, "%li %li %d", (now+timesync), now, timesync);
-  Tcl_AppendResult(irp, buf, NULL);
-  return TCL_OK;
-}
-
-static int tcl_die STDVAR
-{
-  char s[1024];
-
-  BADARGS(1, 2, " ?reason?");
-  if (argc == 2) {
-    egg_snprintf(s, sizeof s, "BOT SHUTDOWN (%s)", argv[1]);
-    strncpyz(quit_msg, argv[1], 1024);
-  } else {
-    strncpyz(s, "BOT SHUTDOWN (No reason)", sizeof s);
-    quit_msg[0] = 0;
-  }
-  kill_bot(s, quit_msg[0] ? quit_msg : "EXIT");
-  return TCL_OK;
-}
-
-tcl_cmds tclmisc_cmds[] =
-{
-  {"putlog",		tcl_putlog},
-  {"unixtime",		tcl_unixtime},
-  {"ctime",		tcl_ctime},
-  {"rand",		tcl_rand},
-  {"timesync",		tcl_timesync},
-  {"exit",		tcl_die},
-  {"die",		tcl_die},
-  {NULL,		NULL}
-};

+ 0 - 386
src/tcluser.c

@@ -1,386 +0,0 @@
-/*
- * tcluser.c -- handles:
- *   Tcl stubs for the user-record-oriented commands
- *
- */
-
-#include "main.h"
-#include "users.h"
-#include "chan.h"
-#include "tandem.h"
-#include "modules.h"
-
-
-extern Tcl_Interp	*interp;
-extern struct userrec	*userlist;
-extern int		 default_flags, dcc_total, ignore_time;
-extern struct dcc_t	*dcc;
-extern char		 origbotname[], botnetnick[];
-extern time_t		 now;
-
-
-static int tcl_chattr STDVAR
-{
-  char *chan, *chg, work[100];
-  struct flag_record pls, mns, user;
-  struct userrec *u;
-
-  BADARGS(2, 4, " handle ?changes? ?channel?");
-  if ((argv[1][0] == '*') || !(u = get_user_by_handle(userlist, argv[1]))) {
-    Tcl_AppendResult(irp, "*", NULL);
-    return TCL_OK;
-  }
-  if (argc == 4) {
-    user.match = FR_GLOBAL | FR_CHAN;
-    chan = argv[3];
-    chg = argv[2];
-  } else if (argc == 3 && argv[2][0]) {
-    int ischan = (findchan_by_dname(argv[2]) != NULL);
-    if (strchr(CHANMETA, argv[2][0]) && !ischan && argv[2][0] != '+' && argv[2][0] != '-') {
-      Tcl_AppendResult(irp, "no such channel", NULL);
-      return TCL_ERROR;
-    } else if (ischan) {
-      /* Channel exists */
-      user.match = FR_GLOBAL | FR_CHAN;
-      chan = argv[2];
-      chg = NULL;
-    } else {
-      /* 3rd possibility... channel doesnt exist, does start with a +.
-       * In this case we assume the string is flags.
-       */
-      user.match = FR_GLOBAL;
-      chan = NULL;
-      chg = argv[2];
-    }
-  } else {
-    user.match = FR_GLOBAL;
-    chan = NULL;
-    chg = NULL;
-  }
-  if (chan && !findchan_by_dname(chan)) {
-    Tcl_AppendResult(irp, "no such channel", NULL);
-    return TCL_ERROR;
-  }
-  get_user_flagrec(u, &user, chan);
-  /* Make changes */
-  if (chg) {
-    pls.match = user.match;
-    break_down_flags(chg, &pls, &mns);
-    /* No-one can change these flags on-the-fly */
-    pls.global &=~(USER_BOT);
-    mns.global &=~(USER_BOT);
-    if (chan) {
-      pls.chan &= ~(BOT_SHARE);
-      mns.chan &= ~(BOT_SHARE);
-    }
-    user.global = sanity_check((user.global |pls.global) &~mns.global);
-    user.udef_global = (user.udef_global | pls.udef_global)
-      & ~mns.udef_global;
-    if (chan) {
-      user.chan = chan_sanity_check((user.chan | pls.chan) & ~mns.chan,
-				    user.global);
-      user.udef_chan = (user.udef_chan | pls.udef_chan) & ~mns.udef_chan;
-    }
-    set_user_flagrec(u, &user, chan);
-  }
-  /* Retrieve current flags and return them */
-  build_flags(work, &user, NULL);
-  Tcl_AppendResult(irp, work, NULL);
-  return TCL_OK;
-}
-
-static int tcl_adduser STDVAR
-{
-  BADARGS(2, 3, " handle ?hostmask?");
-  if (strlen(argv[1]) > HANDLEN)
-    argv[1][HANDLEN] = 0;
-  if ((argv[1][0] == '*') || get_user_by_handle(userlist, argv[1]))
-    Tcl_AppendResult(irp, "0", NULL);
-  else {
-    userlist = adduser(userlist, argv[1], argv[2], "-", default_flags);
-    Tcl_AppendResult(irp, "1", NULL);
-  }
-  return TCL_OK;
-}
-
-static int tcl_deluser STDVAR
-{
-  BADARGS(2, 2, " handle");
-  Tcl_AppendResult(irp, (argv[1][0] == '*') ? "0" :
-		   int_to_base10(deluser(argv[1])), NULL);
-  return TCL_OK;
-}
-
-static int tcl_delhost STDVAR
-{
-  BADARGS(3, 3, " handle hostmask");
-  if ((!get_user_by_handle(userlist, argv[1])) || (argv[1][0] == '*')) {
-    Tcl_AppendResult(irp, "non-existent user", NULL);
-    return TCL_ERROR;
-  }
-  Tcl_AppendResult(irp, delhost_by_handle(argv[1], argv[2]) ? "1" : "0",
-		   NULL);
-  return TCL_OK;
-}
-
-static int tcl_userlist STDVAR
-{
-  struct userrec *u;
-  struct flag_record user, plus, minus;
-  int ok = 1, f = 0;
-
-  BADARGS(1, 3, " ?flags ?channel??");
-  if (argc == 3 && !findchan_by_dname(argv[2])) {
-    Tcl_AppendResult(irp, "Invalid channel: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  if (argc >= 2) {
-    plus.match = FR_GLOBAL | FR_CHAN | FR_BOT;
-    break_down_flags(argv[1], &plus, &minus);
-    f = (minus.global || minus.udef_global || minus.chan ||
-	 minus.udef_chan || minus.bot);
-  }
-  minus.match = plus.match ^ (FR_AND | FR_OR);
-  for (u = userlist; u; u = u->next) {
-    if (argc >= 2) {
-      user.match = FR_GLOBAL | FR_CHAN | FR_BOT | (argc == 3 ? 0 : FR_ANYWH);
-      if (argc == 3) 
-	      get_user_flagrec(u, &user, argv[2]);
-      else
-	      get_user_flagrec(u, &user, NULL);
-
-      if (flagrec_eq(&plus, &user) && !(f && flagrec_eq(&minus, &user)))
-	ok = 1;
-      else
-	ok = 0;
-    }
-    if (ok)
-      Tcl_AppendElement(interp, u->handle);
-  }
-  return TCL_OK;
-}
-
-#ifdef HUB
-static int tcl_save STDVAR
-{
-  write_userfile(-1);
-  return TCL_OK;
-}
-
-static int tcl_reload STDVAR
-{
-  reload();
-  return TCL_OK;
-}
-#endif /* HUB */
-
-static int tcl_chhandle STDVAR
-{
-  struct userrec *u;
-  char newhand[HANDLEN + 1];
-  int x = 1, i;
-
-  BADARGS(3, 3, " oldnick newnick");
-  u = get_user_by_handle(userlist, argv[1]);
-  if (!u)
-     x = 0;
-  else {
-    strncpyz(newhand, argv[2], sizeof newhand);
-    for (i = 0; i < strlen(newhand); i++)
-      if ((newhand[i] <= 32) || (newhand[i] >= 127) || (newhand[i] == '@'))
-	newhand[i] = '?';
-    if (strchr(BADHANDCHARS, newhand[0]) != NULL)
-      x = 0;
-    else if (strlen(newhand) < 1)
-      x = 0;
-    else if (get_user_by_handle(userlist, newhand))
-      x = 0;
-    else if (!egg_strcasecmp(botnetnick, newhand) &&
-             (!(u->flags & USER_BOT) || nextbot (argv [1]) != -1))
-      x = 0;
-    else if (newhand[0] == '*')
-      x = 0;
-  }
-  if (x)
-     x = change_handle(u, newhand);
-  Tcl_AppendResult(irp, x ? "1" : "0", NULL);
-  return TCL_OK;
-}
-
-static int tcl_getting_users STDVAR
-{
-  int i;
-
-  BADARGS(1, 1, "");
-  for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type == &DCC_BOT && dcc[i].status & STAT_GETTING) {
-      Tcl_AppendResult(irp, "1", NULL);
-      return TCL_OK;
-    }
-  }
-  Tcl_AppendResult(irp, "0", NULL);
-  return TCL_OK;
-}
-
-static int tcl_isignore STDVAR
-{
-  BADARGS(2, 2, " nick!user@host");
-  Tcl_AppendResult(irp, match_ignore(argv[1]) ? "1" : "0", NULL);
-  return TCL_OK;
-}
-
-static int tcl_newignore STDVAR
-{
-  time_t expire_time;
-  char ign[UHOSTLEN], cmt[66], from[HANDLEN + 1];
-
-  BADARGS(4, 5, " hostmask creator comment ?lifetime?");
-  strncpyz(ign, argv[1], sizeof ign);
-  strncpyz(from, argv[2], sizeof from);
-  strncpyz(cmt, argv[3], sizeof cmt);
-  if (argc == 4)
-     expire_time = now + (60 * ignore_time);
-  else {
-    if (argc == 5 && atol(argv[4]) == 0)
-      expire_time = 0L;
-    else
-      expire_time = now + (60 * atol(argv[4])); /* This is a potential crash. FIXME  -poptix */
-  }
-  addignore(ign, from, cmt, expire_time);
-  return TCL_OK;
-}
-
-static int tcl_killignore STDVAR
-{
-  BADARGS(2, 2, " hostmask");
-  Tcl_AppendResult(irp, delignore(argv[1]) ? "1" : "0", NULL);
-  return TCL_OK;
-}
-
-/* { hostmask note expire-time create-time creator }
- */
-static int tcl_ignorelist STDVAR
-{
-  struct igrec *i;
-  char expire[11], added[11], *p;
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-    CONST char *list[5];
-#else
-    char *list[5];
-#endif
-
-  BADARGS(1, 1, "");
-  for (i = global_ign; i; i = i->next) {
-    list[0] = i->igmask;
-    list[1] = i->msg;
-    egg_snprintf(expire, sizeof expire, "%lu", i->expire);
-    list[2] = expire;
-    egg_snprintf(added, sizeof added, "%lu", i->added);
-    list[3] = added;
-    list[4] = i->user;
-    p = Tcl_Merge(5, list);
-    Tcl_AppendElement(irp, p);
-    Tcl_Free((char *) p);
-  }
-  return TCL_OK;
-}
-
-static int tcl_getuser STDVAR
-{
-  struct user_entry_type *et;
-  struct userrec *u;
-  struct user_entry *e;
-
-  BADARGS(3, 999, " handle type");
-  if (!(et = find_entry_type(argv[2])) && egg_strcasecmp(argv[2], "HANDLE")) {
-    Tcl_AppendResult(irp, "No such info type: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  if (!(u = get_user_by_handle(userlist, argv[1]))) {
-    if (argv[1][0] != '*') {
-      Tcl_AppendResult(irp, "No such user.", NULL);
-      return TCL_ERROR;
-    } else
-      return TCL_OK;		/* silently ignore user * */
-  }
-  if (!egg_strcasecmp(argv[2], "HANDLE")) {
-    Tcl_AppendResult(irp,u->handle, NULL);
-  } else {
-  e = find_user_entry(et, u);
-  if (e)
-    return et->tcl_get(irp, u, e, argc, argv);
-  }
-  return TCL_OK;
-}
-
-static int tcl_setuser STDVAR
-{
-  struct user_entry_type *et;
-  struct userrec *u;
-  struct user_entry *e;
-  int r;
-  module_entry *me;
-
-  BADARGS(3, 999, " handle type ?setting....?");
-  if (!(et = find_entry_type(argv[2]))) {
-    Tcl_AppendResult(irp, "No such info type: ", argv[2], NULL);
-    return TCL_ERROR;
-  }
-  if (!(u = get_user_by_handle(userlist, argv[1]))) {
-    if (argv[1][0] != '*') {
-      Tcl_AppendResult(irp, "No such user.", NULL);
-      return TCL_ERROR;
-    } else
-      return TCL_OK;		/* Silently ignore user * */
-  }
-  me = module_find("irc", 0, 0);
-  if (me && !strcmp(argv[2], "hosts") && argc == 3) {
-    Function *func = me->funcs;
-
-    (func[IRC_CHECK_THIS_USER]) (argv[1], 1, NULL);
-  }
-  if (!(e = find_user_entry(et, u))) {
-    e = malloc(sizeof(struct user_entry));
-    e->type = et;
-    e->name = NULL;
-    e->u.list = NULL;
-    list_insert((&(u->entries)), e);
-  }
-  r = et->tcl_set(irp, u, e, argc, argv);
-  /* Yeah... e is freed, and we read it... (tcl: setuser hand HOSTS none) */
-  if (!e->u.list) {
-    if (list_delete((struct list_type **) &(u->entries),
-		    (struct list_type *) e))
-      free(e);
-    /* else maybe already freed... (entry_type==HOSTS) <drummer> */
-  }
-  if (me && !strcmp(argv[2], "hosts") && argc == 4) {
-    Function *func = me->funcs;
-
-    (func[IRC_CHECK_THIS_USER]) (argv[1], 0, NULL);
-  }
-  return r;
-}
-
-tcl_cmds tcluser_cmds[] =
-{
-  {"chattr",		tcl_chattr},
-  {"adduser",		tcl_adduser},
-  {"deluser",		tcl_deluser},
-  {"delhost",		tcl_delhost},
-  {"userlist",		tcl_userlist},
-#ifdef HUB
-  {"save",		tcl_save},
-  {"reload",		tcl_reload},
-#endif /* HUB */
-  {"chhandle",		tcl_chhandle},
-  {"chnick",		tcl_chhandle},
-  {"getting-users",	tcl_getting_users},
-  {"isignore",		tcl_isignore},
-  {"newignore",		tcl_newignore},
-  {"killignore",	tcl_killignore},
-  {"ignorelist",	tcl_ignorelist},
-  {"getuser",		tcl_getuser},
-  {"setuser",		tcl_setuser},
-  {NULL,		NULL}
-};