Project

General

Profile

[Script] /Links mIRC copycat v0.1

Added by Mr. BS almost 9 years ago

Inspired in mIRC's behavior where a dedicated window is opened to list server links.

; http://dev.adiirc.com/boards/5/topics/520
; /Links mIRC copycat
; v0.1 by pereba

; Server response for each link
raw 364:*:{
  var %line $puttok($3-,$chr(40) $+ $remove($4,:) $+ $chr(41),2,32)

  ; Since 0 is the current server user is connected, lets add it as first row
  if (0 isin $4) iline -h $wname 1 %line

  ; Add all other servers in sequence
  else aline -h $wname $chr(160) $+ %line

  ; Prevent internal AdiIRC handle of command
  halt
}

; End of /Links list
raw 365:*: {
  ; Unhide window on finish
  window -w3 $wname

  ; Select first row
  sline $wname 1

  ; Put focus to window if flag -n were not used
  if ( [ % $+ links.active.minimized. $+ [ $cid ] ] ) {
    unset %links.active.minimized. $+ $cid
    return
  }
  window -a $wname
}

; Permission denied in some networks, then lets close the window
raw 481:*: {
  if ($wactive) {
    window -c $window($wname)
    unset %links.active.* $+ $cid
  }
}

; Replace internal /Links command
alias links {
  ; If disconnected, call internal /links command to echo default error msg
  if ($status != connected) { !links | return }

  ; Check if a previous /links is active, then clear window prior to resend command
  if ( $wactive ) { unset %links.active. $+ $cid | clear $wname }

  ; Open window if unavailable (-x support removed for now due an AdiIRC bug where mdi control buttons are gone)
  var %flags $iif(-* iswm $1,$regsubex($1,/[^n]/gSi,))
  if (%flags) set -e %links.active.minimized. $+ $cid $!true
  if (!$window($wname)) window -lkvh $+ %flags $wname

  ; Var to indicate links window is active
  set -e %links.active. $+ $cid $!true

  ; Print same mIRC msg to Status Window
  echo 17 -st $prefixsys Retrieving links...

  ; Call internal /Links
  !links $1-

  ; Prevent internal AdiIRC handle of command
  halt
}

alias -l wactive {
  return [ % $+ links.active. $+ [ $cid ] ]
}

; Window name where /Links output is sent
alias -l wname return $+(@,$adilang(Links),$chr(160),$adilang(List),$chr(160),$network)

on *:CLOSE:$($wname):{
  unset %links.active. $+ $cid
}

menu @* {
  dclick:$iif($active == $wname,server $gettok($line($wname,$1),1,32))
  -
  $iif($active == $wname,Connect to Server) :/server $$1
  $iif($active == $wname,Copy to Clipboard) :/clipboard $$1
  -
  $iif($active == $wname,Update Links) :/links
  -
  ; mIRC saves list in .ini format, since I have no idea where it can be used later, lets use simple savebuf for now
  $iif($active == $wname,Save Links...) :/savebuf -l $active $$sdir($adiircdir,Save Links $network) $+ \ $+ $$input(File Name:,e,Save Links $network,links_ $+ $network $+ .txt)
}

menu status {
  -
  $adilang(Links):/links
  -
}

Can you improve this script? post bellow.