Connect V 2.0

By eNkIL on Oct 31, 2018

Enjoy!!

::::::::::::::::::::::::::::
:::::: Coded By eNkIL ::::::
::::::::::::::::::::::::::::
::: Cambiale si sabes =) :::
::::::::::::::::::::::::::::

;Connection
menu menubar,channel,status { 
  Connect:conn
  -
}
alias conn {
  if ($dialog(connect) == $null) { dialog -m connect connect } 
  else { .echo -a -Dialogo de Conexion Ejecutandose.. } 
}
alias -l conn.load.net {
  if ($exists(servers) == $false) { mkdir servers | write -c servers\delete.txt DELETE }
  did -r $dname 101 | %g = 1
  while ($findfile(servers\,*.txt,%g)) {
    did -a $dname 101 $remove($nopath($findfile(servers\,*.txt,%g)),.txt)
    inc %g
  }  
  unset %g
}
alias -l conn.load.serv {
  did -r $dname 201 | %f =  servers\ $+ $did($dname,101,$did($dname,101).sel).text | %f = %f $+ .txt | %g = 2
  while ($read(%f,%g)) {
    did -a $dname 201 $gettok($read(%f,%g),1,58)
    inc %g
  }
}
alias -l conn.rand.ident {
  return $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9)
}
alias -l conn.info.serv {
  %kk = $1 $+ * 
  %l = $read(servers\ $+ $did($dname,101,$did($dname,101).sel).text $+ .txt,w,%kk)
  did -a $dname 602 $gettok(%l,2,58)
  did -a $dname 604 $gettok(%l,4,58)
  did -a $dname 505 $mid($gettok(%l,3,58),1,4)
  did -a $dname 505 $mid($gettok(%l,3,58),6,4)
  did -a $dname 505 $mid($gettok(%l,3,58),11,4)
  did -a $dname 505 $mid($gettok(%l,3,58),16,4)
  did -a $dname 505 $mid($gettok(%l,3,58),21,4)
  did -a $dname 505 $mid($gettok(%l,3,58),26,4)
  did -a $dname 505 $mid($gettok(%l,3,58),31,4)
  did -c $dname 505 1 | unset %l %kk
}
alias -l conn.add.net { 
  set %addred $$?="Network name? Ex: Undernet"
  write servers\ $+ %addred $+ .txt  < $+ %addred $+ >
  conn.load.net | conn.load.serv 
}
alias -l conn.add.serv {
  if (!$did($dname,101,$did($dname,101).sel).text) { echo -at Please select the Network you would like to add the server. | halt }
  set %addserv1 $$?="Add server from: $did($dname,101,$did($dname,101).sel).text $+ . Ex: irc.undernet.org"
  set %addserv2 $$?="Server name? Ex: Undernet"
  set %addserv3 $$?="Ports?. Ex: 6667,6668"
  set %addserv4 $$?="Server country. Ex: USA, CANADA."
  write servers\ $+ $did($dname,101,$did($dname,101).sel).text $+ .txt  %addserv2 $+ : $+ %addserv1 $+ : $+ %addserv3 $+ : $+ %addserv4 
  unset  %addserv1 %addserv2 %addserv3 %addserv4  
  conn.load.serv
}
alias -l conn.rem.net {
  if (!$did($dname,101,$did($dname,101).sel).text) { echo -at Please select the Network you would like to remove. | halt }  
  set %n $$?!="Are you sure you want to remove $did($dname,101,$did($dname,101).sel).text from the list?"
  if (%n) { .remove servers\ $+ $did($dname,101,$did($dname,101).sel).text $+ .txt | conn.load.net | conn.load.serv  }
  unset %n 
}
alias -l conn.rem.serv {
  if (!$did($dname,201,$did($dname,201).sel).text) { echo -at Please select the server you would like to remove from the list. | halt }
  set %n $$?!="Are you sure you want to remove $did($dname,201,$did($dname,201).sel).text from the list?"
  if (%n) {  
    %l = $read(servers\ $+ $did($dname,101,$did($dname,101).sel).text $+ .txt,w,$did($dname,201,$did($dname,201).sel).text $+ *)
    write -dl $+ $readn servers\ $+ $did($dname,101,$did($dname,101).sel).text $+ .txt
    conn.load.serv 
  }
  unset %n  %l
}
alias -l conn.save.con { 
  .server $did($dname,602).text $did($dname,505).text
  set %conn.auto.serv $did($dname,602).text $did($dname,505).text 
  set %conn.modes.me $did($dname,307)
  var %nick = $did($dname,301)
  var %anick = $did($dname,302)
  if (%nick && %nick != $me) .nick %nick
  elseif (!%nick) .nick Nick1
  if (%anick) .anick %anick
  else .anick Nick2
  set %conn.ident.sel $did($dname,303).state
  var %ident_a = $did($dname,305)
  var %ident_b = $did($dname,306)
  if (%conn.ident.sel) { .identd on $iif(%ident_a,$ifmatch,None) }
  else { .identd on $iif(%ident_b,$ifmatch,None) }
  set %conn.ident $iif(%ident_a,$ifmatch,None)
  echo -a ok
}

dialog connect {
  title "Conection Center"
  size -1 -1 386 126
  option dbu

  box "Network", 100, 2 2 101 122
  list 101, 4 10 97 100, size vsbar
  button "+", 102, 26 110 12 12
  button "-", 103, 66 110 12 12

  box "Servers", 200, 105 2 101 122
  list 201, 107 10 97 100, size vsbar
  button "+", 202, 129 110 12 12
  button "-", 203, 168 110 12 12

  box "", 300, 208 2 176 44
  text "Nick:", 2, 210 11 25 8, center
  edit "", 301, 236 10 48 10, autohs
  text "aNick:", 4, 210 23 25 8, center
  edit "", 302, 236 22 48 10, autohs
  radio "Ident:", 303, 290 10 38 10
  radio "Rand. Ident:", 304, 290 22 44 10
  edit "", 305, 334 10 48 10, autohs
  edit "", 306, 334 22 48 10, read autohs
  text "Modes on connection:", 10, 275 35 58 8,
  edit "", 307, 334 34 48 10, autohs

  box "", 400, 208 46 176 22
  button "Disconnect", 401, 210 53 37 12
  button "Connect", 402, 278 53 37 12
  button "Close", 403, 345 53 37 12, ok cancel

  box "", 500, 208 68 61 56
  check "Connect on Start", 501, 210 73 50 10
  check "Open on Start", 502, 210 90 50 10
  text "Ports:", 504, 209 111 16 8
  combo 505, 228 109 40 50, size drop

  box "", 600, 271 68 113 56
  text "Server:", 601, 273 81 21 8
  edit "", 602, 295 80 87 10, read center
  text "Country:", 603, 273 104 25 8
  edit "", 604, 300 103 82 10, read center
}
on *:dialog:connect:*:*: {
  if ($devent = init) {
    conn.load.net
    if ($server != $null) { did -a $dname 602 $server | did -a $dname 600 Connected }
    if (%conn.auto.start) { did -c $dname 501 }
    if (%conn.show.start) { did -c $dname 502 }
    if (%conn.ident.sel) { did -c $dname 303 } | else { did -c $dname 304 }
    did -a $dname 301 $me
    did -a $dname 302 $anick
    did -a $dname 305 %conn.ident
    did -a $dname 306 $conn.rand.ident
    did -a $dname 307 %conn.modes.me

  }
  if ($devent = sclick) {
    if ($did = 101) { did -r $dname 201 |  did -z $dname 101 | did -z $dname 201 | conn.load.serv $did($dname,101,$did($dname,101).sel).text }
    if ($did = 102) { conn.add.net }
    if ($did = 103) { conn.rem.net }
    if ($did = 201) { did -z $dname 101 |  did -z $dname 201 | did -r $dname 505 | did -r $dname 602 | did -r $dname 604 | conn.info.serv $did($dname,201,$did($dname,201).sel).text }  
    if ($did = 202) { conn.add.serv }
    if ($did = 203) { conn.rem.serv }
    if ($did = 304) {  did -r $dname 306 | did -a $dname 306 $conn.rand.ident }
    if ($did = 401) { disconnect }
    if ($did = 402) { conn.save.con }
    if ($did = 501) { set %conn.auto.start $did($dname,501).state }
    if ($did = 502) { set %conn.show.start $did($dname,502).state }
  }
  if ($devent = dclick) {
    if ($did = 201) { conn.save.con }
  }
}
on *:start: { 
  if (%conn.show.start) { conn }
  if (%conn.auto.start) {
    .server %conn.auto.serv
  }
}
on *:connect:{ 
  if $dialog(connect) { did -ra connect 602 $server | did -a connect 600 Connected }
  .mode $me %conn.modes.me
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.