Browse Source

* Remove define AUTOLOCK
* Re-added CFG_KILLTHRESHOLD, CFG_CLOSETHRESHOLD, CFG_FIGHTTHRESHOLD
* Moved all irc.mod loops to 1 chan = chanset loop.
* DP_HELP no longer putlogs to *, now to @


svn: 1177

Bryan Drewery 22 years ago
parent
commit
a01dbc57bf

+ 0 - 1
config.h.in

@@ -336,7 +336,6 @@
 #undef volatile
 #undef volatile
 
 
 /* Defines for pack features */
 /* Defines for pack features */
-#undef S_AUTOLOCK
 #undef S_DCCAUTH
 #undef S_DCCAUTH
 #undef S_GARBLESTRINGS
 #undef S_GARBLESTRINGS
 #undef S_MESSUPTERM
 #undef S_MESSUPTERM

+ 1 - 0
doc/UPDATES

@@ -6,6 +6,7 @@ This is a summary of ChangeLog basically.
 * Removed many unnecesary compile defines: (.config controlling them makes more sense)
 * Removed many unnecesary compile defines: (.config controlling them makes more sense)
   ANTITRACE, HIJACKCHECK, LASTCHECK, NODELAY, PROCESSCHECK, PROMISC, AUTHCMDS, CONFEDIT
   ANTITRACE, HIJACKCHECK, LASTCHECK, NODELAY, PROCESSCHECK, PROMISC, AUTHCMDS, CONFEDIT
   RANDSERVERS, DCCPASS, PSCLOAK, MSGCMDS, UTCTIME, AUTOAWAY, AUTHHASH, SPLITHIJACK
   RANDSERVERS, DCCPASS, PSCLOAK, MSGCMDS, UTCTIME, AUTOAWAY, AUTHHASH, SPLITHIJACK
+  AUTOLOCK
   -Moved PSCLOAK entries to misc/responses.txt
   -Moved PSCLOAK entries to misc/responses.txt
 * All dates are UTC (GMT) now.
 * All dates are UTC (GMT) now.
 * cmd_newleaf was sharing the new bot incorrectly.
 * cmd_newleaf was sharing the new bot incorrectly.

+ 0 - 13
src/botnet.c

@@ -23,11 +23,6 @@
 #include "botmsg.h"
 #include "botmsg.h"
 #include "tandem.h"
 #include "tandem.h"
 #include "core_binds.h"
 #include "core_binds.h"
-#ifdef HUB
-# ifdef S_AUTOLOCK
-#  include "src/mod/channels.mod/channels.h"
-# endif /* S_AUTOLOCK */
-#endif /* HUB */
 
 
 tand_t			*tandbot = NULL;		/* Keep track of tandem bots on the
 tand_t			*tandbot = NULL;		/* Keep track of tandem bots on the
 							   botnet */
 							   botnet */
@@ -1623,14 +1618,6 @@ void check_botnet_pings()
       }
       }
     }
     }
   }
   }
-#ifdef HUB
-#ifdef S_AUTOLOCK
-  check_should_lock();
-#endif /* S_AUTOLOCK */
-#ifdef G_BACKUP
-  check_should_backup();
-#endif /* G_BACKUP */
-#endif /* HUB */
 }
 }
 
 
 void zapfbot(int idx)
 void zapfbot(int idx)

+ 18 - 4
src/cfg.c

@@ -663,7 +663,6 @@ struct cfg_entry CFG_OPBOTS = {
 #endif /* HUB */
 #endif /* HUB */
 };
 };
 
 
-#ifdef S_AUTOLOCK
 struct cfg_entry CFG_FIGHTTHRESHOLD = {
 struct cfg_entry CFG_FIGHTTHRESHOLD = {
 	"fight-threshold", CFGF_GLOBAL, NULL, NULL,
 	"fight-threshold", CFGF_GLOBAL, NULL, NULL,
 	getin_changed, NULL
 	getin_changed, NULL
@@ -671,7 +670,22 @@ struct cfg_entry CFG_FIGHTTHRESHOLD = {
 	, getin_describe
 	, getin_describe
 #endif /* HUB */
 #endif /* HUB */
 };
 };
-#endif /* S_AUTOLOCK */
+
+struct cfg_entry CFG_CLOSETHRESHOLD = {
+	"close-threshold", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL
+#ifdef HUB
+	, getin_describe
+#endif /* HUB */
+};
+
+struct cfg_entry CFG_KILLTHRESHOLD = {
+	"kill-threshold", CFGF_GLOBAL, NULL, NULL,
+	getin_changed, NULL
+#ifdef HUB
+	, getin_describe
+#endif /* HUB */
+};
 
 
 struct cfg_entry CFG_INBOTS = {
 struct cfg_entry CFG_INBOTS = {
 	"in-bots", CFGF_GLOBAL, NULL, NULL,
 	"in-bots", CFGF_GLOBAL, NULL, NULL,
@@ -851,9 +865,9 @@ void init_config()
   add_cfg(&CFG_LAGTHRESHOLD);
   add_cfg(&CFG_LAGTHRESHOLD);
   add_cfg(&CFG_OPREQUESTS);
   add_cfg(&CFG_OPREQUESTS);
   add_cfg(&CFG_OPTIMESLACK);
   add_cfg(&CFG_OPTIMESLACK);
-#ifdef S_AUTOLOCK
   add_cfg(&CFG_FIGHTTHRESHOLD);
   add_cfg(&CFG_FIGHTTHRESHOLD);
-#endif /* S_AUTOLOCK */
+  add_cfg(&CFG_CLOSETHRESHOLD);
+  add_cfg(&CFG_KILLTHRESHOLD);
 }
 }
 
 
 int check_cmd_pass(const char *cmd, char *pass)
 int check_cmd_pass(const char *cmd, char *pass)

+ 1 - 6
src/cfg.h

@@ -25,13 +25,10 @@ extern struct cfg_entry CFG_MOTD, CFG_CMDPREFIX, CFG_BADCOOKIE, CFG_MANUALOP, CF
                         CFG_NICK, CFG_REALNAME, CFG_INBOTS, CFG_LAGTHRESHOLD, CFG_OPREQUESTS, CFG_OPTIMESLACK,
                         CFG_NICK, CFG_REALNAME, CFG_INBOTS, CFG_LAGTHRESHOLD, CFG_OPREQUESTS, CFG_OPTIMESLACK,
                         CFG_OPBOTS, CFG_INBOTS, CFG_SERVPORT, CFG_AUTHKEY, CFG_MSGOP, CFG_MSGPASS, 
                         CFG_OPBOTS, CFG_INBOTS, CFG_SERVPORT, CFG_AUTHKEY, CFG_MSGOP, CFG_MSGPASS, 
 			CFG_MSGINVITE, CFG_MSGIDENT, CFG_LOGIN, CFG_HIJACK, CFG_TRACE, CFG_PROMISC, 
 			CFG_MSGINVITE, CFG_MSGIDENT, CFG_LOGIN, CFG_HIJACK, CFG_TRACE, CFG_PROMISC, 
-			CFG_BADPROCESS, CFG_PROCESSLIST;
+			CFG_BADPROCESS, CFG_PROCESSLIST, CFG_FIGHTTHRESHOLD, CFG_CLOSETHRESHOLD, CFG_KILLTHRESHOLD;
 #ifdef G_MEAN
 #ifdef G_MEAN
 extern struct cfg_entry CFG_MEANDEOP, CFG_MEANKICK, CFG_MEANBAN;
 extern struct cfg_entry CFG_MEANDEOP, CFG_MEANKICK, CFG_MEANBAN;
 #endif /* G_MEAN */
 #endif /* G_MEAN */
-#ifdef S_AUTOLOCK
-struct cfg_entry CFG_FIGHTTHRESHOLD;
-#endif /* S_AUTOLOCK */
 
 
 void set_cfg_str(char *, char *, char *);
 void set_cfg_str(char *, char *, char *);
 void add_cfg(struct cfg_entry *);
 void add_cfg(struct cfg_entry *);
@@ -58,8 +55,6 @@ extern struct cfg_entry		**cfg;
 #define msgpass CFG_MSGPASS.ldata ? CFG_MSGPASS.ldata : CFG_MSGPASS.gdata ? CFG_MSGPASS.gdata : ""
 #define msgpass CFG_MSGPASS.ldata ? CFG_MSGPASS.ldata : CFG_MSGPASS.gdata ? CFG_MSGPASS.gdata : ""
 #define msginvite CFG_MSGINVITE.ldata ? CFG_MSGINVITE.ldata : CFG_MSGINVITE.gdata ? CFG_MSGINVITE.gdata : ""
 #define msginvite CFG_MSGINVITE.ldata ? CFG_MSGINVITE.ldata : CFG_MSGINVITE.gdata ? CFG_MSGINVITE.gdata : ""
 #define msgident CFG_MSGIDENT.ldata ? CFG_MSGIDENT.ldata : CFG_MSGIDENT.gdata ? CFG_MSGIDENT.gdata : ""
 #define msgident CFG_MSGIDENT.ldata ? CFG_MSGIDENT.ldata : CFG_MSGIDENT.gdata ? CFG_MSGIDENT.gdata : ""
-#ifdef S_AUTOLOCK
 #define kill_threshold (CFG_KILLTHRESHOLD.gdata ? atoi(CFG_KILLTHRESHOLD.gdata) : 0)
 #define kill_threshold (CFG_KILLTHRESHOLD.gdata ? atoi(CFG_KILLTHRESHOLD.gdata) : 0)
-#endif /* S_AUTOLOCK */
 
 
 #endif /* !_CFG_H */
 #endif /* !_CFG_H */

+ 0 - 2
src/chan.h

@@ -87,9 +87,7 @@ struct chan_t {
   time_t jointime;
   time_t jointime;
   time_t parttime;
   time_t parttime;
   time_t no_op;
   time_t no_op;
-#ifdef S_AUTOLOCK
   int fighting;
   int fighting;
-#endif /* S_AUTOLOCK */
 #ifdef G_BACKUP
 #ifdef G_BACKUP
   int backup_time;              /* If non-0, set +backup when now>backup_time */
   int backup_time;              /* If non-0, set +backup when now>backup_time */
 #endif /* G_BACKUP */
 #endif /* G_BACKUP */

+ 13 - 13
src/mod/channels.mod/channels.c

@@ -59,21 +59,19 @@ static int 			gfld_ctcp_time;
 static int 			gfld_nick_thr;
 static int 			gfld_nick_thr;
 static int 			gfld_nick_time;
 static int 			gfld_nick_time;
 
 
-#ifdef S_AUTOLOCK
-int 				killed_bots = 0;
-#endif /* S_AUTOLOCK */
+static int 			killed_bots = 0;
 
 
 #include "channels.h"
 #include "channels.h"
 #include "cmdschan.c"
 #include "cmdschan.c"
 #include "tclchan.c"
 #include "tclchan.c"
 #include "userchan.c"
 #include "userchan.c"
 
 
+#ifdef HUB
 /* This will close channels if the HUB:leaf count is skewed from config setting */
 /* This will close channels if the HUB:leaf count is skewed from config setting */
-void check_should_lock()
+static void 
+check_should_close()
 {
 {
-#ifdef S_AUTOLOCK
-#ifdef HUB
-  char *p = CFG_LOCKTHRESHOLD.gdata;
+  char *p = CFG_CLOSETHRESHOLD.gdata;
   tand_t *bot = NULL;
   tand_t *bot = NULL;
   int H, L, hc, lc;
   int H, L, hc, lc;
   struct chanset_t *chan = NULL;
   struct chanset_t *chan = NULL;
@@ -110,10 +108,8 @@ void check_should_lock()
       }
       }
     }
     }
   }
   }
-#endif /* HUB */
-#endif /* S_AUTOLOCK */
 }
 }
-
+#endif /* HUB */
 
 
 static void got_cset(char *botnick, char *code, char *par)
 static void got_cset(char *botnick, char *code, char *par)
 {
 {
@@ -308,16 +304,14 @@ static void got_role(char *botnick, char *code, char *par)
 
 
 void got_kl(char *botnick, char *code, char *par)
 void got_kl(char *botnick, char *code, char *par)
 {
 {
-#ifdef S_AUTOLOCK
   killed_bots++;
   killed_bots++;
   if (kill_threshold && (killed_bots = kill_threshold)) {
   if (kill_threshold && (killed_bots = kill_threshold)) {
     struct chanset_t *ch = NULL;
     struct chanset_t *ch = NULL;
 
 
     for (ch = chanset; ch; ch = ch->next)
     for (ch = chanset; ch; ch = ch->next)
-      do_chanset(NULL, ch, "+closed +backup +bitch", DO_LOCAL | DO_NET);
+      do_chanset(NULL, ch, "+closed +bitch +backup", DO_LOCAL | DO_NET);
   /* FIXME: we should randomize nick here ... */
   /* FIXME: we should randomize nick here ... */
   }
   }
-#endif /* S_AUTOLOCK */
 }
 }
 
 
 
 
@@ -953,6 +947,12 @@ void channels_init()
   timer_create_secs(60, "check_expired_exempts", (Function) check_expired_exempts);
   timer_create_secs(60, "check_expired_exempts", (Function) check_expired_exempts);
   timer_create_secs(60, "check_expired_invites", (Function) check_expired_invites);
   timer_create_secs(60, "check_expired_invites", (Function) check_expired_invites);
   timer_create_secs(10, "channels_10secondly", (Function) channels_10secondly);
   timer_create_secs(10, "channels_10secondly", (Function) channels_10secondly);
+#ifdef HUB
+  timer_create_secs(30, "check_should_close", (Function) check_should_close);
+#ifdef G_BACKUP
+  timer_create_secs(30, "check_should_backup", (Function) check_should_backup);
+#endif /* G_BACKUP */
+#endif /* HUB */
 
 
   add_builtins("dcc", C_dcc_irc);
   add_builtins("dcc", C_dcc_irc);
   add_builtins("bot", channels_bot);
   add_builtins("bot", channels_bot);

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

@@ -49,7 +49,6 @@ int u_setsticky_mask(struct chanset_t *, maskrec *, char *, int, const char *);
 int SplitList(char *, const char *, int *, const char ***);
 int SplitList(char *, const char *, int *, const char ***);
 int channel_modify(char *, struct chanset_t *, int, char **);
 int channel_modify(char *, struct chanset_t *, int, char **);
 int channel_add(char *, char *, char *);
 int channel_add(char *, char *, char *);
-void check_should_lock();
 void clear_channel(struct chanset_t *, int);
 void clear_channel(struct chanset_t *, int);
 int u_equals_mask(maskrec *, char *);
 int u_equals_mask(maskrec *, char *);
 int u_match_mask(struct maskrec *, char *);
 int u_match_mask(struct maskrec *, char *);

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

@@ -762,9 +762,7 @@ int channel_add(char *result, char *newname, char *options)
     /* let's initialize this stuff for shits & giggles */
     /* let's initialize this stuff for shits & giggles */
     chan->channel.jointime = 0;
     chan->channel.jointime = 0;
     chan->channel.parttime = 0;
     chan->channel.parttime = 0;
-#ifdef S_AUTOLOCK
     chan->channel.fighting = 0;
     chan->channel.fighting = 0;
-#endif /* S_AUTOLOCK */
 
 
     /* We _only_ put the dname (display name) in here so as not to confuse
     /* We _only_ put the dname (display name) in here so as not to confuse
      * any code later on. chan->name gets updated with the channel name as
      * any code later on. chan->name gets updated with the channel name as

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

@@ -2339,9 +2339,7 @@ static int gotkick(char *from, char *origmsg)
     return 0; /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
     return 0; /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
   }
   }
   if (channel_active(chan)) {
   if (channel_active(chan)) {
-#ifdef S_AUTOLOCK
     chan->channel.fighting++;
     chan->channel.fighting++;
-#endif /* S_AUTOLOCK */
     fixcolon(msg);
     fixcolon(msg);
     u = get_user_by_host(from);
     u = get_user_by_host(from);
     strcpy(uhost, from);
     strcpy(uhost, from);

File diff suppressed because it is too large
+ 370 - 360
src/mod/irc.mod/irc.c


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

@@ -1247,9 +1247,7 @@ static int gotmode(char *from, char *msg)
 	  }
 	  }
 	  break;
 	  break;
 	case 'o':
 	case 'o':
-#ifdef S_AUTOLOCK
           chan->channel.fighting++;
           chan->channel.fighting++;
-#endif /* S_AUTOLOCK */
 	  op = newsplit(&msg);
 	  op = newsplit(&msg);
 	  fixcolon(op);
 	  fixcolon(op);
 	  if (ms2[0] == '+')
 	  if (ms2[0] == '+')
@@ -1315,9 +1313,7 @@ static int gotmode(char *from, char *msg)
 	  }
 	  }
 	  break;
 	  break;
 	case 'b':
 	case 'b':
-#ifdef S_AUTOLOCK
           chan->channel.fighting++;
           chan->channel.fighting++;
-#endif /* S_AUTOLOCK */
 	  op = newsplit(&msg);
 	  op = newsplit(&msg);
 	  fixcolon(op);
 	  fixcolon(op);
 	  if (ms2[0] == '+')
 	  if (ms2[0] == '+')
@@ -1326,9 +1322,7 @@ static int gotmode(char *from, char *msg)
 	    got_unban(chan, nick, from, op, u);
 	    got_unban(chan, nick, from, op, u);
 	  break;
 	  break;
 	case 'e':
 	case 'e':
-#ifdef S_AUTOLOCK
           chan->channel.fighting++;
           chan->channel.fighting++;
-#endif /* S_AUTOLOCK */
 	  op = newsplit(&msg);
 	  op = newsplit(&msg);
 	  fixcolon(op);
 	  fixcolon(op);
 	  if (ms2[0] == '+')
 	  if (ms2[0] == '+')
@@ -1337,9 +1331,7 @@ static int gotmode(char *from, char *msg)
 	    got_unexempt(chan, nick, from, op, u);
 	    got_unexempt(chan, nick, from, op, u);
 	  break;
 	  break;
 	case 'I':
 	case 'I':
-#ifdef S_AUTOLOCK
           chan->channel.fighting++;
           chan->channel.fighting++;
-#endif /* S_AUTOLOCK */
 	  op = newsplit(&msg);
 	  op = newsplit(&msg);
 	  fixcolon(op);
 	  fixcolon(op);
 	  if (ms2[0] == '+')
 	  if (ms2[0] == '+')

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

@@ -195,7 +195,7 @@ static void deq_msg()
   tputs(serv, hq.head->msg, hq.head->len);
   tputs(serv, hq.head->msg, hq.head->len);
   if (debug_output) {
   if (debug_output) {
     hq.head->msg[strlen(hq.head->msg) - 1] = 0; /* delete the "\n" */
     hq.head->msg[strlen(hq.head->msg) - 1] = 0; /* delete the "\n" */
-    putlog(LOG_SRVOUT, "*", "[h->] %s", hq.head->msg);
+    putlog(LOG_SRVOUT, "@", "[h->] %s", hq.head->msg);
   }
   }
   hq.tot--;
   hq.tot--;
   last_time += calc_penalty(hq.head->msg);
   last_time += calc_penalty(hq.head->msg);

Some files were not shown because too many files changed in this diff