Project

General

Profile

Whois On Join script - displaying information only in the main channel window.

Added by Charlie Sorrow over 3 years ago

I am using the following script:

on *:join:%wchannels: { whois $nick $nick }

menu Channel {
  Whois On Join
  .Enabled {
    set %wchannels $addtok(%wchannels,#,44)
    echo 4 -at ••• Whois on join is 7Enabled 4(for # $+ )
  }
  .Disabled {
    set %wchannels $remtok(%wchannels,#,1,44)
    echo 4 -at ••• Whois on join is 7Disabled 4(for # $+ )
  }
}

It causes every person joining the channel to execute the 'whois' command. Unfortunately, when I go to priv, the 'whois' information from the channel I'm on is displayed in the private message window. How do I make the whois information displayed by this script only visible in the main channel window and not in the private message window?


Replies (6)

RE: Whois On Join script - displaying information only in the main channel window. - Added by Per Amundsen over 3 years ago

Whois information is not associated with a channel, it's associated with a nick. It will either show in the active window or in the status window depending on what this option is set to https://dev.adiirc.com/projects/adiirc/wiki/Events_Options#Whois.

RE: Whois On Join script - displaying information only in the main channel window. - Added by Charlie Sorrow over 3 years ago

OK, so how to make whois information is not displayed in the priv window, but in the channel window where the person being checked is entering?
How to change the above script for this purpose?

RE: Whois On Join script - displaying information only in the main channel window. - Added by C. Syem over 3 years ago

Try this:

menu Channel {
  Whois On Join
  .Enabled {
    set %wchannels $addtok(%wchannels,#,44)
    echo -at ••• Whois on join is Enabled (for # $+ )
  }
  .Disabled {
    set %wchannels $remtok(%wchannels,#,1,44)
    echo -at ••• Whois on join is Disabled (for # $+ )
  }
}

on *:join:%wchannels: {
  if ($nick != $me) {
    set %whoischan $chan
    whois $nick $nick
  }
}

raw 311:*: {
    echo %whoischan $2- | halt
}
raw 319:*: { 
    echo %whoischan Channels: $3- | halt
}
raw 312:*: { 
    echo %whoischan Server: $3 / $4- | halt
}
raw 307:*: { 
    echo %whoischan $2- | halt
}
raw 301:*: { 
    echo %whoischan $2 is away $3- | halt
}
raw 313:*: { 
    echo %whoischan Status: $3- | halt
}
raw 310:*: { 
    echo %whoischan $2- | halt
}
raw 317:*: {
    echo %whoischan SignedOn: $asctime($4) $+ , $duration($calc($ctime - $ctime($asctime($4)))) ago, Idle: $duration($3) | halt
}
raw 318:*: { 
    echo %whoischan $3-
    unset %whoischan
    halt
}

RE: Whois On Join script - displaying information only in the main channel window. - Added by Charlie Sorrow over 3 years ago

@C. Syem:

It doesn't work, displays only:

[14:42:51] * zxcv is logged in as zxcv

RE: Whois On Join script - displaying information only in the main channel window. - Added by C. Syem over 3 years ago

Strange, I just tested it on 2 networks and It's working for me. Maybe your network have other numbers for whois raw or you just miss something in the code. Use:

raw *:*: echo -s $numeric $1- | halt

and whois someone, check in status the numbers and change it in code above if they are different.

RE: Whois On Join script - displaying information only in the main channel window. - Added by Paul Janson over 3 years ago

Different networks can have different raw events part of the /whois, and you may not have the entire grab-bag of events. For example 378 is seen only when you /whois yourself, unless you're a server admin. 671 is seen only if you're connecting via SSL at an SSL port like +6697. etc. You can identify any you've missed by having a raw event beneath these which intercepts all raw numerics. Since it's beneath these listed items, it can't be triggered by the above raw numerics. In the event, you have it ignore everything unless the %whoischan exists.

raw *:*: { 
if ($istok(a b c,$numeric,32)) return
    if (%whoischan != $null) echo -g $chan(1) unhandled whois numeric $numeric : $1-
}

If there are some un-trapped numerics you don't want to see, just add them to the a b c list separated by spaces, and you can delete the a b c.

Your script also has some problems:

  • it assumes that the server will always finish sending the /whois info before the next person joins, so you'll find it switching channel in the middle of someone's info.
  • if you have several shared channels with someone, you'll be /whois'ing that person several times
  • you'll risk flooding yourself off the server or having the server ignore your /whois requests being done too frequently.

What you probably want to do is avoid immediately doing the whois, and instead add them to a queue. Then have a timer which runs at an interval of N seconds. Each time the timer interval triggers the timer's command, it grabs the 1st person in the list. If the person has already quit, discard the nick and try the next in the list. After you send the /whois command, you set a variable of who the script is handling, because you don't want the script to take action when you do a normal whois from the menu. You need to decide how you handle someone who joins a channel while they're already in the queue. If you want to just echo the whois info to all common channels, that's the easiest. If you want to show only into the channels they freshly joined, that will be more complicated, as you'll need to add channel info to the que along with their nick. If you need to support multiple networks, that makes it more complicated since you'll need to create separate global %variables (or hashtables) and separate timers for each network. If you do want to support multiple networks, you'll probably want to have this ignore all-except-one until you get it working, then save a backup before trying to modify variables, hashtables, and timers to include network names.

When incoming messages arrive at these numerics, you only do the echoes if it's the active nick. If you want to have this echoed to all shared channels, you can have a separate alias which each of these numerics calls. Assuming $1 is the nick and $2 is the line of text, you call it like noop $aliasname($2,$3-) because these raw numerics always have $1 being you and $2 being the nick being whois'ed. The subroutine would look something like:

var %i 1 | while ($comchan($1,%i)) { echo g $v1 $1 $2 | inc %i }

The -g is if you want the echo to not be added to the disk channel log for that channel.

There will be a numeric when the server rejects your whois because the server is too busy, so you can decide to re-add the nick to your que (front or back) and let the que try later.

Your numerics would change slightly. Instead of using %whoischan as the destination, it would use %whoisnick to identify which 1 nick should not be ignored.

raw 307:*: {
if ($2 != %whoisnick) return
noop
noop $aliasname($2,$3-) | halt
}

Also, you've probably noticed that some of these numerics display differently than received from the server. For example the 1st line of the whois displays an address userid@hostname but they're received as 2 separate words without the @. So instead of sending $3- you might need to manipulate the string before feeding it to $aliasname.

    (1-6/6)