mIRC Home    About    Download    Register    News    Help

Print Thread
#173290 23/03/07 03:15 AM
Joined: Jun 2004
Posts: 25
Q
Quia Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2004
Posts: 25
Is there a way to make a ban that would effect only people who have three numbers in their userid?
I thought that ? was a number wildcard by the way it was described under $address, but testing proved otherwise.

Quia #173294 23/03/07 04:29 AM
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
? is a wildcard for any 1 character, not just numbers.

Quia #173297 23/03/07 05:32 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Usage: /3ban <channel>
<channel> is optional, but if there's no channel provided, via another means, you will be prompted for it.

Code:
alias 3ban {
  set %chan $iif(!$1 && !$chan,$$?="Channel Name",$iif($1,$1,$chan))
  var %a = 1
  while %a <= $nick(%chan,0) {
    var %c = 1, %d = $right($gettok($address($nick(%chan,%a),0),1,64),-2)
    while %c <= $len(%d) {
      if $mid(%d,%c,3) isnum {
        if $me isop %chan {
          .ban -k %chan $nick(%chan,%a)
          %c  = %d
        }
      }
      inc %c
    }
    inc %a
  }
}


Quia #173301 23/03/07 07:49 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
You might possibly want to be more specific about the numbers. Are they located at a specific spot of the userid, such as the start or end? That could possibly make detecting it a bit easier.

@RusselB there's a small problem using isnum the way you have in your code in that it would see a 2 digit negative number as a "3" digit number when it shouldn't, although I don't know how likely that is to happen. You should probably specify the range to be 100-999. You might also want to make the isop check before the initial loop, as it would be useless to loop through the nicks in a channel where the OP isn't opped. Again, I don't know how likely that is to happen either smile

Joined: Jun 2004
Posts: 25
Q
Quia Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2004
Posts: 25
Guess I should have been a little more specific. blush

The intent of the ban is to keep out spammers. My channel gets a lot of them, and I'd say about 95% of them have an automatically generated userid that contains a letter and several numbers, at least three but usually more like 4-6.
Anyways, I think you answered my question.. There is no handy number-only version of ?. frown

Quia #173327 23/03/07 09:03 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: Quia
There is no handy number-only version of ?. frown


There's always regex.


Invision Support
#Invision on irc.irchighway.net
Quia #173330 23/03/07 09:29 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
I'm a bit confused here. By userid are you referring to the nickname or the ident? Also are the "userids" always just one letter followed by numbers?

In my other post, I forgot to consider that the first number could have been a zero, so the isnum would fail. A simple regex would indeed be better suited.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Good point regarding the negative number option (and the same thing would apply to a two digit number with a decimal/period).

The op should be able to make the modifications that you suggested to my code.

Joined: Mar 2007
Posts: 38
H
Ameglian cow
Offline
Ameglian cow
H
Joined: Mar 2007
Posts: 38
# its the wilcard to a number on some servers...
Eg:
//mode # +b Guest###
Banned Users: Guest345 Guest234
But Guest23 not banned
Try +b ###@* to ban a user with only 3 numbers on his userid...

Cya!.-

Last edited by HuMoR; 25/03/07 10:32 AM.

"if ($me ison $forum) { say Hello! }"
HuMoR #173479 25/03/07 05:44 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Using a wildcard that is only valid on certain networks isn't usually a good idea if there is another method that works on all.


Invision Support
#Invision on irc.irchighway.net
HuMoR #173515 25/03/07 07:25 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
On most (if not all) networks that I've been on using the # symbol returns the name of the channel.
So, if I was in #help, and tried your suggestion, it would return
Code:
//moce #help +b Guest#help#help#help

Since (to my knowledge) the # character can't be used in a nick, that would return an error stating that the nick isn't on the channel.


Link Copied to Clipboard