mIRC Home    About    Download    Register    News    Help

Print Thread
#272965 17/11/24 04:51 PM
Joined: Nov 2021
Posts: 117
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 117
i wanted to have this check for certain in nick!ident@host in channel and count the total the found items wich meet the search patern
this is what i work with so far:

Code

ALIAS IP { set -u10  %ipuser  $1 | who $active  }
Raw 352:*: { 
  if (%ipuser iswm $+($6,!,$3,@,$4)) {
    if (!$window(@IP-SEARCH $+ $chr(160) $+ $network $+ $chr(160) $+ $2)) window -senk0 @IP-SEARCH $+ $chr(160) $+ $network $+ $chr(160) $+ $2
    aline -p @IP-SEARCH $+ $chr(160) $+ $network $+ $chr(160) $+ $2 $chr(160)   $+ $color(action)   $6    --  $+ $color(ctcp) $3 $+  $+ $color(whois) $+  @ $+  $+ $base($color(info),10,10,2) $+ $4  ---  $+ $color(nick) $strip($9-)  ---    $+ $color(normal) $5  
    halt
  }
}


Raw 315:*: { 
  if (%ipuser) { unset %ipuser }
  halt
}



i hope someone can help me to achieve this.

Last edited by Simo; 17/11/24 10:17 PM.
Simo #272972 Yesterday at 11:34 AM
Joined: Dec 2002
Posts: 253
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 253
Issuing a /WHO on a channel potentially multiple times is taxing on a network.

From what I'm guessing, based on the aline code it looks like:
"<nick> --- <user@host> --- <gecos>"
on the format of a match.

You should take advantage of mIRC's Internal address list, $ial() and $ialchan() and avoid doing this with raws and individual whos unless there's really something more you need within that who data (looks like whox data actually).

You can also test if the who needs performed with: $chan(<chan>).ial, and also see if a who is still in progress with $chan(<chan>).inwho.

Here's an example alias outputting what I assume you're after:
Code
alias ipsearch {
  ;// Is the active window a channel
  if ($active ischan) {

    ;// Is the input only one argument and is a wildcard address?
    if ($0 = 1 && *!*@* iswm $1) {

      ;// Is the internal address list full? If not fill it with who...
      if (!$chan($active).ial) { who $active }

      ;// Attempt to call this alias again formatted to execute search
      ;// mIRC doesn't allow recursion so this kinda breaks out, like doing it with a timer.
      scon -r ipsearch $active $1
    }

    ;// Is the input two arguments <chan> and <search>?
    elseif ($0 = 2 && $1 ischan && *!*@* iswm $2) {

      ;// If the channel who's still in-progress delay and call again...
      if ($chan($1).inwho) { 
        ;// Set a NAMED timer (so it can be overwritten if still inwho) to callback once again in one second.
        $+(.timer,IpSearch,.,$cid,.,$1) 1 1 ipsearch $1- 
      }

      ;//Perform search query in <chan> with <search>
      else {
        var %x = 0 , %y = $ialchan($2,$1,0)
        echo -a *** IP Search in: $1 of: $2 $+ , %y matches:
        while (%x < %y) {
          inc %x
          echo -i2 $1 %x $+ . $ialchan($2,$1,%x).nick --- $ialchan($2,$1,%x).addr --- $strip($ialchan($2,$1,%x).gecos)
        }
        echo $1 *** End of IP Search in: $1 $+ , %y matches

      }
    }

    ;// Throw error: improper format
    else { echo -a *** IPSearch Error: $1 is not a valid wildcard address (nick!user@host) }

  }

  ;// Throw error: improper window
  else { echo -a *** IPSearch Error: this command is meant to be used in a channel window. }
}

Example Output(s):
Code
/ipsearch *!*s*@*.com

*** IP Search in: #room of: *!s*@*.com, 2 matches:
1. foo --- s295081@964FE7C0.ilkley.irccloud.com --- baz
2. bar --- s268081@21BAC8D2.lymington.irccloud.com --- baz
*** End of IP Search in: #room, 2 matches

/ipsearch *!*@*.IP

*** IP Search in: #room of: *!*@*.IP, 8 matches:
1. ap --- ~j1@56B39474.82A3EA1D.6D1AEB8C.IP --- realname
2. In --- ~allhellno@ABA50D7B.CA5BEAC9.A73CCF3E.IP --- ...
3. Max --- ~Maxdamant@4AC95BA4.81A6E288.1DD1A8A3.IP --- Max
4. Matrix --- ~matrixbot@FF2BFDBD.969BF113.66765DD7.IP --- matrixbot
5. Placeholder --- ~Placehold@2D769DE7.7C4CA6F0.6E96CB81.IP --- Kari
6. TalWin --- ~TalWin@CFFF3F2F.93ABE5B9.90282140.IP --- ...
7. Talon --- ~Talon@CFFF3F2F.93ABE5B9.90282140.IP --- ...
8. Zzub --- ~Zzub@CF1DED85.7D6431C8.553D384C.IP --- ...
*** End of IP Search in: #room, 8 matches

Note: Gecos (real name) may be blank and $chan(<chan>).ial being true (meaning full).

There's numerous reasons why for this:
You were the first to join the channel so naturally the IAL was filled without ever requiring a who as people join.

You're lacking IRCv3 capabilities or no SETNAME updates to fill a users $ial(<nick>).gecos

The server supports UHNAMES from raw 005 or negotiates the extended-names IRCv3 CAP so you get full address nicknames when you join, etc...

If you run across this issue just manually /who a room first and gecos will become populated.


Link Copied to Clipboard