;IRcap8 9d9fcc0bdf1ef58fccb5f5883bfea5b5

menu @GUIMGEN {
  uclick: {
    if $mouse.y < 32 {
      var %a = $calc($window($active).w - 26)
      if $inrect($mouse.x,$mouse.y,%a,4,20,18) { guicierra $active | return }
      dec %a 20 | if $inrect($mouse.x,$mouse.y,%a,4,14,18) { window -n $active | return }
    }
    else { if (%guidrop) guidrop | if ($isalias(UCLICK. $+ $active)) { UCLICK. $+ $active $mouse.x $mouse.y } }
    unset %tmp.vel
  }
  mouse: {
    if ($mouse.key & 1) && (%tmp.wmueve != on) {
    }
  }
  dclick: {
    if $mouse.y > 32 { 
      var %ractive = $remove($active,@)
      var %n = 1 | :LLdi | var %b = [ %ractive $+ [ .ls $+ [ %n ] ] ] | if (% [ $+ [ %b ] ]) { gguilista 2 %ractive $+ .ls $+ %n | inc %n | goto LLdi }
    }
  }
  sclick: { 
    if ($mouse.y > 32) {
      var %active = $active , %ractive = $remove($active,@) | unset %guidrop

      guipulsaop $mouse.x $mouse.y % [ $+ [ %ractive $+ .op ] ]

      guipulsatx $mouse.x $mouse.y % [ $+ [ %ractive $+ .tx ] ]
      if (%pulsado != $null) guidibtx %active % [ $+ [ %ractive $+ .tx ] ]

      guipulsacb $mouse.x $mouse.y % [ $+ [ %ractive $+ .cb ] ]
      guipulsabt $mouse.x $mouse.y % [ $+ [ %ractive $+ .bt ] ]

      var %n = 1 | :LLi | var %b = [ %ractive $+ [ .ls $+ [ %n ] ] ] | if (% [ $+ [ %b ] ]) { gguilista 1 %ractive $+ .ls $+ %n | inc %n | goto LLi }

      var %n = 1 | :LPe | var %b = [ %ractive $+ [ .pñ $+ [ %n ] ] ] | if (% [ $+ [ %b ] ]) { gpestana %ractive $+ .pñ $+ %n | inc %n | goto LPe }

      if ($isalias(SCLICK. $+ %active)) { SCLICK. $+ %active $mouse.x $mouse.y }

      if (% [ $+ [ %ractive $+ [ .skla ] ] ]) { if ($calc($window(%active).w - $mouse.x) < 16) { if ($calc($window(%active).h - $mouse.y) < 16) { .timerREDIMDIAG -o 0 0 redimdiag | window %active @NOguimgen } } }

      ;      echo -s $mouse.x $mouse.y 
      return
    }
    if ($mouse.x < $calc($window($active).w - 60)) { wmueve $active $calc($mouse.dx - $window($active).x) $calc($mouse.dy - $window($active).y) }
  }
  $guimenus
}
alias -l guimenus .disable #guimgen.* | .enable #guimgen. $+ $active


on 1:input:@edita: cierraedigui $1- | halt
on 1:KEYDOWN:@edita:13: if ($editbox(@edita) == $null) CIERRAEDIGUI $editbox(@edita)
on 1:KEYDOWN:@edita:9: {
  CIERRAEDIGUI $editbox(@edita)
  var %i = $gettok(%edita.tab,1,32) | inc %i | var %a = % [ $+ [ $remove($gettok(%edita.tab,2,32),@) ] $+ .tx ] | var %gtoka = $gettok(%a,%i,124) | if %gtoka == $null return
  set %edig.v $gettok(%edita.tab,2,32) | set %edig.edita $gettok(%gtoka,4,32)
  window -eh +d @edita $calc($gettok(%gtoka,1,32) + $window(%edig.v).x + 3) $calc($gettok(%gtoka,2,32) + $window(%edig.v).y + $window(%edig.v).h - $window(%edig.v).dh + 1) $calc($gettok(%gtoka,3,32) - 4) 14 Verdana 9
  editbox @edita % [ $+ [ $gettok(%gtoka,4,32) ] ]
  window -a @edita
  .timerEDIGUI -om 0 50 edigui
  set %pulsado tx | sss clik
  %edita.tab = %i %edig.v
  halt
}

alias -l REDIMDIAG {
  if (!$mouse.key & 1) { .timerREDIMDIAG off | REDIM. $+ $active fin | window $active @guimgen | return }
  var %w = $calc($mouse.mx - $window($active).x) , %h = $calc($mouse.my - $window($active).y) , %a = % [ $+ [ $remove($active,@) $+ [ .skla ] ] ]
  if (%w < $gettok(%a,1,32)) { %w = $gettok(%a,1,32) } | if (%h < $gettok(%a,2,32)) { %h = $gettok(%a,2,32) }
  if (%w > $window(-3).w) { %w = $window(-3).w } | if (%h > $window(-3).h) { %h = $window(-3).h }
  window $active $window($active).x $window($active).y %w %h | REDIM. $+ $active
}

alias SMENU {
  .timerSMENU off | %sbm.alias = $$1 | %sbm.op = $3- | %sbm.ptn = $active | %sbm.ee = 99
  window -c @submenu | window -pkhB +bd @submenu $calc($mouse.mx - 2) $calc($mouse.my - 0) $$2 $calc($numtok($3-,22) * 16 + 4) @submenu
  if (%combo.pos != $null) { window @submenu %combo.pos | unset %combo.pos }
  if ($calc($window(@submenu).y + $window(@submenu).h) > $window(-3).h) { window @submenu $window(@submenu).x $calc($window(-3).h - $window(@submenu).h - 8) }
  smenudibu 0 |  window -a @submenu
  .timerSMENU -om 0 100 SMENUTIM
}

alias SMENUDIBU {
  if %sbm.ee == %sbm.e { return }
  var %sbm.n = 0 | var %sbm.co = $calc($window(@submenu).w - 2) | var %sbm.nu = $numtok(%sbm.op,22)
  var %r = %skinr | %skinr = 0
  cua @submenu 0 0 $calc($window(@submenu).w - 1) $calc($window(@submenu).h - 1) $gettok(%gui.cc2,10,44) $gettok(%gui.cc2,11,44) $gettok(%gui.cc2,9,44)
  %skinr = %r
  :L1
  var %li = $gettok(%sbm.op,$calc(%sbm.n + 1),22)
  if (%li == -) { cua @submenu 1 $calc(%sbm.n * 16 + 8) $calc(%sbm.co - 1) 1 $gettok(%gui.cc2,11,44) $gettok(%gui.cc2,10,44) $gettok(%gui.cc2,9,44) | goto L2 }
  if ($calc(%sbm.n + 1) != $$1)  { drawtext -rcn @submenu $gettok(%gui.cc2,15,44) Verdana 9 8 $calc(%sbm.n * 16 + 3) 333 33 %li }
  else { cua @submenu 1 $calc(%sbm.n * 16 + 2) $calc(%sbm.co - 1) 15 $gettok(%gui.cc2,13,44) $gettok(%gui.cc2,14,44) $gettok(%gui.cc2,12,44) | drawtext -rcn @submenu $gettok(%gui.cc2,16,44) Verdana 9 8 $calc(%sbm.n * 16 + 3) 333 33 %li }
  :L2
  inc %sbm.n 1 | if (%sbm.n < %sbm.nu) goto L1
  drawline @submenu
  set %sbm.ee %sbm.e
}

alias SMENUTIM {
  if ($active != @submenu) || ($window(%sbm.ptn).state != normal) { window -c @submenu | unset %sbm.* | .timerSMENU off }
}

menu @submenu {
  mouse {
    set %sbm.e $int($calc($mouse.y / 16 + 1))
    smenudibu %sbm.e
  }
  sclick { %sbm.click = on }
  uclick { if %sbm.click == on { window -c @submenu | .timerSMENU off | if $gettok(%sbm.op,%sbm.e,22) != - { $replace(%sbm.alias,_,$chr(32)) %sbm.e } | unset %sbm.* } }
}

alias Kombo {
  %combo.vr = $4 | %edig.v = $active | %combo.t = $5- | set -u3 %combo.pos $1 $2 
  smenu kombobongo $3 $replace($5-,,)
}

alias kombobongo {
  set % $+ [ %combo.vr ] $gettok(%combo.t,$1,22)
  if ($window(%edig.v).state == normal) { guidibcb %edig.v % [ $+ [ $remove(%edig.v,@) ] $+ .cb ] | drawline %edig.v }
  var %onedit = oncombo. $+ $active | if $isalias(%onedit) { %onedit %combo.vr }
  unset %combo.* %edig.*
}

menu @barra {
  uclick: {
    clickicobarra $mouse.x $mouse.y uclick
  }

  sclick: {
    clickicobarra $mouse.x $mouse.y sclick
  }
}

on 1:active:*: {
  if (%barracid != $window(@barra).cid) { .timer -mo 1 20 bar -cl } | %barracid = $window(@barra).cid
  if ($group(#paner) == on) { paner | .timerPANCIERRA -mo 1 50 panercierra }
}

#sidebar on
alias SBARRA {
  unset %sba.*

  if $1 == ini { %sbarra = 160 sba.notify 9999 }

  var %a = $calc($window(-3).h - $window(@barra).h)
  if (redib isin $1-) window @sBa 0 $window(@barra).h $gettok(%sbarra,1,32) $calc(%a - 2)
  else { window -c @sba | window -pBhwzi +d @sBa 0 $window(@barra).h $gettok(%sbarra,1,32) $calc(%a - 2) @sbarra arial 12 }
  if (%skintile) && (%skinbtex == on) { drawpic $gettok(%skintile,1,32) $+ n @sba 0 0 $window(@sba).w $window(@sba).h " $+ $mircdirskin\ $+ %skin $+ \ $+ $gettok(%skintile,2-99,32) $+ " }
  else  drawrect -frn @sBa $gettok(%gui.cc,1,44) 1 0 0 $window(@sba).w $window(@sba).h
  drawrect -frn @sBa 2631720 1 $calc($window(@sba).w - 1) 0 1 $window(@sba).h

  var %y = 16 , %i = 2
  :L1
  var %al = $gettok(%sbarra,$calc(%i + 1),32)
  if (%al != $null) {
    inc %y 12
    if ($calc(%y + %al) > $window(@sba).h) { %al = $calc($window(@sba).h - %y + 6) }
    $gettok(%sbarra,%i,32) %y %al $1
    inc %y %al | inc %i 2 | goto L1
  }

  guidib @sba

  if redib !isin $1- {
    window -a @sBa
    window -a "Status Window"
  }
}


alias SBA.SUB {
  goto $1
  :MUEVE
  if ($2 == inicia) { .timerSBA.MUEVE -om  0 30 sba.sub mueve | window -pBwzh +d  @eje | if ($abs($calc($window(@sba).w - $window(Status Window).x)) < 8) { %sbat.ps = on } | %tikññ = $ticks | %tiknññ = 0 | %sbat.tik = 0 | return }
  if (!$mouse.key & 1) { 
    unset %tikññ %tiknññ
    .timerSBA.MUEVE off | window -c @eje | sbarra redib
    if (%sbat.ps == on) { var %w = Status Window | writeini mirc.ini Windows Status $window(%w).x $+ , $+ $window(%w).w $+ , $+ $window(%w).y $+ , $+ $window(%w).h $+ ,0,1,0 }
    unset %sbat.* | return 
  }
  var %tik = $ticks , %mx = $mouse.mx | if %mx < 125 { %mx = 125 }
  window -a @eje %mx $window(@barra).h 1 $window(@sba).h
  %sbarra = %mx $gettok(%sbarra,2-,32)
  if (%sbat.tik == 0) sbarra redib | if ($calc($ticks - %tik) > 500) { %sbat.tik = 1 }
  inc %tiknññ
  if (%sbat.ps == on) { scon -a window "Status Window" $window(@sba).w $window(Status Window).y }
  return

  :MUEVEH
  if ($2 == inicia) { if $3 == 2 return | %sbat.i = $3 | %sbat.d = $mouse.my | %sbat.cop = %sbarra | %sbat.tik = 0 | .timerSBA.MUEVE -om  0 30 sba.sub mueveh | window -pBwzh +d  @eje | return }
  if (!$mouse.key & 1) { .timerSBA.MUEVE off | window -c @eje | sbarra redib | unset %sbat.* | return }

  var %tik = $ticks , %my = $mouse.my
  if $calc(%my - $window(@sba).y) < 1 { %my = $window(@sba).y }
  if $calc(%my + $window(@sba).y) > $calc($window(@sba).h + $window(@sba).y) { %my = $calc($window(@sba).h - $window(@sba).y) }

  window -a @eje $window(@sba).x %my $window(@sba).w 1
  var %des = $calc(%sbat.d - %my) , %sb = %sbarra
  inc %sbat.i
  var %a = $gettok(%sbat.cop,%sbat.i,32) | %a = $calc(%a + %des) | %sbarra = $puttok(%sbarra,%a,%sbat.i,32)
  dec %sbat.i 2
  %a = $gettok(%sbat.cop,%sbat.i,32) | %a = $calc(%a - %des) | %sbarra = $puttok(%sbarra,%a,%sbat.i,32)
  inc %sbat.i
  var %i = 3 | :L1 | %a = $gettok(%sbarra,%i,32) | if (%a != $null) { if (%a < 6) { %sbarra = %sb } | inc %i 2 | goto L1 }
  if (%sbat.tik == 0) sbarra redib | if ($calc($ticks - %tik) > 500) { %sbat.tik = 1 }
  return

  :AJUSTAW
  var %i = $window(*,0) | while (%i > 0) {
    var %w = $window(*,%i)
    if ($window(%w).x < $gettok(%sbarra,1,32)) {
      if (%w == Status Window) {
        window $replace(%w,Status Window,"Status Window") $gettok(%sbarra,2,32) $window(%w).y | writeini mirc.ini Windows Status $window(%w).x $+ , $+ $window(%w).w $+ , $+ $window(%w).y $+ , $+ $window(%w).h $+ ,0,1,0
      }
    }
    dec %i
  }
  if $2 == pegastatus { var %w = Status Window | scon -a window $replace(%w,Status Window,"Status Window") $gettok(%sbarra,1,32) $window(%w).y | writeini mirc.ini Windows Status $window(%w).x $+ , $+ $window(%w).w $+ , $+ $window(%w).y $+ , $+ $window(%w).h $+ ,0,1,0 }
  return

  :POSY
  var %y = 16 , %i = 2
  :P1
  var %al = $gettok(%sbarra,$calc(%i + 1),32)
  if (%al) {
    inc %y 12
    if ($calc(%y + %al) > $window(@sba).h) { %al = $calc($window(@sba).h - %y - 4 + 10) }
    if ($gettok(%sbarra,%i,32) == $2) { return %y %al }
    inc %y %al | inc %i 2 | goto P1
  }
  return
}

menu @SBARRA {
  uclick: if (%guidrop) guidrop | .signal SBACLICK Uclick | unset %tmp.vel
  mouse: {
    if ($mouse.key & 1) {
    }
  }
  dclick: { 
    var %ractive = $remove($active,@)
    var %n = 2 | :LLdi
    var %i = $remove($gettok(%sbarra,%n,32),sba.) | if (%i) {
      var %b = [ %ractive $+ [ .ls1. $+ [ %i ] ] ] | if (% [ $+ [ %b ] ]) { gguilista 2 %b }
      var %b = [ %ractive $+ [ .ls2. $+ [ %i ] ] ] | if (% [ $+ [ %b ] ]) { gguilista 2 %b }
      inc %n 2 | goto LLdi
    }
  }
  sclick: { 
    var %active = $active , %ractive = $remove($active,@) | unset %guidrop
    guipulsaop $mouse.x $mouse.y % [ $+ [ %ractive $+ .op ] ]

    guipulsatx $mouse.x $mouse.y % [ $+ [ %ractive $+ .tx ] ]
    if (%pulsado != $null) guidibtx %active % [ $+ [ %ractive $+ .tx ] ]

    guipulsacb $mouse.x $mouse.y % [ $+ [ %ractive $+ .cb ] ]
    guipulsabt $mouse.x $mouse.y % [ $+ [ %ractive $+ .bt ] ]

    var %n = 2 | :LLi
    var %i = $remove($gettok(%sbarra,%n,32),sba.) | if (%i) {
      var %b = [ %ractive $+ [ .ls1. $+ [ %i ] ] ] | if (% [ $+ [ %b ] ]) { gguilista 1 %b }
      var %b = [ %ractive $+ [ .ls2. $+ [ %i ] ] ] | if (% [ $+ [ %b ] ]) { gguilista 1 %b }
      inc %n 2 | goto LLi 
    }

    var %n = 2 | :LPe
    var %i = $remove($gettok(%sbarra,%n,32),sba.) | if (%i) {
      var %b = [ %ractive $+ [ .pñ1. $+ [ %i ] ] ] | if (% [ $+ [ %b ] ]) { gpestana %b }
      var %b = [ %ractive $+ [ .pñ2. $+ [ %i ] ] ] | if (% [ $+ [ %b ] ]) { gpestana %b }
      inc %n 2 | goto LPe
    }

    if ($abs($calc($mouse.mx - $gettok(%sbarra,1,32))) < 10) { sba.sub mueve inicia | return }

    var %y = 16 , %i = 2 , %my = $mouse.y | :L2
    var %al = $gettok(%sbarra,$calc(%i + 1),32)
    if (%al != $null) {
      if ($abs($calc(%my - %y)) < 4) { sba.sub mueveh inicia %i }
      inc %y 12 | inc %y %al | inc %i 2 | goto L2
    }
    .signal SBACLICK sclick
  }
  $sbarramenus
}

alias -l sbarramenus {
  .disable #sba.*
  var %y = 16 , %i = 2
  :L1
  var %yy = $gettok(%sbarra,$calc(%i + 1),32) | if (!%yy) return  
  if ($mouse.y > %y) && ($mouse.y < $calc(%yy + %y)) { 
    .enable  $chr(35) $+ $gettok(%sbarra,%i,32)
    if ($isalias($gettok(%sbarra,%i,32) $+ .menu2)) { $gettok(%sbarra,%i,32) $+ .menu2 }
    return
  }
  else { inc %i 2 | inc %y %yy | inc %y 12 | goto L1 }
}
alias onedit.@sba .signal SBAEDIT $1-

alias SBATIT {
  var %a = $width($2-,verdana,9,0)
  drawline -nr @sba $gettok(%gui.cc,16,44) 1 0 $calc($1 + 2) 8 $calc($1 + 2) 8 $calc($1 - 8) $calc(%a + 12) $calc($1 - 8) $calc(%a + 26) $1 $calc($gettok(%sbarra,1,32) - 1) $1
  drawline -nr @sba $gettok(%gui.cc,17,44) 1 0 $calc($1 + 1) 7 $calc($1 + 1) 7 $calc($1 - 9) $calc(%a + 12) $calc($1 - 9) $calc(%a + 26) $calc($1 - 1) $calc($gettok(%sbarra,1,32) - 1) $calc($1 - 1)
  drawtext -nr @sba $gettok(%gui.cc2,18,44) Verdana 9 13 $calc($1 - 7) $2-
  drawtext -nr @sba $gettok(%gui.cc2,17,44) Verdana 9 12 $calc($1 - 8) $2-
}

#sidebar end


alias LARBOL {
  goto $prop
  :ANA
  if ($gettok($2-,2,8) == i) { var %g = $fline($1,$gettok($2,1,8) $+ g***,1) | if ($gettok($line($1,%g),6,8) == 2) return }
  var %a = $fline($1,$gettok($2,1-3,8) $+ ***,1)
  if (%a == $null) { aline $1 $2 } | else { rline $1 %a $2 }
  return
  :DEL
  var %a = $fline($1,$gettok($2,1-3,8) $+ ***,1)
  if (%a) { dline $1 %a }
  return
  :DELG
  var %i = $line($1,0) | :L1 | if %i == 0 return | var %a = $line($1,%i)
  if $gettok(%a,1,8) == $2 {
    if ($3 != g) && ($gettok(%a,2,8) != g) || ($3 == g) { dline $1 %i }
  }
  dec %i | goto L1
}

alias PANERini {
  if $1 == off { 
    .timerPANER -coi 0 1 PANER2 | .disable #paner | unset %paner* | var %pñ = $window(@paner-*,0) | if %pñ == 0 return
    :L1 | window -c $window(@paner-*,%pñ) | dec %pñ 1 | if (%pñ > 0) goto L1 | return 
  }
  .enable #paner | .timerPANER -cmoi 0 300 PANER
}

#paner on
alias PANER {
  if ($mouse.win == @barra) { bartoltip 3 }
  if (%maxi.win == on) { WINGEST | goto L1 }
  var %mño1 = $mouse.key , %mño2 = $timer(paner).mmt
  if (%mño1 == 1) && ($left($mouse.win,1) != @) && (%mño2 == $false) { .timerPANER -hi 0 1 PANER }
  if (%mño1 == 0) && (%mño2 != $false) { .timerPANER -cmoi 0 300 PANER }
  :L1
  if $window($active).state == normal {
    var %panerw = $active
    if ($left($active,1) == $chr(35)) { panerdib $active c | return }
    if ($active == $query($active)) { panerdib $active p | return }
    if ($remove($active,=) == $chat($remove($active,=))) { panerdib $active p | return }
  }
  %paner.ult = )&(
}

alias PANERdib {
  var %pñ = $replace($1,$chr(44),$chr(32)) | var %pññ = @paner- $+ $window($1).cid $+ - $+ $1
  if ($window(%pñ).w != $window(%pññ).w) goto L1
  if $window(%pññ).state == normal {
    if ($window(%pñ).x != $window(%pññ).x) || ($calc($window(%pñ).y + $window(%pñ).h) != $window(%pññ).y) window %pññ $window(%pñ).x $calc($window(%pñ).y + $window(%pñ).h)
    if (%pñ $+ - $+ $window(%pñ).cid != %paner.ult) {  window -a %pññ |  window -a %pñ }
    %paner.ult = %pñ $+ - $+ $window(%pñ).cid
    return
  }
  :L1
  if $window(%pññ).state == $null { window -phkB +bd %pññ }
  window -pkB +bd %pññ $window(%pñ).x $calc($window(%pñ).y + $window(%pñ).h) $calc($window(%pñ).w - 0) 14 @paner
  if $$2 == c  { var %c = %pcpanel.c $+  $+ %pcpanel.p  } | else { var %c = %pcpanel.p }
  drawrect -frn %pññ $gettok(%gui.cc,1,44) 1 0 0 $window(%pñ).w  14
  var %i = 1 , %x = 6 , %c1 = $gettok(%gui.cc,8,44) , %c2 = $gettok(%gui.cc,16,44) , %c3 = $gettok(%gui.cc,17,44)
  :L2
  var %a = $gettok(%c,%i,22)
  if (%a) {
    var %an = $width(%a,verdana,9,0)
    drawtext -rn %pññ %c1 verdana 9 %x 0 %a
    drawline -rn %pññ %c2 1 $calc(%x + %an + 2) 0 $calc(%x + %an + 9) 14
    drawline -rn %pññ %c3 1 $calc(%x + %an + 3) 0 $calc(%x + %an + 10) 14
    inc %i 2 | inc %x %an | inc %x 10 | goto L2
  }
  if $window(%pññ).state == hidden { window -a %pññ | window -a %pñ }
}

menu @paner {
  uclick {
    var %pñ = $remove($active,@paner- $+ $cid $+ -) | window -a %pñ
    var %mx = $mouse.x , %i = 1 , %x = 6 , %nick = $remove(%pñ,=) , %c = %pcpanel.p
    if ($chr(35) isin %pñ) { %c = %pcpanel.c $+  $+ %c | var %nick = $sline(%pñ,1) , %canal = %pñ }
    :L1
    var %a = $gettok(%c,%i,22)
    if (%a) {
      var %an = $width(%a,verdana,9,0)
      if $inrect(%mx,5,%x,0,$calc(%an + 4),14) { 
        if (cbots isin $gettok(%c,$calc(%i + 1),22)) && ($chr(35) !isin $active) { cbots 1 - $remove($active,=) }
        else $replace($gettok(%c,$calc(%i + 1),22),&1,%nick,&2,%canal,&3,$active)
        return
      }
      inc %i 2 | inc %x %an | inc %x 10 | goto L1
    }
    return
  }
}

alias panerOP {
  if $2 == $me { if ($me !isop $1) mcs op $1 $me }
  else { 
    if ($me isop $1) { if $2 isop $1 mode $1 -o $2 | else mode $1 +o $2 } 
    if ($me !isop $1) { if $2 isop $1 mcs deop $1- | else mcs op $1- }
  }
}

alias PANERCIERRA {
  var %pñ = $window(@paner-*,0) | if %pñ == 0 return
  :L1
  var %pññ = $window(@paner-*,%pñ)
  var %sc = $gettok(%pññ,2,45) 
  if ($scid(%sc) == $null) { window -c %pññ }
  else { scid $gettok(%pññ,2,45) | if ($window($remove(%pññ,@paner- $+ %sc $+ -)).state != normal) { window -c %pññ | return } }
  dec %pñ 1 | if (%pñ > 0) goto L1
}
#paner end


alias PANER2 {
  if ($mouse.win == @barra) { bartoltip 2 }
  if (%maxi.win == on) { WINGEST }
}


alias WINGEST {
  if ($window($active).type isin channel query chat status) || (@jab> isin $active) {
    if ($window($active).state == maximized) window -r $active
    var %w = $calc($window(-3).w - $window(@sba).w - 2) , %h = $calc($window(-3).h - $window(@barra).h - 2) | if ($group(#paner) == on) && ($window($active).type isin chat query channel) { dec %h 14 }
    if ($window($active).x $window($active).y $window($active).w $window($active).h != $window(@sba).w $window(@barra).h %w %h) {
      unset %noparpa | window $replace($active,Status Window,"Status Window") $window(@sba).w $window(@barra).h %w %h
    }
  }
}

ctcp 1:PING: echo $iif(%m.c == on,-atq,-stq) $tma(ctcp,$nick,$address,$1,$2-) | if ($2 isnum) && (%ctcp.cloak != on) { .ctcpreply $nick $nexe($1-2) } | meflod | sss ctcp | halt
ctcp 1:VERSION: echo $iif(%m.c == on,-atq,-stq) $tma(ctcp,$nick,$address,$1,$2-) | if  (%ctcp.cloak != on) && (%versionreply == $null) { .timerVREP 1 2 .ctcpreply $nick VERSION • IRcap %ircapv • http:// $+ $urlcap • } | meflod | meflod | sss ctcp | halt
ctcp 1:TIME: echo $iif(%m.c == on,-atq,-stq) $tma(ctcp,$nick,$address,$1,$2-) | if (%ctcp.cloak != on) .ctcpreply $nick time Son las  $time  del  $date  | meflod | sss ctcp | halt

ctcp 1:DCC: {
  dosno nicknuke
  echo -stq $tma(dcc,$nick,$address,$1-)
  if ( %pflood.d == on ) {
    inc %ultchat | .timerDCCPROT 1 20 unset %ultchat
    if (%ultchat >= 6) { 
      ignore -tdu60 $wildsite | echo -stqe $tma(flood,$nick,$address,DCC FLOOD)
      if (%ultchat >= 8) { echo -stq $tma(flood,$nick,$address,DCC FLOOD NET) | ignore -tdu30 *!*@* | echo -s $mg(dccflod) }
      .timerWHOIS off
      alarma | halt 
    }
    if $len($nopath($filename)) > 225 { echo -stq $tma(flood,$nick,$address,DCC Exploit (mIRC 6.12)) | alarma | halt }
  }
  if (%priv.no == on) && ($ulevel < 10) { .timerNOPRIV 1 3 qc notice $nick $remp(%raznopriv) | .ignore -ptu15 $wildsite | halt }
  if (%priv.w == on) .timerWHOIS 1 3 whois $nick
  if ($2 == SEND) {
    sss send
    if (%dcc.osi == on) && ($tipoext($3-,%dcc.si)) { if ((3- isin %dcc.autoe || 4- isin %dcc.autoe) && $notify($nick)) || ((2- isin %dcc.autoe || 4- isin %dcc.autoe) && $ulevel == 10) || (1- isin %dcc.autoe) { .sreq +m auto | .timer -o 1 1 .sreq -m ask | .timerWHOIS off | return } } 
    if (%dcc.ono == on) { if ($tipoext($3-,%dcc.no)) { .timerDCCNO 1 3 qc notice $nick $mg(dccno) | echo -se $logo $mg(dccno2,$nick) | halt } }
    if (%tmp.autocoge isin $1-) { .sreq +m auto | .timer -o 1 1 .sreq -m ask | return }
    if ($appstate == tray) { echo -st $logo $mg(dtry) | halt }
  }
  if ($2 == CHAT) {
    sss priv
    dosno limitaprivados
    if ((3- isin %dcc.auto || 4- isin %dcc.auto) && $notify($nick)) || ((2- isin %dcc.auto || 4- isin %dcc.auto) && $ulevel == 10) { .creq auto | .timer -o 1 1 .creq ask | .timer 1 3 focus =$nick $cid }
    else if ($appstate == tray) { echo -st $logo $mg(dtry) | halt }
    if ($appstate != tray) .timerDCFLA -m 1 500 flash -r9 : $nick DCC 
  }
}

ctcp 1:*: {
  if ($findtok(sound mp3,$1,32)) && ($group(#LlegaSonido) == on) goto L2
  var %e = echo $iif(%m.c == on,-atq,-stq)
  if $left($target,1) == $chr(35) { %e = echo -tq $target }
  if $target == $me && $chat($nick) != $null { %e =  echo -tq =$nick }
  if $target == $me && $query($nick) != $null { %e = echo -tq $nick  }
  %e $tma(ctcp,$nick,$address,$1,$2-)
  :L2
  if (!$findtok(sound slots mp3,$1,32)) sss ctcp 
  if (!$findtok(%pflood.no,$1,32)) { meflod } | else { meflod 10 no }
  halt
}


on 1:ctcpreply:PING*MIDOLAG: {
  if ($nick == $me) {
    var %lag2 = $round($calc(($ticks - $2) / 1000),1)
    set %lag. [ $+ [ $cid ] ] $gettok(%lag2 %lag. [ $+ [ $cid ] ],1-20,32)
    var %a = $sba.sub(posy,sba.lag) | if (%a) { sba.lag %a - $cid | drawline @sba }
    if ($cid == $window(@barra).cid) && (%bar.lag == on) { bar -l }
    halt
  }
}

on 1:ctcpreply:*: {
  if ($1 == PING) && ($2 isnum) { ecot $iif(%m.c == on,-at,-ste) $logo <c4>[<c3> $nick <c2> $+ LAG $+ <c4>] $replace($duration($calc($ctime - $2)),sec,$chr(32) segundo,secs,$chr(32) segundos) | meflod | halt }
  echo $iif(%m.c == on,-atq,-stq) $tma(ctcpreply,$nick,$address,$target,$1,$2-) | meflod | halt
}

on 1:DCCSERVER:chat: dosno nicknuke | echo -ste $logo $mg(dccserver,$nick,$address) | if ($server) .timerWHOIS 1 3 whois $nick | sss priv
on 1:DCCSERVER:send: dosno nicknuke | echo -ste $logo $mg(dccserver2,$nick,$address,$nopath($filename)) | if ($server) .timerWHOIS 1 3 whois $nick | sss send

on ^1:open:?: {
  if $nick == $me && $1- == æD halt
  inc %tmp.floodpriv | .timerULTQUERY 1 20 unset %tmp.floodpriv
  if (%tmp.floodpriv > 8) && (%pflood.q == on) { .ignore -u60 $wildsite | .ignore -pu60 *!*@* | echo -st $tma(flood,$nick,$address,$mg(qeryflod)) | .timerNOPRIV 1 3 qc notice $nick $mg(qeryflod2,%tmp.floodpriv) | alarma | .timerWHOIS off | halt }
  dosno nicknuke
  if $NOSPAM($1-) && %spam.usa == on {
    echo -ste $logo $mg(nospamp) ( $nick > $nexe($left($1-,10)) ..)
    teflod | teflod | if %spam.log == on write " $+ $logdir $+ SPAM.log" $timestamp $nnet $Nick (msg) : $1- 
    if ($comchan($nick,1)) .timer 1 9 .signal -n flood NOTI $nick $site $ifmatch
    halt
  }
  if (%priv.no == on) && ($ulevel < 10) { .timerNOPRIV 1 3 qc msg $nick $remp(%raznopriv) | .ignore -ptu15 $wildsite | halt }
  dosno limitaprivados 
  if (%away.con == on) { if ($ulevel != 69) && ($away) && ($nick != $me) { away -contesta $nick $site $1- | teflod | teflod | teflod | halt } }
}

on 1:open:?: {
  echo -st $tma(query,$nick,$address)
  if ($appstate != tray)  flash -r9 : $nick QUERY
  if ($ulevel != 69) .timer 1 3 focus $nick $cid
  .timerRIIING 1 1 sss priv
  if (%priv.bu == on) { if ($exists(" $+ $logdir $+ $mknickfn($nick) $+ .log")) loadbuf 20 -pc14 $nick " $+ $logdir $+ $mknickfn($nick) $+ .log" }
  if (%priv.w == on) .timerWHOIS 1 3 whois $nick
}

on 1:open:=: {
  if (%priv.bu == on) loadbuf 20 -pc14 =$nick " $+ $logdir $+ $mknickfn($nick) $+ .log"
  if %dcc.query == on close -mic $nick | echo -st $logo $nick IP: $chat($nick).ip
}


on ^1:JOIN:#: {
  if $nick == $me {
    if $window($chan).x <  $window(@sba).w window $chan $calc($gettok(%sbarra,1,32) + $rand(0,50)) $window($chan).y
    set -u30 %tmp.scc. [ $+ [ # $+ . $+ [ $cid ] ] ] on
    %ultcanal = $chan $gettok($remtok(%ultcanal,$chan,32),1-7,32)
    cline $gettok(%skinl,1,44) $chan $me

    var %acc = usr\ $+ $remove(#,$chr(35)) $+ .cch 
    set %cpo. $+ # $+ .dat $readini %acc i dat | if %cpo. [ $+ [ # $+ .dat ] ] == $null { unset %cpo. [ $+ [ # $+ .dat ] ] }
    .timer 1 1 _ca entrando $chan
    .timer 1 3 remini usr\infrac.tmp #
    tma.canal canal0 #
    sss join
    set -u15 %tmp.noname on
    if (%afund == on) { if ($dapass(canal. $+ $nnet,$chan) != $null) { mcs * identify $chan $ifmatch } }
    halt
  }

  if ($kprot($chan,2) == 1) && ($ipef($nick) != falsa) { if $ial($address($nick,2),0) > 1 { .timerEHCLONES 1 1 echo -tq $chan $tma(clones,$gettok($address($nick,2),2,64),$clones($nick),$chan) | .timerCLONES 1 1 sss clon } }
  if ($kprot(#,4) == 1) { if $_ca(rnick,$site,$nick) != $null { var %ea = ( $+ $mg(entroantes) $+  $ifmatch $+ ) } }
  if ($kprot(#,35) != 1) echo -tq $chan $tma($iif(%tma.addr == on,join,join2),$nick,$address,$chan,%ea)
  if ($kprot(#,32) == 1) .timerWENTRAS 1 3 whois $nick
  if ($kprot(#,38) == 1) && ($me isop #) .timerAVOZ $+ # 1 3 qc mode # +v $nick
  _ca saluda $nick 33 saludo
  if $me isop # _ca ulist join
  halt
}


raw 324:*: {
  if (%tmp.scc. [ $+ [ $2 $+ . $+ [ $cid ] ] ] == on) {
    var %a = %tmp.tp. [ $+ [ $2 $+ . $+ [ $cid ] ] ] | unset %tmp.tp. [ $+ [ $2 $+ . $+ [ $cid ] ] ]
    unset %tmp.scc. [ $+ [ $2 $+ . $+ [ $cid ] ] ]
    $tma.canal(canal1,$2,$gettok(%a,1,32),$gettok(%a,2,32))
    _ca scan $2
  }
}

on ^1:PART:#: {
  if $nick == $me { unset %cpo. [ $+ [ # $+ .* ] ] | return }
  if ($kprot(#,35) != 1) echo -tq $chan $tma($iif(%tma.addr == on,part,part2),$nick,$address,$chan,$1-)
  _ca saluda $nick 34 despide
  if ($kprot(#,4) == 1) { _ca rnickw $site $nick }
  if %takop == on .timer 1 1 TAKOP #
  halt
}
on ^1:QUIT: {
  var %spam.mquit = $1- | if %spam.quit == on { nospam $1- | if $result != $null { %spam.mquit = noSpam } }
  var %a = $tma($iif(%tma.addr == on,quit,quit2),$nick,$address,%spam.mquit) | var %i = $comchan($nick,0) | while (%i > 0) { if ($kprot($comchan($nick,%i),35) != 1) { echo -tqi100 $comchan($nick,%i) $iif(($window($comchan($nick,%i)).stamp),$remove(%a,$strip($timestamp)),%a) } | dec %i }
  if $query($nick) == $nick echo -t $nick %a
  if ($kprot(#,4) == 1) { _ca rnickw $site $nick }
  if %takop == on .timer 1 1 TAKOP
  halt
}

on ^1:NICK: {
  if $nick == $me { 
    .timer 1 1 ja yo20 
    if $window(@setup) { %setup.tmpnic = $newnick | refres }
    if (%tmp.nickgpass) .timer 1 1 _ca nickguardapass %tmp.nickgpass | unset %tmp.nickgpass
  }
  var %a = $tma(nick,$nick,$newnick,$address) | var %i = $comchan($newnick,0) | while (%i > 0) { if ($kprot($comchan($newnick,%i),35) != 1) echo -tq $comchan($newnick,%i) %a | dec %i } | if $nick == $me echo -stq $tma(nickme,$nick,$newnick,$address)
  halt
}

on ^1:KICK:#: {
  if $knick == $me {
    echo -stq $mg(kick,$nick,#,$1-)
    alarma 
    if (%pflood.bot == on) && ($nick != $me) { if ($nick != $gettok($netcon(4),1,64)) { var %b = $netcon(1) $+ .protchan | if $isalias(%b) { %b KICK } } }
    if (%reban == on) { set %reentra $chan | .timerREBAN 0 30 reentra | window -c @reentra | window -k @Reentra 1000 $window(@barra).h 225 62 arial 11 }
  }
  echo -tq # $tma(kick,#,$nick,$knick,$1-)
  if ($kprot(#,4) == 1) && ($knick != $me) { _ca rnickw $remove($address($knick,2),*!*@) $knick }
  if (%au.op == on) && ($me isop #) _ca ulist kick
  if $nick == $me sss kick
  halt
}

on 1:DEOP:#: {
  if $opnick == $me {
    if ($nick != $me) {
      echo -setq $mg(deop,$nick,$chan) | .timerOPS -m 1 200 sss deop
      if (%pflood.bot == on) { if ($nick != $gettok($netcon(4),1,64)) && (%tmp.fkem != on) { var %b = $netcon(1) $+ .protchan | if $isalias(%b) { %b DEOP } | set -u6 %tmp.fkem on  } }
    }
  }
  if (%au.op == on) && ($me isop #) _ca ulist deop
}

on 1:OP:#: {
  if $opnick == $me {
    echo -setq $mg(op,$nick,$chan) | .timerOPS -m 1 200 sss op
    if (%tmp.quitaban. [ $+ [ # $+ . $+ [ $cid ] ] ] != $null) { mode # -b $ifmatch | unset %tmp.quitaban. [ $+ [ # $+ . $+ [ $cid ] ] ] }
    if (%tmp.kickban) { if (# == $gettok(%tmp.kickban,1,32)) && ($gettok(%tmp.kickban,2,32) ison #)  _ca pckickban %tmp.kickban | unset %tmp.kickban | mode # -o $me }
    if %au.mop == on .timer 1 5 _ca ulist exe P #
  }
}


on 1:BAN:#:  {
  if ($banmask iswm $address($me,5)) {
    echo -setq $logo $mg(ban,$nick,#,$banmask)
    alarma
    if (%pflood.ban == on) && ($nick != $me) {
      set %tmp.quitaban. [ $+ [ # $+ . $+ [ $cid ] ] ] $banmask
      if $me isop $chan { if %tmp.fkem != on { dopa $chan $nick | set -u6 %tmp.fkem on | mode $chan -b $banmask } }
    }
    if (%pflood.bot == on) && ($nick != $me) { if ($nick != $gettok($netcon(4),1,64)) && (%tmp.fkem != on) { var %b = $netcon(1) $+ .protchan | if $isalias(%b) { %b BAN } | set -u6 %tmp.fkem on } }
  }
  if $_ca(baneaos,$banmask,#) != $null { echo -t $chan $logo $mg(ban2) $+ : $ifmatch }
}

on 1:UNBAN:#: if  $_ca(baneaos,$banmask,#) != $null { echo -t $chan $logo $mg(dban2) $+ : $ifmatch }

on ^1:TOPIC:#: echo -tq # $tma(topic,#,$nick,$1-) | halt
on ^1:RAWMODE:#: echo -tq # $tma(mode,#,$nick,$1,$2-) | halt
on ^1:ACTION:*:*: if ($len($1-) > 50) { teflod $len($1-) } | if (%spam.sex == on) { if ($nick !isop $chan) { var %prh = $numtok(%spam.txt,22) | while (%prh > 0) { if ($gettok(%spam.txt,%prh,22) iswm $1-) { halt | var %prh = 0 } | dec %prh } } } | var %t = $target | if %t == $me { %t = $nick } | echo -tqbf %t $tma(action,$nick,$1-) | halt
on ^1:INVITE:#: var %a = -setq | if %m.ni == on { var %a = -aetq } | echo %a $logo $mg(invite,$nick,$chan) | meflod | .timerNOTISS 1 1 sss noti | halt

on ^1:NOTICE:*:*: {
  if $ulevel == 69 return
  teflod $len($1-)
  if %spam.usa == on {
    if $nospam($1-) != $null { 
      if %spam.log == on write " $+ $logdir $+ SPAM.log" $timestamp $nnet $Nick (notice) : $1-
      .timerNOSALUDOS 1 8 echo -se $logo $mg(nospamn) ( $nick > $nexe($left($1-,10)) ..)
      if ($comchan($nick,1)) .timer 1 9 .signal -n flood NOTI $nick $site $ifmatch
      halt
    } 
  }
  .timerNOTISS 1 1 sss noti 
  var %m = $tma(notice,$nick,$address,$1-) | if $chr(35) isin $left($target,2) { %m = $tma(noticecanal,$nick,$address,$target,$1-) }
  if %m.ni == on { echo -atq %m | halt }
  if $chr(35) isin $left($target,2) { echo -tq $remove($target,@) %m | halt }
  if $target == $me && $chat($nick) != $null && $1 != DCC { echo -tq =$nick %m | halt }
  if $target == $me && $query($nick) != $null && $1 != DCC { echo -tq $nick %m | halt }
  echo -stq %m | halt
}

on ^+20:USERMODE: if $nick == $me { echo -stqe $logo $mg(modo,$me,$1-,$usermode) | halt }

on ^1:NOTIFY: {
  var %t = $logo $mg(notify,$nick) $iif($notify($nick).note,<c4>( $+ $notify($nick).note $+ <c4>))
  if (%m.n == on) ecot -atq %t | else { ecot -stq %t | .timerNOTIFY 1 1 raya }
  if ($query($nick)) ecot -tq $nick %t
  var %w = $readini(%perfil,notifywav,$nick) | if (%w) { if ($exists(%w)) .timer -m 1 100 slocal %w }
  if $nick == %siguenick loadu g-siguenick $nick
  if ($notify($nick).whois) qc w $nick
  halt
}
on ^1:UNOTIFY: {
  var %t = $logo $mg(unotify,$nick)
  if (%m.n == on) echo -atq %t | else { echo -stq %t | .timerNOTIFY 1 1 raya }
  if ($query($nick)) && (!$comchan($nick,0)) echo -tq $nick %t
  if (%reloca == on) { 
    var %rebu = $gettok($notify($nick).addr,2,64)
    if (%rebu) { if (.dal.net !isin %rebu) && ($ipef2(%rebu) != falsa) { set %nwho 1 | .enable #rewhowas | set %rquery $nick | who %rebu } }
    else { set %nwho 1 | if ($netcon(1) != croom.inb) whowas $nick 1 | else whowas $nick }
  }
  halt
}


on ^+69:OPEN:*: {
  identificanick $1-
  var %a
  if (*ltima hora * la red:* iswm $1-) {
    var %m =  $strip($1-)
    var %a = $replace($gettok(%m,7,32),Ene,01,Feb,02,Mar,03,Abr,04,May,05,Jun,06,Jul,07,Ago,08,Sep,09,Oct,10,Nov,11,Dic,12) $gettok(%m,6,32)
    var %a = ( $+ $replace($duration($calc($ctime($date $time) - $ctime(%a)),2),wk,semana,day,día) $+ )
  }
  if ($window(@cbots)) cbotinfo  $+ $Nick $+ : $1- %a
  if %bot.prv != on { echo -stq $botecho($Nick) $1- %a | .timerBOTSEP 1 1 linesep | halt }
}
on ^+69:TEXT:*:*: identificanick $1-
on ^+69:NOTICE:*:*: {
  identificanick $1-
  if ($window(@cbots)) cbotinfo  $+ $Nick $+ : $1-
  echo -stq $botecho($Nick) $1- | .timerBOTSEP 1 1 linesep | halt
}

#dccque off
on 1:TEXT:$(@ $+ $me $+ *):*: {
  teflod | teflod
  if ($1 == @ $+ $me $+ -que) { dccola -stat $nick | return }
  if ($1 == @ $+ $me $+ -remove) { dccola -bor $nick $2- | return }
}
#dccque end

#enviofichero off
on 1:TEXT:$(! $+ $me *):*: if ($2-) { ecot -ste <c4>[ $+ $nick GET] $2- | teflod | teflod | teflod | teflod | dosno concon $2- | .signal envfichero $nick $2- }
#enviofichero end

#cuac on
on 1:TEXT:*:*: if ($me isin $strip($1-)) { cuac $1- | if ($away) && ($chan) && (%away.noti == on) { .timerRAWAY 1 3 qc notice $nick $mg(notiaw,$nexe($awaymsg)) } }
on 1:ACTION:*:*: if ($me isin $strip($1-)) { cuac $1- }
on 1:CHAT:*: if ($me isin $strip($1-)) { cuac $1- }
#cuac end
alias -l CUAC echo -set $tm.h $chan < $+ $nick $+ > $nexe($1-) | .timerCUAC 1 1 sss cuac | .signal -n cuac $iif($chan,$chan,$m(46)) $nick $nexe($1-)

on ^1:TEXT:*:#: {
  if ($len($1-) > 50) teflod $len($1-)
  if (%spam.sex == on) { if ($nick !isop $chan) { var %prh = $numtok(%spam.txt,22) | while (%prh > 0) { if ($gettok(%spam.txt,%prh,22) iswm $1-) { halt } | dec %prh } } }
  if (%nick@ == on) { var %tma.p = %tma.n2 $+ $left($remove($nick($chan,$nick).pnick,$nick),1) }
  var %ni.ck = %tma.n1 $+ %tma.p $+ %tma.n3 $+ $nick $+ %tma.n4 , %ni.an = $calc($len($strip(%ni.ck)) * %tma.tab + 1)
  if ($isalias(tma.text)) { $tma.text(-tbfli $+ %ni.an,$chan,$nick,%ni.ck,$1-) } | else { echo -tbfli $+ %ni.an $chan %ni.ck $+  $1- }
  halt
}

on ^1:TEXT:*:?:{
  if ($len($1-) > 50) teflod $len($1-)
  if (%spam.jix == on) { 
    if ($ulevel < 7) {
      var %prh = $numtok(%spam.txt,22) | while (%prh > 0) { if ($gettok(%spam.txt,%prh,22) iswm $1-) { if ($nnet != $nnet($site)) { window -c $nick | ignore -pu30 $site | if %spam.log == on write " $+ $logdir $+ SPAM.log" $timestamp $nnet $Nick (msg) : $1- | echo -ste $logo $mg(nospamp) ( $nick > $nexe($left($1-,10)) ..) | halt } } | dec %prh } 
    }
  }
  var %ni.ck = %tma.n1 $+ %tma.n3 $+ $nick $+ %tma.n4 , %ni.an = $calc($len($strip(%ni.ck)) * %tma.tab + 1)
  if ($isalias(tma.text)) { $tma.text(-tbfli $+ %ni.an,$nick,$nick,%ni.ck,$1-) } | else { echo -tbfli $+ %ni.an $nick %ni.ck $+  $1- }
  halt
}

on ^1:CHAT:*: {
  if (%pflood.d == on) && (%tmp.fsnoflod != on) { inc %dclok | .timerDC 1 10 unset %dclok | if (%dclok > 80) { unset %dclok | close -c $nick | echo -ste $tma(flood,$nick,$address,$mg(dccloq)) | halt } }
  if ($strip($1) == PONGdcc)  && ( $2 isnum ) { msg =$nick 3Lag =12 $calc($ctime - $2) $mg(seg) | inc %dclok 3 }
  if ($strip($1) == PINGdcc) && ( $2 isnum ) { msg =$nick 3PONG0,0dcc $2 | inc %dclok 3 }
  if ($1- == [\]) && (%viserv == on) { inc %dclok 5 | ja liserv $nick }

  if $gettok($1-,1,32) == ACTION { echo $colour(action) -tq =$nick $tma(action,$nick,$remove($gettok($1-,2-99,32),)) | halt }
  var %ni.ck = %tma.n1 $+ %tma.n3 $+ $nick $+ %tma.n4 , %ni.an = $calc($len($strip(%ni.ck)) * %tma.tab + 1)
  if ($isalias(tma.text)) { $tma.text(-tbfli $+ %ni.an,=$nick,$nick,%ni.ck,$1-) } | else { echo -tbfli $+ %ni.an =$nick %ni.ck $+  $1- }
  halt
}
on 1:SERV:*: if (%pflood.d == on) { inc %dclok 5 | .timerDC 1 10 unset %dclok | if (%dclok > 80) { unset %dclok | close -f $nick | echo -se $tma(flood,$nick,$address,$mg(dccloq)) | halt } }

#hablo on
on *:input:#: if ($left($1,1) != /) { escribiendo $active $1- | halt } | else decoprot $1-
on *:input:?: if ($left($1,1) != /) { escribiendo $active $1- | halt } | else decoprot $1-
on *:input:=: if ($left($1,1) != /) { escribiendo $active $1- | halt } | else decoprot $1-
on *:input:!: if ($left($1,1) != /) { escribiendo $active $1- | halt } | else decoprot $1-
#hablo end
on *:input:*: if ($left($1,1) == /) decoprot $1-

alias ESCRIBIENDO {
  if (!$2-) { return }
  %mi^frase = $2-
  if (!$ctrlenter) { 
    mod^ncomp $2-
    mod^correc $2-
    mod^conv $2-
    mod^crip $2-
    mod^ascii
    .signal -n MODOESCRITURA $2- 
  }
  if (%frase^halt != on)  { 
    .msg $active %nick^comp %mi^frase | var %a = $mi^nick , %ni.an = $calc($len($strip(%a)) * %tma.tab + 1) 
    if ($isalias(tma.say)) { $tma.say(%ni.an,$active,%a,%nick^comp,%mi^frase) }
    else { echo $color(own) -tli $+ %ni.an $active %a %nick^comp %mi^frase }
  }
  unset %mi^frase %nick^comp %frase^halt
}

#mi^nick on
alias MI^NICK {
  var %a | if (%nick@ == on) { if ($me isvoice $active) { %a = %tma.m2 $+ + } | if ($me isop $active) { %a = %tma.m2 $+ @ } } | return %tma.m1 $+ %a $+ %tma.m3 $+ $me $+ %tma.m4 $+ 
}
#mi^nick end
alias MI^NICK return %tma.m4 $+ 

alias SAY { escribiendo $active $1- | haltdef }

#mod^ncomp on
alias mod^ncomp {
  if ($1 ison $active ) { 
    %nick^comp = $1
    if ($gettok(%mod^ncomp,3,8) != off) { %nick^comp = $ [ $+ [ $replace($ifmatch,<t>,%nick^comp) ] ] }
    %nick^comp = $gettok(%mod^ncomp,1,8) $+ %nick^comp $+  $+ $gettok(%mod^ncomp,2,8) $+ 
    %mi^frase = $deltok(%mi^frase,1,32)
  }
}
#mod^ncomp end
alias mod^ncomp return

#mod^correc on
alias mod^correc {
  var %a = %mi^frase
  if (%corrector.may == on) { if (%nick^comp == $null) { %a = $upper($left(%a,1)) $+ $mid(%a,2,9999) } }
  var %n = 1 | :L1
  var %pa = $gettok(%a,%n,32) | if %pa == $null { %mi^frase = %a | return }
  if $hget(corrector,%pa) != $null { %a = $puttok(%a,$ifmatch,%n,32) $+ $chr(32) }
  if (%corrector.url == on) { if (www. isin %pa) || (http: isin %pa) { %a = $puttok(%a,12 $+ %pa $+ ,%n,32) } }
  inc %n | goto L1
}
#mod^correc end
alias mod^correc return

#mod^conv on
alias mod^conv {
  var %vab = $matchtok(%mi^frase,&,1,32)
  if %vab != $null {
    var %vabp = $findtok(%mi^frase,%vab,1,32) , %vabr = $uniconv(%vab)
    if (%vabr != $null) { %mi^frase = $reptok(%mi^frase,%vab,%vabr,1,32) }
  }
}
#mod^conv end
alias mod^conv return

#mod^crip off
alias mod^crip {
  if ($remove($active,=) isin %ncrip) { 
    var %crpass = $readini %perfil CRIPT $remove($active,=)
    if (%crpass != $null) { echo $color(own) -t $active $mi^nick 4¬ %nick^comp %mi^frase | crip %crpass %nick^comp %mi^frase | %mi^frase = 4¬ $result | .msg $active %mi^frase | echo  | %frase^halt = on }
  }
}
#mod^crip end
alias mod^crip return

#mod^ascii off
alias mod^ascii {
  %mi^frase = $replace(%mi^frase,$chr(44),$chr(30))
  if ($gettok(%mod^texto,1,8) != off) { %mi^frase = $ [ $+ [ $replace($ifmatch,<t>,%mi^frase) ] ] }
  if ($gettok(%mod^texto,2,8) != off) { %mi^frase = $ [ $+ [ $replace($ifmatch,<t>,%mi^frase) ] ] }
  %mi^frase = $replace(%mi^frase,$chr(30),$chr(44))
  if ($gettok(%mod^texto,3,8) == on) { var %a =  $+ $gettok(%mod^texto,4,8) | if ($gettok(%mod^texto,5,8) != off) { %a = %a $+ , $+ $ifmatch } | %mi^frase = %a $+ %mi^frase }
  if ($gettok(%mod^texto,6,8) != off) { %mi^frase = $ifmatch $+ %mi^frase }
  if ($gettok(%mod^texto,7,8) == on) { %mi^frase = $gettok(%mod^texto,8,8) $+ %mi^frase $+  $+ $gettok(%mod^texto,9,8) }
}
#mod^ascii end
alias mod^ascii return


on ^1:SNOTICE:*: {
  var %i = 1 | while ($gettok(%sfiltro,%i,44)) { if $ifmatch iswm $1- halt | inc %i }
  var %a = $remove($1-,*** Notice -- )
  if $window(@snotices) { echo @snotices $timestamp $iif($scon(0) > 1,$nnet :) %a } | else { echo -st $serverecho($nnet) %a | .timerSNOTI 1 1 raya }
  halt
}
on ^1:WALLOPS:*: {
  var %i = 1 | while ($gettok(%sfiltro,%i,44)) { if $ifmatch iswm $1- halt | inc %i }
  if $window(@snotices) { echo @snotices $timestamp $iif($scon(0) > 1,$nnet) %tma.n1 $+ $nick $+ %tma.n4 $+  $1- } | else echo -st $serverecho($nick) $1-
  halt
}

#whoix on
raw 301:*: {
  if ($1 == $me) && (%noad != 1) tm.v 301 $1- | halt
}
raw 311:*: {
  %_w = ecot -st | if %m.w == on { %_w = ecot -at }
  set %uw $2 | set %pais $sacapais($4)
  var %tuserr = $2 $+ ! $+ $3 $+ @ $+ $4 | var %tuser = $level(%tuserr) | unset %tm.wuser
  if (69 isin %tuser) { %tm.wuser = BOT $ulist(%tuserr).info }
  if (68 isin %tuser) { %tm.wuser = Eggdrop }
  if (5 isin %tuser) { %tm.wuser = AutoKICK- $+ $group(#noentra) $+ - $ulist(%tuserr).info }
  if (7 isin %tuser) { %tm.wuser = AutoVOZ- $+ $group(#autovoz) $+ - $ulist(%tuserr).info }
  if (10 isin %tuser) { %tm.wuser = AutoOP- $+ $group(#autoop) $+ - $ulist(%tuserr).info }
  unset %whoixclon | if ($ial($address($2,2),0) > 1) && ($ipef($2) != falsa) { %whoixclon = $clones($2) <c2>[ $+ $ial($address($2,2),0) $+ ] }
  %tm.pais = $readini s\irsys\paises.txt paises $gettok($4,-1,46)
  tm.v 311 $1-
  if (%tmp.buscoclon) { echo -ste $logo $mg(bclon,$2,$4) | lwho $4 | unset %tmp.buscoclon }
  halt
}
raw 319:*: {
  var %a = $remove($replace($3-,$chr(32),$chr(44)),@,+,%)
  if (%tmp.veocanal) { echo -st $logo $mg(canalve,$2) | if ($numtok(%a,44) == 1) { .enable #datolistcanal | .raw list %a } | else { names %a } }
  if (%tmp.entrocanal) { echo -st $logo $mg(canalen,$2) | echo -st $logo %a | join %a }
  unset %tmp.veocanal %tmp.entrocanal
  tm.v 319 $1- | halt
}
raw 312:*: tm.v 312 $1- | halt
raw 313:*: tm.v 313 $1- | halt
raw 317:*: tm.v 317 $1- | halt
raw 318:*: {
  if ($group(#hotlwhois) == on) && (%tmp.nowhois == $null) .timer -m 1 100 %_w $_tm(<c3> $+ $2 $+  $+ $color(background) $+ $chr(1) <c2>.Bot_info. .Query. .Whois. .Clones. .Ping. .Chat.) | .timer -m 1 130 raya
  tm.v 318 | unset %tm.pais %tmp.nowhois %tm.wuser %pais | if ($group(#hotlwhois) == !on) raya | halt
}
raw 401:*: borranickque $2 | rebusca $2 | halt
raw 402:*: borranickque $2 | rebusca $2 | halt

raw 314:*: {
  if (%nwho == 1) && ($len($4) > 4) && (%qflod != 1) && ($ipef2($4) != falsa) { .enable #rewhowas | set %rquery $2 | qc who $4 }
  tm.v 314 $1-
  unset %nwho | halt
}
raw 406:*: ecot -t %wdonde <c3> $+ $2 $+  $+ $color(background) $+ $chr(1) $+  $+ $mg(noww) $iif($group(#hotlwhois) == on,<c2>.Bot_info.) | halt
raw 369:*: halt

raw 295:*: tm.v extra $1- | halt
raw 307:*: tm.v extra $1- | halt
raw 308:*: tm.v extra $1- | halt
raw 309:*: tm.v extra $1- | halt
raw 310:*: tm.v extra $1- | halt
raw 316:*: tm.v extra $1- | halt
raw 320:*: tm.v extra $1- | halt
raw 325:*: tm.v extra $1- | halt
raw 342:*: tm.v extra $1- | halt
raw 378:*: tm.v extra $1- | halt
raw 379:*: tm.v extra $1- | halt
#whoix end

alias tm.v {
  if (%tmp.nowhois) return
  tm.w $1-
}

#rewhowas off
raw 352:*: {
  var %a = -st | if %m.n == on { var %a = -at }
  echo %a $logo $mg(reloc,%rquery,$6 ( $+ $3 $+ @ $+ $4 $+ )) | if ($timer(REWWHOIS) == $null) .timerREWWHOis 1 1 whois $6
  if $active == %rquery {
    if ($6 != com1) && ($6 != com2) && ($6 != com3) && ($6 != com4) && ($6 != lpt1) && ($6 != lpt2) && ($6 != ps1) && ($6 != ps2) query $6
  }
  .timerNOWHAS 1 1 .disable #rewhowas | unset %nwho | halt 
}
raw 315:*: .disable #rewhowas | unset %nwho | halt 
#rewhowas end

#scancanal off
raw 352:* {
  if ($ipef2($4) != falsa) {
    if ($4 isin %scc.todos) && ($len($4) > 4) { inc %scc.clon | if $len(%scc.lclon) < 850 { %scc.lclon = %scc.lclon $6 } } | else { if $len(%scc.todos) < 850 { %scc.todos = %scc.todos $4 } }
  }
  if (* isin $7) { inc %scc.cop | %scc.lcop = %scc.lcop $6 | if ($cnick($6).color != $gettok(%skinl,3,44)) { cline $gettok(%skinl,2,44) %scc.canal $6 } }
  halt
}
raw 315:* { 
  .disable #scancanal 
  $tma.canal(canal2,%scc.canal,%scc.cop,%scc.lcop,%scc.clon,%scc.lclon)
  unset %scc.lclon %scc.lcop %scc.todos %scc.clon %scc.cop %scc.canal

  if $gettok(%scc.que,0,32) > 0 {
    %scc.clon = 0 | %scc.cop = 0
    %scc.canal = $gettok(%scc.que,1,32) | .enable #scancanal | who %scc.canal
    %scc.que = $deltok(%scc.que,1,32) | if $len(%scc.que) < 2 { unset %scc.que }
  }
  halt
}
#scancanal end

raw 332:*: if %tmp.noname == on halt
raw 333:*: set -u30 %tmp.tp. [ $+ [ $2 $+ . $+ [ $cid ] ] ] $3- | if %tmp.noname == on halt

#WINWHO off
raw 352:*: {
  if (%tmp.buscanal != $null ) { if ($remove(%tmp.buscanal,*) !isin $1-) halt }
  if $window(@LWho).state != normal { window -bhlsk -t6,26,30,45 @LWho $readini ircap.ini ww lwho }
  var %who.flg = $iif(* isin $7,COP) $+ $iif(@ isin $7,@) $+ $iif(+ isin $7,+) $+ $iif(. isin $7,ow) $+ $iif(G isin $7,aw) | if %who.flg == $null { %who.flg = - }
  aline @LWho $6  $chr(9) $3  $+ @ $+ $4  $chr(9) %who.flg $chr(9)  $+ $5 ( $+ $8 $+ ) $chr(9) $9- ( $2 )
  halt
}
raw 315:*: .disable #winwho | unset %tmp.buscanal | if $line(@lwho,0) > 0 { iline @LWho 1 0,12 $m(194) 12 $+ $str(_,30) $+ $chr(9) $+ 0,12 $m(246) 12 $+ $str(_,30) $+ $chr(9) $+ 0,12 $m(247) 12 $+ $str(_,30) $+ $chr(9) $+ 0,12 $m(248) 12 $+ $str(_,30) $+ $chr(9) $+ 0,12 $m(249) 12 $+ $str(_,99) | titlebar @LWho $2 ( $calc($line(@lwho,0) - 1) nicks ) | window -a @LWho | sss wina } | else { echo -s $logo $mg(nonick,$2) | raya } | halt
#WINWHO end


#WHOX on
raw 352:*: {
  inc %cwho | if (%cwho == 1) { ecot -st <c4>----(<c2>Who<c4>)---------------------------------------------------------- }
  if (!%tmp.nowho) ecot -sti100 <c1> $6 <c4>[<c2> $+ $strip($3)  $+ <c4>@<c2> $+ $4 $+ <c4>] * $9-  <c2> $7 $8 $2 | %uw = $6 | halt
}
raw 315:*: {
  if (!%tmp.nowho) ecot -st <c4>---<c3> $2 <c2> $+ $mg(who1,%cwho) $+ <c4>---------------------------------- | raya | unset %cwho %tmp.nowho | halt 
}
raw 353:*: if (%tmp.noname) { if ($chan($3).logfile) { write " $+ $logdir $+ $mklogfn($3) $+ " $logo Nicks: $4- } | halt } | echo -sti100 $logo $mg(who2,$3,$4-) | %nnic = $numtok($4-,32) | halt
raw 366:*: if (%tmp.noname) halt | echo -st $logo  $+ $2  $+ %nnic  $+ $mg(who3) | unset %nnic  | raya | halt
#whox end

#datolistcanal off
raw 322:*: window -c "channels list" | set -u30 %tmp.datolist $2- | halt
raw 323:*: window -c "channels list" | .disable #datolistcanal | echo -st  $+ $gettok(%tmp.datolist,1,32) ( $gettok(%tmp.datolist,2,32) $mg(usrs) ) | echo -st $logo $mg(topicen,$gettok(%tmp.datolist,1,32)) : $nexe($gettok(%tmp.datolist,3-,32)) | names $gettok(%tmp.datolist,1,32) | mode $gettok(%tmp.datolist,1,32) | halt
#datolistcanal end

raw 367:*: if (%borraban) { qc mode $2 -b $3 }
raw 368:*: unset %borraban

raw 004:*: {
  var %a = s\net\ $+ $gettok($2,$calc($numtok($2,46) - 1),46) $+ . $+ $gettok($2,$numtok($2,46),46) $+ .net
  if $exists(%a) {
    set %netcon. [ $+ [ $cid ] ] $readini %a net menu $readini %a net popup $readini %a net var
    if ($readini %a net ip != $null) .auser 69 $ifmatch
    cargabots | return
  }
  if (Conference isin $3) || ($left($3,2) == CR) { set %netcon. [ $+ [ $cid ] ] croom.inb CRoom Nickserv Chanserv Memoserv - - *If this is your nickname* }
  cargabots
}

#autoghost on
raw 433:*: {
  if $online < 3 { .timerGHOSTCON. $+ $cid -o 60 1 ghostcon $me | return }
  var %a = %netcon. [ $+ [ $cid ] ] | if (!%a) || (!$dapass(nick. $+ $nnet,$2)) return
  if (%tmp.nghost. [ $+ [ $cid ] ] != on) {
    var %b = $readini s\net\ $+ $gettok(%a,1,32) botcom ghost
    $replace(%b,<nickserv>,$gettok(%a,3,32),<pass>,$dapass(nick. $+ $nnet,$2),<me>,$2)
    .timer 1 8 nick $2
    set -u30 %tmp.nghost. [ $+ [ $cid ] ] on
  }
}
#autoghost end

alias GHOSTCON if $status == connected { .timerGHOSTCON. $+ $cid off | .timer 1 3 nick $1 }

raw 306:*: {
  var %a = %tmp.away. [ $+ [ $cid ] ]
  if ($gettok(%a,1,32) == -) || ( isin $gettok(%a,1,32)) {
    if  ( isin $gettok(%a,1,32)) { set %tmp.away. [ $+ [ $cid ] ] $strip($gettok(%a,1,32)) $gettok(%a,2-,32) }
    else { 
      set %tmp.away. [ $+ [ $cid ] ] $me $ctime $gettok(%a,3-,32)
      if (%away.cnick == on) nick $remp(%away.nick)
    }
    echo -stq $logo $mg(away1,$gettok(%a,3-,32))
    echo -stq $logo $mg(away2,%away.con,%away.cnick,%away.anun,%away.seg) | raya
    .timerAWAYSEGS $+ $cid 0 300 away -suma
    .timer 1 2 away -deop d
    if %away.anun == on { .timerAWAYANUN $+ $cid 0 $calc(%away.seg * 60) away -anun | .timer 1 5 away -anun }  
    if ($window(@setup)) && (%apartado == setaway) setaway
  }
  halt
}

raw 305:*: {
  var %a = %tmp.away. [ $+ [ $cid ] ]
  if (%away.cnick == on) nick $gettok(%a,1,32)
  .timerAWAYSEGS $+ $cid off
  .timerAWAYANUN $+ $cid off | if %away.anun == on { $ame2(%away.tx2 [ $duration($calc($ctime - $gettok(%a,2,32))) ausente ],a,%away.canal,%away.canalno) }
  .timer 1 2 away -deop o
  echo -stq $logo $mg(away3,$duration($calc($ctime - $gettok(%a,2,32)))) | raya
  unset %tmp.away. [ $+ [ $cid ] ]
  resetidle
  if ($window(@setup)) && (%apartado == setaway) .timer -m 1 500 setaway
  halt
}

on 1:DNS: {
  if %tmp.dns != $null { DNSque %tmp.dns $iaddress | unset %tmp.dns | halt }
  var %i = 1
  while (%i <= $dns(0)) {
    ecot -st $logo <c3> $+ $nick <c2>DNS: $dns(%i).ip $iif($dns(%i).addr != $null,( $dns(%i).addr )) <c4>.clip. 
    .timerDNR 1 1 raya | inc %i
  }
  halt
}

on 1:FILERCVD:*: {
  var %f = $filename , %e = $gettok($filename,-1,46)
  if ($findtok(mp3 wma ogg wav mid,%e,32)) && ($nofile(%f) != %dir.audio) && (%dir.audio) { %f = %dir.audio $+ $nopath($filename) | rename " $+ $filename $+ " " $+ %f $+ " }
  if ($findtok(mpeg mpg avi asf rm mp4,%e,32)) && ($nofile(%f) != %dir.video) && (%dir.video) { %f = %dir.video $+ $nopath($filename) | rename " $+ $filename $+ " " $+ %f $+ " }
  ddc reg <Recibidos> $nick %f
  ecot -s <c4> ,- $timestamp <c4>--- $mg(rcv1) <c4> $+ $str(-,30)
  ecot -s <c4> |<c2> $mg(rcv2,$nopath(%f),$nick)
  ecot -s <c4> |<c2> $mg(rcv3,$nofile(%f),$lof(%f))
  ecot -s <c4> |<c2> $mg(rcv4,F10) | %firu = %f
  if ($findtok(exe com bat vbs hta scr zip rar pif,%e,32)) && ($exists(%avp)) ecot -s <c4> |<c2> $mg(rcv5,Control + F10)
  ecot -s <c4> ` $+ $str(-,80)
  var %a = $readini %perfil dccstats get | inc %a 1 | writeini %perfil dccstats get %a
  var %a = $readini %perfil dccstats bget | inc %a $file($filename).size | writeini %perfil dccstats bget %a
}
on 1:FILESENT:*: {
  ddc reg <Enviados> $nick $filename
  var %i = $send($nick,0) | while (%i > 0) {
    if ($nopath($filename) == $send($nick,%i).file) {
      var %record = $readini %perfil DCCstats record | inc %record
      if ($send($nick,%i).cps > %record) { writeini %perfil DCCstats record $send($nick,%i).cps | writeini %perfil DCCstats campeon $nick | echo -se $logo $mg(record,$round($calc($send($nick,%i).cps / 1024),1),$nick) }
    }
    dec %i
  }
  var %a = $readini %perfil dccstats send | inc %a 1 | writeini %perfil dccstats send %a
  var %a = $readini %perfil dccstats bsend | inc %a $file($filename).size | writeini %perfil dccstats bsend %a
  .timer 1 2 dccola -sig
  var %c = $shortfn($filename) | %ultsend = $gettok(%c $+  $+ $remtok(%ultsend,%c,1,22),1-4,22)
}
on 1:SENDFAIL:*: {
  if (%tmp.noreenv == on) || (. isin $nick) { unset %tmp.noreenv | echo -ste $logo $mg(sfail,$nopath($filename),$nick)  | .timer 1 2 dccola -sig | halt }
  set -u90 %tmp.noreenv on | dcc send -l $nick " $+ $filename $+ " | .timer -m 1 100 echo -ste $logo $mg(sfail,$nopath($filename),$nick) $+ . $mg(sfail2)
  var %c = $shortfn($filename) | %ultsend = $gettok(%c $+  $+ $remtok(%ultsend,%c,1,22),1-4,22)
}
on 1:GETFAIL:*: ddc reg <pendientes> $nick $filename | if $tipoext($filename,%dcc.si) && (%dcc.repide == on) { .timer 1 3 msg $comcha($nick) ! $+ $nick $nopath($filename) } | sss fallo

raw 0:*: echo -st $logo Silence $1- | halt
raw 481:*: echo -stqe $logo $mg(r481) | halt
raw 482:*: echo -stqe $logo $2 $mg(r482) | halt
raw 421:*: if $2 == silence halt | echo -stqe $logo $2 $mg(r421) | fallo | halt
raw 474:*: echo -stqe $logo $2 $mg(r474) | halt
raw 433:*: echo -stqe $logo $2 $mg(r433) | halt
raw 471:*: echo -stqe $logo $2 $mg(r471) | halt
raw 473:*: echo -stqe $logo $2 $mg(r473) | halt
raw 475:*: echo -stqe $logo $2 $mg(r475) | halt
raw 404:*: echo -t $2 $logo $mg(r404) | fallo | halt
raw 501:*: echo -stq $logo $mg(r501) | halt

#motd on
alias IRMOTD {
  var %motd.d = $readini motd.txt FECHA fecha , %motd.d = $ctime(%motd.d) | inc %motd.d 604800 | if ($ctime < %motd.d) { .play -setMOTD motd.txt 1 | return }
  sockclose MOTD | unset %motdct | %motd.dom = $urlcap(1) | sockopen MOTD %motd.dom 80
  write -c motd.txt [FECHA] | write motd.txt fecha= $+ $date | write motd.txt [MOTD]
}
on 1:sockopen:MOTD: {
  if $sockerr > 0 { echo -ste $logo MOTD error | return }
  var %a = sockwrite -n motd
  %a GET http:// $+ %motd.dom $+ /mdd- $+ $replace(%idioma,ek,es,ga,es,cat,es) $+ .mdd HTTP/1.1
  %a Accept: *.*, */*
  %a User-Agent: motd socks
  %a Range: bytes=0-
  %a Host: %motd.dom $+ :80
  %a $crlf
  unset %motd.dom
}
on 1:sockread:motd: {
  sockread %motd
  if (%motd == +desactiva motd+) { .disable #motd | return }
  if (%motd == +fin+) { unset %motd %motdct | sockclose motd | .play -setMOTD motd.txt 1 }
  if (%motdct == graba) { write motd.txt %motd }
  if (%motd == +ini+) { %motdct = graba }
}
on 1:sockclose:motd: unset %motd %motdct | .play -setMOTD motd.txt 1
#motd end

#contadorkicks on
alias kick inc %cckik | kick $1- $replace(%cckikt,&n,%cckik)
#contadorkicks end

#hotlwhois on
on ^*:hotlink:.*.:*: return
on *:hotlink:.*.:*: {
  if $1 == .clip. { if ($remove($gettok($hotline,-5,32),.) isnum) { clipboard $gettok($hotline,-5,32) | echo -ste $logo ClipBoard: $cb } | return }
  var %a = $gettok($hotline,1,32) | if ($window($active).stamp) { %a = $gettok($hotline,2,32) }
  if ($chr(1) isin %a) { %a = $strip($gettok(%a,1,1)) } | else return
  if $1 == .bot_info. mns info %a
  if $1 == .query. q %a
  if $1 == .chat. dcc chat %a
  if $1 == .whois. w %a
  if $1 == .clones. { set -u30 %tmp.nowhois on | set -u30 %tmp.buscoclon on | whois %a }
  if $1 == .ping. ctcp %a PING
  halt
}
#hotlwhois end

on ^*:hotlink:*.mp3*:*: return
on *:hotlink:*.mp3*:*: {
  if (www. isin $hotline) || (http isin $hotline) return
  var %h = $mid($hotline,$pos($hotline,!,1),999) , %hn = $strip($remove($gettok(%h,1,32),!)) , %h3 = $strip($gettok(%h,2-99,32)) , %hp = $pos(%h3,.mp3,1)
  %h3 = $left(%h3,$calc(%hp + 4)) | msg $comcha(%hn) ! $+ %hn %h3 | echo -se $logo $mg(pidemp,$comcha(%hn),! $+ %hn,%h3)
}

on 1:sockopen:TCPING: {
  if ($calc($ctime - %tmp.tcpping) > 16) { echo -ste $logo $mg(tpingno,$sock($sockname).mark ( $+ $sock($sockname).ip $+ )) }
  else { echo -ste $logo $mg(tping,$sock($sockname).mark ( $+ $sock($sockname).ip $+ ),$calc($ctime - %tmp.tcpping)) }
  sockclose $sockname | unset %tmp.tcpping
}

menu @LWho {
  dclick { w $lvho(1) }
  $lvho(1)
  .$m(205): w $lvho(1)
  .$m(233): q $lvho(1)
  .$m(48): dcc chat $lvho(1)
  .$m(41): dcc send $lvho(1)
  .-
  .ctcp ping: ctcp $lvho(1) ping
  .ctcp version: ctcp $lvho(1) version
  -
  $m(202)
  .$m(194): clipboard $lvho(1)
  .ip: clipboard $gettok($lvho(2),2,64)
  .$m(248): clipboard $lvho(4)
  -
  ip 
  .$m(212): dns $gettok($lvho(2),2,64)
  .$m(57): ipa ping $lvho(1)
  .$m(56): who $gettok($lvho(2),2,64)
  .-
  .$m(48): dcc chat $gettok($lvho(2),2,64)
  .$m(41): dcc send $gettok($lvho(2),2,64)
  -
  $m(248)
  .$lvho(4): motd $lvho(4)
  .-
  .$m(250) $lvho(4): server $lvho(4)
  .$m(251): server -m $lvho(4)
  -
  $m(fijpos): writeini ircap.ini ww lwho $window(@LWho).x $window(@LWho).y $window(@LWho).w $window(@LWho).h @LWho $window(@LWho).font $window(@LWho).fontsize
}
alias -l lvho return $strip($gettok($remove($sline(@Lwho,1),$chr(9)),$1,32))



on 1:start:{
  %ircapv = 8.12
  if (!$exists(skin\ $+ %skin $+ \bar.png)) { echo -ste $logo SKIN %skin error | if ($isalias(sbarra)) { .disable #sidebar | .timer 1 2 .enable #sidebar | .timer 1 2 sbarra } | skin base }
  idioma carga %idioma
  unset %away.rnick* %repoaway* %away.segs* %ncrip %dcque %tmp.*
  unset %clon.* %snik %snik.ip %cl.* %saltakline %ezomime %banner.con %playlist %play.ext %liserv.nick %lag.* %netcon.*
  .disable #encripto
  %apartado = setGENERAL | %perfil = usr\ircapusr.cfg
  if (%arranques < 1) { %farranque = $date | .timer -m 1 2222 loads inicio | .nick IR $+ $rand(999,9999) | .anick CAP $+ $rand(999,9999) } | inc %arranques
  if %m.barra == off bar off | else bar
  if $group(#sidebar) == on sbarra | else { window -pBhwzi +d @sBa 0 40 1 100 | window -h @sBa 0 40 0 100 }
  if $group(#paner) == on panerini on | else panerini off
  if %@noti == on { window -k @sNotices }
  .rlevel 20
  serverz
  bar -c
  if %arranques > 2 { if $exists($mircdirusr\copiavariables.ca8) { if ($read -l2 $mircdirusr\copiavariables.ca8 != $date) { .timer 1 5 dina cfg.guarda $mircdirusr\copiavariables.ca8 } } | else .timer 1 5 dina cfg.guarda $mircdirusr\copiavariables.ca8 }
  .sound off | .dqwindow off
  %canalcfg.pro = $readini usr\canalglobal.ini i dat
  .timestamp -f $_tm($tstamp)
  %urlcap = IRcap[ $+ %ircapv $+ ] 4• $urlcap
  if $group(#mod^correc) == on { .timer 1 6 hmake corrector | .timer 1 6 hload corrector usr/corrector.hash }

  .timerTIM10 -io 0 10 TIM10
  if ($readini %perfil autocon autoconectar == on) { echo -ste $logo $mg(autocon,Shift + F12,5) | .timerAUTOCON 1 5 autoMconex }

  titlebar · IRcap · %ircapv
  echo -s  12,12!0,14     IRcap     1,0   %ircapv   4,4!
  echo -s  http://www.ircap.net - http://www.ircap.com - http://gsi.cjb.net
  ecot -s  IRcap (c) <c2>Carlos Esteve Cremades, 1997 - 2006
  var %f = lng\ $+ %idioma $+ \ $+ %idioma $+ .id , %i = 1 | :L1 | var %a = $readini(%f,lang,%i) | if (%a) { ecot -s  %a | inc %i | goto L1 }
  raya
  if ($readini ircap.ini WAV ini) sss ini
  if %tipofday == on && %arranques > 1 tip
  if ($version !isin $readini ircap.ini var MIRCversion) ecot -s $logo $mg(mircversion,6.17,%ircapv)
_notemp
  .timer 1 3 _novirs
  %motdd = 1
  if ($lock(decode)) { echo -s $mg(decod1) | echo -s $mg(decod2) | echo -s $mg(decod3,http:// $+ $urlcap(1) $+ /ayuda/decode.html) | raya | fallo }
}


on 1:connect:{
  .auser 20 $me
  bar -cl
  pmodo
  if %mlag == on midelag on
  if (%tmp.away. [ $+ [ $cid ] ]) && (%away.aum !isin %tmp.away. [ $+ [ $cid ] ]) away -recon
  unset %scc.que %lag. [ $+ [ $cid ] ]
  .disable #scancanal
  if ($group(#motd) == on) && (%motdd == 1) { .timerMOTD 1 10 irmotd | unset %motdd } | var %motd.d = $readini ircap.ini var wmotd | %motd.d = $ctime(%motd.d) | inc %motd.d 604800 | if ($ctime >= %motd.d) { writeini ircap.ini var wmotd $date | url -n http:// $+ $urlcap $+ /noticias.html }
  .timerRECAN 1 5 recan
  .timerAUTOJ. $+ $cid 1 6 autojoin
  if %arrseq == on .play -sc usr/arrseq.txt 0
  if $readini ircap.ini abrir canalfav == on { .timerCFAV1 -m 1 500 loadu g-canalfav }
  sss login
}

on 1:disconnect: {
  unset %netcon. [ $+ [ $cid ] ] %lag. [ $+ [ $cid ] ]
  echo -stqe * $mg(discon,$server,$duration($online)) : %quitmzg
  if ($active != @barra) && ($active != @conn) .timer -m 1 100 sss cae
  .timer -oi 1 1 cargabots
  var %a = $gettok($readini(s\net\ $+ $nnet $+ .net,net,ip),1,32) | if (%a) && (*!-@- !isin %a) { .ruser 69 %a }
  bar -cl
  unset %recan | var %i = 1 | while ($chan(%i) <= $chan(0)) { if ($chan(%i).key) %recan = %recan $+ $chan(%i) $chan(%i).key $+ , | else %recan = %recan $+ $chan(%i) $+ , | inc %i }
}

on ^*:LOGON:*: {
  var %t = $left($readini %perfil conex tipo,1) { if %t == 3 { play -asc bouncerreplace usr\bouncer.txt 0 | return } }

  var %a = s\net\ $+ $nnet $+ .net | %a = $readini %a net menu $readini %a net popup $readini %a net var
  if $gettok(%a,1,32) == hispano.inb {
    var %vpass = $dapass(nick. $+ $nnet,$me)
    if (%vpass) {
      .raw nick $me $+ ! $+ %vpass | return
      .raw nick $me %vpass
    }
  }
}

;EOF
