This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

parser

Old posts that have not been replied to for several years.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

@KrzychuG:

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 ;) I myself am pretty familiar with the subject, used to patch my bots with an optimized MODE parser and introduced a special TCL bind "mass" which was triggered on mass op/deop, not using eggdrop's queues... and other similar goodies; but those times are long gone, channel wars are no more, even on EFnet (IRCnet may be a different matter, with its total ignorance of channel "ownership" and persistent ops notions)
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Yes, this is mainly IRCnet problem. There are still those damn ircwars and channel protection is really important here. Without own parser you don't have too much change again clones, which are not rare here. Do you still have that patch, i'm interested how you did that and how diffrent is it from my version ;)
Que?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

@KrzychuG:

well, below is the relevant part of my patch for eggdrop 1.4 (as you'll probably notice, this is pretty ancient hehe... but nevertheless effective):

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) &&
feel free to use it if you consider it better than yours
Locked