[eggheads-patches] PATCH:delayset.patch

Axel Franke eule at berlin.snafu.de
Sun Oct 29 19:26:01 CST 2000


Hi,

This patch added a chanset aop-delay (minimum:maximum) and a 
globalchanset. For without delay you can set aop-delay to 0 and for 
use a delaytime without random you can set this for example to 
aop-delay 10 or aop-delay 10:10.
This patch included a check for pending delay-ops for prevent bot use 
for this more modelines as needed.

Greeting Eule

-------------- next part --------------
diff -ur eggdrop1.5/eggdrop.advanced.conf eggneu/eggdrop.advanced.conf
--- eggdrop1.5/eggdrop.advanced.conf	Mon Oct 30 02:31:28 2000
+++ eggneu/eggdrop.advanced.conf	Mon Oct 30 02:33:36 2000
@@ -381,6 +381,8 @@
 set global-flood-ctcp 3:60
 set global-flood-nick 5:60
 
+set global-aop-delay 5:30
+
 set global-idle-kick 0
 
 set global-chanset {
@@ -410,6 +412,7 @@
   chanmode "+nt-likm"
   idle-kick 0
   stopnethack-mode 0
+  aop-delay 5:30
   need-op { putserv "PRIVMSG #lamest :op me cos i'm lame!" }
   need-invite { putserv "PRIVMSG #lamest :let me in!" }
   need-key { putserv "PRIVMSG #lamest :let me in!" }
@@ -445,6 +448,14 @@
 #         if channel +bitch: see stopnethack-mode 1
 #       6 if channel -bitch: see stopnethack-mode 2
 #         if channel +bitch: see stopnethack-mode 4
+
+# aop-delay (minimum:maximum)
+# aop-delay 0                   no autoopdelay
+# aop-delay x or aop-delay x:x  x sec. autoopdelay
+# aop-delay x:y                 random delay
+# if a autoopped user joined during a other delayed autoop is pending,
+# the bot will sent both autoop based on the last-joined-user-delay-time,
+# probable in only one line.
 
 # need-op
 #   script to run (if any) when the bot needs to be op'd on this channel
diff -ur eggdrop1.5/eggdrop.complete.conf eggneu/eggdrop.complete.conf
--- eggdrop1.5/eggdrop.complete.conf	Mon Oct 30 02:31:28 2000
+++ eggneu/eggdrop.complete.conf	Mon Oct 30 02:33:36 2000
@@ -447,6 +447,8 @@
 set global-flood-ctcp 3:60
 set global-flood-nick 5:60
 
+set global-aop-delay 5:30
+
 set global-idle-kick 0
 
 set global-chanset {
@@ -476,6 +478,7 @@
   chanmode "+nt-likm"
   idle-kick 0
   stopnethack-mode 0
+  aop-delay 5:30
   need-op { putserv "PRIVMSG #lamest :op me cos i'm lame!" }
   need-invite { putserv "PRIVMSG #lamest :let me in!" }
   need-key { putserv "PRIVMSG #lamest :let me in!" }
@@ -511,6 +514,14 @@
 #         if channel +bitch: see stopnethack-mode 1
 #       6 if channel -bitch: see stopnethack-mode 2
 #         if channel +bitch: see stopnethack-mode 4
+
+# aop-delay (minimum:maximum)
+# aop-delay 0                   no autoopdelay
+# aop-delay x or aop-delay x:x  x sec. autoopdelay
+# aop-delay x:y                 random delay
+# if a autoopped user joined during a other delayed autoop is pending,
+# the bot will sent both autoop based on the last-joined-user-delay-time,
+# probable in only one line.
 
 # need-op
 #   script to run (if any) when the bot needs to be op'd on this channel
diff -ur eggdrop1.5/src/chan.h eggneu/src/chan.h
--- eggdrop1.5/src/chan.h	Mon Oct 30 02:31:29 2000
+++ eggneu/src/chan.h	Mon Oct 30 02:33:36 2000
@@ -55,6 +55,7 @@
 #define SENTDEVOICE 0x0080	/* a devoice has been sent		*/
 #define WASOP       0x0100	/* was an op before a split		*/
 #define STOPWHO     0x0200
+#define FULL_DELAY  0x0400
 
 #define chan_hasvoice(x) (x->flags & CHANVOICE)
 #define chan_hasop(x) (x->flags & CHANOP)
@@ -144,6 +145,8 @@
   int flood_ctcp_time;
   int flood_nick_thr;
   int flood_nick_time;
+  int aop_min;
+  int aop_max;
   int status;
   int ircnet_status;
   int idle_kick;
diff -ur eggdrop1.5/src/mod/channels.mod/channels.c eggneu/src/mod/channels.mod/channels.c
--- eggdrop1.5/src/mod/channels.mod/channels.c	Mon Oct 30 02:31:30 2000
+++ eggneu/src/mod/channels.mod/channels.c	Mon Oct 30 02:33:36 2000
@@ -44,6 +44,8 @@
 static struct udef_struct *udef;
 static int global_stopnethack_mode;
 static int global_idle_kick;		/* Default idle-kick setting. */
+static int global_aop_min;
+static int global_aop_max;
 
 /* Global channel settings (drummer/dw) */
 static char glob_chanset[512];
@@ -397,7 +399,7 @@
     fprintf(f, "channel %s %s%schanmode %s idle-kick %d stopnethack-mode %d \
 need-op %s need-invite %s need-key %s need-unban %s need-limit %s \
 flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d \
-flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d \
+flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d aop-delay %d:%d \
 %cenforcebans %cdynamicbans %cuserbans %cautoop %cbitch \
 %cgreet %cprotectops %cprotectfriends %cdontkickops \
 %cstatuslog %crevenge %crevengebot %cautovoice %csecret \
@@ -416,6 +418,7 @@
         chan->flood_kick_thr, chan->flood_kick_time,
         chan->flood_deop_thr, chan->flood_deop_time,
 	chan->flood_nick_thr, chan->flood_nick_time,
+	chan->aop_min, chan->aop_max,
 	PLSMNS(channel_enforcebans(chan)),
 	PLSMNS(channel_dynamicbans(chan)),
 	PLSMNS(!channel_nouserbans(chan)),
@@ -761,6 +764,7 @@
   {"global-flood-join",		&gfld_join_thr,		&gfld_join_time},
   {"global-flood-ctcp",		&gfld_ctcp_thr,		&gfld_ctcp_time},
   {"global-flood-nick",		&gfld_nick_thr, 	&gfld_nick_time},
+  {"global-aop-delay",		&global_aop_min,	&global_aop_max},
   {NULL,			NULL,			NULL}
 };
 
@@ -875,6 +879,8 @@
   gfld_ctcp_thr = 5;
   gfld_ctcp_time = 60;
   global_idle_kick = 0;
+  global_aop_min = 5;
+  global_aop_max = 30;
   setstatic = 0;
   use_info = 1;
   ban_time = 60;
diff -ur eggdrop1.5/src/mod/channels.mod/tclchan.c eggneu/src/mod/channels.mod/tclchan.c
--- eggdrop1.5/src/mod/channels.mod/tclchan.c	Mon Oct 30 02:31:31 2000
+++ eggneu/src/mod/channels.mod/tclchan.c	Mon Oct 30 02:33:36 2000
@@ -768,6 +768,8 @@
   Tcl_AppendElement(irp, s);
   simple_sprintf(s, "%d:%d", chan->flood_nick_thr, chan->flood_nick_time);
   Tcl_AppendElement(irp, s);
+  simple_sprintf(s, "%d:%d", chan->aop_min, chan->aop_max);
+  Tcl_AppendElement(irp, s);
   if (chan->status & CHAN_ENFORCEBANS)
     Tcl_AppendElement(irp, "+enforcebans");
   else
@@ -1155,6 +1157,23 @@
 	*pthr = atoi(item[i]);
 	*ptime = 1;
       }
+    } else if (!strncmp(item[i], "aop-delay", 9)) {
+      char *p;
+      i++;
+      if (i >= items) {
+	if (irp)
+	  Tcl_AppendResult(irp, item[i - 1], " needs argument", NULL);
+	return TCL_ERROR;
+      }
+      p = strchr(item[i], ':');
+      if (p) {
+	p++;
+	chan->aop_min = atoi(item[i]);
+	chan->aop_max = atoi(p);
+      } else {
+	chan->aop_min = atoi(item[i]);
+	chan->aop_max = chan->aop_min;
+      }
     } else {
       if (!strncmp(item[i] + 1, "udef-flag-", 10))
         initudef(UDEF_FLAG, item[i] + 11, 0);
@@ -1589,6 +1608,8 @@
     chan->flood_nick_time = gfld_nick_time;
     chan->stopnethack_mode = global_stopnethack_mode;
     chan->idle_kick = global_idle_kick;
+    chan->aop_min = global_aop_min;
+    chan->aop_max = global_aop_max;
     
     /* 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
diff -ur eggdrop1.5/src/mod/irc.mod/chan.c eggneu/src/mod/irc.mod/chan.c
--- eggdrop1.5/src/mod/irc.mod/chan.c	Mon Oct 30 02:31:32 2000
+++ eggneu/src/mod/irc.mod/chan.c	Mon Oct 30 02:33:36 2000
@@ -1708,7 +1708,28 @@
 	   /* ... and is it op-on-join or is the use marked auto-op? */
 	    (channel_autoop(chan) || glob_autoop(fr) || chan_autoop(fr))) {
 	  /* Yes! do the honors. */
-	  m->delay = now;
+	  if (!chan->aop_min)
+	    add_mode(chan, '+', 'o', nick);
+	  else {
+	    time_t a_delay;
+	    int aop_min = chan->aop_min, aop_max = chan->aop_max, count = 0;
+	    memberlist *m2;
+	    if (aop_min >= aop_max)
+	      a_delay = now + aop_min;
+	    else
+	      a_delay = now + (random() % (aop_max - aop_min)) + aop_min + 1;
+	    for (m2 = chan->channel.member; m2 && m2->nick[0]; m2 = m2->next)
+	      if (m2->delay && !(m2->flags & FULL_DELAY))
+		count++;
+	    if (count)
+	      for (m2 = chan->channel.member; m2 && m2->nick[0]; m2 = m2->next)
+		if (m2->delay && !(m2->flags & FULL_DELAY)) {
+		  m2->delay = a_delay;
+		  if (count + 1 >=  modesperline)
+		    m2->flags |= FULL_DELAY;
+		}
+	    m->delay = a_delay;
+	  }
 	} else if ((channel_autovoice(chan) &&
 		    (chan_voice(fr) || (glob_voice(fr) && !chan_quiet(fr)))) ||
 		   ((glob_gvoice(fr) || chan_gvoice(fr)) && !chan_quiet(fr)))
diff -ur eggdrop1.5/src/mod/irc.mod/irc.c eggneu/src/mod/irc.mod/irc.c
--- eggdrop1.5/src/mod/irc.mod/irc.c	Mon Oct 30 02:31:32 2000
+++ eggneu/src/mod/irc.mod/irc.c	Mon Oct 30 02:33:36 2000
@@ -939,9 +939,10 @@
   while (chan != NULL) {
     m = chan->channel.member;
     while (m && m->nick[0]) {
-      if ((m->delay) && (now - m->delay) > 4) {
-        add_mode(chan, '+', 'o', m->nick);
-        m->delay = 0L;
+      if (m->delay && m->delay <= now) {
+	add_mode(chan, '+', 'o', m->nick);
+	m->delay = 0L;
+	m->flags &= ~FULL_DELAY;
       }
       m = m->next;
     }


More information about the Patches mailing list