¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤    TeeeeeeeeeelNeeeeet   ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ 
alias @t return 01«02LoVEe12»
alias telnetad return 12Telnet v1.6
alias sock.err return $@t 12Telnet v1.6 10Error!
alias telnet {
  if ($1 == $null) {
    echo -a $@t 12You didn't specify a 2anything12 to connect to.
    return
  }
  inc %telnet.num
  if ($2 != $null) set %telnet.port $2
  if ($2 == $null) set %telnet.port 23
  sockopen telnet $+ %telnet.num $1 %telnet.port
}
alias telcmd {
  if ($1 == $null) return
  if ($2 == $null) return
  bset &telcmd 1 255
  set %telcmd.len $gettok($2-,0,32)
  set %telcmd.num 0
  :telcmd
  inc %telcmd.num
  if (%telcmd.num > %telcmd.len) {
    sockwrite $1 &telcmd
    return
  }
  bset &telcmd $calc(%telcmd.num + 1) $gettok($2-,%telcmd.num,32)
  goto telcmd
}
alias telhp {
  if ($1 == $null) return
  if ($sock($rtrim(1,$1),0) == 0) return
  set $evac(telnet.psn,$rtrim(1,$1)) $calc($telen($editbox($1)) * 2)
  if ($evacl(telnet.psl,$rtrim(1,$1)) == $null) {
    set $evac(telnet.psl,$rtrim(1,$1)) $evacl(telnet.psn,$rtrim(1,$1))
  }
  if (($evacl(telnet.psn,$rtrim(1,$1)) == 2) && ($evacl(telnet.psn,$rtrim(1,$1)) == $evacl(telnet.psl,$rtrim(1,$1))) && ($right($editbox($1),1) != $chr(42))) {
    set $evac(telnet.ps,$rtrim(1,$1)) $asc($right($editbox($1),1)) $+ $chr(44)
  }
  if ($evacl(telnet.psn,$rtrim(1,$1)) > $evacl(telnet.psl,$rtrim(1,$1))) set $evac(telnet.ps,$rtrim(1,$1)) $evacl(telnet.ps,$rtrim(1,$1)) $+ $chr(44) $+ $asc($right($editbox($1),1))
  if ($evacl(telnet.psn,$rtrim(1,$1)) < $evacl(telnet.psl,$rtrim(1,$1))) set $evac(telnet.ps,$rtrim(1,$1)) $ltrim($calc($evacl(telnet.psl,$rtrim(1,$1)) - $evacl(telnet.psn,$rtrim(1,$1))),$evacl(telnet.ps,$rtrim(1,$1)))
  if ($editbox($1) != $null) set $evac(telnet.psl,$rtrim(1,$1)) $evacl(telnet.psn,$rtrim(1,$1))
  editbox $1 $str($chr(42),$calc($evacl(telnet.psn,$rtrim(1,$1)) / 2))
}
alias telhpout {
  if ($1 == $null) return
  unset %telhpout.*
  if (($2 == $null) || ($2 !isnum)) set %telhpout.tok 44
  if (($2 != $null) && ($2 isnum)) set %telhpout.tok $2
  set %telhpout.len $gettok($1,0,%telhpout.tok)
  set %telhpout.num 0
  :telhpout.loop | inc %telhpout.num
  if (%telhpout.num > %telhpout.len) { return %telhpout.val }
  set %telhpout.val %telhpout.val $+ $chr($gettok($1,%telhpout.num,%telhpout.tok))
  goto telhpout.loop
}
alias telen {
  if ($1 == $null) return
  if ($len($1) == $null) return 0
  else return $len($1)
}
alias evac {
  if ($1 == $null) return
  return $chr(37) $+ $1 $+ $2
}
alias evacl {
  if ($1 == $null) return
  return % [ $+ [ $remove($1-2,$chr(32)) ] ]
}
alias evacr return $1-
alias evar {
  if ($1 == $null) return
  return % [ $+ [ $1 ] ]
}
alias evau return $remove($1-,$chr(32))
alias rtrim return $right($2-,$calc($len($2-) - $1))
alias ltrim return $left($2-,$calc($len($2-) - $1))
on 1:LOAD: {
  if (%state.telnet != 1) {
    set %state.telnet 1
    echo -a $@t 12Usage: 2/telnet [server] <port>
  }
}
on 1:INPUT:@telnet*: {
  if ($right($line($target,$line($target,0)),1) == $chr(255)) {
    if ($gettok($line($target,$line($target,0)),1,58) == Yourmomma) {
      if ($timer($rtrim(1,$target)) == 1) .timer $+ $rtrim(1,$target) off
      sockwrite -n $gettok($target,1,64) $telhpout($evacl(telnet.ps,$rtrim(1,$target)))
      set $evac(telnet.tls,$gettok($target,1,64)) $1-
      unset $evac(telnet.ps,$rtrim(1,$target))
      unset $evac(telnet.psl,$rtrim(1,$target))
      unset $evac(telnet.psn,$rtrim(1,$target))
      halt
    }
    else rline $target $line($target,0) $line($target,$line($target,0)) $+ $1-
  }
  else {
    aline $target $1-
    unset $evac(telnet.tcr,$gettok($target,1,64))
  }
  :telnet.end
  sockwrite -n $gettok($target,1,64) $1-
  set $evac(telnet.tls,$gettok($target,1,64)) $1-
  halt
}
on 1:CLOSE:@: {
  if (tel isin $target) {
    if ($timer($rtrim(1,$target)) == 1) .timer $+ $rtrim(1,$target) off
    echo -s $@t 12I closed telnet connection to2 $sock($gettok($target,1,64)).ip $+ .
    sockclose $gettok($target,1,64)
    unset $evac(telnet.*,$gettok($target,1,64))
    return
  }
}
on 1:SOCKOPEN:telnet*: {
  if ($sockerr > 0) {
    echo -a $sock.err
    echo -a $@t 12I could not connect to2 $sock($sockname).ip $+ .
    return
  }
  window -e $evau(@,$sockname) Terminal
  titlebar $evau(@,$sockname) - connected to $sock($sockname).ip $+ .
}
on 1:SOCKCLOSE:telnet*: {
  if ($timer($target) == 1) .timer $+ $target off
  window -c @ $+ $sockname
  echo -s $@t 12Connection to2 $sock($sockname).ip was disconnected.
  unset $evac(telnet.*,$sockname)
}
on 1:SOCKREAD:telnet*: {
  sockread &tel
  set %telread.len $bvar(&tel,0)
  set %telread.num 0
  set %telread.sp 0
  :telread
  inc %telread.num
  if (%telread.num > %telread.len) {
    if ($evacl(telnet.tls,$sockname) != $null) {
      if ($left($gettok($evacl(telnet.tls,$sockname),1,32),$len($gettok(%telread.str,1,32))) != $null) goto tpa
      if ($left($gettok($evacl(telnet.tls,$sockname),1,32),$len($gettok(%telread.str,1,32))) == $null) return
      :tpa
      if ($gettok(%telread.str,1,32) == $left($gettok($evacl(telnet.tls,$sockname),1,32),$len($gettok(%telread.str,1,32)))) {
        set $evac(telnet.tcn,$sockname) 1
        unset %telread.*
        return
      }
    }
    if (($mid(%telread.str,1,1) == $chr(253)) && ($mid(%telread.str,2,1) == $chr(24))) set %telread.go 1
    if (($mid(%telread.str,1,1) == $chr(255)) && ($mid(%telread.str,2,1) == $chr(251))) set %telread.go 1
    if (%telread.go) {
      unset %telread.go
      unset %telread.str
    }
    if ((%telread.str) && ($replace(%telread.str,$chr(255),$chr(32)) != $evacl(telnet.tls,$sockname))) {
      if ($gettok(%telread.str,1,58) == Yourmamma) .timer $+ $sockname -m 0 1 telhp $evau(@,$sockname)
      aline $evau(@,$sockname) %telread.str
    }
    unset %telread.*
    return
  }
  if (%telread.fst == 1) {
    if ($bvar(&tel,%telread.num) == 109) unset %telread.fst
    goto telread
  }
  if (($bvar(&tel,%telread.num) == 27) && ($bvar(&tel,$calc(%telread.num + 1)) == 91)) {
    set %telread.fst 1
    goto telread
  }
  if (($bvar(&tel,%telread.num) = 255) && ($bvar(&tel,$calc(%telread.num + 1)) == 253)) {
    telcmd $sockname 252 $bvar(&tel,$calc(%telread.num + 2))
    goto telread
  }
  if ($bvar(&tel,%telread.num) == 13) {
    goto telread
  }
  if ($bvar(&tel,%telread.num) == 9) {
    set %telread.str %telread.str $+ $str($chr(255),5)
    goto telread
  }
  if ($bvar(&tel,%telread.num) == 10) {
    if ($evacl(telnet.tcn,$sockname)) {
      unset $evac(telnet.tls,$sockname)
      unset $evac(telnet.tcn,$sockname)
      unset %telread.str
      goto telread
    }
    if (%telread.str == $null) aline $evau(@,$sockname) $chr(255)
    if (($mid(%telread.str,1,1) == $chr(253)) && ($mid(%telread.str,2,1) == $chr(24))) set %telread.go 1
    if (($mid(%telread.str,1,1) == $chr(255)) && ($mid(%telread.str,2,1) == $chr(251))) set %telread.go 1
    if (%telread.go) {
      unset %telread.go
      unset %telread.str
    }
    if ((%telread.str) && ($replace(%telread.str,$chr(255),$chr(32)) != $evacl(telnet.tls,$sockname))) {
      aline $evau(@,$sockname) %telread.str
    }
    unset %telread.al
    unset %telread.str
    goto telread
  }
  if ($bvar(&tel,%telread.num) == 32) {
    set %telread.str %telread.str $+ $chr(255)
    goto telread
  }
  set %telread.str %telread.str $+ $chr($bvar(&tel,%telread.num))
  goto telread
}

alias telnetunload {
  /timer21 1 4 /unload -rs telnet.mrc
}

alias octo /set %onctelnetto $$?="Telnet to What on Startup? (Current: %onctelnetto $+ )"
alias oct /set %onctelnet $$?="Telnet to %onctelnetto on Startup? (Current: %onctelnet $+ )"

on 1:connect:{ 
  if ( %onctelnet == Yes ) { /telnet %onctelnetto | /echo -s $@t 12Opening Telnet to2 %onctelnetto $+ 12... }
  elseif ( %onctelnet == No ) { /echo -s $@t 12Your on connect Telnet12 to2 %onctelnetto $+ 12 has been 10skipped. }
}

alias telnetc {
  //window -c @Telnet 
  //window -l +t @Telnet 0 0 600 100 Terminal 
  //titlebar @Telnet Credits...
  //aline @Telnet 1 $c1 $+ ÚÄ[ $+ $c2 2Telnet v1.6 Credits1 $+ $c1 ]ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
  //aline @Telnet 1 $c1 $+ ³ $+ $c2 15.................... $telnetad
  //aline @Telnet 1 $c1 $+ ³ $+ $c2 This addon was originally not made by me (LoVEe)    
  //aline @Telnet 1 $c1 $+ ³ $+ $c2 but I couldn't track down the original author so I released
  //aline @Telnet 1 $c1 $+ ³ $+ $c2 it with my email as the contact, so if this is yours email me.
  //aline @Telnet 1 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ15....1(2close1)
}

menu @Telnet {
  dclick:{
    //close -@Telnet
  }
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<                       ‡‡ ãÚ ÊÍíÇÊ ãÕãã ÇáÓßÑÈÊ ‡‡                           >>
<<                       ‡‡                       ‡‡                           >>
<<                       ‡‡        LoVEe          ‡‡                           >>
<<                       ‡‡       ‡‡‡‡‡‡‡         ‡‡                           >>
<<                       ‡‡                       ‡‡                           >>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ ¤ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
