Project

General

Profile

[script] Colored Whois Script Plus v0.1.8

Added by Mr. BS about 10 years ago

Long time ago, Amiga600 released a cool colored whois script. I liked it a lot, but for some mysterious reason, he removed the code from interwebs. Unfortunately I lost the original version. What I'm releasing here, is an edited version by me with some new features. It's ok if I call it Plus? ;)

New features:

- Whois in standalone window with optional taskbar entry.
- Toggle visibility of raw code for each whois line.
- Common channels are underlined.
- Clone scan.
- Easy to customize colors.
- Random nick colors.
- Online IP lookup.
- and more... check the script body for description and settings.

Observations:

- $hotlink isn't supported on AdiIRC yet, so ip has no link to online lookup service.
- AdiIRC doesn't support wildcard for Menu @title* yet. Expect for all features soon in upcoming builds.

Video demo:

<video controls>
<source src="http://1.grn.cc/temp/2014-03-19_01-07-47.mp4&quot;>
</video>

Screenshots:

Dark Silver Light

Dark

Silver

Light

Changelog:

  • v0.1.8
    - Temp fix for the Adi $calc issue on nick color alias.
    - Added option to control where to display the window entry: treebar, switchbar or none.
    - Added option to display timestamp.
  • v0.1.7
    - "fixed" the number display for clones, now it excludes the target from the counter. Before: found 2 clones, 1 = ... 3 = ... | Now: found 2 clones, 1 = ... 2 = ...
  • v0.1.6
    - Added a basic context/right click menu: version info/about/close.
    - New option (ON by default) to make ip clickable to open an online lookup service, geoip.flagfox.net for now.
    ps: IP is normally visible only for IRCop or yourself.
    - New feature to simulate internal AdiIRC random nick colors, ON by default.
    - Now double clicking the window trigger the /whois again.
  • v0.1.5
    - combined some alias.
    - minor fixes.
  • v0.1.4
    - changed echo to use explicit window name to avoid output to other window in case focus change.
    - minor syntax issue.
  • v0.1.3
    - Fixed away message display.
  • v0.1.2
    - Added network name to titlebar.
    - Now all colors are easy to change in config block.
    - New default color scheme, a bit better for light themes (white background).
    - Removed previous ctime workaround, when Adi was returning wrong value.
    - Display fixes.
  • v0.1.1
    - mIRC compatible.
  • v0.1
    - initial release.

Script:

; http://dev.adiirc.com/boards/5/topics/170
; Colored Whois Script 1.0 by Amiga600
; Plus edition mod v0.1.8 by pereba
; Modifies the whole of the /WHOIS output, Re-arranges Channel Names
; in alphabetical order, and in order of rights level, eg ~&@%+

; Colors Channels based on users rights
; eg. ~Purple &Yellow @Red %Green +Blue Modeless=Green

; mIRC Colors: White0 Black1 DarkBlue2 DarkGreen3 LightRed4 DarkRed5
; Purple6 Brown7 Yellow8 LightGreen9 DarkCyan10 LightCyan11 LightBlue12
; LightPurple13 DarkGrey14 White15

; Colors can be adjusted below to users preferences
; whoismain - Main color of the whois block (14=grey)
; whoisother - the extra data of the whois block (3=dark green)

; ==== Config =====

; colors explained above:
alias -l whoismain return 14
alias -l whoisother return 2
alias -l ColorCloneScan return 7
alias -l ColorCloneScanMatch return 6
alias -l ColorTimeAgo return 14
alias -l ColorAdmin return 13
alias -l ColorOwner return 13
alias -l ColorProtect return 8
alias -l ColorOp return 4
alias -l ColorHalfOp return 9
alias -l ColorVoice return 11
alias -l ColorIsAway return 4

; Timestamp in each line? Set 1 to enable it (OFF by default).
alias -l EnableTimestamp return 0

; Where to display the whois? 1 for custom window, other value current window. Default is 1.
alias -l EnableWhoisWindow return 1

; Window mode: 1 (default) for tool/modal (no taskbar entry), other value for standalone desktop window.
alias -l WindowMode return 1

; Set desktop whois window on top? 1 to enable, other value to disable. ON by default.
alias -l whoisontop return 1

; Window entry display: 0 = hide from switchbar/treebar, 1 = show in switchbar, 2 = show in treebar, 3 = show in both. Default is 1.
alias -l WindowDisplay return 0

; Window size (default 650x300)
alias -l width return 650
alias -l height return 300

; Set alias bellow to 1 if you want to see the raw code for each whois line (OFF by default)
alias -l EnableEchoRaw return 0

; Set 1 to clear whois windows if previously opened. ON by default.
alias -l whoisclear return 1

; Simulate AdiIRC random nick color? set 1 to enable (ON by default)
; this option doesn't use the AdiIRC internal random nick colors, just mimic the formula to generate the unique color per nick.
alias -l RandomNickColor return 1

; Enable ip* link to online lookup service? for now using geoip.flagfox.net service. Set 1 to enable. On by default.
; *normally visible only for IRCop or yourself.
alias -l iplink return 1

; ==== Script =====

on $*:hotlink:$($ipregex):@whois*: {
  if ($iplink != 1) { halt }
  if ($hotlink(event) == dclick) { run http://geoip.flagfox.net/?ip= $+ $1 }
}

alias -l ipregex {
  return /\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b/
}

alias -l RandomNickColorGen {
  return $iif($RandomNickColor == 1, $whoisother $chr(3) $+ $calc(($left($regsubex($1,/(.)/g,$asc(\1) $chr(32) $chr(43) ),-3) ) % 16) $+ $1, $whoisother $1)
}

menu @whois:* {
  dclick: if ($whoisclear == 1) { clear %whoistitle } | whois $gettok($active,2,160) $gettok($active,2,160)
  $style(2) Version 0.1.8:/
  -
  About: run http://dev.adiirc.com/boards/5/topics/170
  -
  Close: window -c $active
}

alias -l echoMode {
  return $iif($EnableWhoisWindow == 1,  $iif($EnableTimestamp == 1,-t) %whoistitle $iif($EnableEchoRaw == 1, $1-, $2-), -a $+ $iif($EnableTimestamp == 1,-t) $iif($EnableEchoRaw == 1, $1-, $2-))
}

raw 311:*: {
  set -e %whoistitle $+(@,Whois:,$chr(160),$2,$chr(160),$chr(40),$network,$chr(41))
  if ($EnableWhoisWindow == 1) {
    if ($whoisclear == 1) { clear %whoistitle }
    else { if ($window(%whoistitle)) { echo %whoistitle $chr(160) } }
    $iif($window(%whoistitle), window -a %whoistitle, window -dCk0iw $+ $WindowDisplay $+ $iif($whoisontop == 1, o) $iif($WindowMode == 1, +L) %whoistitle -1 -1 $width $height)
  }
  echo $echoMode([000]) $chr(3) $+ $whoismain *** Start Of Whois For User $chr(3) $+ $RandomNickColorGen($2) $chr(3) $+ $whoismain ***
  echo $echoMode([311]) $chr(3) $+ $whoismain $strip($2) is $chr(3) $+ $whoisother $+ $strip($3) $+ @ $+ $strip($4) $chr(3) $+ $whoismain $+ ( $+ $6- $+ )
  halt
}

raw 379:*:{ echo $echoMode([379]) $chr(3) $+ $whoismain $2 User Modes: $chr(3) $+ $whoisother $strip($6) $chr(3) $+ $whoismain Server Modes: $chr(3) $+ $whoisother $strip($7) | halt }
raw 378:*:{ echo $echoMode([378]) $chr(3) $+ $whoismain $2 Host: $chr(3) $+ $whoisother $strip($6) $chr(3) $+ $whoismain IP: $chr(3) $+ $whoisother  $strip($7) | halt }
raw 307:*:{ echo $echoMode([307]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 319:*:{
  var %chan $sorttok($strip($3-),32,c)
  var %chan $replace(%chan,$chr(32),$chr(3) $+ $whoisother $+ $chr(32))
  var %chan $replace(%chan,$chr(33),$chr(3) $+ $ColorAdmin $+ $chr(33) ) | ; !admin (same as Owner in some networks)   Purple
  var %chan $replace(%chan,$chr(126),$chr(3) $+ $ColorOwner $+ $chr(126) ) | ; ~Owner   Purple
  var %chan $replace(%chan,$chr(38),$chr(3) $+ $ColorProtect $+ $chr(38) )    | ; &Protect Yellow
  var %chan $replace(%chan,$chr(64),$chr(3) $+ $ColorOp $+ $chr(64) )    | ; @Op      Red
  var %chan $replace(%chan,$chr(37),$chr(3) $+ $ColorHalfOp $+ $chr(37) )    | ; %HalfOp  Green
  var %chan $replace(%chan,$chr(43),$chr(3) $+ $ColorVoice $+ $chr(43) )   | ; +Voice   L-Blue
  var %total = $comchan($2,0), %output, %x = 1
  if (%total > 1) && ($2 != $me) {
    while ( %x <= %total ) {
      %output = $addtok(%output,$comchan($2,%x),32)
      %bosta = $comchan($2,%x)
      var %chan $replace(%chan,%bosta,$chr(31) $+ %bosta $+ $chr(31))
      inc %x
    }
  }
  echo $echoMode([319]) $chr(3) $+ $whoismain $2 on $numtok(%chan,32) Channels: $chr(3) $+ $whoisother %chan
  halt
}
raw 312:*:{ echo $echoMode([312]) $chr(3) $+ $whoismain $2 Server: $chr(3) $+ $whoisother $strip($3) ( $+ $strip($4-) $+ ) | halt }
raw 301:*:{ echo $echoMode([301]) $chr(3) $+ $whoismain $strip($2) is $chr(3) $+ $ColorIsAway $+ AWAY $+ $chr(3) $+ $whoismain $+ : $chr(3) $+ $whoisother $3- | halt }
raw 313:*:{ echo $echoMode([313]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 338:*:{ echo $echoMode([313]) $chr(3) $+ $whoismain $strip($2) $chr(3) $+ $whoisother $strip($3-) | halt }
raw 310:*:{ echo $echoMode([310]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 335:*:{ echo $echoMode([335]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 614:*:{ echo $echoMode([614]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 671:*:{ echo $echoMode([671]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 320:*:{ echo $echoMode([320]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 330:*:{ echo $echoMode([330]) $chr(3) $+ $whoismain $2 $4- $chr(3) $+ $whoisother $3 | halt }
raw 317:*:{ echo $echoMode([317]) $chr(3) $+ $whoismain $2 Idle: $chr(3) $+ $whoisother $strip($duration($3)) $chr(3) $+ $whoismain - SignOn: $chr(3) $+ $whoisother $strip($asctime($4)) $chr(3) $+ $ColorTimeAgo $+ ( $+ $duration($calc($ctime - $4)) ago) | halt }
raw 275:*:{ echo $echoMode([275]) $chr(3) $+ $whoismain $strip($2-) | halt }
raw 615:*:{ echo $echoMode([615]) $chr(3) $+ $whoismain $2 User Modes: $chr(3) $+ $whoisother $strip($6) $chr(3) $+ $whoismain  Server Modes: $chr(3) $+ $whoisother $strip($7) | halt }
raw 616:*:{ echo $echoMode([616]) $chr(3) $+ $whoismain $2 Host: $chr(3) $+ $whoisother $strip($5) $chr(3) $+ $whoismain IP: $chr(3) $+ $whoisother  $strip($6) | halt }

raw 401:*:{ set %wdone veadinho } ;nick not found

raw 318:*: {
  if (%wdone) { ;stop cuz nick not found
    haltdef
    unset %namec %wdone %whoistitle
    return
  }
  haltdef
  var %whois.Clones $ial($address($2,2),0)
  if (%whois.Clones > 1) {
    echo $echoMode([Clones]) $chr(3) $+ $ColorCloneScan User/Service  $+ $chr(3) $+ $ColorCloneScanMatch $2 $chr(3) $+ $ColorCloneScan $+ has $calc($ial($address($2,2),0) - 1) Other Clone(s):
    var %iee $ial($address($2,2),0)
    var %x %iee
    while %iee {
      if ($gettok($ial($address($2,2),%iee),1,33) != $2) {
        dec %x
        echo $echoMode([Clones], $chr(3) $+ $ColorCloneScan %x = $v1 $chr(3) $+ $ColorCloneScanMatch $address($v1,5))
      }
      dec %iee
    }
  }
  echo $echoMode([318]) $chr(3) $+ $whoismain *** End Of Whois ***
  unset %namec %whoistitle
}

✔ mIRC compatible.