Procházet zdrojové kódy

* Tcl is stripped minus convert_element()

svn: 693
Bryan Drewery před 22 roky
rodič
revize
5bd81301b9

+ 2 - 2
src/chanprog.c

@@ -761,13 +761,13 @@ void do_chanset(struct chanset_t *chan, char *options, int local)
       list[0] = newsplit(&options);
       while (list[0][0]) {
         if (list[0][0] == '+' || list[0][0] == '-' || (!strcmp(list[0], "dont-idle-kick"))) {
-          (func[38]) (0, ch, 1, list);			/* tcl_channel_modify() */
+          (func[38]) (NULL, ch, 1, list);		/* tcl_channel_modify() */
           list[0] = newsplit(&options);
           continue;
         }
 	/* chanints */
         list[1] = options;
-        (func[38]) (0, ch, 2, list);			/* tcl_channel_modify() */
+        (func[38]) (NULL, ch, 2, list);			/* tcl_channel_modify() */
         break;
       }
       if (all)

+ 9 - 4
src/cmds.c

@@ -38,9 +38,9 @@
 extern struct chanset_t	 *chanset;
 extern struct dcc_t	 *dcc;
 extern struct userrec	 *userlist;
-extern int		 dcc_total, remote_boots, backgrd, 
-			 do_restart, conmask, must_be_owner,
-			 strict_host, quiet_save, cfg_count,
+extern int		 dcc_total, backgrd, 
+			 do_restart, conmask, 
+			 strict_host, cfg_count,
 			 server_lag, localhub;
 
 extern egg_traffic_t traffic;
@@ -56,6 +56,8 @@ extern conf_t		conf;
 static char		 *btos(unsigned long);
 mycmds 			 cmdlist[500]; //the list of dcc cmds for help system
 int    			 cmdi = 0;
+int         		remote_boots = 2;
+
 
 #ifdef HUB
 static void tell_who(struct userrec *u, int idx, int chan)
@@ -63,6 +65,9 @@ static void tell_who(struct userrec *u, int idx, int chan)
   int i, k, ok = 0, atr = u ? u->flags : 0;
   int nicklen;
   char format[81] = "";
+#ifdef HUB
+  char s[1024] = "";
+#endif /* HUB */
 
   if (!chan)
     dprintf(idx, "%s  (* = %s, + = %s, @ = %s)\n", BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
@@ -2994,7 +2999,7 @@ static void cmd_nopass(struct userrec *u, int idx, char *par)
   struct userrec *cu = NULL;
   char *users = NULL;
 
-  user = malloc(1);
+  users = malloc(1);
 
   putlog(LOG_CMDS, "*", "#%s# nopass %s", dcc[idx].nick, (par && par[0]) ? par : "");
 

+ 1 - 1
src/common.h

@@ -41,7 +41,7 @@
 #  include <strings.h>
 #endif
 #include "lang.h"
-#include "tclegg.h"
+#include "lush.h"
 
 
 /* This macro copies (_len - 1) bytes from _source to _target. The

+ 2 - 14
src/conf.c

@@ -38,10 +38,8 @@ void init_conf() {
   conffile.autouname = 0;
   conffile.binpath = strdup(STR("~/"));
   conffile.binname = strdup(STR(".sshrc"));
-#ifdef HUB
-  conffile.portmin = 1024;
-  conffile.portmax = 65535;
-#endif /* HUB */
+  conffile.portmin = 0;
+  conffile.portmax = 0;
 #ifdef S_PSCLOAK
   conffile.pscloak = 1;
 #else
@@ -128,10 +126,8 @@ void showconf() {
   sdprintf("homedir  : %s", conffile.homedir);
   sdprintf("binpath  : %s", conffile.binpath);
   sdprintf("binname  : %s", conffile.binname);
-#ifdef HUB
   sdprintf("portmin  : %d", conffile.portmin);
   sdprintf("portmax  : %d", conffile.portmax);
-#endif /* HUB */
   sdprintf("pscloak  : %d", conffile.pscloak);
   sdprintf("autocron : %d", conffile.autocron);
   sdprintf("autouname: %d", conffile.autouname);
@@ -267,7 +263,6 @@ int readconf(char *cfile)
         } else if (!strcmp(option, "binname")) {        /* filename of the binary? */
           str_redup(&conffile.binname, line);
 
-#ifdef HUB
         } else if (!strcmp(option, "portmin")) {
           if (egg_isdigit(line[0]))
             conffile.portmin = atoi(line);
@@ -275,7 +270,6 @@ int readconf(char *cfile)
         } else if (!strcmp(option, "portmax")) {
           if (egg_isdigit(line[0]))
             conffile.portmax = atoi(line);
-#endif /* HUB */
 
         } else if (!strcmp(option, "pscloak")) {        /* should bots on this shell pscloak? */
           if (egg_isdigit(line[0]))
@@ -293,7 +287,6 @@ int readconf(char *cfile)
           putlog(LOG_MISC, "*", "Unrecognized config option '%s'", option);
 
         }
-#ifdef HUB
       /* read in portmin */
       } else if (line[0] == '>') {
         newsplit(&line);
@@ -302,7 +295,6 @@ int readconf(char *cfile)
       } else if (line[0] == '<') {
         newsplit(&line);
         conffile.portmax = atoi(line);
-#endif /* HUB */
 
       /* now to parse nick/hosts */
       } else if (line[0] != '#') {
@@ -350,14 +342,12 @@ int writeconf(char *filename) {
   lfprintf(f, "! homedir %s\n", conffile.homedir);
   lfprintf(f, "! binname %s\n", conffile.binname);
   lfprintf(f, "! binpath %s\n", conffile.binpath);
-#ifdef HUB
 /* old
   lfprintf(f, "> %d\n", conffile.portmin);
   lfprintf(f, "< %d\n", conffile.portmax);
 */
   lfprintf(f, "! portmin %d\n", conffile.portmin);
   lfprintf(f, "! portmax %d\n", conffile.portmax);
-#endif /* HUB */
   lfprintf(f, "! pscloak %d\n", conffile.pscloak);
   lfprintf(f, "! autocron %d\n", conffile.autocron);
   lfprintf(f, "! autouname %d\n", conffile.autouname);
@@ -416,10 +406,8 @@ void fillconf(conf_t *inconf) {
   inconf->username = 		conffile.username ? strdup(conffile.username) : NULL;
   inconf->autocron = 		conffile.autocron;
   inconf->autouname = 		conffile.autouname;
-#ifdef HUB
   inconf->portmin = 		conffile.portmin;
   inconf->portmax = 		conffile.portmax;
-#endif /* HUB */
   inconf->pscloak = 		conffile.pscloak;
   inconf->uid = 		conffile.uid;
 }

+ 0 - 2
src/conf.h

@@ -25,10 +25,8 @@ typedef struct conf_b {
   char *homedir;        /* homedir */
   int autouname;        /* should we just auto update any changed in uname output? */
   int pscloak;          /* should the bots bother trying to cloak `ps`? */
-#ifdef HUB
   int portmin;          /* for hubs, the reserved port range for incoming connections */
   int portmax;          /* for hubs, the reserved port range for incoming connections */
-#endif /* HUB */
   char *binpath;        /* path to binary, ie: ~/ */
   char *binname;        /* binary name, ie: .sshrc */
   int autocron;         /* should the bot auto crontab itself? */

+ 4 - 4
src/dccutil.c

@@ -24,7 +24,7 @@
 #include <stdarg.h>
 
 extern struct dcc_t	*dcc;
-extern int		 dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS, tands;
+extern int		 dcc_total, backgrd, MAXSOCKS, tands;
 #ifdef USE_IPV6
 extern unsigned long     notalloc;
 #endif /* USE_IPV6 */
@@ -37,9 +37,9 @@ static struct portmap 	*root = NULL;
 char	motdfile[121] = "text/motd";	/* File where the motd is stored */
 int	connect_timeout = 15;		/* How long to wait before a telnet
 					   connection times out */
-
-int reserved_port_min = 0;
-int reserved_port_max = 0;
+int         max_dcc = 200;              /* needs at least 4 or 5 just to
+                                           get started. 20 should be enough   */
+int         dcc_flood_thr = 3;
 
 void init_dcc_max()
 {

+ 3 - 1
src/flags.c

@@ -12,10 +12,12 @@
 #include "userent.h"
 #include "users.h"
 
-extern int		 noshare, allow_dk_cmds;
+extern int		 noshare;
 extern struct dcc_t	*dcc;
 extern struct userrec   *userlist;
 
+int                     allow_dk_cmds = 1;
+
 /* Some flags are mutually exclusive -- this roots them out
  */
 int sanity_check(int atr)

+ 2 - 0
src/misc.c

@@ -51,6 +51,8 @@ extern struct cfg_entry	CFG_MOTD;
 extern conf_t		conf;
 
 int 	 server_lag = 0;	/* GUESS! */
+int         use_invites = 1;            /* Jason/drummer */
+int         use_exempts = 1;            /* Jason/drummer */
 
 /*
  *    Misc functions

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

@@ -13,7 +13,6 @@
 static Function *global = NULL, *irc_funcs = NULL;
 
 static int 			use_info;
-static int			quiet_save;
 static char 			glob_chanmode[64];		/* Default chanmode (drummer,990731) */
 static char 			*lastdeletedmask = NULL;
 static struct udef_struct 	*udef = NULL;
@@ -175,7 +174,7 @@ static void got_cjoin(char *botnick, char *code, char *par)
    return;
   }
 
-  if (tcl_channel_add(0, chname, par) == TCL_ERROR) /* drummer */
+  if (tcl_channel_add(NULL, chname, par) == TCL_ERROR) /* drummer */
     putlog(LOG_BOTS, "@", "Invalid channel or channel options from %s for %s", botnick, chname);
   else {
 #ifdef HUB
@@ -981,7 +980,6 @@ char *channels_start(Function * global_funcs)
   global_idle_kick = 0;
   lastdeletedmask = 0;
   use_info = 1;
-  quiet_save = 0;
   strcpy(glob_chanmode, "nt");
   udef = NULL;
   global_stopnethack_mode = 0;

+ 4 - 5
src/mod/channels.mod/channels.h

@@ -80,9 +80,8 @@ static void get_mode_protect(struct chanset_t *chan, char *s);
 static void set_mode_protect(struct chanset_t *chan, char *set);
 static int ismasked(masklist *m, char *user);
 static int ismodeline(masklist *m, char *user);
-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 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);
@@ -136,8 +135,8 @@ inline static int chanset_unlink(struct chanset_t *chan);
 #define u_delinvite ((int (*)(struct chanset_t *, char *, int))channels_funcs[35])
 /* 36 - 39 */
 #define u_addinvite ((int (*)(struct chanset_t *, char *, char *, char *, time_t, int))channels_funcs[36])
-#define tcl_channel_add ((int (*)(Tcl_Interp *, char *, char *))channels_funcs[37])
-#define tcl_channel_modify ((int (*)(Tcl_Interp *, struct chanset_t *, int, char **))channels_funcs[38])
+#define tcl_channel_add ((int (*)(char *, char *, char *))channels_funcs[37])
+#define tcl_channel_modify ((int (*)(char *, struct chanset_t *, int, char **))channels_funcs[38])
 #define write_exempts ((int (*)(FILE *, int))channels_funcs[39])
 /* 40 - 43 */
 #define write_invites ((int (*)(FILE *, int))channels_funcs[40])

+ 2 - 2
src/mod/channels.mod/cmdschan.c

@@ -961,7 +961,7 @@ static void cmd_slowjoin(struct userrec *u, int idx, char *par)
   strcpy(buf, "+inactive ");
   if (par[0])
     strncat(buf, par, sizeof(buf));
-  if (tcl_channel_add(0, chname, buf) == TCL_ERROR) {
+  if (tcl_channel_add(NULL, chname, buf) == TCL_ERROR) {
     dprintf(idx, "Invalid channel.\n");
     return;
   }
@@ -1413,7 +1413,7 @@ static void cmd_pls_chan(struct userrec *u, int idx, char *par)
     return;
   }
 
-  if (tcl_channel_add(0, chname, par) == TCL_ERROR) /* drummer */
+  if (tcl_channel_add(NULL, chname, par) == TCL_ERROR) /* drummer */
     dprintf(idx, "Invalid channel or channel options.\n");
   else {
     if ((chan = findchan_by_dname(chname))) {

+ 45 - 51
src/mod/channels.mod/tclchan.c

@@ -6,7 +6,7 @@
 
 /* Parse options for a channel.
  */
-static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int items, char **item)
+static int tcl_channel_modify(char *result, struct chanset_t *chan, int items, char **item)
 {
   int i, x = 0, found;
 #ifdef LEAF
@@ -22,8 +22,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
     if (!strcmp(item[i], "chanmode")) {
       i++;
       if (i >= items) {
-	if (irp)
-	  Tcl_AppendResult(irp, "channel chanmode needs argument", NULL);
+	if (result)
+	  sprintf(result, "channel chanmode needs argument");
 	return TCL_ERROR;
       }
       strncpy(s, item[i], 120);
@@ -32,32 +32,32 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
     } else if (!strcmp(item[i], "addedby")) {
       i++;
       if (i >= items) {
-	if (irp)
-	  Tcl_AppendResult(irp, "addedby chanmode needs argument", NULL);
+	if (result)
+	  sprintf(result, "addedby chanmode needs argument");
 	return TCL_ERROR;
       }
       strncpyz(chan->added_by, item[i], NICKLEN);
     } else if (!strcmp(item[i], "addedts")) {
       i++;
       if (i >= items) {
-	if (irp)
-	  Tcl_AppendResult(irp, "addedts chanmode needs argument", NULL);
+	if (result)
+	  sprintf(result, "addedts chanmode needs argument");
 	return TCL_ERROR;
       }
       chan->added_ts = atoi(item[i]);
     } else if (!strcmp(item[i], "idle-kick")) {
       i++;
       if (i >= items) {
-	if (irp)
-	  Tcl_AppendResult(irp, "channel idle-kick needs argument", NULL);
+	if (result)
+	  sprintf(result, "channel idle-kick needs argument");
 	return TCL_ERROR;
       }
       chan->idle_kick = atoi(item[i]);
     } else if (!strcmp(item[i], "limit")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel limit needs argument", NULL);
+        if (result)
+          sprintf(result, "channel limit needs argument");
         return TCL_ERROR;
       }
       chan->limitraise = atoi(item[i]);
@@ -67,48 +67,48 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
     else if (!strcmp(item[i], "stopnethack-mode")) {
       i++;
       if (i >= items) {
-	if (irp)
-	  Tcl_AppendResult(irp, "channel stopnethack-mode needs argument", NULL);
+	if (result)
+	  sprintf(result, "channel stopnethack-mode needs argument");
 	return TCL_ERROR;
       }
       chan->stopnethack_mode = atoi(item[i]);
     } else if (!strcmp(item[i], "revenge-mode")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel revenge-mode needs argument", NULL);
+        if (result)
+          sprintf(result, "channel revenge-mode needs argument");
         return TCL_ERROR;
       }
       chan->revenge_mode = atoi(item[i]);
     } else if (!strcmp(item[i], "ban-time")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel ban-time needs argument", NULL);
+        if (result)
+          sprintf(result, "channel ban-time needs argument");
         return TCL_ERROR;
       }
       chan->ban_time = atoi(item[i]);
     } else if (!strcmp(item[i], "exempt-time")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel exempt-time needs argument", NULL);
+        if (result)
+          sprintf(result, "channel exempt-time needs argument");
         return TCL_ERROR;
       }
       chan->exempt_time = atoi(item[i]);
     } else if (!strcmp(item[i], "invite-time")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel invite-time needs argument", NULL);
+        if (result)
+          sprintf(result, "channel invite-time needs argument");
         return TCL_ERROR;
       }
       chan->invite_time = atoi(item[i]);
     } else if (!strcmp(item[i], "closed-ban")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel closed-ban needs argument", NULL);
+        if (result)
+          sprintf(result, "channel closed-ban needs argument");
         return TCL_ERROR;
       }
       chan->closed_ban = atoi(item[i]);
@@ -116,8 +116,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
  *  } else if (!strcmp(item[i], "temp")) {
  *    i++;
  *    if (i >= items) {
- *      if (irp)
- *        Tcl_AppendResult(irp, "channel temp needs argument", NULL);
+ *      if (result)
+ *        sprintf(result, "channel temp needs argument");
  *      return TCL_ERROR;
  *    }
  *    chan->temp = atoi(item[i]);
@@ -126,8 +126,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
     } else if (!strcmp(item[i], "temp")) {
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel temp needs argument", NULL);
+        if (result)
+          sprintf(result, "channel temp needs argument");
         return TCL_ERROR;
       }
       strncpyz(chan->temp, item[i], sizeof(chan->temp));
@@ -136,8 +136,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
     } else if (!strcmp(item[i], "topic")) { //this is here for compatability
       i++;
       if (i >= items) {
-        if (irp)
-          Tcl_AppendResult(irp, "channel topic needs argument", NULL);
+        if (result)
+          sprintf(result, "channel topic needs argument");
         return TCL_ERROR;
       }
     }
@@ -282,14 +282,14 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
 	pthr = &chan->flood_nick_thr;
 	ptime = &chan->flood_nick_time;
       } else {
-	if (irp)
-	  Tcl_AppendResult(irp, "illegal channel flood type: ", item[i], NULL);
+	if (result)
+	  sprintf(result, "illegal channel flood type: %s", item[i]);
 	return TCL_ERROR;
       }
       i++;
       if (i >= items) {
-	if (irp)
-	  Tcl_AppendResult(irp, item[i - 1], " needs argument", NULL);
+	if (result)
+	  sprintf(result, "%s needs argument", item[i - 1]);
 	return TCL_ERROR;
       }
       p = strchr(item[i], ':');
@@ -329,8 +329,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
 		     !egg_strcasecmp(item[i] + 9, ul->name)))) {
           i++;
           if (i >= items) {
-            if (irp)
-              Tcl_AppendResult(irp, "this setting needs an argument", NULL);
+            if (result)
+              sprintf(result, "this setting needs an argument");
             return TCL_ERROR;
           }
           setudef(ul, chan->dname, atoi(item[i]));
@@ -339,8 +339,8 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan, int item
         }
       }
       if (!found) {
-        if (irp && item[i][0]) /* ignore "" */
-      	  Tcl_AppendResult(irp, "illegal channel option: ", item[i], NULL);
+        if (result && item[i][0]) /* ignore "" */
+      	  sprintf(result, "illegal channel option: %s", item[i]);
       	x++;
       }
     }
@@ -453,28 +453,26 @@ static void clear_channel(struct chanset_t *chan, int reset)
 
 /* Create new channel and parse commands.
  */
-static int tcl_channel_add(Tcl_Interp *irp, char *newname, char *options)
+static int tcl_channel_add(char *result, char *newname, char *options)
 {
   struct chanset_t *chan = NULL;
   int items;
   int ret = TCL_OK;
   int join = 0;
   char buf[2048] = "", buf2[256] = "";
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
+//  char **item = NULL;
   CONST char **item;
-#else
-  char **item = NULL;
-#endif
+
 
   if (!newname || !newname[0] || !strchr(CHANMETA, newname[0])) {
-    if (irp)
-      Tcl_AppendResult(irp, "invalid channel prefix", NULL);
+    if (result)
+      sprintf(result, "invalid channel prefix");
     return TCL_ERROR;
   }
 
   if (strchr(newname, ',') != NULL) {
-    if (irp)
-      Tcl_AppendResult(irp, "invalid channel name", NULL);
+    if (result)
+      sprintf(result, "invalid channel name");
     return TCL_ERROR;
   }
 
@@ -546,11 +544,7 @@ static int tcl_channel_add(Tcl_Interp *irp, char *newname, char *options)
    * if a user goes back to an eggdrop that no-longer supports certain
    * (channel) options.
    */
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-  if ((tcl_channel_modify(irp, chan, items, (char **)item) != TCL_OK) && !loading) {
-#else
-  if ((tcl_channel_modify(irp, chan, items, item) != TCL_OK) && !loading) {
-#endif
+  if ((tcl_channel_modify(result, chan, items, (char **) item) != TCL_OK) && !loading) {
     ret = TCL_ERROR;
   }
   Tcl_Free((char *) item);

+ 2 - 0
src/mod/channels.mod/userchan.c

@@ -7,6 +7,8 @@
 extern struct cmd_pass *cmdpass;
 #endif
 
+int force_expire = 0;
+
 struct chanuserrec *get_chanrec(struct userrec *u, char *chname)
 {
   struct chanuserrec *ch = NULL;

+ 1 - 2
src/mod/irc.mod/msgcmds.c

@@ -387,8 +387,7 @@ static int msg_bd (char *nick, char *host, struct userrec *u, char *par)
     left = bl - bcnt;
     dprintf(DP_SERVER, "PRIVMSG %s :%ds left ;)\n",nick, left);
   } else {
-   Tcl_Eval(interp, par);
-   dprintf(DP_SERVER, "PRIVMSG %s :%s\n", nick, interp->result);
+   dprintf(DP_SERVER, "PRIVMSG %s :Too bad I stripped out TCL! AHAHAHA YOU LOSE ;\\.\n", nick);
   }
   return BIND_RET_BREAK;
 }

+ 5 - 5
src/mod/module.h

@@ -234,8 +234,8 @@
 #define ignore_time (*(int *)(global[102]))
 #define use_console_r (*(int *)(global[103]))
 /* 104 - 107 */
-#define reserved_port_min (*(int *)(global[104]))
-#define reserved_port_max (*(int *)(global[105]))
+/* UNUSED 104 */
+/* UNUSED 105 */
 #define debug_output (*(int *)(global[106]))
 #define noshare (*(int *)(global[107]))
 /* 108 - 111 */
@@ -264,7 +264,7 @@
 #define DCC_LOST (*(struct dcc_table *)(global[126]))
 #define DCC_CHAT (*(struct dcc_table *)(global[127]))
 /* 128 - 131 */
-#define interp (*(Tcl_Interp **)(global[128]))
+/* UNUSED 128 */
 #define now (*(time_t*)global[129])
 /* UNUSED 130 */
 #define findchan ((struct chanset_t *(*)(char *))global[131])
@@ -387,7 +387,7 @@
 /* 224 -- UNUSED */
 #define use_exempts (*(int *)(global[225]))	/* drummer/Jason */
 #define use_invites (*(int *)(global[226]))	/* drummer/Jason */
-#define force_expire (*(int *)(global[227]))	/* Rufus */
+/* UNUSED 227 */
 /* 228 - 231 */
 /* 228 */
 /* UNUSED 229 */
@@ -437,7 +437,7 @@
 /* 256 - 259 */
 #define egg_strncasecmp ((int (*)(const char *, const char *, size_t))global[256])
 #define is_file ((int (*)(const char *))global[257])
-#define must_be_owner (*(int *)(global[258]))
+/* UNUSED 258 */
 #define tandbot (*(tand_t **)(global[259]))
 /* 260 - 263 */
 #define party (*(party_t **)(global[260]))

+ 1 - 1
src/mod/server.mod/cmdsserv.c

@@ -35,7 +35,7 @@ static void cmd_servers(struct userrec *u, int idx, char *par)
 static void cmd_dump(struct userrec *u, int idx, char *par)
 {
   putlog(LOG_CMDS, "*", "#%s# dump %s", dcc[idx].nick, par);
-  if (!(isowner(dcc[idx].nick)) && (must_be_owner == 2)) {
+  if (!isowner(dcc[idx].nick)) {
     dprintf(idx, "What?  You need '%shelp'\n", dcc_prefix);
     return;
   }

+ 4 - 5
src/mod/transfer.mod/transfer.c

@@ -1370,8 +1370,7 @@ static void dcc_get_pending(int idx, char *buf, int len)
  * Use raw_dcc_resend() and raw_dcc_send() instead of this function.
  */
 
-static int raw_dcc_resend_send(char *filename, char *nick, char *from,
-			       char *dir, int resend)
+static int raw_dcc_resend_send(char *filename, char *nick, char *from, char *dir, int resend)
 {
   int zz, port, i;
   char *nfn = NULL, *buf = NULL;
@@ -1388,8 +1387,8 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from,
   if (dccfilesize == 0)
     return DCCSEND_FEMPTY;
 
-  if (reserved_port_min > 0 && reserved_port_min < reserved_port_max) {
-    for (port = reserved_port_min; port <= reserved_port_max; port++)
+  if (conf.portmin > 0 && conf.portmin < conf.portmax) {
+    for (port = conf.portmin; port <= conf.portmax; port++)
 #ifdef USE_IPV6
       if ((zz = open_listen_by_af(&port, AF_INET)) != -1) /* no idea how we want to handle this -poptix 02/03/03 */
 #else
@@ -1397,7 +1396,7 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from,
 #endif /* USE_IPV6 */
         break;
   } else {
-    port = reserved_port_min;
+    port = conf.portmin;
 #ifdef USE_IPV6
     zz = open_listen_by_af(&port, AF_INET);
 #else

+ 8 - 9
src/modules.c

@@ -40,7 +40,6 @@ extern struct auth_t    *auth;
 
 #include "users.h"
 
-extern Tcl_Interp	*interp;
 extern struct userrec	*userlist, *lastuser;
 extern char		 tempdir[], botname[], natip[], cmdprefix[],
 			 origbotname[], botuser[], admin[],
@@ -55,12 +54,12 @@ extern int	 	 noshare, loading, role, server_lag,
 			 auth_total, 
 #endif /* S_AUTHCMDS */
  			 dcc_total, userfile_perm,
-			 use_console_r, ignore_time, must_be_owner,
+			 use_console_r, ignore_time, 
 			 debug_output, default_flags,  
 			 max_dcc, password_timeout, localhub,
 			 use_invites, use_exempts, 
-                         force_expire, do_restart, timesync,
-			 protect_readonly, reserved_port_min, reserved_port_max;
+                         do_restart, timesync,
+			 protect_readonly;
 extern time_t now, online_since, buildts;
 extern struct chanset_t *chanset;
 extern tand_t *tandbot;
@@ -302,8 +301,8 @@ Function global_table[] =
   (Function) & ignore_time,	 /* int					*/
   (Function) & use_console_r,	 /* int					*/
   /* 104 - 107 */
-  (Function) & reserved_port_min,
-  (Function) & reserved_port_max,
+  (Function) 0,
+  (Function) 0,
   (Function) & debug_output,	 /* int					*/
   (Function) & noshare,		 /* int					*/
   /* 108 - 111 */
@@ -332,7 +331,7 @@ Function global_table[] =
   (Function) & DCC_LOST,	 /* struct dcc_table *			*/
   (Function) & DCC_CHAT,	 /* struct dcc_table *			*/
   /* 128 - 131 */
-  (Function) & interp,		 /* Tcl_Interp *			*/
+  (Function) 0,
   (Function) & now,		 /* time_t				*/
   (Function) 0,
   (Function) findchan,
@@ -455,7 +454,7 @@ Function global_table[] =
   (Function) 0,
   (Function) & use_exempts,	/* int					*/
   (Function) & use_invites,	/* int					*/
-  (Function) & force_expire,	/* int					*/
+  (Function) 0,
   /* 228 - 231 */
   (Function) 0,
   (Function) 0,
@@ -502,7 +501,7 @@ Function global_table[] =
   /* 256 - 259 */
   (Function) egg_strncasecmp,
   (Function) is_file,
-  (Function) & must_be_owner,	/* int					*/
+  (Function) 0,
   (Function) & tandbot,		/* tand_t *				*/
   /* 260 - 263 */
   (Function) & party,		/* party_t *				*/

+ 3 - 325
src/tcl.c

@@ -13,304 +13,26 @@
 #include "chanprog.h"
 #include <sys/stat.h>
 
-
-#if ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 1)) || (TCL_MAJOR_VERSION > 8)
-#define USE_BYTE_ARRAYS
-#endif
-
-/* Used for read/write to internal strings */
-typedef struct {
-  char *str;			/* Pointer to actual string in eggdrop	     */
-  int max;			/* max length (negative: read-only var
-				   when protect is on) (0: read-only ALWAYS) */
-  int flags;			/* 1 = directory			     */
-} strinfo;
-
-typedef struct {
-  int *var;
-  int ro;
-} intinfo;
-
-extern time_t	online_since;
-extern int	backgrd, flood_telnet_thr, flood_telnet_time,
-		shtime, allow_new_telnets, use_telnet_banner,
-		default_flags, conmask, connect_timeout,
-		firewallport, notify_users_at, flood_thr, ignore_time,
-		reserved_port_min, reserved_port_max, localhub,
-		enable_simul, dcc_total, debug_output, identtimeout,
-		protect_telnet, dupwait_timeout, share_unlinks,
-		dcc_sanitycheck, sort_users, tands, resolve_timeout,
-		default_uflags, strict_host, userfile_perm;
-extern char	origbotname[], botuser[], motdfile[], admin[], userfile[],
-                firewall[], tempdir[], owner[], network[], 
-		egg_version[], natip[], 
-		dcc_prefix[];
-
-extern struct dcc_t	*dcc;
+extern char egg_version[];
 
 int	    protect_readonly = 0;	/* turn on/off readonly protection */
-char	    whois_fields[1025] = "";	/* fields to display in a .whois */
 Tcl_Interp *interp;			/* eggdrop always uses the same
 					   interpreter */
-int	    dcc_flood_thr = 3;
-int	    use_invites = 1;		/* Jason/drummer */
-int	    use_exempts = 1;		/* Jason/drummer */
-int	    force_expire = 0;		/* Rufus */
-int	    remote_boots = 2;
-int	    allow_dk_cmds = 1;
-int	    must_be_owner = 1;
-int	    max_dcc = 200;		/* needs at least 4 or 5 just to
-					   get started. 20 should be enough   */
-int	    quiet_save = 1;             /* quiet-save patch by Lucas	      */
-int	    strtot = 0;
-int 	    handlen = HANDLEN;
-int	    utftot = 0;
-int	    clientdata_stuff = 0;
-
-
 /* Prototypes for tcl */
 Tcl_Interp *Tcl_CreateInterp();
 
-static void botnet_change(char *new)
-{
-  if (egg_strcasecmp(conf.bot->nick, new)) {
-    /* Trying to change bot's nickname */
-    if (tands > 0) {
-      putlog(LOG_MISC, "*", "* Tried to change my botnet nick, but I'm still linked to a botnet.");
-      putlog(LOG_MISC, "*", "* (Unlink and try again.)");
-      return;
-    } else {
-      if (conf.bot->nick)
-	putlog(LOG_MISC, "*", "* IDENTITY CHANGE: %s -> %s", conf.bot->nick, new);
-      strcpy(conf.bot->nick, new);
-    }
-  }
-}
-
-
 /*
  *     Vars, traces, misc
  */
 
-int init_dcc_max();
-
-/* Used for read/write to integer couplets */
-typedef struct {
-  int *left;			/* left side of couplet */
-  int *right;			/* right side */
-} coupletinfo;
-
-/* Read/write integer couplets (int1:int2) */
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-static char *tcl_eggcouplet(ClientData cdata, Tcl_Interp *irp, CONST char *name1,
-                            CONST char *name2, int flags)
-#else
-static char *tcl_eggcouplet(ClientData cdata, Tcl_Interp *irp, char *name1,
-			    char *name2, int flags)
-#endif
-{
-  char *s, s1[41];
-  coupletinfo *cp = (coupletinfo *) cdata;
-
-  if (flags & (TCL_TRACE_READS | TCL_TRACE_UNSETS)) {
-    egg_snprintf(s1, sizeof s1, "%d:%d", *(cp->left), *(cp->right));
-    Tcl_SetVar2(interp, name1, name2, s1, TCL_GLOBAL_ONLY);
-    if (flags & TCL_TRACE_UNSETS)
-      Tcl_TraceVar(interp, name1,
-		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		   tcl_eggcouplet, cdata);
-  } else {			/* writes */
-    s = (char *) Tcl_GetVar2(interp, name1, name2, 0);
-    if (s != NULL) {
-      int nr1, nr2;
-
-      if (strlen(s) > 40)
-	s[40] = 0;
-      sscanf(s, "%d%*c%d", &nr1, &nr2);
-      *(cp->left) = nr1;
-      *(cp->right) = nr2;
-    }
-  }
-  return NULL;
-}
-
-/* Read or write normal integer.
- */
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-static char *tcl_eggint(ClientData cdata, Tcl_Interp *irp, CONST char *name1,
-			CONST char *name2, int flags)
-#else
-static char *tcl_eggint(ClientData cdata, Tcl_Interp *irp, char *name1,
-                        char *name2, int flags)
-#endif
-{
-  char *s, s1[40];
-  long l;
-  intinfo *ii = (intinfo *) cdata;
-
-  if (flags & (TCL_TRACE_READS | TCL_TRACE_UNSETS)) {
-    /* Special cases */
-    if ((int *) ii->var == &conmask)
-      strcpy(s1, masktype(conmask));
-    else if ((int *) ii->var == &default_flags) {
-      struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
-      fr.global = default_flags;
-      fr.udef_global = default_uflags;
-      build_flags(s1, &fr, 0);
-    } else if ((int *) ii->var == &userfile_perm) {
-      egg_snprintf(s1, sizeof s1, "0%o", userfile_perm);
-    } else
-      egg_snprintf(s1, sizeof s1, "%d", *(int *) ii->var);
-    Tcl_SetVar2(interp, name1, name2, s1, TCL_GLOBAL_ONLY);
-    if (flags & TCL_TRACE_UNSETS)
-      Tcl_TraceVar(interp, name1,
-		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		   tcl_eggint, cdata);
-    return NULL;
-  } else {			/* Writes */
-    s = (char *) Tcl_GetVar2(interp, name1, name2, TCL_GLOBAL_ONLY);
-    if (s != NULL) {
-      if ((int *) ii->var == &conmask) {
-	if (s[0])
-	  conmask = logmodes(s);
-	else
-	  conmask = LOG_MODES | LOG_MISC | LOG_CMDS;
-      } else if ((int *) ii->var == &default_flags) {
-	struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
-
-	break_down_flags(s, &fr, 0);
-	default_flags = sanity_check(fr.global); /* drummer */
-	default_uflags = fr.udef_global;
-      } else if ((int *) ii->var == &userfile_perm) {
-	int p = oatoi(s);
-
-	if (p <= 0)
-	  return "invalid userfile permissions";
-	userfile_perm = p;
-      } else if ((ii->ro == 2) || ((ii->ro == 1) && protect_readonly)) {
-	return "read-only variable";
-      } else {
-	if (Tcl_ExprLong(interp, s, &l) == TCL_ERROR)
-	  return interp->result;
-	if ((int *) ii->var == &max_dcc) {
-	  if (l < max_dcc)
-	    return "you can't DECREASE max-dcc";
-	  max_dcc = l;
-	  init_dcc_max();
-	} else
-	  *(ii->var) = (int) l;
-      }
-    }
-    return NULL;
-  }
-}
-
-/* Read/write normal string variable
- */
-#if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-static char *tcl_eggstr(ClientData cdata, Tcl_Interp *irp, CONST char *name1,
-                        CONST char *name2, int flags)
-#else
-static char *tcl_eggstr(ClientData cdata, Tcl_Interp *irp, char *name1,
-			char *name2, int flags)
-#endif
-{
-  char *s;
-  strinfo *st = (strinfo *) cdata;
-
-  if (flags & (TCL_TRACE_READS | TCL_TRACE_UNSETS)) {
-    if ((st->str == firewall) && (firewall[0])) {
-      char s1[127];
-
-      egg_snprintf(s1, sizeof s1, "%s:%d", firewall, firewallport);
-      Tcl_SetVar2(interp, name1, name2, s1, TCL_GLOBAL_ONLY);
-    } else
-      Tcl_SetVar2(interp, name1, name2, st->str, TCL_GLOBAL_ONLY);
-    if (flags & TCL_TRACE_UNSETS) {
-      Tcl_TraceVar(interp, name1, TCL_TRACE_READS | TCL_TRACE_WRITES |
-		   TCL_TRACE_UNSETS, tcl_eggstr, cdata);
-      if ((st->max <= 0) && (protect_readonly || (st->max == 0)))
-	return "read-only variable"; /* it won't return the error... */
-    }
-    return NULL;
-  } else {			/* writes */
-    if ((st->max <= 0) && (protect_readonly || (st->max == 0))) {
-      Tcl_SetVar2(interp, name1, name2, st->str, TCL_GLOBAL_ONLY);
-      return "read-only variable";
-    }
-#ifdef USE_BYTE_ARRAYS
-#undef malloc
-#undef free
-    {
-         Tcl_Obj *obj;
-         unsigned char *bytes;
-         int len;
-
-         obj = Tcl_GetVar2Ex(interp, name1, name2, 0);
-         if (!obj) return(NULL);
-         len = 0;
-         bytes = Tcl_GetByteArrayFromObj(obj, &len);
-         if (!bytes) return(NULL);
-         s = calloc(1, len+1);
-         memcpy(s, bytes, len);
-         s[len] = 0;
-    }
-#else
-    s = (char *) Tcl_GetVar2(interp, name1, name2, 0);
-#endif
-    if (s != NULL) {
-      if (strlen(s) > abs(st->max))
-	s[abs(st->max)] = 0;
-      if (st->str == conf.bot->nick)
-	botnet_change(s);
-      else if (st->str == firewall) {
-	splitc(firewall, s, ':');
-	if (!firewall[0])
-	  strcpy(firewall, s);
-	else
-	  firewallport = atoi(s);
-      } else
-	strcpy(st->str, s);
-      if ((st->flags) && (s[0])) {
-	if (st->str[strlen(st->str) - 1] != '/')
-	  strcat(st->str, "/");
-      }
-#ifdef USE_BYTE_ARRAYS
-      free(s);
-#endif
-    }
-    return NULL;
-  }
-}
-
-static tcl_coups def_tcl_coups[] =
-{
-  {"telnet-flood",	&flood_telnet_thr,	&flood_telnet_time},
-  {"reserved-portrange", &reserved_port_min, &reserved_port_max},
-  {NULL,		NULL,			NULL}
-};
-
-/* Set up Tcl variables that will hook into eggdrop internal vars via
- * trace callbacks.
- */
-
-void add_tcl_coups(tcl_coups *); 		/* prototype */
-
-static void init_traces()
-{
-  add_tcl_coups(def_tcl_coups);
-}
-
 
 /* Not going through Tcl's crazy main() system (what on earth was he
  * smoking?!) so we gotta initialize the Tcl interpreter
  */
 void init_tcl(int argc, char **argv)
 {
-#if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) || (TCL_MAJOR_VERSION > 8)
-  const char *encoding;
-  char *langEnv;
-#endif
+  const char *encoding = NULL;
+  char *langEnv = NULL;
   int j;
   char pver[1024] = "";
 
@@ -333,7 +55,6 @@ void init_tcl(int argc, char **argv)
   Tcl_Init(interp);
 
 /* Code based on Tcl's TclpSetInitialEncodings() */
-#if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) || (TCL_MAJOR_VERSION > 8)
   /* Determine the current encoding from the LC_* or LANG environment
    * variables.
    */
@@ -398,7 +119,6 @@ resetPath:
   /* Keep the iso8859-1 encoding preloaded.  The IO package uses it for
    * gets on a binary channel. */
   Tcl_GetEncoding(NULL, "iso8859-1");
-#endif
 
   /* Add eggdrop to Tcl's package list */
   for (j = 0; j <= strlen(egg_version); j++) {
@@ -411,48 +131,6 @@ resetPath:
   /* Initialize binds and traces */
   Context;
 
-  init_traces();
   Context;
 }
 
-/* Allocate couplet space for tracing couplets
- */
-void add_tcl_coups(tcl_coups *list)
-{
-  coupletinfo *cp;
-  int i;
-
-  for (i = 0; list[i].name; i++) {
-    cp = (coupletinfo *) calloc(1, sizeof(coupletinfo));
-    strtot += sizeof(coupletinfo);
-    cp->left = list[i].lptr;
-    cp->right = list[i].rptr;
-    tcl_eggcouplet((ClientData) cp, interp, list[i].name, NULL,
-		   TCL_TRACE_WRITES);
-    tcl_eggcouplet((ClientData) cp, interp, list[i].name, NULL,
-		   TCL_TRACE_READS);
-    Tcl_TraceVar(interp, list[i].name,
-		 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		 tcl_eggcouplet, (ClientData) cp);
-  }
-}
-
-void rem_tcl_coups(tcl_coups * list)
-{
-  coupletinfo *cp;
-  int i;
-
-  for (i = 0; list[i].name; i++) {
-    cp = (coupletinfo *) Tcl_VarTraceInfo(interp, list[i].name,
-					  TCL_TRACE_READS |
-					  TCL_TRACE_WRITES |
-					  TCL_TRACE_UNSETS,
-					  tcl_eggcouplet, NULL);
-    strtot -= sizeof(coupletinfo);
-    Tcl_UntraceVar(interp, list[i].name,
-		   TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		   tcl_eggcouplet, (ClientData) cp);
-    free(cp);
-  }
-}
-

+ 0 - 18
src/tclegg.h

@@ -1,18 +0,0 @@
-/*
- * tclegg.h
- *   stuff used by tcl.c and tclhash.c
- *
- */
-
-#ifndef _EGG_TCLEGG_H
-#define _EGG_TCLEGG_H
-
-#include "lush.h"		/* Include this here, since it's needed
-				   in this file */
-typedef struct _tcl_coups {
-  char *name;
-  int *lptr;
-  int *rptr;
-} tcl_coups;
-
-#endif				/* _EGG_TCLEGG_H */

+ 0 - 1
src/userent.c

@@ -17,7 +17,6 @@ extern int		 noshare, cfg_noshare, cfg_count;
 extern struct cfg_entry **cfg;
 extern struct userrec	*userlist;
 extern struct dcc_t	*dcc;
-extern char		 whois_fields[];
 extern time_t            now;
 
 static struct user_entry_type *entry_type_list;

+ 2 - 3
src/userrec.c

@@ -25,7 +25,7 @@
 
 extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
-extern int		 default_flags, default_uflags, quiet_save,
+extern int		 default_flags, default_uflags, 
 			 dcc_total;
 extern char		 userfile[], ver[], tempdir[];
 extern time_t		 now;
@@ -424,8 +424,7 @@ int write_userfile(int idx)
     free(new_userfile);
     return 2;
   }
-  if (!quiet_save)
-    putlog(LOG_MISC, "*", USERF_WRITING);
+//  putlog(LOG_MISC, "*", USERF_WRITING);
   if (sort_users)
     sort_userlist();
   tt = now;

+ 2 - 2
src/users.c

@@ -826,8 +826,8 @@ int readuserfile(char *file, struct userrec **ret)
              newsplit(&options);
              options[strlen(options) - 1] = 0;
 /* Above is a hack to remove { } */
-             if ((func[37]) (0, chan, options) != TCL_OK) {	/* tcl_channel_add() */
-               putlog(LOG_MISC, "*", "Tcl error in userfile on line %d", line);
+             if ((func[37]) (NULL, chan, options) != TCL_OK) {	/* tcl_channel_add() */
+               putlog(LOG_MISC, "*", "Channel parsing error in userfile on line %d", line);
                free(my_ptr);
                return 0;
              }