Procházet zdrojové kódy

* Ported [2667] to 1.2.9 (Adds a 'notify-ison' var (fixes #182))

svn: 2668
Bryan Drewery před 20 roky
rodič
revize
70359b44bd
8 změnil soubory, kde provedl 19 přidání a 4 odebrání
  1. 1 0
      doc/UPDATES
  2. 1 0
      misc/help.txt
  3. 11 1
      src/main.c
  4. 0 1
      src/mod/server.mod/server.c
  5. 1 0
      src/mod/server.mod/server.h
  6. 1 1
      src/mod/server.mod/servmsg.c
  7. 2 0
      src/set.c
  8. 2 1
      src/set.h

+ 1 - 0
doc/UPDATES

@@ -50,6 +50,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * cmd_botcmd <?> now displays which bot is chosen in the log. (#192)
 * There is now a 'datadir' option in the binary config. The tempdir is still automatically found. (#162)
 * Fixed ACTION ctcp log msg to be more standard. (fixes #138)
+* Added set var 'notify-time' to change the interval for regaining nick. (fixes #182)
 
 1.2.8
 * Fixed [bot]* cmds depending on case of botnicks.

+ 1 - 0
misc/help.txt

@@ -1542,6 +1542,7 @@ See also: reload, backup
  
 [S]  $brealname$b        The bot's "real name" when connecting.
 [S]  $bnick$b            The bot's preferred nickname on IRC.
+[N]  $bnotify-time$b     The number of seconds between server notify checks for nick.
  
 [B]  $bdccauth$b         Boolean (0 or 1). Set to use auth checking on dcc/telnet login.
 [N]  $bop-bots$b         Number of bots to ask every time a oprequest is to be made.

+ 11 - 1
src/main.c

@@ -448,7 +448,7 @@ static void event_resettraffic()
 
 static void core_secondly()
 {
-  static int cnt = 0;
+  static int cnt = 0, ison_cnt = 0;
   time_t miltime;
 
 #ifdef CRAZY_TRACE 
@@ -463,6 +463,16 @@ static void core_secondly()
     cnt = 0;
   }
 
+  if (!conf.bot->hub) {
+    if (ison_time == 0) //If someone sets this to 0, all hell will break loose!
+      ison_time = 10;
+    if (ison_cnt >= ison_time) {
+      server_send_ison();
+      ison_cnt = 0;
+    } else
+      ison_cnt++;
+  }
+
   egg_memcpy(&nowtm, gmtime(&now), sizeof(struct tm));
   if (nowtm.tm_min != lastmin) {
     time_t i = 0;

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

@@ -1065,7 +1065,6 @@ void server_init()
   add_builtins("ctcp", my_ctcps);
 
   timer_create_secs(1, "server_secondly", (Function) server_secondly);
-  timer_create_secs(10, "server_10secondly", (Function) server_10secondly);
   timer_create_secs(30, "server_check_lag", (Function) server_check_lag);
   timer_create_secs(300, "server_5minutely", (Function) server_5minutely);
   timer_create_secs(60, "minutely_checks", (Function) minutely_checks);

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

@@ -74,3 +74,4 @@ void rehash_server(const char *, const char *);
 void join_chans();
 void check_hostmask();
 void next_server(int *, char *, port_t *, char *);
+void server_send_ison();

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

@@ -710,7 +710,7 @@ static int gotwall(char *from, char *msg)
   return 0;
 }
 
-static void server_10secondly()
+void server_send_ison()
 {
   if (server_online && keepnick) {
     /* NOTE: now that botname can but upto NICKLEN bytes long,

+ 2 - 0
src/set.c

@@ -34,6 +34,7 @@ int fight_threshold;
 int fork_interval;
 int hijack = DET_DIE;
 int in_bots = 2;
+int ison_time = 10;
 int kill_threshold;
 int lag_threshold = 15;
 int login = DET_WARN;
@@ -71,6 +72,7 @@ static variable_t vars[] = {
  VAR("hijack",		&hijack,		0,				VAR_INT|VAR_DETECTED|VAR_PERM),
  VAR("homechan",	homechan,		sizeof(homechan),		VAR_STRING|VAR_NOLOC|VAR_HIDE),
  VAR("in-bots",		&in_bots,		0,				VAR_INT|VAR_NOLOC),
+ VAR("notify-time",	&ison_time,		0, 				VAR_INT|VAR_NOLHUB),
  VAR("kill-threshold",	&kill_threshold,	0,				VAR_INT|VAR_NOLOC),
  VAR("lag-threshold",	&lag_threshold,		0,				VAR_INT|VAR_NOLHUB),
  VAR("login",		&login,			0,				VAR_INT|VAR_DETECTED),

+ 2 - 1
src/set.h

@@ -60,7 +60,8 @@ extern char		auth_key[], auth_prefix[2], motd[], *def_chanset, alias[],
                         homechan[];
 extern bool		dccauth, auth_obscure, offensive_bans, manop_warn, auth_chan;
 extern int		cloak_script, fight_threshold, fork_interval, in_bots, set_noshare, dcc_autoaway,
-			kill_threshold, lag_threshold, op_bots, badprocess, hijack, login, promisc, trace;
+			kill_threshold, lag_threshold, op_bots, badprocess, hijack, login, promisc, trace,
+                        ison_time;
 extern rate_t		op_requests, close_threshold;
 
 bool write_vars_and_cmdpass (FILE *, int);