mIRC Home    About    Download    Register    News    Help

Print Thread
"Anti" excess flood ... is it possible? #185858 15/09/07 08:04 AM
Joined: Feb 2007
Posts: 28
F
Fill Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2007
Posts: 28
I run a mIRC-based bot and some hours ago the server had a netsplit, you know, everyone quitting irc. The problem is, when they come back, they make a mass join flood, because they're scripts autommaticly reconnect to the server and then something like 100 people joins the channel in seconds.

When someone join that channel, my bot does a /who on the nick that joined, to check if its Real Name is not ofensive, and if it is, it kicks.

When everyone joined, the bot, obviously, started to do /who on all that people at the same time .... because they all joined!

So I wanted to make sure this doesn't happen again, I was thinking about doing a script that detects mass join and so stops the bot from making /who for a while. We would set a variable. in case of massjoin, he sets the %join $true, and I add it on the script of /who.

What do you recommend me to do?

Re: "Anti" excess flood ... is it possible? [Re: Fill] #185860 15/09/07 09:53 AM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
something I use is timers.

each event I:
* inc -uX %somecountervar , where X is for instance 30 (seconds). this will increase the value of the variable with 1 and unset it after 30 seconds.
* .timer 1 $calc(%somecountervar * 2) who SOMEONE , where someone is forinstance $nick to match the nickname of the person that triggers the event.

what this does is:
each time someone joins it increases the counter var with 1 or set it to 1 if no one joined in the last 30 seconds (and the var was unset), then it will delay the /who with 2 * the value of the counter. that way you will counter the excess flood by delaying the /who requests with 2 seconds between each command (2 seconds is safest to use on most networks).

hope this is clear :-]


If it ain't broken, don't fix it!
Re: "Anti" excess flood ... is it possible? [Re: Fill] #185874 15/09/07 02:09 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Alternatively, since people joining at the end of a netsplit tend to already have been in the channel before, you could just make /who not trigger after more than 3 people join within a 2 second interval.

Code:
on *:join:#yourchannel: {
  if (%Join.fld > 3) { return }
  inc -u2 %Join.fld
  who $nick
}


To adjust the time period, change the 2 in -u2, and to change the number of people that can join within that time period before /who doesn't trigger anymore, change the 3 in > 3.

Note that this will still /who the first 3 people, but will stop after that to prevent getting flooded.


Invision Support
#Invision on irc.irchighway.net
Re: "Anti" excess flood ... is it possible? [Re: Riamus2] #185877 15/09/07 02:30 PM
Joined: Feb 2007
Posts: 28
F
Fill Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2007
Posts: 28
Yes, but when will it restart to make /who on the people that join the chan?

When the mass join stops, right?

Last edited by Fill; 15/09/07 02:33 PM.
Re: "Anti" excess flood ... is it possible? [Re: Fill] #185888 15/09/07 04:45 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
When a netsplit completes, everyone joins at the same time. This script will only /who the first 3 people in a 2 second time period. (As I mentioned, you can adjust that if needed). 2 seconds after the last person joins from a netsplit, /who will work again. If normal people join all at once, it will again only /who the first 3 people within that 2 seconds and then it will wait until 2 seconds after the last person in the group joins and then /who will work again.

Note that the 2 second timer restarts anytime someone else joins. So, if you had 10 people all join, with 1 second between them, it will trigger the flood protection and 2 seconds after the 10th person joins, the flood protection will disable and /who will work again.


Invision Support
#Invision on irc.irchighway.net
Re: "Anti" excess flood ... is it possible? [Re: Riamus2] #185899 15/09/07 07:35 PM
Joined: Feb 2007
Posts: 28
F
Fill Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2007
Posts: 28
I understand now, 3 people per 2 seconds is fine, because I checked in the netsplit logs and noticed that we had something like an average of 7 people per 2 seconds under netsplit ... so I guess it is perfect wink

Thanks for the help. See ya