;IRcap8 2be9a0f5f9766285314648d52d751997

Alias CARGADORMOD {
  if (!$s(1)) { .hmake -s tool | .hload tool "lng\ $+ %idioma $+ \tool.lnh" }

  cargatextomod
  guiwin @Mod c c 600 350 $s(109)

  %mod.pñ1 = 40 56 1 mod.pest $s(110) $+  $+ $s(111)
  mod.pest 1

  window -wa @mod
  sss wina
}
alias -l S return $hget(tool,$1)



alias mod.pest {
  cuag @mod 14 56 570 200 $gettok(%gui.cc,1,32) | pestana @mod mod.pñ1
  if $1 == 1 {
    %mod.bt = 40 228 130 modmenu $s(112) |390 228 150 modvisitaweb_1 $s(113) |40 276 170 ircapweb_modulos $s(114)
    %mod.ls1 = 24 78 532 10 1 0 returnONOFFICO.@MOD @mod1 0,20,420,450,550
    mod.lista
    guitgrid @mod %mod.ls1 • $s(115)  $s(116)  $s(117) 
    .timer -m  1 50 dibutext 260 @mod verdana 10 300 280 $mg(modpeligro)
  }
  if $1 == 2 {
    %mod.bt = 40 228 130 addmenu $s(112) |390 228 150 modvisitaweb_2 $s(113) |40 276 170 ircapweb_addons $s(118)
    %mod.ls1 = 24 78 532 10 1 0 returnONOFFICO.@MOD @mod1 0,20,420,450,550
    add.lista
    guitgrid @mod %mod.ls1 • $s(119)  $s(116)  $s(117) 
  }
  guidib @mod
}

alias mod.lista {
  window -c @mod1 | window -hl @mod1
  var %l = $readini(%perfil,modulos,instalados)
  var %i = 1
  :L1
  var %f = $nopath($finddir(mod,*.,%i,1))
  if (%f) {
    var %ini = mod\ $+ %f $+ \ $+ %f $+ .ini
    var %des = $readini(lng\ $+ %idioma $+ \misc.ini,modulo,%f)
    if (!%des) { var %des = ~ $+ $readini(%ini,modulo,desc) }
    if (%des == ~) { var %des = ~ $+ %f }
    var %ver = $readini(%ini,modulo,ver) , %aut = $readini(%ini,modulo,autor) | if (!%ver) { %ver = - } | if (!%aut) { %aut = - }
    aline @mod1 $iif(%f isin %l,#/#on,#/#off) $+  $+ %des $+  $+ %ver $+  $+ %aut $+  $+ %f
    inc %i | goto L1
  }
  guilista @mod mod.ls1
}



alias ONOFFICO.@MOD {
  if (!%tmp.1click) { .timer -m 1 200 $iif($gettok(%mod.pñ1,3,32) == 1,modmenu,addmenu) | set -u1 %tmp.1clic on }
}

alias modmenu {
  var %a = $sline(@mod1,1) | if (%a) {
    var %b = $gettok(%a,1,8) | if %b == #/#on { %a = $puttok(%a,#/#off,1,8) } | else { %a = $puttok(%a,#/#on,1,8) } | rline @mod1 $sline(@mod1,1).ln %a
    if (%b == #/#off) { carga1mod $gettok(%a,5,8) } | else { descarga1mod $gettok(%a,5,8) }
  }
  guilista @mod mod.ls1 | drawline @mod
}

alias addmenu {
  var %a = $sline(@mod1,1) | if (%a) {
    var %b = $gettok(%a,1,8) | if %b == #/#on { %a = $puttok(%a,#/#off,1,8) } | else { %a = $puttok(%a,#/#on,1,8) } | rline @mod1 $sline(@mod1,1).ln %a
    if (%b == #/#off) { load -rs " $+ $remove($gettok(%a,5,8),$mircdir) $+ " | .timerADDVERIF 1 2 add.verif }
    else { 
      if ($readini($gettok(%a,5,8),addon,unload)) { .timer -m 1 300 $ifmatch }
      else unload -rs " $+ $remove($gettok(%a,5,8),$mircdir) $+ "
      .timerADDVERIF 1 2 add.verif 
    }
  }
  guilista @mod mod.ls1 | drawline @mod
}
alias -l add.verif if ($gettok(%mod.pñ1,3,32) == 2) { mod.pest 2 }

alias add.lista {
  window -c @mod1 | window -hl @mod1
  var %i = 1
  :L1
  var %f = $findfile(addons,*.mrc,%i)
  if (%f) {
    var %des = $readini(%f,addon,nombre) : $readini(%f,addon,desc)
    if (%des == :) { var %des = $nopath(%f) }
    var %ver = $readini(%f,addon,ver) , %aut = $readini(%f,addon,autor) | if (!%ver) { %ver = - } | if (!%aut) { %aut = - }

    aline @mod1 $iif(($script(%f)),#/#on,#/#off) $+  $+ %des $+  $+ %ver $+  $+ %aut $+  $+ %f
    inc %i | goto L1
  }
  guilista @mod mod.ls1
}

alias modvisitaweb {
  var %l = $sline(@mod1,1) | if (!%l) return
  if $1 == 1 { var %w = $readini(mod\ $+ $gettok(%l,5,8) $+ \ $+ $gettok(%l,5,8) $+ .ini,modulo,web) }
  else { var %w = $readini($gettok(%l,5,8),addon,web) }
  if (%w) url %w
}

alias CARGATEXTOMOD {
  var %i = 1 | :L1
  var %f = $nopath($finddir(mod,*.,%i,1))
  if (%f) {
    var %ini = mod\ $+ %f $+ \ $+ %f $+ .ini
    var %lng = $readini(%ini,n,modulo,lng) , %des = $readini(%ini,modulo,desc) , %tab = $readini(%ini,modulo,tabsetup) , %men = $readini(%ini,modulo,modsetup)
    var %lng = es

    if (%des) { 
      writeini lng\ $+ %lng $+ \misc.ini modulo %f %des 
      if (%tab) writeini lng\ $+ %lng $+ \misc.ini modulo %f $+ -tab $gettok(%tab,2-,32)
      if (%men) writeini lng\ $+ %lng $+ \misc.ini modulo %f $+ -men %men
    }

    inc %i | goto L1
  }
  raya
}

alias CARGA1MOD {
  var %ini = mod\ $+ $1 $+ \ $+ $1 $+ .ini , %f = $readini(%ini,modulo,load) , %i = 1
  while (%i <= $numtok(%f,32)) { load -rs mod\ $+ $1 $+ \ $+ $gettok(%f,%i,32) | inc %i }
  wrini %perfil modulos instalados $addtok($readini(%perfil,modulos,instalados),$1,44)
  menusetupmod
  var %a = $readini(%ini,modulo,icobar) | if (%a) $bar-ico(+,$gettok(%a,1,44),$gettok(%a,2,44),$gettok(%a,3,44))
}


alias DESCARGA1MOD {
  var %ini = mod\ $+ $1 $+ \ $+ $1 $+ .ini , %f = $readini(%ini,n,modulo,unload) , %i = 1

  while (%i <= $numtok(%f,32)) { 
    var %a = $gettok(%f,%i,32)
    if (EXEC isincs %a) { .timer -m 1 200 $replace($removecs(%a,EXEC),_,$chr(32)) | goto L1 }
    if (NSET isincs %a) { unset % [ $+ [ $removecs(%a,UNSET) ] ] | goto L1 }
    if (timer isin %a) { . $+ %a off | goto L1 }
    unload -rs mod\ $+ $1 $+ \ $+ $gettok(%f,%i,32)
    :L1
    inc %i
  }
  wrini %perfil modulos instalados $remtok($readini(%perfil,modulos,instalados),$1,1,44)
  menusetupmod | unset %apartado
  var %a = $readini(%ini,modulo,icobar) | if (%a) $bar-ico(-,$gettok(%a,1,44),$gettok(%a,2,44),$gettok(%a,3,44))
}

on 1:CLOSE:@mod: mod.cierra
alias mod.cierra unset %mod.* | .timerADDVERIF off | window -c @mod | .timer 1 2 tolhfree | .unload -rs gmod.mrc

;EOF-dt
