;IRcap8 7b5abd0d41d42b8dcf9aa0acd0cbad63
;Visor de Fservers 3.0

#leeserve off
on 1:CHAT:*: {
  if ($nick == %liserv.nick) {
    wviserv
    if (\*.*] isin $1-) { clear @ViServ | return }
    if ($1- == ..) { return }
    if ($islower($1-)) { var %a = $VISERkb($1-) | aline @ViServ $_tm( $+ $color(listbox) $+ · $gettok(%a,2-999,32) $bytes($gettok(%a,1,32),3).suf) | return }
    if (End of list isin $1-) || (Fin de lista isin $1-) { unset %tmp.fsnoflod | .disable #leeserve | .timerNOLEESERVE off | iline @ViServ 1 .. | return }
    iline @ViServ 1  $+ $1- 
  }
}
#leeserve end

on 1:CHAT:*: {
  if ($nick == %liserv.nick) { ecot -ste $logo FServer <c3> $+ $nick <c4>> $1- | .timerFSLIS 1 1 raya }
}

alias WVISERV {
  if $window(@ViServ).state == $null { window -lk @ViServ $readini ircap.ini ww viserv @ViServ | titlebar @ViServ %liserv.nick }
}

menu @ViServ {
  dclick {
    var %lins = $strip($sline(@ViServ,1)) | var %ling = $gettok(%lins,0,32) | unset %dclok
    if %lins == .. { msg = $+ %liserv.nick cd .. | NFDIR | goto L2 }
    if ($left(%lins,1) == ·) { var %texto = $gettok($VISERkb(%lins),3-999,32) | msg = $+ %liserv.nick GET %texto | set %tmp.autocoge %texto | echo -ste $logo $mg(vifs1,%texto) | goto L2 }
    if %lins == [\*.*] { goto L2 }
    msg = $+ %liserv.nick CD %lins | NFDIR
    :L2
    beep 1 1
  }
  $s(106)
  .$chat(1): window -c @viserv | abreliserv $chat(1)
  .$chat(2): window -c @viserv | abreliserv $chat(2)
  .$chat(3): window -c @viserv | abreliserv $chat(3)
  .$chat(4): window -c @viserv | abreliserv $chat(4)
  .$chat(5): window -c @viserv | abreliserv $chat(5)
  .$chat(6): window -c @viserv | abreliserv $chat(6)
  -
  $m(41): dcc send %liserv.nick
  -
  $s(107): cierravisor
  $s(108): close -c %liserv.nick | cierravisor
}


alias NFDIR .enable #leeserve | .timerNOLEESERVE -o 1 50 .disable #leeserve | msg = $+ %liserv.nick DIR -b | set -u50 %tmp.fsnoflod on

alias ABREliserv {
  if (!$s(1)) { .hmake -s tool | .hload tool "lng\ $+ %idioma $+ \tool.lnh" }
  if ($window(@ViServ).state != $null ) { return }
  set %liserv.n 1 | unset %liserv.o | :L1
  if ($chat(%liserv.n) != $null) {
    if ($chat(%liserv.n) == $$1) { inc %liserv.o 1 | if (%liserv.o > 1) { echo -ste $logo $mg(vifs2,$$1)  | unset %liserv.o %liserv.n | cierravisor | return } }
    inc %liserv.n 1 | goto L1
  }
  set %liserv.nick $$1 | unset %liserv.n %liserv.o
  .enable #leeserve | NFDIR | window -n = $+ %liserv.nick
  echo -ste $logo $mg(vifs3,%liserv.nick)
}

on 1:close:@viserv: cierravisor
on 1:close:=: if ($nick == %liserv.nick) { cierravisor }

alias CIERRAVISOR {
  writeini ircap.ini ww viserv $window(@viserv).x $window(@viserv).y $window(@viserv).w $window(@viserv).h
  window -c @viserv | echo -ste $logo $mg(vifs4)
  .timerINIDI off | if ($chat(%liserv.nick) != $null) window -r = $+ %liserv.nick
  .disable #leeserve | unset %liserv.nick %lins %ling
  .unload -rs liserv.mrc
}

alias VISERkb {
  var %a = $numtok($1-,32)
  if ($gettok($1-,%a,32) == b) { return $gettok($1-,$calc(%a - 1),32) $gettok($1-,1- $+ $calc(%a - 2),32) }
  return $remove($gettok($1-,%a,32),b) $gettok($1-,1- $+ $calc(%a - 1),32) 
}
alias -l S return $hget(tool,$1)

;EOF-dt
