mIRC Home    About    Download    Register    News    Help

Print Thread
#197356 02/04/08 11:48 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Hi can anyone show me a way to whois the whole channel when I join it? In other words, I would like to be able to whois people upon my arrival to a room. I have tried the code below but nothing happened:

Code:
on *:JOIN:#: {
if ($nick == $me) { 
 whois $nick 
 }
}


I'm not sure if there's an effective way of doing this to trigger the whois successfully.

Tomao #197357 03/04/08 12:01 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
What info do you actually need from their whois? Can't you use /who $chan instead?

Tomao #197359 03/04/08 12:51 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
According to your posted code, it would perform a whois on the joining nick when you join, so it would only work when you joined and it would whois yourself.

In order to do what you're asking for (and this does have some serious limitations to it) your code should look like
Code:
on me:*:join:#:{
  var %a = 1, %b = $nick($chan,0)
  while %a <= %b {
    .enable #channel_whois
    .whois $nick($chan,%a)
    inc %a
  }
}
#channel_whois off
raw *:*:{
  if $istok(402 311 401 379 378 307 319 312 301 313 310 671 317 320,$event,32) {      haltdef  }
  echo -a $2-
  if $numeric == 318 {
    .disable #whois
    haltdef
  }
}
#channel_whois end


As SladeKraven already stated, doing a /who on the channel is probably more efficient, but that also depends on what information you're wanting.

RusselB #197361 03/04/08 01:08 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
When you join a channel (which is when on JOIN triggers), mirc doesn't know who is on that channel yet. You'll have to wait for the "end of NAMES" reply (raw 366).

Regardless, it should be pointed out that whois-ing every user in a channel is not just less efficient but an unnecessarily big strain on the server that may even cause it to disconnect you.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
qwerty #197363 03/04/08 04:31 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I realize that, and only wrote (and tested) the code due to the OP's original request for assistance. I guess I was lucky that the raw 366 came through in my testing before the whois's actually started.. probably a fluke.


RusselB #197370 03/04/08 10:56 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Quote:
I guess I was lucky that the raw 366 came through in my testing before the whois's actually started.. probably a fluke.
This is 100% impossible. No fluke or anything else could make that work: mirc cannot process two events at the same time. on JOIN would have to finish before mirc deals with any other information (like raw 366). The whois loop is in on JOIN however, so there is nothing to loop through (except your own nick).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
qwerty #197384 03/04/08 06:53 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Yeah I realize that when I first join a channel mIRC does not know who is in that channel. It does know I am in the channel so $nick(#,0) will equal 1. I guess there's no way of solving this puzzle, because there isn't any to solve.

Tomao #197386 04/04/08 03:35 AM
Joined: Dec 2004
Posts: 66
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2004
Posts: 66
This demonstrates looping through the names in a channel after you join it. I used /who but you can /whois if you require that information. raw 366 is the end of the names list for the channel.

Code:
on *:join:#: {
  if ($nick == $me) set -su120 %WhoChan. $+ $chan $true
  else who $nick
}

raw 366:*: {
  var %chan = $2
  if ($eval(% $+ WhoChan. $+ %chan,2)) {
    unset $eval(% $+ WhoChan. $+ %chan,1)
    var %i = 1,  %nick
    while ($nick(%chan,%i)) {
      %nick = $v1
      if (%nick != $me) who %nick
      inc %i
    }
  }
}

Bob57 #197389 04/04/08 06:58 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline OP
Hoopy frood
OP Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Bob, you're such a godsend. You've solved the puzzle for me. This script is EXACTLY what I want! laugh

Many thanks to all who have responded to assist me. I'm truly grateful.

Last edited by Tomao; 04/04/08 07:00 AM.
Tomao #197462 06/04/08 09:55 AM
Joined: Jan 2004
Posts: 162
R
RRX Offline
Vogon poet
Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
Originally Posted By: Tomao
Hi can anyone show me a way to whois the whole channel when I join it? In other words, I would like to be able to whois people upon my arrival to a room. I have tried the code below but nothing happened:

Code:
on *:JOIN:#: {
if ($nick == $me) { 
 whois $nick 
 }
}

I'm not sure if there's an effective way of doing this to trigger the whois successfully.


As said the code needs to be started in end of names raw 366 and will be more than a simple loop that does a /whois on every nick, otherwise theres a high risk of a flood disconnect.
Most servers support whois nick1,nick2,nickN so that will already decrease this risk substantially. I use a queue for this that sends next chunk after all received from previous, and also a timer that forces a minimal delay to give mirc some room to do something else because if you have alot code running upon receival of the raws, it could cause ping timeouts disconnects too. All together: a reliable solution is not that easy, especially since you specified every channel, potentially inflicting the need to whois thousands. I have something finished for cases like this but it's a couple thousand lines :p


Link Copied to Clipboard