well there's no question about that - bypassing eggdrop's queue system gives your bot some advantage over stock eggdrops in case of channel wars, and being IRCnet user, you probably have had to learn that the hard way

Code: Select all
diff -urN src/mod/irc.mod/mode.c src+d1/mod/irc.mod/mode.c
--- src/mod/irc.mod/mode.c Tue Dec 14 21:32:59 1999
+++ src+d1/mod/irc.mod/mode.c Mon Feb 7 03:02:44 2000
@@ -941,13 +941,47 @@
}
}
+static struct oppee { char op; char nick[63]; } opp[16];
+
+static int my_parse(char *chg, char *args, struct oppee *opp, int size)
+{
+ char *p = chg, *q, *r, buf[512];
+ int i, plus = 0, minus = 0, pos = 0, cur = 0;
+
+ r = buf;
+ while (*p) switch (*p++) {
+ case '+': plus = 1; minus = 0;
+ break;
+ case '-': minus = 1; plus = 0;
+ break;
+ case 'o':
+ if (plus && (cur < size))
+ opp[cur].op = '+';
+ else if (minus && (cur < size))
+ opp[cur].op = '-';
+ else return 0;
+ strncpy(buf, args, 511); buf[511] = 0;
+ pos++; q = buf;
+ for (i=0; i < pos; i++) r = newsplit(&q);
+ strncpy(opp[cur].nick, r, 62);
+ opp[cur++].nick[62] = 0;
+ break;
+ case 'b': case 'e': case 'I': case 'v': case 'h':
+ pos++;
+ break;
+ default:
+ break;
+ }
+ return cur;
+}
+
/* a pain in the ass: mode changes */
static void gotmode(char *from, char *msg)
{
char *nick, *ch, *op, *chg;
char s[UHOSTLEN];
char ms2[3];
- int z;
+ int z, i, oppees, badops = 0;
struct userrec *u;
memberlist *m;
struct chanset_t *chan;
@@ -967,12 +1001,32 @@
msg[z] = 0;
putlog(LOG_MODES, chan->name, "%s: mode change '%s %s' by %s",
ch, chg, msg, from);
+ if (strchr(from, '@') && me_op(chan))
+ if ((oppees = my_parse(chg, msg, opp, 16)))
+ for (i=0; i < oppees; i++) {
+ m = ismember(chan, opp[i].nick);
+ if (m) {
+ u = m->user;
+ if (u) {
+ get_user_flagrec(u, &user, ch);
+ if (opp[i].op == '+' && !(glob_op(user) || chan_op(user)))
+ badops++;
+ if (opp[i].op == '-' && (glob_op(user) || chan_op(user)))
+ badops++;
+ } else if (opp[i].op == '+') badops++;
+ }
+ }
u = get_user_by_host(from);
get_user_flagrec(u, &user, ch);
nick = splitnick(&from);
m = ismember(chan, nick);
if (m)
m->last = now;
+ if (m && me_op(chan) && (badops > 1)) {
+ dprintf(DP_MODE, "KICK %s %s :%s\n", ch, nick, CHAN_MASSDEOP_KICK);
+ m->flags |= SENTKICK;
+ reversing = 1;
+ }
if ((allow_desync == 0) && /* arthur2: added flag tests */
!(glob_friend(user) || chan_friend(user) ||
(channel_dontkickops(chan) &&