소스 검색

* Removed defines from ctcp/irc/server/channels

svn: 1837
Bryan Drewery 21 년 전
부모
커밋
a9d27f32fb

+ 2 - 4
src/dccutil.c

@@ -180,7 +180,6 @@ dprintf(int idx, const char *format, ...)
       case DP_STDERR:
         tputs(STDERR, buf, len);
         break;
-#ifdef LEAF
       case DP_SERVER:
       case DP_HELP:
       case DP_MODE:
@@ -188,6 +187,8 @@ dprintf(int idx, const char *format, ...)
       case DP_SERVER_NEXT:
       case DP_HELP_NEXT:
       case DP_DUMP:
+        if (conf.bot->hub)
+          break;
         len -= remove_crlf_r(buf);
 
         if ((idx == DP_DUMP || floodless)) {
@@ -199,7 +200,6 @@ dprintf(int idx, const char *format, ...)
         } else
           queue_server(idx, buf, len);
         break;
-#endif /* LEAF */
     }
     return;
   } else {                      /* normal chat text */
@@ -413,9 +413,7 @@ tell_dcc(int idx)
   egg_snprintf(format, sizeof format, "%%-4d %%-4d %%08X %%5ud %%-%us %%-40s %%s\n", nicklen);
 
   dprintf(idx, "dccn: %d, dcc_total: %d\n", dccn, dcc_total);
-#ifdef LEAF
   dprintf(idx, "dns_idx: %d, servidx: %d\n", dns_idx, servidx);
-#endif /* LEAF */
   for (i = 0; i < dcc_total; i++) {
     if (dcc[i].type) {
       j = strlen(dcc[i].host);

+ 1 - 1
src/main.c

@@ -741,13 +741,13 @@ printf("out: %s\n", out);
   if (!conf.bot->hub) {
     server_init();
     irc_init();
+    ctcp_init();
   }
   transfer_init();
   share_init();
   update_init();
   notes_init();
   console_init();
-  ctcp_init();
   chanprog();
   if (conf.bot->hub) {
     cfg_noshare = 1;

+ 63 - 84
src/mod/channels.mod/cmdschan.c

@@ -92,11 +92,10 @@ static void cmd_pls_mask(const char type, int idx, char *par)
     egg_snprintf(s, sizeof s, "%s@*", who);	/* brain-dead? */
   else
     strlcpy(s, who, sizeof s);
-#ifdef LEAF
-    egg_snprintf(s1, sizeof s1, "%s!%s", botname, botuserhost);
-#else
-    egg_snprintf(s1, sizeof s1, "%s!%s@%s", origbotname, botuser, conf.bot->net.host);
-#endif /* LEAF */
+    if (conf.bot->hub)
+      egg_snprintf(s1, sizeof s1, "%s!%s@%s", origbotname, botuser, conf.bot->net.host);
+    else
+      egg_snprintf(s1, sizeof s1, "%s!%s", botname, botuserhost);
   if (type == 'b' && s1[0] && wild_match(s, s1)) {
     dprintf(idx, "I'm not going to ban myself.\n");
     putlog(LOG_CMDS, "*", "#%s# attempted +ban %s", dcc[idx].nick, s);
@@ -120,14 +119,14 @@ static void cmd_pls_mask(const char type, int idx, char *par)
 	     dcc[idx].u.chat->con_chan, cmd, s, chan->dname, par);
       dprintf(idx, "New %s %s: %s (%s)\n", chan->dname, cmd, s, par);
     }
-#ifdef LEAF
-    if (type == 'e' || type == 'I')
-      add_mode(chan, '+', type, s);
-    /* Avoid unnesessary modes if you got +dynamicbans
-     */
-    else
-      check_this_ban(chan, s, sticky);
-#endif /* LEAF */
+    if (!conf.bot->hub) {
+      if (type == 'e' || type == 'I')
+        add_mode(chan, '+', type, s);
+      /* Avoid unnesessary modes if you got +dynamicbans
+       */
+      else
+        check_this_ban(chan, s, sticky);
+    }
   } else {
     u_addmask(type, NULL, s, dcc[idx].nick, par, expire_time ? now + expire_time : 0, 0);
     if (par[0] == '*') {
@@ -139,14 +138,14 @@ static void cmd_pls_mask(const char type, int idx, char *par)
       putlog(LOG_CMDS, "*", "#%s# (GLOBAL) +%s %s (%s)", dcc[idx].nick, cmd, s, par);
       dprintf(idx, "New %s: %s (%s)\n", cmd, s, par);
     }
-#ifdef LEAF
-    for (chan = chanset; chan != NULL; chan = chan->next) {
-      if (type == 'b')
-        check_this_ban(chan, s, sticky);
-      else
-        add_mode(chan, '+', type, s);
+    if (!conf.bot->hub) {
+      for (chan = chanset; chan != NULL; chan = chan->next) {
+        if (type == 'b')
+          check_this_ban(chan, s, sticky);
+        else
+          add_mode(chan, '+', type, s);
+      }
     }
-#endif /* LEAF */
   }
 }
 
@@ -213,10 +212,10 @@ static void cmd_mns_mask(const char type, int idx, char *par)
       mask = s;
     putlog(LOG_CMDS, "*", "#%s# -%s %s", dcc[idx].nick, cmd, mask);
     dprintf(idx, "%s %s: %s\n", "Removed", cmd, s);
-#ifdef LEAF
-    for (chan = chanset; chan != NULL; chan = chan->next)
-      add_mode(chan, '-', type, mask);
-#endif /* LEAF */
+    if (!conf.bot->hub) {
+      for (chan = chanset; chan != NULL; chan = chan->next)
+        add_mode(chan, '-', type, mask);
+    }
     return;
   }
   /* Channel-specific ban? */
@@ -234,9 +233,8 @@ static void cmd_mns_mask(const char type, int idx, char *par)
           mask = s;
 	putlog(LOG_CMDS, "*", "#%s# (%s) -%s %s", dcc[idx].nick, chan->dname, cmd, mask);
 	dprintf(idx, "Removed %s channel %s: %s\n", chan->dname, cmd, mask);
-#ifdef LEAF
-	add_mode(chan, '-', type, mask);
-#endif  /* LEAF */
+        if (!conf.bot->hub)
+          add_mode(chan, '-', type, mask);
 	return;
       }
       i = 0;
@@ -247,9 +245,8 @@ static void cmd_mns_mask(const char type, int idx, char *par)
 	      chan->invites, m->mask))) {
 	  i++;
 	  if (i == -j) {
-#ifdef LEAF
-	    add_mode(chan, '-', type, m->mask);
-#endif  /* LEAF */
+            if (!conf.bot->hub)
+              add_mode(chan, '-', type, m->mask);
 	    dprintf(idx, "%s %s '%s' on %s.\n", "Removed", cmd, m->mask, chan->dname);
 	    putlog(LOG_CMDS, "*", "#%s# (%s) -%s %s [on channel]", dcc[idx].nick, chan->dname, cmd, who);
 	    return;
@@ -261,16 +258,14 @@ static void cmd_mns_mask(const char type, int idx, char *par)
       if (j > 0) {
 	putlog(LOG_CMDS, "*", "#%s# (%s) -%s %s", dcc[idx].nick, dcc[idx].u.chat->con_chan, cmd, who);
 	dprintf(idx, "Removed %s channel %s: %s\n", chname, cmd, who);
-#ifdef LEAF
-	add_mode(chan, '-', type, who);
-#endif  /* LEAF */
+        if (!conf.bot->hub)
+          add_mode(chan, '-', type, who);
 	return;
       }
       for (; m && m->mask && m->mask[0]; m = m->next) {
 	if (!rfc_casecmp(m->mask, who)) {
-#ifdef LEAF
-	  add_mode(chan, '-', type, m->mask);
-#endif  /* LEAF */
+          if (!conf.bot->hub)
+            add_mode(chan, '-', type, m->mask);
 	  dprintf(idx, "%s %s '%s' on %s.\n", "Removed", cmd, m->mask, chan->dname);
 	  putlog(LOG_CMDS, "*", "#%s# (%s) -%s %s [on channel]", dcc[idx].nick, chan->dname, cmd, who);
 	  return;
@@ -531,11 +526,9 @@ static void cmd_slowjoin(int idx, char *par)
   }
   sprintf(buf2, "cjoin %s %s", chan->dname, buf);
   putallbots(buf2);
-#ifdef HUB
-  count=0;
-#else /* !HUB */
-  count=1;
-#endif /* HUB */
+  if (conf.bot->hub)
+    count = 0;
+
   for (bot = tandbot; bot; bot = bot->next) {
     struct userrec *ubot = NULL;
     char tmp[100] = "";
@@ -557,10 +550,8 @@ static void cmd_slowjoin(int idx, char *par)
   }
   dprintf(idx, "%i bots joining %s during the next %i seconds\n", count, chan->dname, delay);
   chan->status &= ~CHAN_INACTIVE;
-#ifdef LEAF
-  if (shouldjoin(chan)) 
+  if (!conf.bot->hub && shouldjoin(chan)) 
     dprintf(DP_MODE, "JOIN %s %s\n", chan->name, chan->key_prot);
-#endif /* LEAF */
 }
 
 static void cmd_slowpart(int idx, char *par)
@@ -588,9 +579,8 @@ static void cmd_slowpart(int idx, char *par)
     return;
   }
   remove_channel(chan);
-#ifdef HUB
-  write_userfile(-1);
-#endif /* HUB */
+  if (conf.bot->hub)
+    write_userfile(-1);
   dprintf(idx, "Channel %s removed from the bot.\n", chname);
   dprintf(idx, "This includes any channel specific bans, invites, exemptions and user records that you set.\n");
 
@@ -598,11 +588,8 @@ static void cmd_slowpart(int idx, char *par)
     dprintf(idx, "Hmmm... Channel didn't get removed. Weird *shrug*\n");
     return;
   }
-#ifdef HUB
-  count = 0;
-#else /* !HUB */
-  count = 1;
-#endif /* HUB */
+  if (conf.bot->hub)
+    count = 0;
   for (bot = tandbot; bot; bot = bot->next) {
     char tmp[100] = "";
     struct userrec *ubot = NULL;
@@ -623,9 +610,8 @@ static void cmd_slowpart(int idx, char *par)
       }  
   }
   dprintf(idx, "%i bots parting %s during the next %i seconds\n", count, chname, delay);
-#ifdef LEAF
-  dprintf(DP_MODE, "PART %s\n", chname);
-#endif /* LEAF */
+  if (!conf.bot->hub)
+    dprintf(DP_MODE, "PART %s\n", chname);
 }
 
 static void cmd_stick_yn(int idx, char *par, int yn)
@@ -737,14 +723,12 @@ static void cmd_stick_yn(int idx, char *par, int yn)
     if (i > 0) {
       putlog(LOG_CMDS, "*", "#%s# %sstick ban %s", dcc[idx].nick, yn ? "" : "un", s);
       dprintf(idx, "%stuck ban: %s\n", yn ? "S" : "Uns", s);
-#ifdef LEAF
-    {
-      struct chanset_t *achan = NULL;
+      if (!conf.bot->hub) {
+        struct chanset_t *achan = NULL;
  
-      for (achan = chanset; achan != NULL; achan = achan->next)
-        check_this_ban(achan, s, yn);
-    }
-#endif /* LEAF */
+        for (achan = chanset; achan != NULL; achan = achan->next)
+          check_this_ban(achan, s, yn);
+      }
       return;
     }
     strlcpy(chname, dcc[idx].u.chat->con_chan, sizeof chname);
@@ -769,9 +753,8 @@ static void cmd_stick_yn(int idx, char *par, int yn)
   if (j > 0) {
     putlog(LOG_CMDS, "*", "#%s# %sstick ban %s %s", dcc[idx].nick, yn ? "" : "un", s, chname);
     dprintf(idx, "%stuck %s ban: %s\n", yn ? "S" : "Uns", chname, s);
-#ifdef LEAF
-    check_this_ban(chan, s, yn);
-#endif /* LEAF */
+    if (!conf.bot->hub)
+      check_this_ban(chan, s, yn);
     return;
   }
   dprintf(idx, "No such ban.\n");
@@ -914,11 +897,11 @@ static void cmd_cycle(int idx, char *par)
 
   sprintf(buf2, "cycle %s %d", chname, delay); /* this just makes the bot PART */
   putallbots(buf2);
-#ifdef LEAF
-  do_chanset(NULL, chan, "+inactive", DO_LOCAL);
-  dprintf(DP_SERVER, "PART %s\n", chan->name);
-  chan->channel.jointime = ((now + delay) - server_lag);
-#endif /* LEAF */
+  if (!conf.bot->hub) {
+    do_chanset(NULL, chan, "+inactive", DO_LOCAL);
+    dprintf(DP_SERVER, "PART %s\n", chan->name);
+    chan->channel.jointime = ((now + delay) - server_lag);
+  }
 }
 
 static void cmd_down(int idx, char *par)
@@ -942,11 +925,10 @@ static void cmd_down(int idx, char *par)
   
   sprintf(buf2, "down %s", chan->dname);
   putallbots(buf2);
-#ifdef LEAF
-  add_mode(chan, '-', 'o', botname);
-  chan->channel.no_op = (now + 10);
-#endif /* LEAF */
-  
+  if (!conf.bot->hub) {
+    add_mode(chan, '-', 'o', botname);
+    chan->channel.no_op = (now + 10);
+  }
 }
 
 static void pls_chan(int idx, char *par, char *bot)
@@ -1006,9 +988,8 @@ static void pls_chan(int idx, char *par, char *bot)
       }
       putallbots(buf);
     }
-#ifdef HUB
-    write_userfile(-1);
-#endif /* HUB */
+    if (conf.bot->hub)
+      write_userfile(-1);
   }
 }
 
@@ -1074,9 +1055,8 @@ static void mns_chan(int idx, char *par, char *bot)
         strcpy(dcc[i].u.chat->con_chan, "*");
       } 
     remove_channel(chan);
-#ifdef HUB
-    write_userfile(-1);
-#endif /* HUB */
+    if (conf.bot->hub)
+      write_userfile(-1);
     dprintf(idx, "Channel %s removed from the botnet.\n", chname);
     dprintf(idx, "This includes any channel specific bans, invites, exemptions and user records that you set.\n");
   } else
@@ -1363,9 +1343,8 @@ static void cmd_chanset(int idx, char *par)
   else
     dprintf(idx, "Successfully set modes { %s } on %s\n", par, chan->dname);
 
-#ifdef HUB
-  write_userfile(idx);
-#endif /* HUB */
+  if (conf.bot->hub)
+    write_userfile(idx);
 }
 
 /* DCC CHAT COMMANDS

+ 20 - 27
src/mod/channels.mod/tclchan.c

@@ -286,11 +286,9 @@ int SplitList(char *resultBuf, const char *list, int *argcPtr, const char ***arg
 int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
 {
   bool error = 0;
-#ifdef LEAF
   int old_status = chan->status,
       old_mode_mns_prot = chan->mode_mns_prot,
       old_mode_pls_prot = chan->mode_pls_prot;
-#endif /* LEAF */
   char s[121] = "";
 
   for (register int i = 0; i < items; i++) {
@@ -626,25 +624,25 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
       error = 1;
     }
   }
-#ifdef LEAF
-  if ((old_status ^ chan->status) & CHAN_INACTIVE) {
-    if (!shouldjoin(chan) && (chan->status & (CHAN_ACTIVE | CHAN_PEND)))
-      dprintf(DP_SERVER, "PART %s\n", chan->name);
-    if (shouldjoin(chan) && !(chan->status & (CHAN_ACTIVE | CHAN_PEND)))
-      dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ?
-			   chan->name : chan->dname,
-			   chan->channel.key[0] ?
-			   chan->channel.key : chan->key_prot);
-  }
-  if ((old_status ^ chan->status) & (CHAN_ENFORCEBANS | CHAN_BITCH)) {
-    recheck_channel(chan, 1);
-  /* if we -take, recheck the chan for modes and shit */
-  } else if ((chan->status ^ old_status) & (CHAN_TAKE)) {
-    recheck_channel(chan, 1);
-  } else if (old_mode_pls_prot != chan->mode_pls_prot || old_mode_mns_prot != chan->mode_mns_prot) {
-    recheck_channel_modes(chan);
+  if (!conf.bot->hub) {
+    if ((old_status ^ chan->status) & CHAN_INACTIVE) {
+      if (!shouldjoin(chan) && (chan->status & (CHAN_ACTIVE | CHAN_PEND)))
+        dprintf(DP_SERVER, "PART %s\n", chan->name);
+      if (shouldjoin(chan) && !(chan->status & (CHAN_ACTIVE | CHAN_PEND)))
+        dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ?
+  			   chan->name : chan->dname,
+  			   chan->channel.key[0] ?
+    			   chan->channel.key : chan->key_prot);
+    }
+    if ((old_status ^ chan->status) & (CHAN_ENFORCEBANS | CHAN_BITCH)) {
+      recheck_channel(chan, 1);
+    /* if we -take, recheck the chan for modes and shit */
+    } else if ((chan->status ^ old_status) & (CHAN_TAKE)) {
+      recheck_channel(chan, 1);
+    } else if (old_mode_pls_prot != chan->mode_pls_prot || old_mode_mns_prot != chan->mode_mns_prot) {
+      recheck_channel_modes(chan);
+    }
   }
-#endif /* LEAF */
   if (error)
     return ERROR;
   return OK;
@@ -751,9 +749,7 @@ int channel_add(char *result, char *newname, char *options)
   if (SplitList(result, buf, &items, &item) != OK)
     return ERROR;
 
-#ifdef LEAF
   bool join = 0;
-#endif /* LEAF */
   struct chanset_t *chan = NULL;
   int ret = OK;
 
@@ -805,10 +801,9 @@ int channel_add(char *result, char *newname, char *options)
     /* Initialize chan->channel info */
     init_channel(chan, 0);
     list_append((struct list_type **) &chanset, (struct list_type *) chan);
-#ifdef LEAF
     /* Channel name is stored in xtra field for sharebot stuff */
-    join = 1;
-#endif /* LEAF */
+    if (!conf.bot->hub)
+      join = 1;
   }
   /* If loading is set, we're loading the userfile. Ignore errors while
    * reading userfile and just return OK. This is for compatability
@@ -819,9 +814,7 @@ int channel_add(char *result, char *newname, char *options)
     ret = ERROR;
 
   free(item);
-#ifdef LEAF
   if (join && shouldjoin(chan))
     dprintf(DP_SERVER, "JOIN %s %s\n", chan->dname, chan->key_prot);
-#endif /* LEAF */
   return ret;
 }

+ 16 - 23
src/mod/channels.mod/userchan.c

@@ -293,11 +293,10 @@ bool u_addmask(char type, struct chanset_t *chan, char *who, char *from, char *n
     strcat(host, "!*");
     strcat(host, s);
   }
-#ifdef LEAF
-    simple_sprintf(s, "%s!%s", botname, botuserhost);
-#else
-    simple_sprintf(s, "%s!%s@%s", origbotname, botuser, conf.bot->net.host);
-#endif /* LEAF */
+    if (conf.bot->hub)
+      simple_sprintf(s, "%s!%s@%s", origbotname, botuser, conf.bot->net.host);
+    else
+      simple_sprintf(s, "%s!%s", botname, botuserhost);
   if (s[0] && type == 'b' && wild_match(host, s)) {
     putlog(LOG_MISC, "*", IRC_IBANNEDME);
     return 0;
@@ -1156,9 +1155,8 @@ static void check_expired_bans(void)
       for (chan = chanset; chan; chan = chan->next)
         for (b = chan->channel.ban; b->mask[0]; b = b->next)
 	  if (!rfc_casecmp(b->mask, u->mask) && expired_mask(chan, b->who) && b->timer != now) {
-#ifdef LEAF
-	    add_mode(chan, '-', 'b', u->mask);
-#endif /* LEAF */
+            if (!conf.bot->hub)
+              add_mode(chan, '-', 'b', u->mask);
 	    b->timer = now;
 	  }
       u_delmask('b', NULL, u->mask, 1);
@@ -1173,9 +1171,8 @@ static void check_expired_bans(void)
 	       u->mask, MISC_ONLOCALE, chan->dname, MISC_EXPIRED);
 	for (b = chan->channel.ban; b->mask[0]; b = b->next)
           if (!rfc_casecmp(b->mask, u->mask) && expired_mask(chan, b->who) && b->timer != now) {
-#ifdef LEAF
-	    add_mode(chan, '-', 'b', u->mask);
-#endif /* LEAF */
+            if (!conf.bot->hub)
+              add_mode(chan, '-', 'b', u->mask);
 	    b->timer = now;
 	  }
 	u_delmask('b', chan, u->mask, 1);
@@ -1218,9 +1215,8 @@ static void check_expired_exempts(void)
 	else
 	  for (e = chan->channel.exempt; e->mask[0]; e = e->next)
 	    if (!rfc_casecmp(e->mask, u->mask) && expired_mask(chan, e->who) && e->timer != now) {
-#ifdef LEAF
-	      add_mode(chan, '-', 'e', u->mask);
-#endif /* LEAF */
+              if (!conf.bot->hub)
+                add_mode(chan, '-', 'e', u->mask);
 	      e->timer = now;
 	    }
       }
@@ -1250,9 +1246,8 @@ static void check_expired_exempts(void)
 		 u->mask, MISC_ONLOCALE, chan->dname, MISC_EXPIRED);
 	  for (e = chan->channel.exempt; e->mask[0]; e = e->next)
 	    if (!rfc_casecmp(e->mask, u->mask) && expired_mask(chan, e->who) && e->timer != now) {
-#ifdef LEAF
-	      add_mode(chan, '-', 'e', u->mask);
-#endif /* LEAF */
+              if (!conf.bot->hub)
+                add_mode(chan, '-', 'e', u->mask);
 	      e->timer = now;
 	    }
           u_delmask('e', chan, u->mask, 1);
@@ -1282,9 +1277,8 @@ static void check_expired_invites(void)
 	if (!(chan->channel.mode & CHANINV))
 	  for (b = chan->channel.invite; b->mask[0]; b = b->next)
 	    if (!rfc_casecmp(b->mask, u->mask) && expired_mask(chan, b->who) && b->timer != now) {
-#ifdef LEAF
-	      add_mode(chan, '-', 'I', u->mask);
-#endif /* LEAF */
+              if (!conf.bot->hub)
+                add_mode(chan, '-', 'I', u->mask);
 	      b->timer = now;
 	    }
       u_delmask('I', NULL, u->mask,1);
@@ -1300,9 +1294,8 @@ static void check_expired_invites(void)
 	if (!(chan->channel.mode & CHANINV))
 	  for (b = chan->channel.invite; b->mask[0]; b = b->next)
 	    if (!rfc_casecmp(b->mask, u->mask) && expired_mask(chan, b->who) && b->timer != now) {
-#ifdef LEAF
-	      add_mode(chan, '-', 'I', u->mask);
-#endif /* LEAF */
+              if (!conf.bot->hub)
+                add_mode(chan, '-', 'I', u->mask);
 	      b->timer = now;
 	    }
 	u_delmask('I', chan, u->mask, 1);

+ 7 - 16
src/mod/ctcp.mod/ctcp.c

@@ -17,18 +17,14 @@
 #include "src/botmsg.h"
 #include "src/tclhash.h"
 #include "src/egg_timer.h"
-
-#ifdef LEAF
 #include "src/mod/server.mod/server.h"
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sys/utsname.h>
 #include <ctype.h>
-#endif /* LEAF */
 
 int cloak_script = CLOAK_PLAIN;
 
-#ifdef LEAF
 #define AVGAWAYTIME             60
 #define AVGHERETIME             5
 time_t cloak_awaytime = 0;
@@ -617,7 +613,6 @@ static cmd_t myctcp[] =
   {"CHAT",		"",	(Function) ctcp_CHAT,		NULL, LEAF},
   {NULL,		NULL,	NULL,			NULL, 0}
 };
-#endif /* LEAF */
 
 static void cloak_describe(struct cfg_entry *cfgent, int idx)
 {
@@ -632,27 +627,24 @@ static void cloak_changed(struct cfg_entry *cfgent, int *valid)
   if (!(p = cfgent->ldata ? cfgent->ldata : cfgent->gdata))
     return;
 
-  if (!conf.bot->hub) {
-    int i = atoi(p);
+  int i = atoi(p);
 
-    if (i == 0)
-      i = randint(CLOAK_COUNT) + 1;
-    if ((*valid = ((i >= 0) && (i <= CLOAK_COUNT))))
-      cloak_script = i;
+  if (i == 0)
+    i = randint(CLOAK_COUNT) + 1;
+  if ((*valid = ((i >= 0) && (i <= CLOAK_COUNT))))
+    cloak_script = i;
 
-    scriptchanged();
-  }
+  scriptchanged();
 }
 
 struct cfg_entry CFG_CLOAK_SCRIPT = {
-	"cloak-script", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+	"cloak-script", CFGF_GLOBAL | CFGF_LOCAL | CFGF_LEAF, NULL, NULL,
 	cloak_changed, cloak_changed, cloak_describe
 };
 
 
 void ctcp_init()
 {
-#ifdef LEAF
   char *p = NULL;
 #ifndef CYGWIN_HACKS
   struct utsname un;
@@ -701,5 +693,4 @@ void ctcp_init()
   add_builtins("ctcp", myctcp);
 
   timer_create_secs(60, "ctcp_minutely", (Function) ctcp_minutely);
-#endif /* LEAF */
 }

+ 0 - 2
src/mod/ctcp.mod/ctcp.h

@@ -35,8 +35,6 @@
 
 void ctcp_init();
 extern struct cfg_entry 	CFG_CLOAK_SCRIPT;
-#ifdef LEAF
 extern char		kickprefix[], bankickprefix[];
-#endif /* LEAF */
 
 #endif				/* _EGG_MOD_CTCP_CTCP_H */

+ 0 - 2
src/mod/irc.mod/chan.c

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  *
  * chan.c -- part of irc.mod
@@ -3042,4 +3041,3 @@ static cmd_t irc_raw[] =
   {"353",	"",	(Function) got353,	"irc:353", LEAF},
   {NULL,	NULL,	NULL,			NULL, 0}
 };
-#endif /* LEAF */

+ 0 - 2
src/mod/irc.mod/cmdsirc.c

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * chancmds.c -- part of irc.mod
  *   handles commands directly relating to channel interaction
@@ -1720,4 +1719,3 @@ static cmd_t irc_dcc[] =
   {NULL,		NULL,	 NULL,				NULL, 0}
 };
 
-#endif /* LEAF */

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

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * irc.c -- part of irc.mod
  *   support for channels within the bot
@@ -1545,4 +1544,3 @@ irc_init()
 
   do_nettype();
 }
-#endif /* LEAF */

+ 0 - 2
src/mod/irc.mod/irc.h

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * irc.h -- part of irc.mod
  *
@@ -116,4 +115,3 @@ extern bool		use_354;
 extern unsigned int	modesperline;
 #endif				/* _EGG_MOD_IRC_IRC_H */
 
-#endif /* LEAF */

+ 0 - 2
src/mod/irc.mod/mode.c

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * mode.c -- part of irc.mod
  *   queuing and flushing mode changes made by the bot
@@ -1435,4 +1434,3 @@ gotmode(char *from, char *msg)
   return 0;
 }
 
-#endif /* LEAF */

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

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * msgcmds.c -- part of irc.mod
  *   all commands entered via /MSG
@@ -752,4 +751,3 @@ static cmd_t C_msgc[] =
   {"voice",		"",	(Function) msgc_voice,		NULL, LEAF},
   {NULL,		NULL,	NULL,				NULL, 0}
 };
-#endif /* LEAF */

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

@@ -3,7 +3,6 @@
  *   handles commands from a user via dcc that cause server interaction
  *
  */
-#ifdef LEAF
 static void cmd_servers(int idx, char *par)
 {
   struct server_list *x = serverlist;
@@ -124,4 +123,3 @@ static cmd_t C_dcc_serv[] =
   {NULL,		NULL,	NULL,				NULL, 0}
 };
 
-#endif /* LEAF */

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

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * server.c -- part of server.mod
  *   basic irc server support
@@ -1047,4 +1046,3 @@ void server_init()
 
   do_nettype();
 }
-#endif /* LEAF */

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

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * server.h -- part of server.mod
  *
@@ -69,4 +68,3 @@ void clearq(struct server_list *);
 void nuke_server(const char *);
 bool match_my_nick(char *);
 
-#endif /*leaf*/

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

@@ -1,4 +1,3 @@
-#ifdef LEAF
 /*
  * servmsg.c -- part of server.mod
  *
@@ -1455,4 +1454,3 @@ static void server_dns_callback(int id, void *client_data, const char *host, cha
     /* Wait for async connect now */
   }
 }
-#endif /* LEAF */