mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2017
Posts: 20
A
Angela Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Jun 2017
Posts: 20
I have a whois script that whois people as they enter the channel. It hasn't been a problem until the channel started getting flooded and then I would get frozen up. I have looked and looked for something but I can't find anything. Can anyone help with a small script for flood protection?

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
This is a basic problem with doing any automated task in reaction to other people's behavior or network splits. You may have to reconcile that you do not really need to /whois everyone, or perhaps you can perform delayed batch processing of /whois lookups and only do them for new strangers who really need it... adding known regular users to an exemption list.

Another solution is to just temporarily disable the script, ignoring when there are too many joins in a short period like after a netsplit resync.

Why do you feel it's necessary to /whois everyone, and can the same information be gleaned by other means?


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I haven't stress-tested this, but it seems to work. During the JOIN event, this calls the alias instead of doing the /whois. If there's nothing in the queue, it will do the /whois immediately, otherwise it waits to let the timer do it. The 15 sec delay is obviously too long, I just had it that way so I could test the queue. It doesn't take someone out of the queue until it gets back a valid whois reply, and skips someone for 5 seconds if they join several of your channels all at the same time.

I assume you're sending the whois output to a @window instead of cluttering up the channel. If you need to merge these raw 311 and 318 events with your scripting, you should be able to copypaste these to the top of your existing handlers for those raw events without hurting your existing code.

Code:
on !*:JOIN:#:{ whois_on_join $nick }
raw 311:*:{
  var %table whois_on_join. $+ $network | if ($hget(%table,$2)) hadd %table $2 $2
}
raw 318:*:{
  var %table whois_on_join. $+ $network , %table2 whois_on_join2. $+ $network | if ($hget(%table,$2) == $2) hdel %table $2 | hdel %table2 1.lastwhois
}
on *:CONNECT:{ var %table whois_on_join. $+ $network , %table2 whois_on_join2. $+ $network | hfree -w %table | hfree -w %table2 | hmake %table 1 | hmake %table2 101 }
ON *:NICK:{
  var %table whois_on_join. $+ $network | if (!$hget(%table,$nick)) return
  hadd %table $newnick $hget(%table,$nick) | hdel %table $nick
}
/*
{
  Find the place in the script using these 3 times, and change them as you decide is appropriate
  The 15 on the last line of script is the timer's interval.
  The 5 in -mu5 uses 1recent.nick to block adding to que if already added within the past 5 seconds (mainly for sharing 2+ channels with nick)
  The 1 in -mu1 uses 1.lastwhois to prevent timer from doing repeat /whois within 1 sec of a /whois performed on that nick during ON JOIN, if the previous /whois isn't finished

  nick isn't removed from que until raw-311/318 shows successful whois is done.
  hooks raw-311 to make sure that 318 didn't end the "rate limited" or "No such nick/channel" message
  doesn't block adding nick if whois'ed prior to nick change
}
*/
alias whois_on_join {
  var %table whois_on_join. $+ $network , %table2 whois_on_join2. $+ $network
  if ($ctimer != %table) {
    if ($1 == $null) return
    if ($hget(%table,$1)) { goto exit }
    if ($hget(%table2,1recent. $+ $1)) { goto exit }
    hadd -m1 %table $1 1 | hadd -mu5 %table2 1recent. $+ $1 1
    if ($hget(%table,2).item == $null) { var %nick $1 | goto into }
    goto exit
  }
  :next_whois
  var %t $hget(%table,0).item | if (%t == 0) return
  var %nick $hget(%table,%t).item
  if ($hget(%table2,1.lastwhois) == %nick) return
  :into
  if (!$comchan(%nick,1)) { hdel %table %nick | goto next_whois }
  !whois %nick %nick | hadd -mu1 %table2 1.lastwhois %nick
  :exit
  if (!$timer(%table)) .timer $+ %table 0 15 whois_on_join
}

Joined: Jun 2017
Posts: 20
A
Angela Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Jun 2017
Posts: 20
Thank you :)and I use the whois to keep track of people like trolls who come into the channel.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
What are some of the qualifications to determine whether someone is a troll, and I might be able to help you find another option besides /whois.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jun 2017
Posts: 20
A
Angela Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Jun 2017
Posts: 20
People who come in to cause trouble in the channel. As you said whois isn't the best but right now it is all I have. I would like something where I could add them to a list with their ip's. Then I could search for them by nick or ip.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
What I need you to specify is exactly the information that you currently glean from their /whois, which is helpful to you on your quest.

Their IP/host is automatically disclosed to you when they join the channel, without you having to do anything. mIRC even has the option '[x] Show Addresses' to make them visible to you when they join/part/quit/nick

You say "but it's all I have," allow me be to the judge -- maybe I know something better smile

Yes, it would be trivial to add bad people and their addresses to a list. You can even add them to your ban list.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jun 2017
Posts: 20
A
Angela Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Jun 2017
Posts: 20
Example George (ident@iamatroll.org) comes into the channel and does something to get banned. I would like to have a list that shows his nick ident@address and real name so that if he tries to sneak back in by changing his ip.. i can compare it with the prior whois to see if there is something similar there. I am probably not explaining this well. Kind of like a troll database.


Link Copied to Clipboard