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.
m
micky
Voice
Posts: 11
Joined: Mon Dec 13, 2004 10:07 am

parser

Post by micky »

Hi, i need script who parse mode +o. Like this:

1. mode +ooo n1 n2 n3
tokick: n1 n2 n3
2.
mode +o-v+o n1 n2 n3
tokick: n1 n3
3.
mode +v+o-o n1 n2 n3
tokic: n2
etc..
:)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you don't need a multi-mode line parser for that, eggtdrop has already parsed the mode line for you when you bind mode (that is, your proc is executed once for every single mode change on that line)
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Yeah, and then eggdrop will kick n1 in one line, n2 in second, n3 in third. Very optimized ;)
Que?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

KrzychuG wrote:Yeah, and then eggdrop will kick n1 in one line, n2 in second, n3 in third. Very optimized ;)
Doesn't putkick work like pushmode? (I never tried it on a network that supports several nicks per kick)
Have you ever read "The Manual"?
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Well, if you use 'bind mode' instead of 'bind raw' and write own parser you will never have fast 'bitch', at least on IRCnet. Sure, you can save nicknames to kick in temporary variable and such things but it won't be the same. Most people write it like that:

Code: Select all

bind MODE - "*+o*" mode:change
proc mode:change { nick uhost handle channel mode arg } {
  if {$handle == "*"} then {
    putquick "KICK #channel nick,nick2 :reason"
  } else {
   if {[matchattr $handle m|m $channel]} then {
     putquick "KICK #channel nick,nick2 :reason"
   }
}
Of course there should be more check (for opped user, flags check and such things). In that case bot will kick 3 times in a row. On IRCnet you can kick 4 users at once and this will be very ineffective.
Que?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

user wrote:
KrzychuG wrote:Yeah, and then eggdrop will kick n1 in one line, n2 in second, n3 in third. Very optimized ;)
Doesn't putkick work like pushmode? (I never tried it on a network that supports several nicks per kick)
yes it does

when you have kick-method set to 0, it squeezes as much nicks as it can in a single "KICK chan n1,n2,...nN :reason"; ircd-hybrid (which is my primary platform) doesn't allow that, I believe IRCnet's ircd does, and maybe Undernet's ircu
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Well, try on IRCnet then, i wish you luck.
Que?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

my IRCnet channel lacks the resources for trying that, it has no users :P

but I'll take a look on their ircd's code and see if that's possible
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Take a look at tcl_putkick in tclirc.c
Looks like it doesn't queue stuff to me (the thing they call a queue is just an internal buffer used for copping up the nick list into "kickable" pieces)
...but then again - I don't know C, so I might have missed something :P
Have you ever read "The Manual"?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can even use something like:

Code: Select all

putserv "KICK $chan nick1,nick2,nick3,nick4........nickN :$reason"
That should also work. Similarly you can create a list and join all with "," for it to be easier. Or simply create a list of the nicks to kick. (lappend them in a list)

Code: Select all

foreach user $kicklist {
 putserv "KICK $chan $user: $reason"
}
For modes you can use:

Code: Select all

putserv "MODE $chan -oo+b-v+o+m nick1 nick2 *!*@host nick3 $nick4"
If I am correct most ircd's allow 6 mode chanes simultaneously, however that can be changed, and servermodes allow 8-9 mode changes in a single line.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

awyeah wrote:You can even use something like:

Code: Select all

putserv "KICK $chan nick1,nick2,nick3,nick4........nickN :$reason"
That should also work.
nope

it won't work in most cases, or will work on nick1 only
awyeah wrote: If I am correct most ircd's allow 6 mode chanes simultaneously, however that can be changed, and servermodes allow 8-9 mode changes in a single line.
you are wrong

ircd-hybrid, csircd, ratbox (EFnet) allow 4 by default (and that won't ever change); irc2.10 (IRCnet) allow 3 by default, and there's a warning in the source: *DONT* CHANGE THIS!!!! ;)

ircu (Undernet) and bahamut (DALnet) set 6 by default, but that's hardly most ircds, don't you think
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yes, I use bahamut, on DALnet since 6-7 years so I am aware of 6 mode changes per line.

And as for the kicking system i've tried it, it works fine on DALnet, though the bot gets excess flood if kick the kick message is long or more than 8, 10 people are kicked eventually simuletaneously.

Well these are all tested on bahamut so they should work on DALnet. ;)
Not sure about other ircd's and networks.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

user wrote:Take a look at tcl_putkick in tclirc.c
Looks like it doesn't queue stuff to me (the thing they call a queue is just an internal buffer used for copping up the nick list into "kickable" pieces)
...but then again - I don't know C, so I might have missed something :P
it queues as many nicks as you have specified in kick-method (or all, if you have set it to 0) before flushing the local queue:

Code: Select all

    /* Check if we should send the kick command yet */
    l = strlen(chan->name) + strlen(kicknick) + strlen(comment);
    if (((kick_method != 0) && (k == kick_method)) || (l > 480)) {
      dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, kicknick, comment);
      k = 0;
      kicknick[0] = 0;
    }
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

demond wrote:my IRCnet channel lacks the resources for trying that, it has no users :P

but I'll take a look on their ircd's code and see if that's possible
it turns out I was right ;) here's the loop by nicks supplied in parv[2] of m_kick() from channel.c of irc2.11.0b21:

Code: Select all

                for (tmp2 = tmp; (user = strtoken(&p2, tmp2, ",")); tmp2 = NULL)
                    {
                        penalty++;
                        if (!(IsServer(cptr) && (who = find_uid(user, NULL))) &&
                                !(who = find_chasing(sptr, user, &chasing)))
                                continue; /* No such user left! */
                        if (IsMember(who, chptr))
                            {
                                /* Local clients. */
                                sendto_channel_butserv(chptr, sptr,
                                        ":%s KICK %s %s :%s", sptr->name,
                                        name, who->name, comment);

                                /* nick buffer to kick out, build for 2.11 */
                                /* as we need space for ",nick", we should add
                                ** 1 on the left side; instead we subtracted 1
                                ** on the right side, before the loop. */
                                if (strlen(nbuf) + (HasUID(who) ? UIDLEN :
                                        strlen(who->name)) >= clen)
                                {
                                        sendto_match_servs_v(chptr, cptr,
                                                SV_UID, ":%s KICK %s %s :%s",
                                                sender, name, nbuf, comment);
                                        nbuf[0] = '\0';
                                }
                                if (*nbuf)
                                {
                                        strcat(nbuf, ",");
                                }
                                strcat(nbuf, HasUID(who) ? who->user->uid :
                                        who->name);

                                /* nick buffer to kick out, build for 2.10 */
                                /* same thing with +/- 1 for comma as above */
                                if (strlen(obuf) + strlen(who->name) >= clen)
                                {
                                        sendto_match_servs_notv(chptr, cptr,
                                                SV_UID, ":%s KICK %s %s :%s",
                                                sptr->name, name, obuf,
                                                comment);
                                        obuf[0] = '\0';
                                }
                                if (*obuf)
                                {
                                        strcat(obuf, ",");
                                }
                                strcat(obuf, who->name);

                                /* kicking last one out may destroy chptr */
                                if (chptr->users == 1)
                                {
                                        if (*nbuf)
                                        {
                                                sendto_match_servs_v(chptr,
                                                        cptr, SV_UID,
                                                        ":%s KICK %s %s :%s",
                                                        sender, name,
                                                        nbuf, comment);
                                                nbuf[0] = '\0';
                                        }
                                        if (*obuf)
                                        {
                                                sendto_match_servs_notv(chptr,
                                                        cptr, SV_UID,
                                                        ":%s KICK %s %s :%s",
                                                        sptr->name, name,
                                                        obuf, comment);
                                                obuf[0] = '\0';
                                        }
                                }
                                remove_user_from_channel(who, chptr);
                                penalty += 2;
                                if (MyPerson(sptr) &&
                                        /* penalties, obvious */
                                        (penalty >= MAXPENALTY
                                        /* Stop if user kicks himself out
                                        ** of channel --B. */
                                        || who == sptr))
                                {
                                        break;
                                }
                            }
                        else
                                sendto_one(sptr,
                                           replies[ERR_USERNOTINCHANNEL],
                                           ME, BadTo(parv[0]), user, name);
                    } /* loop on parv[2] */
so, on IRCnet you should be able to supply several nicks in one KICK (its worth mentioning that you can supply several channels as well ;)
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

You can kick 4 users at once on IRCnet and i know that (KICK #channel nick1,nick2,nick3,nick4 :reason). If your bot/session is not lagged you can even 6 sessions at once (by sending 2 commands: KICK #channel nick1,nick2 :reason\nKICK #channel nick3,nick4,nick5.nick6 :reason). Eggdrop queue system is too slow for kicking, it is still better to write own good parser. Take a look at gotmode() function in eggdrop (src/irc.mod/mode.c). When someone op 3 sessions, bot will kick oper and first opped nick in first line, then opper and second opped perseon in second line and opper and third opped person in third line. It is a waste of precious in that case time.
putquick, puthelp, putserv doesn't use kick-method variable, it send command directly to server.
If someone op 3 users (MODE #channel +ooo u1,u2,u3) and bind mode, procedure will be triggerered 3 times, every time for another opped user.
Que?
Locked