mIRC Home    About    Download    Register    News    Help

Print Thread
#52583 05/10/03 01:23 PM
Joined: Dec 2002
Posts: 266
Z
zack Offline OP
Fjord artisan
OP Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
I wrote a join flood protection script ages back, and it has worked properly countless times. At the time of writing it I implemented a netsplit detection system which adds nicknames that split to a hash table, and when they rejoin if they're in it, they're removed and the flood protection ignores them joining.

It has worked for some time through many netsplits, this evening it decided to not work, after absolutely no edits or anything. It kicked out coutnless people after a netsplit, and the people in them ain't happy and neither am I. This has lead me to believe that there is a bug in mIRC somewhere, and has somehow affected my script.

The code of the flood protection is below

Code:
on @*:JOIN:#:{
  if ($istok($hget(sbot,floodprosnicks),$nick,44)) { hadd -m sbot floodprosnicks $remtok($hget(sbot,floodprosnicks),$nick,1,44) | return }
  .hinc -mu2 sbot floodpro. $+ $chan
  .hadd -mu30 sbot floodpro. $+ $chan $+ .nicks $addtok($hget(sbot,floodpro. $+ $chan $+ .nicks),$nick,44)
  if ($hget(sbot,floodpro. $+ $chan) > 3) && (!$hget(sbot,floodprocheck. $+ $chan)) { 
    mode # +im
    .timer-im+R 1 30 MODE $chan -im+R
    .timer-R 1 60 MODE $chan -R
    .hadd -mu10 sbot floodprocheck. $+ $chan 1
  }
}
on *:MODE:#:{
  if ($nick == $me) && ($1 == +im) {
    sbot_ban $chan $replace($hget(sbot,floodpro. $+ $chan $+ .nicks),$chr(44),$chr(32))
    sbot_kick $chan $hget(sbot,floodpro. $+ $chan $+ .nicks) Flood
    .hdel sbot floodpro. $+ $chan $+ .nicks
  }
}
on *:QUIT:{
  if (*.*.* *.*.* iswm $1-2) {
    hadd -m sbot floodprosnicks $addtok($hget(sbot,floodprosnicks),$nick,44)
  }
}
alias -l sbot_kick {
  var %stemp $2
  while %stemp {
    .raw -q KICK $1 $gettok(%stemp,1-4,44) $+(:,$3-)
    %stemp = $deltok(%stemp,1-4,44)
  }
}
alias -l sbot_ban {
  var %stemp 1,%scurr,%sbans,%snum
  while $gettok($iif($2 isnum,$3-,$2-),%stemp,32) {
    %scurr = $ifmatch
    %sbans = $addtok(%sbans,$iif($address(%scurr,$iif($2 isnum,$2,13)),$ifmatch,%scurr),32)
    inc %stemp
  }
  while %sbans {
    %snum = $numtok(%sbans,32)
    .raw -q MODE $1 $+(+,$str(b,$iif(%snum > 6,6,%snum))) $gettok(%sbans,1-6,32)
    %sbans = $deltok(%sbans,1-6,32)
  }
}


Can someone locate an error in the code, otherwise note a bug in mIRC?

Thankyou.


You won't like it when I get angry.
#52584 05/10/03 01:55 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I didn't go through the whole code, most likely the server didn't give the netsplit quit message in a *.*.* *.*.* format.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#52585 05/10/03 02:16 PM
Joined: Dec 2002
Posts: 266
Z
zack Offline OP
Fjord artisan
OP Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
This was the quit message in question: renew.hub.dal.net diamond.hub.dal.net

With a simple test:
//var %a renew.hub.dal.net diamond.hub.dal.net | if (*.*.* *.*.* iswm %a) { echo -a Yes it is in that format }

That shows that it works perfectly fine.


You won't like it when I get angry.
#52586 06/10/03 12:03 AM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Looking at it I couldn't find anything, did you debug it? Like adding echoes when adding and removing someone into/from the table, simulating a netsplit, etc.

Edit: Also, are you sure there isn't any other script code interacting with that table?

Last edited by cold; 06/10/03 12:06 AM.

* cold edits his posts 24/7
#52587 06/10/03 08:13 AM
Joined: Dec 2002
Posts: 266
Z
zack Offline OP
Fjord artisan
OP Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
It was tested thoroughly and being on DALnet netsplits are plentiful :P Flags (/echo's) were placed throughout it when it was created to test that nicknames were added and removed correctly. Other people tested it as well.

The code above was originally written for a socket bot (hence sbot), and I 'translated' it into normal mIRC code a little while ago (both were tested and both have worked fine). At the time of the netsplit, the socket bot with the same code didn't kick anyone out of any channels, yet this one did.

---Edit---

I should note that someone else is running the socket bot (on 6.03), and that no other remotes in my script write/edit/delete these hash tables.

Last edited by zack; 06/10/03 08:15 AM.

You won't like it when I get angry.
#52588 06/10/03 08:33 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I couldn't find anything wrong either (none of the bugs introduced in 6.1 have anything to do with this), but I noticed the lack of multiserv support. As the hash tables items are not session-specific, two netsplits occuring on different sessions (and you happened to be op on the same channel on both networks) could contaminate the hash table and cause the problem you described.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#52589 06/10/03 08:54 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I would say, you likely should be a happy camper, your channel has out grown your script.

this command well have overflowed

hadd -m sbot floodprosnicks $addtok($hget(sbot,floodprosnicks),$nick,44)

For two reasons,
One u never clear out anyone who QUITS and never returns
Two it can only hold around 950 characters

try in ON *:QUIT:{
hadd -mu3600 sbot Quitnick. $+ $nick $true

then in ON @*:JOIN:#:{
if ($hget(sbot,Quitnick. $+ $nick) == $true) { hadd -mu60 sbot Quitnick. $+ $nick $true | return }

You dont want to delete the Quitnick.<nick> flag for maybe 60 seconds more as the same nick maybe joining other channels also, 60 seconds might be more than you need but isnt excessivly long.

#52590 06/10/03 02:43 PM
Joined: Dec 2002
Posts: 266
Z
zack Offline OP
Fjord artisan
OP Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
I checked the status window for any possible errors, there were none. I believed that was the problem to begin with but there were no '* /hadd: line too long' etc errors at all.
Echo'ing the hash table results returned only a few nicknames which hadn't rejoined, so they were removed, mIRC just decided to ignore it for soem reason.

1hr? I guess you don't know how long DALnet netsplits last :P It can be from a few seconds to many hours... That's why I didn't implement that in the first place, in case the table was wiped and then they decided to rejoin.

But I agree with qwerty and yourself, that this wasn't built for multi-channel/network support. Which I might do in the near future, as to eliminate that problem.


You won't like it when I get angry.

Link Copied to Clipboard