IRcap — File Browser

ircap871-mircscripts_2799 / ircap871-mircscripts_2799 / s / conn.mrc

conn.mrc — 11.64 KB — Download this file

;IRcap8 64c73d602cf5944af1bdf3643ad36b1b

alias CONN {
  if ($window(@CONn)) { conn.cierra | return }
  .hmake -s CONN | .hload CONN "lng\ $+ %idioma $+ \conn.lnh"
  ;  %conn.db = lng\ $+ $replace(%idioma,cat,es,ga,es,ek,es) $+ \servers.txt
  %conn.db = ircapservers.txt
  guiwin @conn $cvent(600,272) $s(titlebar)
  %conn.pñ1 = 52 56 1 conntab $s(1) $+  $+ $s(2) $+  $+ $s(3)
  %conn.server = $gettok(%serverz,2-,32)
if (!%conn.server) { 
    var %a = $readini(mirc.ini,mirc,host)
    %a = $mid(%a,$pos(%a,SERVER:,1),999)
    %conn.server = $gettok(%a,2,58) 
  }
  %conn.nick = $gettok($me,1,58)
  %conn.tipo = $readini %perfil conex tipo | if %conn.tipo == $null { %conn.tipo = 1) $s(19) }
  %conn.identd = $inichr($readini %perfil conex identd) | if %conn.identd == $null { %conn.identd = ircap }
  %conn.s.host = $readini %perfil conex s.host
  %conn.s.pt = $readini %perfil conex s.pt
  %conn.s.proto = $readini %perfil conex s.proto
  %conn.s.pass = $readini %perfil conex s.pass
  %conn.b.host = $readini %perfil conex b.host
  %conn.b.pt = $readini %perfil conex b.pt
  %conn.b.pass = $readini %perfil conex b.pass
  %conn.b.vp = $readini %perfil conex b.vp
  %conn.autoc = $readini %perfil autocon autoconectar

  %conn.ls1 = 352 72 196 12 1 0 connclick @conn.ls1 arbol
  conntab 1
  connllenared

  var %a = $fline(@conn.ls1,$gettok(%serverz,1,32) $+ g****)
  if (%a) { 
    %conn.ls1 = $gettok(%conn.ls1,1-4,32) %a 0 $gettok(%conn.ls1,7-,32) 
    connclick 2 %a $line(@conn.ls1,%a)
    var %s = $fline(@conn.ls1,*i* $+ $gettok(%serverz,2,32) $+ ****)
    if (%s) { %conn.ls1 = $gettok(%conn.ls1,1-5,32) %s $gettok(%conn.ls1,7-,32) | sline @conn.ls1 %s }
    if ($calc(%s - %a) > 11) { %conn.ls1 = $gettok(%conn.ls1,1-4,32) $calc(%s - 11) $gettok(%conn.ls1,6-,32) }
  }

  guilista @conn conn.ls1 
  window -wai @conn $window(@conn).x $calc($window(@barra).h + 8)
}

alias -l S return $hget(conn,$1)

#guimgen.@conn on
menu @guimgen {
  $s(5) : conn.r +
  $s(6) : conn.r -
  -
  $s(7) : conn.r g+
  $s(8) : conn.r g-
  -
  $s(9) : conn.r copy
  $s(10) : conn.r paste
}
#guimgen.@conn end

alias CONNTAB {
  unset %conn.ls2
  cuag @conn 20 56 560 198 gui
  pestana @conn conn.pñ1
  if $1 == 1 {
    %conn.ls1 = 352 $gettok(%conn.ls1,2-,32)
    cuagr @conn 28 70 314 82
    %conn.op = 48 160 conn.multi $s(11)
    %conn.tx = 44 96 168 conn.server $s(12) |132 124 80 conn.nick $s(13)
    %conn.bt = 216 92 100 conn.necta $s(14) |216 120 8 conn.r_nic !|250 120 64 conn.orga $s(40)
    %conn.cb = 
    guilista @conn conn.ls1 
  }
  if $1 == 2 {
    %conn.ls1 = 1352 $gettok(%conn.ls1,2-,32)
    cuagr @conn 28 68 544 36
    cuagr @conn 28 124 544 92 $s(15)
    %conn.op = 330 80 arrseq $s(16)
    %conn.tx = 92 80 76 conn.identd $s(17)
    %conn.bt = 480 76 70 run_usr\arrseq.txt $s(18)
    %conn.cb = 40 144 120 conn.tipo 1) $s(19) $+ 2) $s(20) $+ 3) $s(21) $+ 
    var %a = $left(%conn.tipo,1)
    if %a == 2 {
      %conn.tx = %conn.tx $+ |40 184 128 conn.s.host $s(22) |172 184 50 conn.s.pt $s(23) |236 184 128 conn.s.pass $s(24)
      %conn.cb = %conn.cb $+ |380 184 60 conn.s.proto Socks4Socks5Proxy $+ $s(25)
    }
    if %a == 3 {
      %conn.tx = %conn.tx $+ |40 184 128 conn.b.host $s(22) |172 184 50 conn.b.pt $s(23) |236 184 128 conn.b.pass $s(24) |380 184 90 conn.b.vp $s(26)
      %conn.bt = %conn.bt $+ |480 180 70 run_usr\bouncer.txt $s(27)
    }
  }
  if $1 == 3 {
    %conn.ls1 = 352 $gettok(%conn.ls1,2-,32)
    %conn.op = 30 74 conn.autoc $s(28)
    %conn.bt = 270 220 16 autoconmenu_+ +|310 220 16 autoconmenu_- -|30 220 55 autoconmenu_onoff $s(29)
    %conn.ls2 = 30 120 292 6 1 0 returnONOFFICO.@CONN @conn.ls2 0,20,40,210
    window -c @conn.ls2 | window -hl @conn.ls2
    var %n = 1 | :L11 | var %a = $readini %perfil autocon %n | if (%a) { aline @conn.ls2 %n $chr(8) $+ $replace($gettok(%a,1,231),on,#/#on,off,#/#off) $+ $chr(8) $+ $gettok(%a,2,231) $+ $chr(8) $+ $gettok(%a,3,231) | inc %n | goto L11  }
    guitgrid @conn %conn.ls2 $s(30) $+  $+ $s(31) $+  $+ $s(32) $+  $+ $s(33)
    guilista @conn conn.ls2
    %conn.cb = 
    %conn.tx =
    guilista @conn conn.ls1 
  }
  guidib @conn 
  if $1 == 1 conn.banner
}

alias CONNllenared {
  window -hsl @conn.ls1 | clear @conn.ls1 | var %i = 1 , %r = $readini %conn.db vars index
  while ($gettok(%r,%i,32)) { 
    aline -l @conn.ls1 $ifmatch $+ g $+ $ifmatch  --2 | inc %i 
  }
}

alias CONNllenaserver {
  var %i = 1
  while ($readini %conn.db $1 %i) {
    aline @conn.ls1 $1 $+ i $+ $gettok($ifmatch,1,44) 4:14 $gettok($ifmatch,2-9,44)   -3
    inc %i
  }
}


alias connclick {
  if ($1 == 2) && ($gettok($3-,2,8) == g) {
    var %a = $gettok($3-,-1,8) | inc %a | if %a > 2 { var %a = 1 }
    $larbol(@conn.ls1,$puttok($3-,%a,-1,8)).ana
    if (%a == 2) { $larbol(@conn.ls1,$gettok($3-,1,8)).delg | unset %serverz }
    else { connllenaserver $gettok($3-,1,8) }
    guilista @conn conn.ls1 | drawline @conn
  }
  if ($gettok($3-,2,8) == i) {
    %conn.server = $gettok($strip($gettok($3-,3,8)),2,58) | guidibtx @conn %conn.tx | drawline @conn
    %serverz = $gettok($3-,1,8) %conn.server
    if $1 == 2 { conn.necta | .timerServerINFO off }
    else .timerServerINFO -mo 1 700 serverinfo %conn.server
  }
}


alias conn.necta {
  var %a | if %conn.multi == on { var %a = -m }
  server %a %conn.server -i %conn.nick
}

alias CONN.BANNER {
  var %banner = $read s\banners\banners.ini
  %banner.click = $urlcap
  if (%banner) drawpic @conn 36 196 s\banners\ $+ $gettok(%banner,1,32) 
}

alias -l serverinfo {
  var %a = $read(usr\server0.txt, w, $1- $+ ;*)
  if (%a) tttip  $+ $gettok(%a,2,59)  $gettok($s(42),1,22) $+ : $gettok(%a,1,59)  $gettok($s(42),2,22) $+ : $gettok(%a,3,59)  $gettok($s(42),3,22) $+ : $gettok(%a,4,59)  $gettok($s(42),4,22) $+ : $gettok(%a,5,59)
}

alias CONN.R {
  var %g = $gettok($sline(@conn.ls1,1),1,8) , %s = $strip($gettok($gettok($sline(@conn.ls1,1),3,8),2,58)) | if $gettok($sline(@conn.ls1,1),2,8) == g { var %s }
  if ($findtok(+ - copy paste g+ g-,$1,1,32)) { if $readini(ircap.ini,var,serverorg) != 3 { fallo | %m = $?!=" $mg(edconn) " | return } }
  goto $1
  :nic | loads listador | $listador($mg(pnic1),$mg(pnic2),$nofile(%perfil) $+ nicks.txt,nick <item>,1) | return
  :+ | if (%g) { 
    var %c1 = $$?=" $s(34) "  | %c1 = $remove(%c1,;,:,$chr(44))
    var %c2 = $?=" $s(35) " | if (!%c2) { %c2 = %c1 } | %c2 = $replace(%c2,$chr(44),',;,_,:,_)
    var %c4 = $?=" $mg(ppais) " | if (!%c4) { %c4 = - }
    var %c5 = $?=" $mg(pidioma) " | if (!%c5) { %c5 = - }
    write usr\server0.txt %c1 $+ ; $+ %c2  $+ ; $+ %g  $+ ; $+ $replace(%c4,$chr(32),_,$chr(44),',;,:)  $+ ; $+ $replace(%c5,$chr(32),_,$chr(44),',;,:) $+ ;

    if ($gettok($sline(@conn.ls1,1),2,8) == g) && ($gettok($sline(@conn.ls1,1),6,8) == 2) { connclick 2 $sline(@conn.ls1,1).ln $sline(@conn.ls1,1) }
    aline @conn.ls1 %g $+ i $+ %c2 4:14 %c1   -3 | conn.gserver %g | goto refres 
  }
  return
  :- | if (%s) { 
    var %p = $?!=" $s(36) " | if (%p == $true) { 
      server0borra $gettok($strip($gettok($sline(@conn.ls1,1),3,8)),2,58) %g
      dline @conn.ls1 $sline(@conn.ls1,1).ln | conn.gserver %g | goto refres 
    }
  }
  return
  :copy | clipboard SERVER: $+ $sline(@conn.ls1,1) | bip | return
  :paste | if ($left($cb,7) == SERVER:) && (%g) { 
    if ($gettok($sline(@conn.ls1,1),2,8) == g) && ($gettok($sline(@conn.ls1,1),6,8) == 2) { connclick 2 $sline(@conn.ls1,1).ln $sline(@conn.ls1,1) }
    var %s = $strip($gettok($gettok($cb,3,8),2,58)) | %s = $left(%s,$calc($len(%s) - 1))
    var %l = $read(usr\server0.txt, w, %s $+ ;*; $+ $remove($gettok($cb,1,8),SERVER:) $+ ;*)
    write usr\server0.txt $puttok(%l,%g,3,59)
    aline -l @conn.ls1 %g $+ $chr(8) $+ $gettok($mid($cb,8,99),2-,8) | conn.gserver %g | goto refres 
  }
  return
  :g+ | var %g = $$?=" $s(37) " | write %conn.db $chr(91) $+ $replace(%g,$chr(32),_,;,_,:,_,$chr(44),_) $+ $chr(93) | CONN.INDEXA | connllenared | goto refres
  :g- | if (%g) { 
    var %p = $?!=" $s(38) $crlf $+ %g " | if %p == $true { 
      var %l = 1 | :L9 | var %a = $readini(%conn.db,%g,%l) | if (%a) {
        server0borra $gettok(%a,2,44) %g
        inc %l | goto L9
      }
      remini %conn.db %g | CONN.INDEXA | connllenared | goto refres 
    } 
  }
  return
  :refres | guilista @conn conn.ls1 | drawline @conn
}


alias CONN.guarda {
  wrini %perfil conex tipo %conn.tipo
  wrini %perfil conex identd $chrini(%conn.identd)
  wrini %perfil conex s.host %conn.s.host
  wrini %perfil conex s.pt %conn.s.pt
  wrini %perfil conex s.proto %conn.s.proto
  wrini %perfil conex s.pass %conn.s.pass
  wrini %perfil conex b.host %conn.b.host
  wrini %perfil conex b.pt %conn.b.pt
  wrini %perfil conex b.pass %conn.b.pass
  wrini %perfil conex b.vp %conn.b.vp
  wrini %perfil autocon autoconectar %conn.autoc
}


alias CONN.CIERRA  window -c @conn | window -c @conn.ls1 | conn.guarda | unset %conn.* %banner.click | hfree CONN | window -c @tttip | .unload -rs conn.mrc
on 1:CLOSE:@conn: conn.cierra
on 1:CONNECT: conn.cierra
alias conn.cierra conexcierra

on 1:KEYDOWN:@conn:13: conn.necta

alias sclick.@conn {
  if $gettok(%conn.pñ1,3,32) == 1 {
    if ($inrect($mouse.x,$mouse.y,36,196,300,45)) {
      drawrect -fi @conn 4 1 36 196 300 46 | bip | .timer -m 1 100 drawrect -fi @conn 4 1 36 196 300 46 
      if ($gettok(%banner.click,1,32) == run) { $gettok(%banner.click,2-99,32) | return }
      .timer -m 1 200 url %banner.click
    }
  }
}

alias oncombo.@conn {
  if $1 == conn.tipo conntab 2
}

alias CONN.INDEXA {
  var %l = 1 , %ll = $lines(%conn.db) , %index | inc %ll 10 | :L1
  while (%l < %ll) {
    var %s = $read -l $+ %l %conn.db 
    if ($left(%s,1) == $chr(91)) {
      if %s != [VARS] { %index = %index $remove($remove(%s,[),]) }
    }
    inc %l
  }
  if (%index) { writeini %conn.db VARS index %index }  | else { remini %conn.db VARS index }
}

alias CONN.GSERVER {
  remini %conn.db $1
  var %l = 1 , %i = 1 , %ll = $line(@conn.ls1,0) | while (%l <= %ll) {
    var %a = $strip($line(@conn.ls1,%l))
    if ($1 $+ i* iswm %a) { var %b = $gettok(%a,3,8) | writeini %conn.db $1 %i $left($gettok(%b,1,58),-1) $+ , $+ $right($gettok(%b,2,58),-1) | inc %i }
    inc %l
  }
}


alias AUTOCONMENU {
  goto $1
  :+ | aline @conn.ls2 $calc($line(@conn.ls2,0) + 1) $+ #/#on $+ %conn.server $+  $+ $$?=" $s(39) " | autocongraba | goto refres
  :- | if ($sline(@conn.ls2,1).ln) { dline @conn.ls2 $ifmatch | autocongraba | goto refres } | return 
  :onoff
  var %a = $sline(@conn.ls2,1) | if (%a) {
    var %b = $gettok(%a,2,8) | if %b == #/#on { %a = $puttok(%a,#/#off,2,8) } | else { %a = $puttok(%a,#/#on,2,8) } | rline @conn.ls2 $sline(@conn.ls2,1).ln %a
    autocongraba
  }
  :refres | guilista @conn conn.ls2 | drawline @conn
}

alias autocongraba {
  if (!%conn.autoc) { %conn.autoc = off }
  remini %perfil autocon
  writeini %perfil autocon autoconectar %conn.autoc
  var %i = 1 | while ($line(@conn.ls2,%i)) {
    writeini %perfil autocon %i $remove($gettok($ifmatch,2-,8),#/#)
    inc %i
  }
}

alias ONOFFICO.@CONN if (!%tmp.1click) { .timer -m 1 200 AUTOconmenu onoff | set -u1 %tmp.1clic on }

alias CONN.orga {
  if (!$1) { smenu conn.orga 120 $s(41) | return }
  if $1 == 5 { dina SERVERORG 1 | goto L }
  if $1 == 7 { dina SERVERORG buscar | goto L }
  dina SERVERORG $calc($1 + 2)
  :L
  %conn.ls1 = $puttok(%conn.ls1,1,5,32)
  connllenared
  guilista @conn conn.ls1 
  guidib @conn
}

alias server0borra {
  var %s = $1 , %g = $2 | if ($3) { %s = $1 $2 | %g = $3 }
  :L
  if ($read(usr\server0.txt, w, %s $+ ;*; $+ %g $+ ;*)) {
    write -dl $+ $readn usr\server0.txt
    goto L
  }
}

;EOF