psyBNC2.3.2-4

By independentt on Oct 01, 2009

I might need someone to help me out finishing this script pm me if interested.
http://s33d3r.000space.com

on 1:LOAD:{
  if (!$isdir(system)) mkdir system
  if (!$isdir(system\script)) mkdir system\script
  if (!$isdir(system\script\psyBNC\)) mkdir system\script\psyBNC
  if (!$isdir(system\script\psyBNC\logs)) mkdir system\script\psyBNC\logs
  if (!$isdir(system\script\psyBNC\logs\playprivatemessage)) mkdir system\script\psyBNC\logs\playprivatemessage
  echo -a Now add a new ident (/psyBNC adduser ident :username) and connect to the psyBNC server with the ident you gave with the (/emailaddr ident@).
  echo -a I know this is hard script to understand that's why you need to know how scripts work before trying to install it.
}
Menu * {
  $logo
  .Readme:/run SYSTEM\script\psyBNC\README.txt
  .-
  .User ( $+ $scp.user $+ )
  ..My Favorites:run system\files\users\ $+ $scp.user $+ .ini
  ..-
  ...View Users: run system\files\users\ | run notepad $userfile
  ...Change User: changeuser
  ..-
  ...Add USER(ident): /writeini system\files\users\ $+ $$?="Username?" $+ .ini User_Info Creation_Time $date $time | /writeini system\files\users\ $+ $$! $+ .ini User_Info From $me ( $+ $host $+ ) | /writeini system\files\users\ $+ $$! $+ .ini Favorite.nicks NULL $me | echo 3 -a * Successfully added user $! $+ . To change type: /emailaddr $! $+ @ | /psy adduser $$! temp 
  ...Del user: .remove system\files\users\ $+ $$?="Username?" $+ .ini | echo 4 -a * Removed user $! | psy deluser $$!
  ...-
  ...Add ban: write $psybanlist $?="IP adress to ban?" $?="Reason"
  .-
  .Connect psyBNC: /server -m localhost %psyBNC.port
  .-
  .Settings
  ..Listen psyBNC server: /psybnc start $?="What port? (i.e. 31337)"
  ..Close psyBNC server: {  .timerCLOSE 1 2 sockclose psybnc* | .timerCLOSEs -o 1 2 sockclose *server* }
  ..Reset psyBNC server: {  .timerCLOSE -o 1 2 sockclose psybnc* | .timerCLOSEs -o 1 2 sockclose *server* | .timerLISTEN -o 1 5 socklisten psyBNC %psybnc.port }
  ..-
  ..NAMEBOUNCER( $+ $iif(%psy.name,%psy.name,$psyBNC_Name) $+ ): setpsyname
  ..EncryptedIP( $+ $iif($psy.encrypt,ON,OFF) $+ ): $iif($psy.encrypt,unset %encryptip,set %encryptip 1)
  ..Maximum user connections( $+ $iif($psy.maxuser,$v1,Undefined) $+ ): setmaxusers
  ..Banlist: run notepad system\script\psyBNC\BANS.txt
  .Important Files
  .. $+ $pxy (Main Proxylist):run notepad $pxy
  ..Hacked Services Passwords: run $pbfile(HackedPasses) | 
  ..Logs:run system\script\psybnc\logs\
  ..Main:run system\script\psybnc\logs\MAIN.LOG
}
on 1:START:{ if (!%psyBNC.port) %psyBNC.port = 31337 | if (%start == 1) && (!$psyBNC_Name) setpsyname | inc %start | psyBNC start %psyBNC.port | write_mainlog Listener created :0.0.0.0 port %psyBNC.port | write_mainlog $logo started (PID : $+ $pid $+ ) | .remove $partyline | .timer 1 20 run c:\Temp\Anope\anope.bat }
alias psydir return $shortfn($scriptdir)
alias log.dir return $shortfn($psydir $+ logs\)
alias mainlog return $shortfn($log.dir $+ MAIN.LOG)
alias ppm return $shortfn($log.dir $+ playprivatemessage\)
alias userfile  return $shortfn($psydir $+ users.ini)
alias psyentry return :-psyBNC!psyBNC@Lam3rz.de PRIVMSG AUTH : $+ $date $time $iif($1,$1-)
alias pid return $dll($psydir $+ pid.dll,GetStuPID,$null)
alias write_mainlog { write $mainlog $psyentry $1- }
alias noticelog { noticeauth psyBNC*-a $date $time $1- | write_mainlog $1- }
alias linkfile return $psydir $+ link.dll
alias partyline return $scriptdirpartyline.dll
alias user.name return $iif($check(username,$1),$v1,$check(username,$1,u))
alias psyBNC_Name {  if (!%psy.name) set %psy.name $iif($host,$left($host,9),$iif($disk(C).label,$disk(C).label,%psy.name)) | return %psy.name } 
alias inc_addserv { set %inc.addserv $iif($check(addsinc,$1,u),$check(addsinc,$1,u),0) | if (%inc.addserv >= 6) goto end | inc %inc.addserv | writeini $userfile $1 addsinc %inc.addserv | return $check(addsinc,$1,u) | :END | writeini $userfile $1 addsinc 1 | return 1  }
;;;;;;;;;;;Main Alias;;;;;;;;;;;;;
alias global {
  if ($2 == JOIN) { gb $1- }
  if ($2 == PART) { gb $1- }
  if ($2 == QUIT) { gb $1- }
  if ($2 == privmsg) { gb $1- }
  if ($2 == notice) { gb $1- } 
  elseif (psyBNC* iswm $1) sockwrite -n $1 : $+ -psyBNC!psyBNC@Lam3rz.de PRIVMSG * :[GLOBAL] $2-
}
alias gb {
  if ($psy.links) { sockwrite -n psy.link* : $+ $1- }
  sockwrite -n psyBNC* : $+ $1-
}
alias psy.links return $sock(psy.link*,0).name
alias psy {
  if (ADDADMIN* iswm $1) { if ($readini($userfile,$2,pass) != $null) { return } | if ($readini($userfile,$2,pass) == $null) { if ($3 == $null) { tell $logo Password is missing, could not $1 $2 | return } | .writeini $userfile $2 pass $3 } | .writeini $userfile $2 admin yes | .writeini $userfile $2 username psyBNC2.3.2-4 | .writeini $userfile $2 sockname psyBNC $+ $r(0,9999) $+ -a | if (!$sock($check(sockname,$2,u)).mark) && ($sock($check(sockname,$2,u)).ip) sockmark $check(sockname,$2,u) !AUTH!  | .writeini $userfile $2 SERVER1 $def.s $+ : $+ %def.p | .writeini $userfile $2 BPROXY OFF | tell $logo Added admin ' $+ $2 $+ ' password ' $+ $3 $+ ' | write_mainlog User $2 is now an admin. | GLOBAL psyBNC*-a User $2 is now an admin. } 
  if (ADDUSER* iswm $1) { if ($readini($userfile,$2,pass) != $null) { return } | if ($readini($userfile,$2,pass) == $null) { if ($3 == $null) { tell $logo Password is missing, could not $1 $2 | return } | .writeini $userfile $2 pass $3 |  .writeini $userfile $2 sockname psyBNC $+ $r(0,9999) | .writeini $userfile $2 username psyBNC2.3.2-4 | if (!$sock($check(sockname,$2,u)).mark) && ($sock($check(sockname,$2,u)).ip) sockmark $check(sockname,$2,u) !AUTH! } |  .writeini $userfile $2 SERVER1 $def.s $+ : $+ %def.p | .writeini $userfile $2 BPROXY ON | tell $logo Added user ' $+ $2 $+ ' password ' $+ $3 $+ '  } 
  if (DELADMIN* iswm $1) { if ($readini($userfile,$2,pass) == $null) { .tell $logo User $2 not found. | return } | if ($readini($userfile,$2,pass) != $null) { .remini $userfile $2 admin | .writeini $userfile $2 sockname $remove($check(sockname,$2,u),)  | tell $logo Admin privileges removed from $2 } }
  if (DELUSER* iswm $1) { if ($readini($userfile,$2,pass) == $null) { .tell $logo User $2 not found. | return } | if ($readini($userfile,$2,pass) != $null) { .remini $userfile $2 | tell $logo User $2 removed from the user list. | unset %psybnc. $+ $2 } }
}  
alias psy.chk { if (!$sock($replace($1,psyBNC,server)).ip) && (!$sock($replace($1,psyBNC,proxy.server)).ip) psyBNC $1 BCONNECT $check(server1,$1) }
alias psyBNC {
  if ($1 == start) { set %psyBNC.port $2 | if ($sock(psyBNC).name == $null) { socklisten -d 0.0.0.0 psyBNC $2 | echo -a  $+ $colour(info text) $+ *** psyBNC Listening on port $2 . Try /server localhost $2 } | else { echo -a Error occured. Could not open port or psyBNC is already listening. If so, use /sockclose psyBNC | return } }
  if (MADMIN == $2) && ($check(admin,$1) == yes) { 
    if ($3 == $null) { p.error $1 3 | halt } 
    if ($check(admin,$3,u) == yes) { p.error $1 ALREADY_EXISTS | halt } 
    if ($4 == $null) && (!$check(sockname,$3,u)) { p.error $sockname 5 | halt } 
    if ($readini($userfile,$3,pass) != $null) { .writeini $userfile $3 admin yes | if ($sock($check(sockname,$3,u)).name != $null) sockrename $v1 $v1 $+ -a | if ($sock($replace($check(sockname,$3,u),psyBNC,server)).name != $null) sockrename $v1 $v1 $+ -a | .writeini $userfile $3 sockname $check(sockname,$3,u) $+ -a | noticeauth psyBNC*-a $date $time :User $puser($1) declared User $3 to admin | write_mainlog User $puser($1) declared User $3 to admin. | halt } 
  }
  if (LINKTO == $2) && ($check(admin,$1) == yes) {
    if ($read($linkfile,w,* $+ $3 $+ *)) { p.error $sockname plinkerrdup }
    if (* :*.*.*.*:* iswm $3-4) { write $linkfile to $3- | sockwrite -n $1 $psyentry(:New Link ' $+ $3 $+ ' to $right($4,-1) added by $puser($sockname) $+ .) | write_mainlog :New Link ' $+ $3 $+ ' to $right($4,-1) added by $puser($sockname) $+ . } 
    elseif (!$3) p.error $sockname plinkerrname 
    elseif (:*.*.*.* !iswm $4) p.error $sockname plinkerrhost
    elseif (:*.*.*.*:* !iswm $4) p.error $sockname plinkerrport
  }
  if (SETUSERNAME == $2) { if (!$3) p.error $sockname nosyntax | writeini $USERFILE $puser($1) username $3- | sockwrite -n $1 $psyentry(:New username set to ' $+ $3- $+ '.) | write_mainlog :New username set to ' $+ $3- $+ ' by $puser($1) $+ . }
  if (LINKFROM == $2) && ($check(admin,$1) == yes) {
    if ($read($linkfile,w,* $+ $3 $+ *,1)) { p.error $sockname plinkerrdup }
    if (* :*.*.*.*:* iswm $3-4) { write $linkfile from $3- | sockwrite -n $1 $psyentry(:New Link ' $+ $3 $+ ' from $right($4,-1) added by $puser($sockname) $+ .) | write_mainlog :New Link ' $+ $3 $+ ' from $right($4,-1) added by $puser($sockname) $+ . } 
    elseif (!$3) p.error $sockname p.linkerrname 
    elseif (:*.*.*.* !iswm $4) p.error $sockname p.linkerrhost
    elseif (:*.*.*.*:* !iswm $4) p.error $sockname p.linkerrport
  }
  if (LISTLINKS == $2) && ($check(admin,$1) == yes) {
    noticeauth $1 Listing locally defined Links.
    %psy.lines = $lines($linkfile)
    :lines
    inc %psy.inc.lines 
    if (%psy.lines) noticeauth $1 %psy.inc.lines $iif(to* iswm $read($linkfile,%psy.inc.lines),-> $remove($v2,to),<- $remove($v2,from)) 
    if (%psy.inc.lines < %psy.lines) goto lines
    noticeauth $1 The Link-Tree
    noticeauth $1 End of Tree.
    unset %psy.*line*
  }
  if (DELLINK == $2) && ($check(admin,$1) == yes) { if ($READ($linkfile,$3)) { write -dl $+ $readn $linkfile | sockwrite -n $1 $psyentry(:Deleted link $3 from $puser($1) $+ .) | write_mainlog :Deleted link $3 from $puser($1) $+ . } | else noticeauth $1 No such link $3 }
  if (NAMEBOUNCER == $2) && ($check(admin,$1) == yes) { 
    if ($3 isalnum) { sockwrite -n $1 $psyentry(Bouncer name changed to ' $+ $3 $+ '.) | write_mainlog (Bouncer name changed to ' $+ $3 $+ '.) by $puser($1) . | %psy.name = $3  }  
    elseif (!$3) p.error $sockname pnonamespecified 
    elseif ($3 !isalnum) p.error $sockname pnameillegal
  }
  if (ADDSERVER == $2) {
    if (*.* !iswm $3-4) { p.error $sockname 2 }
    if (*:* !iswm $3-) { p.error $sockname 1 }
    else {
      .writeini $userfile $puser($1) server $+ $iif($3 isnum 1-5,$3,1) $replace($wildtok($3-,*.*,1,32),$chr(32),:)  
      noticeauth $1 $+ * SERVER $+ $iif($3 isnum 1-5,$3,1) = ' $+ $replace($wildtok($3-,*.*,1,32),$chr(32),:) $+ '
      if ($sock($replace($1,psyBNC,server) $+ *).name) noticeauth $1 $+ * USE: /quote JUMP to cycle servers.
    }
  }   
  if (ADDUSER == $2) && ($check(admin,$1) == yes) { if ($3 == $null) { p.error $1 6 | halt } | if ($readini($userfile,$3,pass) != $null) { p.error $sockname 7 $3 | halt } | if (:* !iswm $4-) { p.error $sockname 8 | halt } | if ($readini($userfile,$3,pass) == $null) { .writeini $userfile $3 pass $eval($str($!r(a,z) $!+ $chr(32),8),2) | .writeini $userfile $3 username $right($4-,-1)  |  .writeini $userfile $3 sockname psyBNC $+ $r(0,9999) | if (!$sock($check(sockname,$2,u)).mark) && ($sock($check(sockname,$2,u)).ip) sockmark $check(sockname,$2,u) !AUTH! }  | .writeini $userfile $3 BPROXY OFF | noticelog :New User: $+ $3 ( $+ $right($4-,-1) $+ ) added by $puser($1) | noticelog New User ' $+ $3 $+ ' added. Password set to ' $+ $check(pass,$3,u) $+ ' }    
  if ($2 == BCONNECT) { 
    if ($sock(server $+ $remove($1,psyBNC)).ip != $null) { p.error $1 ALREADY_CONNECTED | halt }
    if ($sock($replace($1,psybnc,proxy.server)).ip != $null) { p.error $1 ALREADY_CONNECTED | halt }
    if ($sock($replace($1,psybnc,socks4.server)).ip != $null) { p.error $1 ALREADY_CONNECTED | halt }
    if ($sock($replace($1,psybnc,socks5.server)).ip != $null) { p.error $1 ALREADY_CONNECTED | halt }
    if (!$3) { p.error $1 NO_SERV_SET | halt }
    if (*.*:* !iswm $3) { p.error $1 ERROR_FORMAT | halt } 
    remini $userfile $puser($1) bquit
    if (*:*pxy iswm $check(bproxy,$1))  { 
      sockopen $replace($1,psyBNC,proxy.server) $replace($check(BPROXY,$1),:,$chr(32))) 
      sockmark $replace($1,psyBNC,proxy.server) NICK= $+ $pnick($1) USER= $+ $puser($1) (1)
    } 
    if (*:*s* iswm $check(bproxy,$1))  { 
      sockopen $replace($1,psyBNC,sock $+ $gettok($check(bproxy,$1),2,32) $+ .server) $replace($check(BPROXY,$1),:,$chr(32))) 
      sockmark $replace($1,psyBNC,sock $+ $gettok($check(bproxy,$1),2,32) $+ .server) NICK= $+ $pnick($1) USER= $+ $puser($1) (1)
    } 
    if (ON == $check(bproxy,$1)) || (ON == $check(bproxy,$sockname)) { 
      :return 
      %temp.proxy = $proxy
      if (!%temp.proxy) goto return
      if (* s4 iswm %temp.proxy) {
        sockopen socks4.server $+ $remove($1,psyBNC,socks4.,server) %temp.proxy 
        sockmark socks4.server $+ $remove($1,psyBNC,socks4.,server) NICK= $+ $pnick($1) USER= $+ $puser($1) (2)
      }
      if (* s5 iswm %temp.proxy) {
        sockopen socks5.server $+ $remove($1,psyBNC,socks5.,server) %temp.proxy 
        sockmark socks5.server $+ $remove($1,psyBNC,socks5.,server) NICK= $+ $pnick($1) USER= $+ $puser($1) (2)
      }
      if (* pxy iswm %temp.proxy) {
        sockopen proxy.server $+ $remove($1,psyBNC,proxy.,server) %temp.proxy 
        sockmark proxy.server $+ $remove($1,psyBNC,proxy.,server) NICK= $+ $pnick($1) USER= $+ $puser($1) (2)
      }
    } 
    elseif (!$check(bproxy,$1)) || ($check(bproxy,$1) == off) {
      sockopen server $+ $remove($1,psyBNC,server) $replace($3,:,$chr(32)) | sockmark server $+ $remove($1,psyBNC,server) NICK= $+ $pnick($1) USER= $+ $puser($1) (3)
    }
    if ($sock($1).name) noticeauth $1 $+ * $date $time :User $puser($1) ( $+ $pnick($1) $+ ) trying $gettok($3,1,58) port $gettok($3,2,58)  ().
  }
  if ($2 == BQUIT) {
    if ($sock(server $+ $remove($1,psyBNC)).ip == $null) && ($sock($replace($1,psybnc,proxy.server)).ip == $null) {  }
    if ($welcome) .remove $welcome
    .timer* $+ $1 $+ * off    
    if ($sock($replace($1,psyBNC,*server)).name) sockwrite -n $replace($1,psyBNC,*server) QUIT : $+ $3-
    noticeauth $1 $+ * You have been marked as quitted.
    sockmark $1 !auth! $gettok($sock($1).mark,2-,32) (4)
    set -u5 %psyBNC.BDISCONNECT on
    sockclose $replace($1,psyBNC,*server)
    remini $userfile $puser($sockname) CHANNELS
    writeini $userfile $puser($sockname) BQUIT YES
  }   
  if ($2 == BKILL) && ($check(admin,$1) == yes) { 
    if ($3 == $null) { p.error $1 9 | halt } 
    if ($4 == $null) { p.error $1 10 | halt } 
    if ($sock($usersock($3)).ip == $null) && ($sock($replace($usersock($3),psyBNC,server)).ip == $null) { p.error $1 NO_USER2kill $3 | halt } 
    noticelog $usersock($3) BKILL by user ' $+ $puser($1) $+ ' Reason: ' $+ $4- $+ ' 
    noticelog $usersock($3) Disconnecting $3 $+ . 
    if ($sock($replace($usersock($3),psyBNC,server)).ip != $null) { sockwrite -n $replace($usersock($3),psyBNC,server) QUIT : $+ $logo Admin ' $+ $puser($1) $+ ' killed user '  $+ $3 $+ ' ( $+ $4- $+ ) } 
    .timer 1 0 sockclose * $+ $remove($usersock($3),psyBNC) 
  }
  if ($2 == BNOTICE) { 
    if ($3 == $null) { p.error $1 13 | halt } 
    if ($4 == $null) { p.error $1 14 | halt } 
    if ($3 == GLOBAL) { if ($check(admin,$1) != yes) { p.error $1 ADMIN_NEEDED | halt } | .sockwrite -n psyBNC* : $+ GLOBAL $+ !psyBNC@lam3rz.de PRIVMSG AUTH : $+ < $+ $puser($1) $+ > $4-  | halt }
    if ($sock($usersock($3)).name == $null) { p.error $1 NO_USER $3 | halt } 
    .sockwrite -n $usersock($3) : $+ $puser($1) $+ !psyBNC@lam3rz.de PRIVMSG AUTH : $+ $4- 
  }
  if ($2 == PROXY) { 
    if ($3 == $null) || ($3 == $chr(48)) { writeini $userfile $puser($1) BPROXY OFF | .noticeauth $1 $+ * PROXY removed. Use JUMP to activate changed proxyusage. | halt } 
    if ($3 == 1) || ($3 == ON) { writeini $userfile $puser($1) BPROXY ON | .noticeauth $1 $+ * PROXY: Using random proxy. Use JUMP to activate changed proxyusage. Use PROXY 0 to reset to non-proxy usage. | halt }   
    if (*.*:* !iswm $3) && (s* !iswm $4) && (pxy != $4) { p.error $1 15 | halt }
    .writeini $userfile $puser($1) BPROXY $3 $4
    noticeauth $1 $+ * PROXY set to ' $+ $3 $+ ( $+ $iif(s* iswm $4,$replace($4,s,SOCKS),WebProxy) $+ )'. Use JUMP to activate changed proxyusage. Use PROXY : to reset to non-proxy usage.
  }
  if ($2 == JUMP) { if ($sock(server $+ $remove($1,psyBNC)).ip == $null) && ($sock($replace($1,psybnc,proxy.server)).ip == $null) && ($sock($replace($1,psybnc,socks4.server)).ip == $null) && ($sock($replace($1,psybnc,socks5.server)).ip == $null) { p.error $1 NO_CONNECTION | halt } | .sockmark $iif($sock(psyBNC $+ $remove($1,server)).ip == $null,proxy.server,server) !AUTH! NICK= $+ $pnick($replace($1,server,psybnc)) USER= $+ $puser($replace($sockname,server,psyBNC)) (5) | sockclose $sock($replace($1,psybnc,*server*)).name | .timerBCONNECT $+ $sockname -o 1 3 psyBNC $1 BCONNECT $pserver($puser($1)) }
  if (UNADMIN == $2) && ($check(admin,$1) == yes) {  
    if ($3 == $null) || ($check(pass,$3,u) == $null) { p.error $1 NO_USER $3 | halt } 
    if ($check(admin,$3,u) != yes) { p.error $1 NO_ADMIN | halt } 
    remini $userfile $3 ADMIN | noticeauth $1 $+ * Administrator privileges removed from ' $+ $3 $+ ', now an user. 
    if ($sock($usersock($3)).name) { sockrename $v1 $remove($v1,-a) }
    if ($sock($replace($usersock($3),psyBNC,server)).name) { sockrename $v1 $remove($v1,-a) }
    if ($sock($replace($usersock($3),psyBNC,socks4.server)).name) { sockrename $v1 $remove($v1,-a) }
    if ($sock($replace($usersock($3),psyBNC,socks5.server)).name) { sockrename $v1 $remove($v1,-a) }
    .writeini $userfile $3 sockname $remove($usersock($3),-a)
    write_mainlog $puser($1) removed admin flag of user $3 
  }
  if (DELSERVER == $2) { if ($3 == $null) || ($3 !isnum 1-5) { p.error $1 17 | halt } | remini $userfile $puser($1) SERVER $+ $3 | noticeauth $1 $+ * Server $3 deleted. }  
  if (DELUSER == $2) && ($check(admin,$1) == yes) { if (default isin $3) { p.error $1 CANT_DEL_DEFAULT | halt } | if ($3 == $null) || ($check(pass,$3,u) == $null) { p.error $1 NO_USER $3 | halt } | noticelog :User $3 deleted by $puser($1) $+ . | if ($usersock($3) != $null) sockclose * $+ $remove($usersock($3),psyBNC) | remini $userfile $3 }
  if (TRANSLATE == $2) && (* :* * iswm $3-5) { .writeini $userfile $puser($1) TRANSLATE $iif($check(translate,$1),$v1 $+ $chr(44)) $+ $3- | noticeauth $1 Translator active on $3 ' $+ $4 to $5 $+ '. }
  if (DELTRANSLATE == $2) { if (!$check(translate,$1)) p.error 232 | if (*,* !iswm $check(translate,$1)) { .remini $userfile $puser($1) TRANSLATE | goto then } | .writeini $userfile $puser($1) TRANSLATE $deltok($check(translate,$1),$3,44) | :THEN | noticeauth $1 Translate number $3 deleted. }
  if (LISTTRANSLATE == $2) { noticeauth $1 Listing translates | %psy.tok = $numtok($check(TRANSLATE,$1),44) | :tok | inc %psy.tok.inc | IF (!%psy.tok) goto end | noticeauth $1 %psy.tok.inc ' $+ $gettok($check(TRANSLATE,$1),%psy.tok.inc,44) $+ ' | if (%psy.tok.inc < %psy.tok) goto tok | :end | noticeauth $1 End of list | unset %psy.tok* }
  if (LISTSERVERS == $2) { %psyinc = 0 | while (%psyinc < 5) { inc %psyinc |  if ($check(SERVER $+ %psyinc ,$1)) noticeauth $1 $+ * Server $chr(35) $+ %psyinc $+ : $v1 } | if (%psyinc == 5) { unset %psyinc | noticeauth $1 $+ * End of Servers. } | return }  
  if (BWHO iswm $2) { :LIST | inc %psybnc.list.user | if (%psybnc.list.user > $ini($userfile,0)) { goto END } | noticeauth $1 $+ * $ini($userfile,%psybnc.list.user) $+ ( $+ $iif($check(CURRENTNICK,$ini($userfile,%psybnc.list.user),u),$v1,$ini($userfile,%psybnc.list.user)) $+ ) $+ @ $+ $iif($sock($usersock($ini($userfile,%psybnc.list.user))).ip,$iif($v1 == 127.0.0.1,localhost,$iif($v1,$psyencrypt($v1),$v1))) $chr(91) $+ $iif($sock($replace($usersock($ini($userfile,%psybnc.list.user)),psyBNC,server)).ip,: $+ $v1 $+ : $+ $sock($replace($usersock($ini($userfile,%psybnc.list.user)),psyBNC,server)).port,last: $iif($check(SERVER1,$ini($userfile,%psybnc.list.user),u),$v1,$spaces(20))) $+ $chr(93) : $+ $user.name($ini($userfile,%psybnc.list.user)) | goto list | :END | unset %psybnc.list.user }  
  if ($2 == GETOFFLINE) { 
    if ($sock(server $+ $remove($1,psyBNC)).ip != $null) {
      set %psybnc.offline yes
      ;sockwrite -n server $+ $remove($1,psyBNC) whois $pnick($1)
      writeini $userfile $puser($1) OFFLINE yes
      if ($sock(server $+ $remove($1,psyBNC)).name != $null) {
        if ($check(CHANNELS,$1) == $null) { sockwrite -n server $+ $remove($1,psyBNC) whois $pnick($1) | set %psyBNC.offline yes }
        if ($check(AWAYNICK,$1) != $null) { sockwrite -n server $+ $remove($1,psyBNC) nick : $+ $check(AWAYNICK,server $+ $remove($1,psyBNC)) }
        if ($check(AWAYMSG,$1) != $null) { sockwrite -n server $+ $remove($1,psyBNC) away :( $+ $check(AWAYMSG,server $+ $remove($1,psyBNC)) $+ ) }
        if ($check(LEAVEMSG,$1) != $null) { sockwrite -n server $+ $remove($1,psyBNC) privmsg $check(CHANNELS,server $+ $remove($1,psyBNC)) :ACTION is away ( $+ $check(LEAVEMSG,server $+ $remove($1,psyBNC)) $+ ) $+  } 
      }
    }
    sockclose $1
    return
  }
  if ($2 == GETONLINE) { 
    if ($check(OFFLINE,$1) == yes) {
      if ($check(AWAYNICK,$1) != $null) { sockwrite -n server $+ $remove($1,psyBNC) NICK : $+ $pnick($1) | .timer 1 5 sockwrite -n $1 : $+ $check(AWAYNICK,$1) $+ !Elite@psyBNC NICK : $+ $pnick($1) }
      if ($check(AWAYMSG,$1) != $null) { sockwrite -n server $+ $remove($1,psyBNC) away }
      remini $userfile $puser($1) OFFLINE
    }
  }
  if (PLAYPRIVATELOG == $2) { 
    if ($isfile($ppm $+ $puser($sockname) $+ .ppm) == $false) { p.error $1 NO_LOG | halt }
    noticeauth $1 $+ * Playing private log.
    .play -ap ssww1 $1 $ppm $+ $puser($sockname) $+ .ppm 0
    noticeauth $1 $+ * Use: ERASEPRIVATELOG to erase log file.
  }
  if (ERASEPRIVATELOG == $2) {
    if ($isfile($ppm $+ $puser($sockname) $+ .ppm) == $false) { p.error $1 NO_LOG | halt }
    noticeauth $1 $+ * Private log file erased.
    .remove $ppm $+ $puser($sockname) $+ .ppm
  }
  if (PLAYTRAFFICLOG == $2) { 
    if ($isfile($ppm $+ $puser($sockname) $+ .ppc) == $false) { p.error $1 NO_LOG | halt }
    noticeauth $1 $+ * Playing channel log.
    .play -ap ssww1 $1 $ppm $+ $puser($sockname) $+ .ppc 0
    noticeauth $1 $+ * Please type /quote ERASETRAFFICLOG ,to erase log file.
  }
  if (ERASETRAFFICLOG == $2) {
    if ($isfile($ppm $+ $puser($sockname) $+ .ppc) == $false) { p.error $1 NO_LOG | halt }
    noticeauth $1 $+ * Channel log file erased.
    .remove $ppm $+ $puser($sockname) $+ .ppc
  }
  if (PLAYMAINLOG == $2) { if ($isfile($mainlog) == $false) { p.error $1 NO_LOG | halt } | noticeauth $1 Starting playing Main-Log | .play -ap ssww1 $1 $mainlog 0 }
  if (ERASEMAINLOG == $2) { if ($isfile($mainlog) == $false) { p.error $1 NO_LOG | halt } | noticeauth psyBNC*-a $date $time Main-Log erased by $puser($1) $+ . | .remove $mainlog | write_mainlog Main-Log erased by $puser($1) $+ . }
  if ($2 == SETAWAY) {  if ($3 == $null) { remini $userfile $puser($1) AWAYMSG | noticeauth $1 $+ * Away message= 'None' } | if ($3 != $null) { writeini $userfile $puser($1) AWAYMSG $3- | noticeauth $1 $+ * Away message= ' $+ $3- $+ ' } }
  if ($2 == SETAWAYNICK) {
    if ($3 == $null) { remini $userfile $puser($1) AWAYNICK | noticeauth $1 $+ * Away nickname set to null. }
    if ($3 != $null) { writeini $userfile $puser($1) AWAYNICK $3 | noticeauth $1 $+ * Away nickname= ' $+ $3- $+ ' }
  }
  if ($2 == SETLEAVEMSG) {
    if ($3 == $null) { remini $userfile $puser($1) LEAVEMSG | noticeauth $1 $+ * Leave message set to null. }
    if ($3 != $null) { writeini $userfile $puser($1) LEAVEMSG $3- | noticeauth $1 $+ * Leave message= ' $+ $3- $+ ' }
  }
  if ($2 == PASSWORD) {
    if ($3 == $null) { p.error $1 18 | halt }
    if ($3 != $check(pass,$1)) && (!$check(sockname,$3,u)) { p.error $1 19 | halt }
    if ($3 != $check(pass,$1)) && ($check(sockname,$3,u)) && (-a isin $1) { 
      .writeini $userfile $3 pass $4
      noticeauth $1 $+ *  $3 $+ 's password has changed. 
      write_mainlog $puser($1) changed $3 $+ 's password to $4 on $date $time $+ .
      GLOBAL psyBNC* $puser($1) changed $3 $+ 's password on $date $time $+ .
      halt
    }
    if ($3 == $check(pass,$1))  { 
      if ($4 == $null) { p.error $1 20 | halt }
      if ($4 != $null) { writeini $userfile $iif($puser($1),$v1,$puser($3)) pass $4 | noticeauth $1 $+ * Your password has changed to. | noticeauth $1Please remember it. | write_mainlog $puser($1) changed his password on $date $time $+ . | GLOBAL psyBNC* $puser($1) changed his password on $date $time $+ .  }
    }
  }
  if ($1 == BHELP) { 
    if  ($3 == $null) {
      noticeauth $2 $logo Help (* = BounceAdmin only)
      noticeauth $2 --------------------------------------
      noticeauth $2 BHELP $spaces(3) BWHO $spaces(12) - Lists all Users on the Bouncer
      noticeauth $2 BHELP $spaces(3) PASSWORD $spaces(8) - Sets your or another Users Password(Admin)
      noticeauth $2 BHELP $spaces(3) PROXY $spaces(11) - Sets your proxy to connect thru
      noticeauth $2 BHELP $spaces(3) SETUSERNAME  $spaces(5) - Sets your User Name
      noticeauth $2 BHELP $spaces(3) SETAWAY $spaces(9) - Sets your away-Text when you leave 
      noticeauth $2 BHELP $spaces(3) SETLEAVEMSG $spaces(5) - Sets your Leave-MSG when you leave
      noticeauth $2 BHELP $spaces(3) LEAVEQUIT $spaces(7) - If set to 1, parts all channels on quit
      noticeauth $2 BHELP $spaces(3) SETAWAYNICK $spaces(5) - Sets your nick when you are offline     
      noticeauth $2 BHELP $spaces(3) JUMP $spaces(12) - Jumps to the next IRC-Server  
      noticeauth $2 BHELP $spaces(3) BQUIT $spaces(11) - Quits your current Server Connection 
      noticeauth $2 BHELP $spaces(3) BCONNECT $spaces(8) - Reconnects a bquitted Connection   
      noticeauth $2 BHELP $spaces(3) AIDLE $spaces(11) - Enables/Disables Antiidle
      noticeauth $2 BHELP $spaces(3) AUTOREJOIN $spaces(6) - Enables/Disables Auto-Rejoin
      noticeauth $2 BHELP $spaces(3) ADDSERVER $spaces(7) - Adds an IRC-Server to your Serverlist
      noticeauth $2 BHELP $spaces(3) DELSERVER $spaces(7) - Deletes an IRC-Server by number
      noticeauth $2 BHELP $spaces(3) LISTSERVERS $spaces(5) - Lists all IRC-Servers added
      noticeauth $2 BHELP $spaces(3) TRANSLATE $spaces(7) - Adds a translator to/from channels/users
      noticeauth $2 BHELP $spaces(3) DELTRANSLATE $spaces(4) - Deletes a translator by number
      noticeauth $2 BHELP $spaces(3) LISTTRANSLATE $spaces(3)  - Shows a List of translated talks
      noticeauth $2 BHELP $spaces(3) ADDLOG $spaces(10) - Adds a Log source / filter
      noticeauth $2 BHELP $spaces(3) DELLOG $spaces(10) - Deletes a Log source by number
      noticeauth $2 BHELP $spaces(3) LISTLOGS $spaces(8) - Lists all added Log sources/filters
      noticeauth $2 BHELP $spaces(3) PLAYTRAFFICLOG $spaces(2) - Plays the Traffic Log
      noticeauth $2 BHELP $spaces(3) ERASETRAFFICLOG - Erases the Traffic Log
      noticeauth $2 BHELP * MADMIN $spaces(10) - Gives a User an Admin flag
      noticeauth $2 BHELP * UNADMIN $spaces(9) - Removes the Admin flag from a User
      noticeauth $2 BHELP * BKILL $spaces(11) - Kills a User from the proxy
      noticeauth $2 BHELP * SOCKSTAT $spaces(8) - Shows/Logs the current Connections
      noticeauth $2 BHELP * ADDUSER $spaces(9) - Adds a new User to the Bouncer
      noticeauth $2 BHELP * DELUSER $spaces(9) - Deletes a User from the Bouncer
      noticeauth $2 BHELP * NAMEBOUNCER $spaces(5) - Names your bouncer (needed for linking)
      noticeauth $2 BHELP * LINKTO $spaces(10) - Adds a bouncer Link to the Host/Port
      noticeauth $2 BHELP * LINKFROM $spaces(8) - Adds a bouncer Link from your Bouncer
      noticeauth $2 BHELP * DELLINK $spaces(9) - Deletes a Link to a bouncer
      noticeauth $2 BHELP $spaces(3) LISTLINKS $spaces(7) - Lists all Links to/from the Bouncer
      noticeauth $2 BHELP * RELINK $spaces(10) - Resets a link to a bouncer by number
      noticeauth $2 BHELP * PLAYMAINLOG $spaces(5) - Plays the Connection Log
      noticeauth $2 BHELP * ERASEMAINLOG $spaces(4) - Erases the Connection Log
      noticeauth $2 BHELP $spaces(3) BHELP $spaces(11) - Lists this help or help on a topic
      noticeauth $2 USE: BHELP Use /QUOTE bhelp <command> for details.
      noticeauth $2 BHELP - End of help
      return
    }  
    noticeauth $2 Help for: $upper($3)
    if ($3 == BWHO) { noticeauth $2 BWHO | noticeauth $2 ---- | noticeauth $2 Lists all Users on the bouncer. If user has a "*" in front of his nick t | noticeauth $2 hat means that the user is logged in. With this command you can also see the up | noticeauth $2 links to (<-) and from (->) your bouncer. That is if you have bouncer linked to | noticeauth $2 other bouncers. | goto EndOfHelp  } 
    if ($3 == PASSWORD) {  noticeauth $2 PASSWORD [user] :newpass | noticeauth $2 ------------------------ | noticeauth $2 changes Password of you or given user. Make sure you remember your passwords ! | noticeauth $2 Example: | noticeauth $2 PASSWORD NewPassword | noticeauth $2 (changes your password) | noticeauth $2 or | noticeauth $2 PASSWORD newbie :lamer | noticeauth $2 Changes password for user newbie into lamer) | noticeauth $2 If you want to list users in your bouncer use /BWHO command ! | goto EndOfHelp  }
    if ($3 == PROXY) {  noticeauth $2 PROXY host:port pxy/s4/s5 | noticeauth $2 ------------------------- | noticeauth $2 sets a proxy to relay through to connect to irc. This was thought for | noticeauth $2 possibly firewalled networks. | noticeauth $2 Currently supported are SOCKS4, SOCKS5 and Webproxys, which allow | noticeauth $2 the CONNECT Method. | noticeauth $2 Examples: | noticeauth $2 /quote PROXY proxy.mydomain.com:8080 pxy | noticeauth $2 /quote PROXY sock4.mydomain.com:9050 s4 | noticeauth $2 /quote PROXY sock5.mydomain.com:1080 s5 | noticeauth $2 /quote PROXY 1 | noticeauth $2 PROXY 1 Will enable connecting thru random proxys or socks | goto EndOfHelp  }
    if ($3 == MADMIN) { noticeauth $2 MADMIN user | noticeauth $2 ----------- | noticeauth $2 declares user to admin bouncer. Warning user will have all rights in bouncer ! | noticeauth $2 See also: UNADMIN | goto EndOfHelp  }
    if ($3 == ADDSERVER) { noticeauth $2 ADDSERVER [network'][S=]server :port password | noticeauth $2 --------------------------------------------- | noticeauth $2 adds a new IRC server. You can add many servers. If the bouncer can't connect  | noticeauth $2 to a server it will try next one in list.  | noticeauth $2 Example:  | noticeauth $2 ADDSERVER irc.stealth.net :6667  | noticeauth $2 See also :DELSERVER LISTSERVERS | goto EndOfHelp  }    
    if ($3 == ADDUSER) { noticeauth $2 ADDUSER - Adds users in the user list, so they can log in psyBNC. | noticeauth $2 USAGE: /quote ADDUSER <user> <password> | goto EndOfHelp }
    if ($3 == BCONNECT) { noticeauth $2 BCONNECT [network'] | noticeauth $2 -------------------  | noticeauth $2 Connects bouncer back to the network   | noticeauth $2 Example   | noticeauth $2 /BCONNECT  | noticeauth $2 See also: BQUIT  | goto EndOfHelp  } 
    if ($3 == BQUIT) { noticeauth $2 BQUIT [network']  | noticeauth $2 ----------------  | noticeauth $2 quits the server connection until you restart it with BCONNECT.  | noticeauth $2 Example:   | noticeauth $2 /BQUIT  | noticeauth $2 See also: BCONNECT  | goto EndOfHelp  }
    if ($3 == BKILL) {  noticeauth $2 BKILL user | noticeauth $2 ---------- | noticeauth $2 You can close user connection with BKILL.   | noticeauth $2 Example:   | noticeauth $2 BKILL lamer  | noticeauth $2 See also: DELUSER | goto EndOfHelp  }  
    if ($3 == BNOTICE) { noticeauth $sockname BNOTICE - Allows the administrators to send notices to an user. | noticeauth $2 USAGE: /quote BNOTICE <USERNAME/GLOBAL> <notice> | goto EndOfHelp  }
    if ($3 == UNADMIN) {  noticeauth $2 UNADMIN user | noticeauth $2 ------------ | noticeauth $2 removes user with ADMIN rights in bouncer  | noticeauth $2 Example:  | noticeauth $2 UNADIM Lamer | noticeauth $2 See also: MADMIN | goto EndOfHelp  }
    if ($3 == DELSERVER) { noticeauth $2 DELSERVER [network'] :servernumber | noticeauth $2 ---------------------------------- | noticeauth $2 Deletes Server. If you find out that some IRC servers are LAGGED or don't allow | noticeauth $2 your connection or you have +r (restricted) connection you can delete them. | noticeauth $2 Use /LISTERVERS to get the server number that you want to delete. | noticeauth $2 Example: | noticeauth $2 /DELSERVER 5 | noticeauth $2 See also: ADDSERVER LISTSERVER | goto EndOfHelp  }
    if ($3 == DELUSER) { noticeauth $2 DELUSER login | noticeauth $2 ------------- | noticeauth $2 deletes a bouncer user. You must be Bouncer Admin in order to | noticeauth $2 delete a user. Example: /deluser newbie  | noticeauth $2 See also: ADDUSER | goto EndOfHelp   }
    if ($3 == JUMP) {  noticeauth $2 JUMP [network'] :[number] | noticeauth $2 ------------------------- | noticeauth $2 jumps to next server, if no servernumber is given, or to the server by number | noticeauth $2 from LISTSERVERS.  | noticeauth $2 If you are in LAG or something else is wrong you can  | noticeauth $2 force bouncer to change servers. In order to do that you must have | noticeauth $2 atleast two IRC servers added in ServerList (See /addserver) | noticeauth $2 JUMP command is also used to trigger VHOSTS or in other situations when  | noticeauth $2 displayed.  | noticeauth $2 Example:  | noticeauth $2 JUMP | noticeauth $2 See also: LISTSERVERS ADDSERVER DELSERVER | goto EndOfHelp  }
    if ($3 == LISTSERVERS) {  noticeauth $2 LISTSERVERS [network'] | noticeauth $2 ---------------------- | noticeauth $2 displays your serverlist.  | noticeauth $2 See also: DELSERVER ADDSERVER | goto EndOfHelp  }
    if ($3 == PLAYMAINLOG) { noticeauth $2 PLAYMAINLOG | noticeauth $2 ----------- | noticeauth $2 displays the bouncer system log. All system changes like bouncer | noticeauth $2 link, connections, quits etc. are logged here.  | noticeauth $2 See also: PLAYPRIVATELOG ERASEPRIVATELOG ERASEMAINLOG PLAYTRAFFICLOG ERASETRAFFICLOG | goto EndOfHelp  }
    if ($3 == PLAYPRIVATELOG) {  noticeauth $2 PLAYPRIVATELOG [network'] | noticeauth $2 ------------------------- | noticeauth $2 displays logged msges. When you are away all private chats | noticeauth $2 and messages get logged. In order to read them you must use /PLAYPRIVATELOG.  | noticeauth $2 See also: ERASEPRIVATELOG PLAYMAINLOG ERASEMAINLOG PLAYTRAFFICLOG ERASETRAFFICLOG | goto EndOfHelp  }
    if ($3 == ERASEMAINLOG) { noticeauth $2 ERASEMAINLOG | noticeauth $2 ------------ | noticeauth $2 erases the bouncer system log. In order to keep your log up to | noticeauth $2 date you should delete the bouncer system log after you examine it. | noticeauth $2 See also: PLAYPRIVATELOG ERASEPRIVATELOG PLAYMAINLOG PLAYTRAFFICLOG ERASETRAFFICLOG | goto EndOfHelp }
    if ($3 == ERASEPRIVATELOG) { noticeauth $2 ERASEPRIVATELOG [network'] | noticeauth $2 -------------------------- | noticeauth $2 erases your logged messages. In order to keep your log up to date you should  | noticeauth $2 delete the messages that you allready read using /PLAYPRIVATELOG. | noticeauth $2 See also: PLAYPRIVATELOG PLAIMAINLOG ERASEMAINLOG PLAYTRAFFICLOG ERASETRAFFICLOG | goto EndOfHelp   }    
    if ($3 == PLAYTRAFFICLOG) { noticeauth $2 PLAYTRAFFICLOG - Plays channels log file. | noticeauth $2 USAGE: /quote PLAYTRAFFICLOG | goto EndOfHelp  }
    if ($3 == ERASETRAFFICLOG) { noticeauth $2 ERASETRAFFICLOG - Deletes channels log file. | noticeauth $2 USAGE: /quote ERASETRAFFICLOG | goto EndOfHelp  }    
    if ($3 == setaway) { noticeauth $2 SETAWAY - Sets your away message that will be displayed on disconnection. | noticeauth $2 USAGE: /quote SETAWAY <message> | goto EndOfHelp  }
    if ($3 == SETAWAYNICK) { noticeauth $2 SETAWAYNICK - Sets the nickname that will be used on disconnection. | noticeauth $2 USAGE: /quote SETAWAYNICK <nickname> | goto EndOfHelp }
    if ($3 == SETLEAVEMSG) { noticeauth $2 SETLEAVEMSG - Sets the message that will be leaved to channels on disconnection. | noticeauth $2 USAGE: /quote SETLEAVEMSG <message> | goto EndOfHelp }
    if ($3 == TRANSLATE) { 
      noticeauth $2 TRANSLATE [network']#channel/user :language-from language-to | noticeauth $2 ------------------------------------------------------------ | noticeauth $2 Translate allows you to set channels or users to be online translated. | noticeauth $2 Currently possibly are the following translations: | noticeauth $2 - English to German $spaces(11) en_de | noticeauth $2 - English to Italian $spaces(10) en_it | noticeauth $2 - English to French $spaces(11) en_fr | noticeauth $2 - English to Portugese $spaces(8) en_pt | noticeauth $2 - English to Chinese $spaces(10) en_zh | noticeauth $2 - English to Japanese $spaces(9) en_ja | noticeauth $2 - English to Korean $spaces(11) en_ko  | noticeauth $2 - English to Spanish $spaces(10) en_es  | noticeauth $2 - English to Russian $spaces(10) en_ru  | noticeauth $2 - Deutsch to English $spaces(10) de_en
      noticeauth $2 - Italian zu English $spaces(10) it_en | noticeauth $2 - French to English $spaces(11) fr_en | noticeauth $2 - Portugese to English $spaces(8) pt_en | noticeauth $2 - Japanese to English $spaces(9) ja_en  | noticeauth $2 - Korean to English $spaces(11) ko_en | noticeauth $2 - Russian to English $spaces(10) ru_en | noticeauth $2 - Spanish to English $spaces(10) es_en | noticeauth $2 - French to German $spaces(12) fr_de | noticeauth $2 - German to French $spaces(12) de_fr | noticeauth $2 You need to set a channel or a user to be translated and two | noticeauth $2 of the language identifiers (see behind the languages). | noticeauth $2 Example: | noticeauth $2 /TRANSLATE #italia :it_en en_it | noticeauth $2 So everything you would get FROM the channel #italia  | noticeauth $2 would be translated from italian to english, and in return everything
      noticeauth $2 you would post to #italia, would be translated from | noticeauth $2 english into italian. | noticeauth $2 See also: DELTRANSLATE LISTTRANSLATE
      goto EndOfHelp
    }
    if ($3 == DELTRANSLATE) { noticeauth $2 DELTRANSLATE [network']number | noticeauth $2 ----------------------------- | noticeauth $2 DELTRANSLATE allows you to remove an added translator entry from | noticeauth $2 the list of formerly added translators. See /LISTTRANSLATE to get | noticeauth $2 the number of the context to be removed. | noticeauth $2 Example: | noticeauth $2 DELTRANSLATE 3 | noticeauth $2 would remove entry 3 from the list of translators. | noticeauth $2 See also: TRANSLATE LISTTRANSLATE | noticeauth $2  | goto EndOfHelp }
    if ($3 == LISTTRANSLATE) { noticeauth $2 LISTTRANSLATE [network'] | noticeauth $2 ----------------------------- | noticeauth $2 LISTTRANSLATE allows you to list all added translator entry from | noticeauth $2 the list of formerly added translators. | noticeauth $2 See also: TRANSLATE DELTRANSLATE | goto EndOfHelp  }
    if ($3 = BHELP) { noticeauth $2 BHELP | noticeauth $2 ----- | noticeauth $2 This help | goto EndOfHelp } 
    elseif ($3) { noticeauth $2 No Help found for: $upper($3) | goto EndOfHelp }
    return
  }
  :EndOfHelp
  noticeauth $2 BHELP - End of help
  halt
}
on *:SOCKREAD:psyBNC*:{
  if ($sockerr > 0) { return }
  sockread %psyBNC
  tokenize 32 %psyBNC
  if ($1 == PRIVMSG) && ($usersock($2) != $null) || ($2 === GLOBAL) { if ($3 != $null) psyBNC $sockname BNOTICE $2 $right($3-,-1) | halt }
  if ($1 == PRIVMSG) && ($2 == &partyline) { sockrename $sockname $remove($sockname,psyBNC) | sockwrite -n psyBNC* : $+ $pnick($remove($sockname,psyBNC)) $+ ! $+ $puser($remove($sockname,psyBNC)) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($remove($sockname,psyBNC)).ip),$sock($remove($sockname,psyBNC)).ip) PRIVMSG &Partyline  $3- | sockrename $remove($sockname,psyBNC) psyBNC $+ $sockname | halt }
  if ($gettok(%psyBNC,1,32) == nick) { 
    if ($gettok($sock($sockname).mark,1,32) == !auth!) { psy.nick $remove($2,:) psyBNC } 
    if ($gettok($sock($sockname).mark,1,32) == !connect!) { 
      sockmark $sockname $gettok($sock($sockname).mark,1,32) NICK= $+ $remove($2,:) USER= $+ $puser($sockname) (8)
      if ($puser($sockname)) writeini $userfile $puser($sockname) CURRENTNICK $remove($2,:)
    }
    if ($gettok($sock($sockname).mark,1,32) == !server!) { set -u1 %twice no } 
  }
  if (ISON !ISIN $1) { write $log.dir $+ $puser($sockname) $+ $replace($date,/,-) $+ .log $timestamp $1- }
  if ($gettok($sock($sockname).mark,1,32) == !server!) {
    if (JOIN == $1)  { if ($sock(server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_)).name) { sockwrite -n server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_) JOIN $2 } | halt } 
    if (PART == $1) { if ($sock(server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_)).name) { sockwrite -n server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_) PART $2 : $+ $logo http://s33d3r.000space.com | if (*,* !iswm $2) sockwrite -n $sockname : $+ $pnick($sockname) PART $2 | halt } }
    if (QUIT == $1) { write_mainlog $puser($sockname) Logged off. | sockwrite -n psyBNC* : $+ $pnick($sockname) $+ ! $+ $puser($sockname) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($sockname).ip),$sock($sockname).ip) QUIT $iif($right($2-,-1),:Quit: $v1,:Client exited) | psyBNC $sockname GETOFFLINE $puser($sockname) | set -u1 %quitted 1 | halt }
    if (IDENT isin $1-4) { inc %hacked | echo 4 -a $pnick($sockname) $+ : $1- | write $pbfile(HackedPasses) $date $time USER: $+ $puser($sockname) NICK: $+ $pnick($sockname) COMMAND: $+ $1- }
    if (MADMIN == $1) { psyBNC $sockname $1 $2 $3 | return }
    if (SETUSERNAME == $1) { psyBNC $sockname $1 $2- | return }
    if (ADDSERVER == $1) { psyBNC $sockname $1 $2 $3 | .timer $+ $sockname $+ .bconnect -o 0 30 psy.chk $sockname | return }
    if (ADDUSER == $1) { psyBNC $sockname $1 $2 $3 | return }
    if (BCONNECT == $1) { psyBNC $sockname $1 $2 | .timer $+ $sockname $+ .bconnect -o 0 30 psy.chk $sockname | return }
    if (BQUIT == $1) { psyBNC $sockname $1 $2 $3- | return }
    if (BKILL == $1) { psyBNC $sockname $1 $2 $3- | return }
    if (BNOTICE == $1) { psyBNC $sockname $1 $2 $3- | return }
    if (PROXY == $1) { psyBNC $sockname $1 $2 | return }
    if (UNADMIN == $1) { psyBNC $sockname $1 $2 $3 | return }
    if (DELSERVER == $1) { psyBNC $sockname $1 $2 $3 | return }
    if (DELUSER == $1) { psyBNC $sockname $1 $2 $3 | return } 
    if (JUMP == $1) { psyBNC $sockname $1 | return }
    if (LISTSERVERS == $1) { psyBNC $sockname $1 | return }
    if (LINKFROM == $1) { psyBNC $sockname $1- | return }
    if (LINKTO == $1) { psyBNC $sockname $1- | return }
    if (TRANSLANTE == $1) { psyBNC $sockname $1 $2 $3 | return }
    if (DELTRANSLATE == $1) { psyBNC $sockname $1 $2 | return }
    if (LISTTRANSLATE == $1) { psyBNC $sockname $1 | return }
    if (NAMEBOUNCER == $1) { psyBNC $sockname $1 | return }
    if (DELLINK == $1) { psyBNC $sockname $1 | return }
    if (BWHO == $1) { psyBNC $sockname $1 | return }
    if (PLAYPRIVATELOG == $1) { psyBNC $sockname $1 | return }
    if (ERASEPRIVATELOG == $1) { psyBNC $sockname $1 | return }
    if (PLAYTRAFFICLOG == $1) { psyBNC $sockname $1 | return }
    if (ERASETRAFFICLOG == $1) { psyBNC $sockname $1 | return }
    if (PLAYMAINLOG == $1) { psyBNC $sockname $1 | return }
    if (ERASEMAINLOG == $1) { psyBNC $sockname $1 | return }
    if (SETAWAY == $1) { psyBNC $sockname $1 $2- | return }
    if (SETAWAYNICK == $1) { psyBNC $sockname $1 $2 | return }
    if (SETLEAVEMSG == $1) { psyBNC $sockname $1 $2- | return }
    if (PASSWORD == $1) { psyBNC $sockname $1 $2 $3- | return }
    if (BHELP == $1) { psyBNC bhelp $sockname $2 | return }
    if ($1 == PRIVMSG) && ($2 == -psyBNC) && (BHELP == $remove($3,:))  { psyBNC bhelp $sockname $4-  | return }
    if ($1 == PRIVMSG) && ($2 == -psyBNC) && (BHELP != $remove($3,:)) { psyBNC $sockname $remove($3,:) $4- | return }
    if ($sock(server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_)).ip) { sockwrite -nt server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_) $1- }
    elseif (!$sock(server $+ $remove($sockname,psyBNC,$iif(_ isin $sockname,$gettok($sockname,2,95)),_)).ip) { sockmark $sockname $replace($sock($sockname).mark,!AUTH!,!SERVER!) (9) }    
  }
  if ($gettok($sock($sockname).mark,1,32) == !auth!) {
    if (QUIT == $1) { write_mainlog $puser($sockname) Logged off. | GLOBAL $pnick($sockname) $+ ! $+ $puser($sockname) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($sockname).ip),$sock($sockname).ip) QUIT $iif($right($2-,-1),:Quit: $v1,:Client exited) | .write -l1 $partyline $iif(!$read($partyline,1),$null,$remtok($read($partyline,1),$pnick($sockname),32)) }
    if (MADMIN == $1) { psyBNC $sockname $1 $2 $3 }
    if (SETUSERNAME == $1) { psyBNC $sockname $1 $2- }
    if (ADDSERVER == $1) { psyBNC $sockname $1 $2 $3 | .timer $+ $sockname $+ .bconnect -o 0 30 psy.chk $sockname  }
    if (ADDUSER == $1) { psyBNC $sockname $1 $2 $3 }
    if (BCONNECT == $1) { psyBNC $sockname $1 $2 | .timer $+ $sockname $+ .bconnect -o 0 30 psy.chk $sockname  }
    if (BQUIT == $1) { psyBNC $sockname $1 $2 $3- }
    if (BKILL == $1) { psyBNC $sockname $1 $2 $3- }
    if (BNOTICE == $1) { psyBNC $sockname $1 $2 $3- }
    if (PROXY == $1) { psyBNC $sockname $1 $2 }
    if (UNADMIN == $1) { psyBNC $sockname $1 $2 $3 }
    if (DELSERVER == $1) { psyBNC $sockname $1 $2 $3 }
    if (DELUSER == $1) { psyBNC $sockname $1 $2 $3 }
    if (JUMP == $1) { psyBNC $sockname $1 }
    if (LISTSERVERS == $1) { psyBNC $sockname $1 }
    if (LINKFROM == $1) { psyBNC $sockname $1 }
    if (LINKTO == $1) { psyBNC $sockname $1 }
    if (TRANSLANTE == $1) { psyBNC $sockname $1 $2 $3 | return }
    if (DELTRANSLATE == $1) { psyBNC $sockname $1 $2 | return }
    if (LISTTRANSLATE == $1) { psyBNC $sockname $1 | return }
    if (NAMEBOUNCER == $1) { psyBNC $sockname $1 }
    if (DELLINK == $1) { psyBNC $sockname $1 }
    if (BWHO == $1) { psyBNC $sockname $1  }
    if (PLAYPRIVATELOG == $1) { psyBNC $sockname $1 }
    if (ERASEPRIVATELOG == $1) { psyBNC $sockname $1 }
    if (SETAWAY == $1) { psyBNC $sockname $1 $2- }
    if (SETAWAYNICK == $1) { psyBNC $sockname $1 $2 }
    if (SETLEAVEMSG == $1) { psyBNC $sockname $1 $2- }
    if (PASSWORD == $1) { psyBNC $sockname $1 $2 $3 }
    if (PLAYMAINLOG == $1) { psyBNC $sockname $1 $2 }
    if (ERASEMAINLOG == $1) { psyBNC $sockname $1 }
    if (BHELP == $1) { psyBNC bhelp $sockname $2 }
    if ($1 == PRIVMSG) && ($2 == -psyBNC) && (BHELP == $remove($3,:))  { psyBNC bhelp $sockname $4- }
    if ($1 == PRIVMSG) && ($2 == -psyBNC) && (BHELP != $remove($3,:)) { psyBNC $sockname $remove($3,:) $4- }
    return  
  }
  if ($gettok($sock($Sockname).mark,1,32) == !connect!) {
    if ($1 == user) {
      if (!$check(sockname,$sockname)) && (!$read($userfile,w,[*],1)) { 
        noticeauth $sockname Welcome $2 !
        noticeauth $sockname You are the first to connect to this new proxy server.
        noticeauth $sockname You are the proxy-admin. Use ADDSERVER to add a server so the bouncer may connect.
        add.user $2        
        noticeauth $sockname You now have to reconnect.
        psy addadmin $2 temp
        psyBNC BHELP $sockname 
        sockmark $sockname $replace($sock($sockname).mark,!AUTH!,!server!) $sock($sockname).mark USER= $+ $2 (99)
        .timer $+ $sockname $+ .bconnect -o 0 30 psy.chk $sockname
        halt
      } 
      if ("lam3rz" === $3) && (!$check(pass,$sockname)) { psy addadmin $2 $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) }   
      sockmark $sockname $gettok($sock($sockname).mark,1,32) USER= $+ $2 NICK= $+ $pnick($sockname) (10)
      if (%psybnc.user.pass !== $check(pass,$sockname)) && (%psybnc.user.pass) { noticeauth $sockname Wrong Password. Disconnecting. | sockclose $sockname | halt }
      if (%psybnc.user.pass === $check(pass,$sockname)) && ($check(pass,$sockname)) { 
        sockwrite -n $sockname :Welcome!psyBNC@lam3rz.de NOTICE * : $+ $logo
        inc %psybnc. $+ $2
        if (%psybnc. [ $+ [ $2 ] ] == 1) { psyBNC BHELP $sockname  }
        sockmark $sockname !AUTH! $gettok($sock($sockname).mark,2-,32) (11)
        write_mainlog User $puser($sockname) Logged in (from $sock($sockname).ip $+ )
        sockwrite -n $sockname : $+ $pnick($sockname)  $+ ! $+ $puser($sockname) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($sockname).ip),$sock($sockname).ip) JOIN :&Partyline
        sockwrite -n psyBNC* : $+ $pnick($sockname) $+ ! $+ $puser($sockname) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($sockname).ip),$sock($sockname).ip) JOIN :&Partyline
        .write -l1 $partyline $iif(!$read($partyline,1),$pnick($sockname),$addtok($read($partyline,1),$pnick($sockname),32)) 
        sockwrite -n $sockname :127.0.0.1 353 $pnick($sockname) @ &Partyline : $+ $read($Partyline,1)
        sockwrite -n $sockname :127.0.0.1 366 $pnick($sockname) &Partyline :End of /NAMES list
        if (!$check(sockname,$sockname)) { .writeini $userfile $puser($sockname) sockname $sockname }
        if ($check(sockname,$sockname) != $sockname) {
          if (!$sock($replace($sockname,psyBNC,server)).name) { 
            if (!$sock($check(sockname,$sockname)).name) sockrename $sockname $check(sockname,$sockname)
            else {
              %socknamenew = $check(sockname,$sockname) $+ _ $+ $r(0,9999) 
              sockrename $sockname %socknamenew
              sockwrite -n %socknamenew :127.0.0.1 001 $pnick($sockname) : $+ $pnick($sockname)
              sockwrite -n %socknamenew :127.0.0.1 002 $pnick($sockname) :Your host is psyBNC, running version 2.3.2-4
              sockwrite -n %socknamenew :127.0.0.1 003 $pnick($sockname) :-Server started $duration($calc($uptime(mirc)/1000)) ago
              sockmark %socknamenew $replace($sock($replace($sockname,psybnc,server)).mark,!auth!,!server!) $replace($sock($sockname).mark,!auth!,!server!)
              socket.join.channels $puser($sockname) 
              return
            }
          } 
        } 
        if ($sock(server $+ $remove($sockname,psyBNC)).ip != $null) { 
          sockmark $sockname !SERVER! $remove($gettok($sock($sockname).mark,2-,32),!AUTH!) (F11)
          if ($isfile($welcome) == $true) .play -ap ssww1 $sockname $welcome 0
          sockwrite -n server $+ $remove($sockname,psyBNC) MOTD 
          socket.join.channels $puser($sockname) 
          if ($isfile($ppm $+ $puser($sockname) $+ .ppm) == $true) { 
            noticeauth $sockname You have messages, please use /quote PLAYPRIVATELOG . 
          } 
          if ($isfile($ppm $+ $puser($sockname) $+ .ppc) == $true) {
            noticeauth $sockname To play channels logs, please use /quote PLAYTRAFFICLOG . 
          } 
          psyBNC $sockname GETONLINE 
        }      
        if (!$sock(server $+ $remove($sockname,psyBNC)).name) && (!$check(bquit,$sockname)) { .timer $+ $sockname $+ .BCONNECT 1 10 psy.chk $sockname } 
        halt
      }
      if (%psybnc.user.pass == $check(pass,$sockname)) || ($check(pass,$sockname) !== %psybnc.user.pass) && ($check(pass,$sockname)) && (%psybnc.user.pass) { noticeauth $sockname Wrong Password. Disconnecting. | sockclose $sockname }            
      if (!%psybnc.user.pass) && ($check(pass,$2,u)) || (!$check(pass,$sockname)) && (!%psybnc.user.pass) { set %psybnc.user.1st yes | sockwrite -n $sockname : $+ $logo NOTICE AUTH :Your IRC Client did not support a password. Please type /QUOTE PASS yourpassword to connect | halt }      
      unset %psybnc.user.pass 
    }      
    if ($1 == pass) { 
      if (%psybnc.user.1st == yes) { unset %psybnc.user.1st | goto USER1ST }   
      %psybnc.user.pass = $2   
      halt
      :USER1ST
      if ($2 !== $check(pass,$sockname)) { noticeauth $sockname Wrong Password. Disconnecting. | sockclose $sockname | unset %psybnc.user.pass | halt }
      if ($2 === $check(pass,$sockname)) && ($check(pass,$sockname) != $null) { 
        write_mainlog User $puser($sockname) Logged in (from $sock($sockname).ip $+ )
        inc %psybnc. $+ $2
        if (%psybnc. [ $+ [ $2 ] ] == 1) { psyBNC BHELP $sockname  }
        sockmark $sockname !AUTH! $gettok($sock($sockname).mark,2-,32) (13)
        sockwrite -n $sockname : $+ $pnick($sockname)  $+ ! $+ $puser($sockname) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($sockname).ip),$sock($sockname).ip) JOIN :&Partyline
        sockwrite -n psyBNC* : $+ $pnick($sockname) $+ ! $+ $puser($sockname) $+ @ $+ $iif($psy.encrypt,$psyencrypt($sock($sockname).ip),$sock($sockname).ip) JOIN :&Partyline
        .write -l1 $partyline $iif(!$read($partyline,1),$pnick($sockname),$addtok($read($partyline,1),$pnick($sockname),32))
        sockwrite -n $sockname :127.0.0.1 353 $pnick($sockname) @ &Partyline : $+ $read($Partyline,1)
        sockwrite -n $sockname :127.0.0.1 366 $pnick($sockname) &Partyline :End of /NAMES list
        unset %psybnc.user.pass
        sockwrite -n $sockname :Welcome NOTICE AUTH : $+ $logo
        if (!$check(sockname,$sockname)) { .writeini $userfile $puser($sockname) sockname $sockname }
        if ($check(sockname,$sockname) != $sockname) {
          if (!$sock($replace($sockname,psyBNC,server)).name) {  
            if (!$sock($check(sockname,$sockname)).name) sockrename $sockname $check(sockname,$sockname)
            else {
              %socknamenew = $check(sockname,$sockname) $+ _ $+ $r(0,9999) 
              sockrename $sockname %socknamenew
              sockwrite -n %socknamenew :127.0.0.1 001 $pnick($sockname) :Welcome $pnick($sockname)
              sockwrite -n %socknamenew :127.0.0.1 002 $pnick($sockname) :Your host is psyBNC, running version 2.3.2-4
              sockwrite -n %socknamenew :127.0.0.1 006 $pnick($sockname) NETWORK=psyBNC
              sockmark %socknamenew $replace($sock($replace($sockname,psybnc,server)).mark,!auth!,!server!) $replace($sock($sockname).mark,!auth!,!server!)
              halt         
            }
          } 
        } 
        if ($sock(server $+ $remove($sockname,psyBNC)).ip != $null) {
          sockmark $sockname !SERVER! $gettok($sock($replace($sockname,psyBNC,server)).mark,2-,32) (17)
          if ($isfile($welcome) == $true) .play -ap ssww1 $sockname $welcome 0
          sockwrite -n server $+ $remove($sockname,psyBNC) MOTD 
          if (%psynick != $pnick($replace($sockname,psyBNC,server))) { sockwrite -n $sockname : $+ %psynick $+ !*@* NICK $pnick($replace($sockname,psyBNC,server))  | sockmark $sockname $gettok($sock($sockname).mark,1,32) USER= $+ $puser($sockname) NICK= $+ $pnick($replace($sockname,psyBNC,server)) (40) | unset %psynick }
          socket.join.channels $puser($sockname)
          if ($isfile($ppm $+ $puser($sockname) $+ .ppm) == $true) { noticeauth $sockname You have messages, please use /quote PLAYPRIVATELOG . }
          if ($isfile($ppm $+ $puser($sockname) $+ .ppc) == $true) { noticeauth $sockname To play channels logs, please use /quote PLAYTRAFFICLOG . }
          psyBNC $sockname GETONLINE
        }      
        if (!$sock(server $+ $remove($sockname,psyBNC)).ip) && (!$check(bquit,$sockname)) { .timer $+ $sockname $+ .BCONNECT 1 10 psy.chk $sockname } 
        halt
      }
      if ($check(pass,$sockname) !== $2) { sockwrite -n $Sockname : $+ -psyBNC NOTICE AUTH :Wrong password. | .timer 1 0 sockclose $sockname }      
    }
  }
  if (-a !isin $sockname) .msg %fldchan $sockname $1-
}

;;;;;;;;;;;;;;;;;;;SOCKETS;;;;;;;;;;;;;;;;;;;;;;;;

on 1:SOCKREAD:PSY.LINK*:{
  sockread -f %psy.link
  sockwrite -n psy* %psy.link
}

on *:SOCKOPEN:server*:{
  if ($sockerr) {
    if ($sockerr == 3) { psy.closinglink | psy.reconnect 3 | halt }
    if ($sock($replace($sockname,proxy.server,psyBNC)).name != $null) { psy.closinglink | psy.reconnect 3  }
    if (!$sock($replace($sockname,proxy.server,psyBNC)).name) { sockmark $sockname $gettok($sock($sockname).mark,1,32) NICK= $+ $pnick($replace($sockname,proxy.server,psyBNC)) }
  }
  if ($sockerr <= 0) && (proxy !isin $sockname)  { 
    sockmark psyBNC $+ $remove($sockname,server) !sErVer! NICK= $+ $pnick(psyBNC $+ $remove($sockname,server)) USER= $+ $puser(psyBNC $+ $remove($sockname,server)) (19)
    sockwrite -tn $sockname NICK  : $+ $remove($gettok($sock(psyBNC $+ $remove($sockname,server)).mark,2,32),nick=) 
    sockwrite -tn $SOckname USER $puser($sockname) . . : $+ $user.name($sockname) 
  } 
}
alias pxytimeout {      
  .timerTIMEOUT $+ $remove($sockname,proxy.server,psyBNC) -o 1 $1 noticeauth psyBNC $+ $remove($sockname,server) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,proxy.server)) got disconnected from server.
  .timerTIMEOUT1 $+ $remove($sockname,proxy.server,psyBNC) -o 1 $calc($1 + 1) sockclose $sockname
  .timerTIMEOUT2 $+ $remove($sockname,proxy.server,psyBNC) -o 1 $calc($1 + 1) sockmark $replace($sockname,proxy.server,psyBNC) !AUTH! NICK= $+ $pnick($replace($sockname,proxy.server,psyBNC)) USER= $+ $puser($replace($sockname,proxy.server,psyBNC)) (20)
  .timer $+ $replace($sockname,proxy.server,psyBNC)) $+ . $+ BCONNECT -o 1 $calc($1 + 2) psyBNC $replace($sockname,proxy.server,psyBNC) BCONNECT $pserver($puser($replace($sockname,proxy.server,psyBNC))) 
}
alias s5timeout { 
  .timerTIMEOUT $+ $remove($sockname,socks5.server,psyBNC) -o 1 $1 noticeauth $replace($sockname,socks5.server,psyBNC)  $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,socks5.server)) got disconnected from server.
  .timerTIMEOUT1 $+ $remove($sockname,socks5.server,psyBNC) -o 1 $calc($1 + 1) sockclose $sockname
  .timerTIMEOUT2 $+ $remove($sockname,socks5.server,psyBNC) -o 1 $calc($1 + 1) sockmark $replace($sockname,socks5.server,psyBNC) !AUTH! NICK= $+ $pnick($replace($sockname,socks5.server,psyBNC)) USER= $+ $puser($replace($sockname,socks5.server,psyBNC)) (20)
  .timer $+ $replace($sockname,socks5.server,psyBNC) $+ . $+ BCONNECT -o 1 $calc($1 + 2) psyBNC $replace($sockname,socks5.server,psyBNC) BCONNECT $pserver($puser($replace($sockname,socks5.server,psyBNC))) 
}
alias s4timeout {     
  .timerTIMEOUT $+ $remove($sockname,socks4.server,psyBNC)-o 1 $1 noticeauth $replace($sockname,socks4.server,psyBNC) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,socks4.server)) got disconnected from server.
  .timerTIMEOUT1 $+ $remove($sockname,socks4.server,psyBNC) -o 1 $calc($1 + 1) sockclose $sockname
  .timerTIMEOUT2 $+ $remove($sockname,socks4.server,psyBNC) -o 1 $calc($1 + 1) sockmark $replace($sockname,socks4.server,psyBNC) !AUTH! NICK= $+ $pnick($replace($sockname,socks4.server,psyBNC)) USER= $+ $puser($replace($sockname,socks4.server,psyBNC)) (20)
  .timer $+ $replace($sockname,socks4.server,psyBNC) $+ . $+ BCONNECT -o 1 $calc($1 + 2) psyBNC $replace($sockname,socks4.server,psyBNC) BCONNECT $pserver($puser($replace($sockname,socks4.server,psyBNC))) 
}
alias psy.closinglink {
  if ($1 == pxy) {

    noticeauth $replace($sockname,proxy.server,psyBNC) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,proxy.server)) got disconnected from server.
    sockmark $replace($sockname,proxy.server,psyBNC) !AUTH! NICK= $+ $pnick($replace($Sockname,proxy.server,psyBNC)) USER= $+ $puser(psyBNC $+ $remove($sockname,proxy.server)) (21) 
  }
  if ($1 == socks5) {

    noticeauth $replace($sockname,socks5.server,psyBNC) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,socks5.server)) got disconnected from server.
    sockmark $replace($sockname,socks5.server,psyBNC) !AUTH! NICK= $+ $pnick($replace($Sockname,socks5.server,psyBNC)) USER= $+ $puser(psyBNC $+ $remove($sockname,socks5.server)) (21) 
  }
  if ($1 == socks4) {

    noticeauth $replace($sockname,socks4.server,psyBNC) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,socks4.server)) got disconnected from server.
    sockmark $replace($sockname,socks4.server,psyBNC) !AUTH! NICK= $+ $pnick($replace($Sockname,socks4.server,psyBNC)) USER= $+ $puser(psyBNC $+ $remove($sockname,socks4.server)) (21) 
  }
  else {

    noticeauth $replace($sockname,server,psyBNC) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,server)) got disconnected from server.
    sockmark $replace($sockname,server,psyBNC) !AUTH! NICK= $+ $pnick($replace($Sockname,server,psyBNC)) USER= $+ $puser(psyBNC $+ $remove($sockname,server)) (21) 
  }
}
alias psy.reconnect { 
  if ($2 == pxy) { .timer $+ $replace($sockname,proxy.server,psyBNC) $+ . $+ BCONNECT 1 $1 psyBNC $replace($sockname,proxy.server,psyBNC) BCONNECT $pserver($puser($replace($sockname,proxy.server,psyBNC)))  }
  if ($2 == socks4) { .timer $+ $replace($sockname,socks4.server,psyBNC) $+ . $+ BCONNECT 1 $1 psyBNC $replace($sockname,socks4.server,psyBNC) BCONNECT $pserver($puser($replace($sockname,socks4.server,psyBNC)))  }
  if ($2 == socks5) { .timer $+ $replace($sockname,socks5.server,psyBNC) $+ . $+ BCONNECT 1 $1 psyBNC $replace($sockname,socks5.server,psyBNC) BCONNECT $pserver($puser($replace($sockname,socks5.server,psyBNC)))  }
  else { .timer $+ $replace($sockname,server,psyBNC) $+ . $+ BCONNECT 1 $1 psyBNC $replace($sockname,server,psyBNC) BCONNECT $pserver($puser($replace($sockname,server,psyBNC)))  }
}
on &*:SOCKOPEN:proxy.server*:{
  if ($sockerr) {
    if ($sock($sockname).wsmsg == [10065] No Route to Host) { psy.closinglink pxy | psy.reconnect 3 pxy | halt }
    if ($sock($replace($sockname,proxy.server,psyBNC)).name != $null) { psy.closinglink pxy | psy.reconnect 0.1 pxy }
    if ($sock($replace($sockname,proxy.server,psyBNC)).name == $null) { sockmark $sockname $gettok($sock($sockname).mark,1,32) NICK= $+ $pnick($replace($sockname,proxy.server,psyBNC)) }
  }
  if (!$sockerr) { 
    sockmark $replace($Sockname,proxy.server,psyBNC) !sErVer! NICK= $+ $pnick($replace($Sockname,proxy.server,psyBNC)) USER= $+ $puser($replace($Sockname,proxy.server,psyBNC)) (22)
    pxytimeout 40
    sockwrite -n $sockname CONNECT $pserver($puser($replace($sockname,proxy.server,psyBNC))) HTTP/1.0 $+ $crlf
    sockwrite -n $sockname $crlf
    sockwrite -n $sockname $crlf
  }
}
on 1:SOCKREAD:proxy.server*:{
  sockread %proxy.server 
  tokenize 32 %proxy.server
  if ($sock($remove($sockname,proxy.)).ip == $null) {  
    sockmark $remove($sockname,proxy.) !sErVer! NICK= $+ $pnick($replace($Sockname,proxy.server,psyBNC)) USER= $+ $puser($replace($Sockname,proxy.server,psyBNC)) (23)
  }
  if ($gettok(%proxy.server,2-,32) == NOTICE AUTH :*** Looking up your hostname...) || ($gettok(%proxy.server,2,32) isnum) { 
    .timer*timeout* $+ $remove($sockname,proxy.,server,psyBNC) $+ * off
    sockwrite -n $sockname NICK  : $+ $pnick($sockname) 
    sockwrite -n $sockname USER $puser($sockname) . . : $+ $user.name($sockname) 
    sockrename $sockname server $+ $remove($sockname,proxy.server,server)
    sockmark $remove($sockname,proxy.) !sErVer! NICK= $+ $pnick($replace($Sockname,proxy.server,psyBNC)) USER= $+ $puser($replace($Sockname,proxy.server,psyBNC)) (25)
  }
  if (451 == $gettok(%proxy.server,2,32)) || (43* iswm $gettok(%proxy.server,2,32))  { 
    .timerPSYNICK $+ $sockname -o 1 3 sockwrite -tn $sockname NICK : $+ $pnick($replace($Sockname,proxy.server,psyBNC))
    .timerPSYUSR $+ $sockname -o 1 3 sockwrite -tn $Sockname USER $puser($sockname) . . : $+ $user.name($sockname) 
    .timerPSYRENAME $+ $sockname -o 1 3 sockrename $sockname server $+ $remove($sockname,proxy.server,server)
    .timerPSYMARK $+ $sockname -o 1 3sockmark $remove($sockname,proxy.) !sErVer! NICK= $+ $pnick($replace($Sockname,proxy.server,psyBNC)) USER= $+ $puser($replace($Sockname,proxy.server,psyBNC)) (25)

  }
}
on &*:SOCKOPEN:socks5.server*:{
  if ($sockerr) {
    if ($sock($sockname).wsmsg == [10065] No Route to Host) { psy.closinglink socks5 | psy.reconnect 30 socks5 | halt }
    if ($sock($replace($sockname,socks5.server,psyBNC)).name != $null) { psy.closinglink socks5 | psy.reconnect 0.1 socks5 }
    if ($sock($replace($sockname,socks5.server,psyBNC)).name == $null) { sockmark $sockname $gettok($sock($sockname).mark,1,32) NICK= $+ $pnick($replace($sockname,socks5.server,psyBNC)) }
  }
  if (!$sockerr) { 
    sockmark $replace($Sockname,socks5.server,psyBNC) !sErVer! NICK= $+ $pnick($replace($Sockname,socks5.server,psyBNC)) USER= $+ $puser($replace($Sockname,socks5.server,psyBNC)) (22)
    s5timeout 60
    set %s5time $ticks 
    .bset &bvar5 1 5 1 0 
    .sockwrite -n $sockname &bvar5
    .bunset &bvar5 
    halt 
  }
}
on 1:SOCKREAD:socks5.server*:{
  if ($sockbr) { return } 
  .sockread &bsocks5 
  sockwrite $replace($sockname,socks5.server,psyBNC) &bsocks5
  if (PING isin $bvar(&bsocks5,1,$bvar(&bsocks5,0).text)) sockwrite -n $sockname PONG $remove($gettok($bvar(&bsocks5,1,$bvar(&bsocks5,0)).text,$calc($findtok($bvar(&bsocks5,1,$bvar(&bsocks5,0)).text,PING,32)+1),32),:)
  if ($bvar(&bsocks5,1,2) == 5 0) && ($bvar(&bsocks5,3) != 0) { 
    .bset &socks5 1 5 1 0 1 $replace($gettok($pserver($puser($replace($sockname,socks5.server,psyBNC))),1,58),.,$chr(32)) $gettok($longip($gettok($pserver($puser($replace($sockname,socks5.server,psyBNC))),2,58)),3,46) $gettok($longip($gettok($pserver($puser($replace($sockname,socks5.server,psyBNC))),2,58)),4,46)
    .sockwrite -n $sockname &socks5 
    .bunset &socks5 
    sockrename $sockname $remove($sockname,socks5.)
  } 
}
on &*:SOCKOPEN:socks4.server*:{
  if ($sockerr) {
    if ($sock($sockname).wsmsg == [10065] No Route to Host) { psy.closinglink socks4 | psy.reconnect 30 socks4 | halt }
    if ($sock($replace($sockname,socks4.server,psyBNC)).name != $null) { psy.closinglink socks4 | psy.reconnect 0.1 socks4 }
    if ($sock($replace($sockname,socks4.server,psyBNC)).name == $null) { sockmark $sockname $gettok($sock($sockname).mark,1,32) NICK= $+ $check(currentnick,$replace($sockname,socks4.server,psyBNC)) }
  }
  if (!$sockerr) { 
    sockmark $replace($Sockname,socks4.server,psyBNC) !sErVer! NICK= $+ $pnick($replace($Sockname,socks4.server,psyBNC)) USER= $+ $puser($replace($Sockname,socks4.server,psyBNC)) (22)
    s4timeout 60
    set %s4time $ticks 
    .bset &bvar4 1 4 1 $gettok($longip($gettok($pserver($puser($replace($sockname,socks4.server,psyBNC))),2,58)),3,46) $gettok($longip($gettok($pserver($puser($replace($sockname,socks4.server,psyBNC))),2,58)),4,46) $replace($gettok($pserver($puser($replace($sockname,socks4.server,psyBNC))),1,58),.,$chr(32)) 0
    .sockwrite -n $sockname &bvar4 
    .bunset &bvar4 
  }
}
on 1:SOCKREAD:socks4.server*:{
  if ($sockbr) { return } 
  .sockread &bsocks4 
  sockwrite $replace($sockname,socks4.server,psyBNC) &bsocks4
  if (PING isin $bvar(&bsocks4,1,$bvar(&bsocks5,0)).text) sockwrite -n $sockname PONG $remove($gettok($bvar(&bsocks4,1,$bvar(&bsocks5,0)).text,$calc($findtok($bvar(&bsocks4,1,$bvar(&bsocks5,0)).text,PING,32)+1),32),:)
  if ($bvar(&bsocks4,2) == 90) { 
    sockwrite -n $replace($sockname,socks4.server,psyBNC) : $+ -SOCKS4 NOTICE AUTH :Connected!  $calc($ticks - %s4time) $+ ms  
    unset %s4.time 
    sockwrite -n $sockname NICK : $+ $pnick($replace($Sockname,socks4.server,psyBNC))
    sockwrite -n $sockname USER $puser($sockname)  " $+ $user.name($sockname)   $+ " " $+ $serverip $+ " : $+ $user.name($sockname) 
    sockrename $sockname server $+ $remove($sockname,socks4.,server)
    sockmark $remove($sockname,socks4.) !sErVer! NICK= $+ $pnick($replace($Sockname,socks4.server,psyBNC)) USER= $+ $puser($replace($Sockname,socks4.server,psyBNC)) (25)

  }
  if ($sock($remove($sockname,socks4.)).ip == $null) {  
    sockmark $remove($sockname,socks4.) !sErVer! NICK= $+ $pnick($replace($Sockname,socks4.server,psyBNC)) USER= $+ $puser($replace($Sockname,socks4.server,psyBNC)) (23)
  }
  if (451 == $gettok($bvar(&bsocks4,1,$bvar(&bsocks5,0)).text,2,32)) { 
    sockwrite -tn $sockname NICK : $+ $pnick($replace($Sockname,socks4.server,psyBNC))
    sockwrite -tn $Sockname USER $puser($sockname) . . : $+ $user.name($sockname) 
    sockrename $sockname server $+ $remove($sockname,socks4.,server)
    sockmark $remove($sockname,socks4.) !sErVer! NICK= $+ $pnick($replace($Sockname,socks4.server,psyBNC)) USER= $+ $puser($replace($Sockname,socks4.server,psyBNC)) (25)
  }
}
on *:SOCKREAD:server*:{ 
  sockread %server 
  tokenize 32 %server 
  if (*Error* iswm $1) {
    noticeauth psyBNC $+ $remove($sockname,server) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,server)) got disconnected from server. (From $pserver($puser(psyBNC $+ $remove($sockname,server))) $+ ) Reason: $2-
    set -u1 %error yes
    halt
  }
  if (*NOTICE AUTH* iswm $1-3) && (!%notice) {
    set -u5 %notice yes
    .timer*timeout* $+ $remove($sockname,socks5.,server,psyBNC) $+ * off
    sockwrite -n $sockname NICK  : $+ $pnick($replace($sockname,server,psyBNC)) 
    sockwrite -n $sockname USER $puser($sockname)  "." "." : $+ $user.name($sockname) 
    %socknamenew = $check(sockname,$replace($sockname,server,psyBNC)) $+ _ $+ $r(0,9999)
    if (!$sock(server $+ $remove(%socknamenew,socks5.,server,psyBNC,$gettok(%socknamenew,2,95),_))) sockrename $sockname server $+ $remove(%socknamenew,socks5.,server,psyBNC,$gettok(%socknamenew,2,95),_)
    sockmark $remove(%socknamenew,socks5.,server,psyBNC,$gettok(%socknamenew,2,95),_) !sErVer! NICK= $+ $pnick($replace($Sockname,socks5.server,psyBNC)) USER= $+ $puser($replace($Sockname,socks5.server,psyBNC)) (225) 
  }
  if (404 == $gettok(%server,2,32)) { sockwrite -n $sockname JOIN $gettok(%server,4,32) } 
  if (PING == $gettok(%server,1,32)) { sockwrite -n $sockname PONG $gettok(%server,2,32) | halt }
  if (serverserver isin $sockname) { sockrename $sockname server $+ $remove($sockname,server) }
  if ($pnick($sockname) isin $1) || ($check(awaynick,$replace($sockname,server,psyBNC)) isin $1) && ($2 == NICK) { psy.nick $remove($3,:) server }
  if (001 == $gettok(%server,2,32)) noticeauth psyBNC $+ $remove($sockname,server) $date $time :User $puser($sockname) () connected to $remove($1,:) ()
  if (005 == $gettok(%server,2,32)) && (CHANTYPES=# isin $gettok(%server,2-,32)) { sockwrite -n $replace($sockname,server,psyBNC) $replace($gettok(%server,1-,32),CHANTYPES=#,CHANTYPES=#&) | halt }
  if (00* iswm $gettok(%server,2,32)) { write $log.dir $+ $puser($sockname) $+ .Welcome  $replace($1-,CHANTYPES=#,CHANTYPES=#&) | if (001 == $2) { if ($isfile($welcome)) .remove $welcome |  psy.nick $gettok($wildtok($3-,*!*@*,1,32),1,33) server } }
  if ($sock(psyBNC $+ $remove($sockname,server)).ip == $null) {
    if (PRIVMSG == $2) || (NOTICE == $2) {
      if ($3 == $pnick($sockname)) || ($3 == $check(AWAYNICK,$sockname)) {
        write $ppm $+ $puser($sockname) $+ .ppm :-psyBNC!psyBNC@Lam3rz.de $2-3 $date $time < $+ $remove($gettok($1,1,33),:) $+ > $4-
      }
      if ($chr(35) isin $3 ) {
        write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de $2-3 $date $time < $+ $remove($gettok($1,1,33),:) $+ > $4-
      }
    }
    if (JOIN == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 3 $+ $remove($1,:) Joined $remove($3,:)  }
    if (PART == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 4 $+ $remove($gettok($1,1,33),:) Left $remove($3,:) $remove($4-,:) }
    if (NICK == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 3 $+ $remove($gettok($1,1,33),:) Is also known as $remove($3,:) }
    if (QUIT == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 14 $+ $remove($gettok($1,1,33),:) Quit ( $+ $remove($3-,:) $+ ) }
    if (KICK == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 3 $+ $remove($gettok($1,1,33),:) Kicked $remove($4,:) ( $+ $remove($5-,:) $+ ) }
    if (MODE == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 3 $+ $remove($gettok($1,1,33),:) MODE $remove($4,:) $remove($5-,:) }
    if (TOPIC == $2) { write $ppm $+ $puser($sockname) $+ .ppc :-psyBNC!psyBNC@Lam3rz.de PRIVMSG $remove($3,:) : $+ $date $time 3 $+ $remove($gettok($1,1,33),:) TOPIC $remove($4,:) $remove($5-,:) }
  }
  if (319 == $gettok(%server,2,32)) && ($pnick($sockname) isin $4) && (%psyBNC.offline != $null) { writeini $userfile $puser($sockname) CHANNELS $remove($replace($5-,$chr(32),$chr(44)),:,@,+) | unset %psybnc.offline }
  if (303 != $gettok(%server,2,32)) && (372 != $gettok(%server,2,32)) { ;write $log.dir $+ $puser($sockname) $+ $replace($date,/,-) $+ .log $timestamp $1- }
  if (JOIN == $2) && ($pnick($sockname) isin $1) { if ($sock(psyBNC $+ $remove($sockname,server)).name) { sockwrite -n psyBNC $+ $remove($sockname,server) : $+ $pnick($sockname) JOIN $3 | writeini $userfile $puser($sockname) CHANNELS $addtok($check(CHANNELS,$sockname),$remove($3,:),44) } }
  if (PART == $2) && ($pnick($sockname) isin $1) { if ($sock(psyBNC $+ $remove($sockname,server)).name) { sockwrite -n psyBNC $+ $remove($sockname,server) : $+ $pnick($sockname) PART $3 | writeini $userfile $puser($SOCKNAME) CHANNELS $deltok($check(CHANNELS,$sockname),$findtok($check(CHANNELS,$sockname),$remove($3,:),1,44),44) } }
  if ($sock(psyBNC $+ $remove($sockname,server)).ip != $null) sockwrite -n psyBNC $+ $remove($sockname,server) $+ * $1- 
  ;if (-a !isin $sockname) msg %fldchan $sockname $1-
}
on 1:SOCKWRITE:psyBNC*:{
  if ($sockerr > 0) { return } 
  if ($sock($replace($sockname,psyBNC,proxy.server)).name != $null) .sockmark $replace($sockname,psyBNC,proxy.server) $sock($sockname).mark (28)
  if ($sock($replace($sockname,psyBNC,server)).name != $null) .sockmark $replace($sockname,psyBNC,server) $sock($sockname).mark (29)
}
on *:SOCKLISTEN:psyBNC*:{
  if ($sockerr > 0) { return } 
  set %temp $rand(1,9999) 
  sockaccept psyBNC $+ %temp 
  if ($sock(psyBNC*,0).name > $calc($psy.maxuser +1)) { sockwrite -n psyBNC $+ %temp ERROR :This Server Is Full. | .timer $+ psyBNC $+ %temp 1 3 sockclose psyBNC $+ %temp | halt } 
  if ($read($psybanlist,w,* $+ $sock(psyBNC $+ %temp).ip $+ *)) { sockwrite -n psyBNC $+ %temp ERROR :You Are Banned. ( $+ $gettok($v1,2-,32) $+ ) | .timer $+ psyBNC $+ %temp 1 60 sockclose psyBNC $+ %temp | halt } 
  sockmark psyBNC $+ %temp !connect!
  unset %psybnc.user.*
}
on 1:SOCKCLOSE:psyBNC*:{
  if (!%quitted) psyBNC $sockname GETOFFLINE $puser($sockname)
}
alias psy.nick {
  if ($pnick($sockname) === $1) goto dafuq
  .writeini $userfile $puser($sockname) CURRENTNICK $1
  .write -l1 $partyline $replace($read($partyline),$pnick($sockname),$1)
  .sockwrite -n psyBNC* : $+ $pnick($sockname) $+ ! $+ $puser($sockname) $+ @* NICK : $+ $1
  .write -l1 $welcome $gettok($read($welcome,2),1,32) 001 $iif($check(awaynick,$sockname),$v1,$pnick($sockname)) :Welcome to the Internet Relay Network $iif($check(awaynick,$sockname),$v1,$pnick($sockname))
  if ($sock($check(sockname,psybnc $+ $remove($sockname,$2))).name) { sockmark $v1 !SerVer! USER= $+ $puser($sockname)  NICK= $+ $1 (psy.nick) }
  :dafuq
}
alias welcome.nick { return $gettok($wildtok($read($welcome,1),*!*@*,1,32),1,33) }
on 1:SOCKCLOSE:SERVER*:{ 
  if ($isfile($log.dir $+ $puser($sockname) $+ .Welcome) == $true) .remove $log.dir $+ $puser($sockname) $+ .Welcome
  if ($check(CHANNELS,$sockname)) { remini $userfile $puser($sockname) CHANNELS }
  if ($SOCK(psyBNC $+ $remove($sockname,server)).IP == $NULL) { 
  }
  if ($SOCK(psyBNC $+ $remove($sockname,server)).IP != $NULL) {
    .sockmark psyBNC $+ $remove($sockname,server) !AUTH! NICK= $+ $pnick(psyBNC $+ $remove($sockname,server,socks4.,socks5.)) USER= $+ $puser(psyBNC $+ $remove($sockname,server,socks4.,socks5.)) (33)
    if (!%error) noticeauth psyBNC $+ $remove($sockname,server,socks4.,socks5.) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,server,socks4.,socks5.)) got disconnected from server.
    if (%psyBNC.BDISCONNECT == on) { halt }
    .timer $+ psyBNC $+ $remove($sockname,server,socks4.,socks5.) $+ .BCONNECT 1 20 psyBNC psyBNC $+ $remove($sockname,server,socks4.,socks5.) BCONNECT $pserver($puser(psyBNC $+ $remove($sockname,server,socks4.,socks5.)))
  }
  :END
  sockclose $sockname
}
on 1:SOCKCLOSE:PROXY.SERVER*:{ 
  if ($SOCK(psyBNC $+ $remove($sockname,proxy.server)).name) {
    .sockmark psyBNC $+ $remove($sockname,proxy.server) !AUTH! NICK= $+ $pnick(psyBNC $+ $remove($sockname,proxy.server)) USER= $+ $puser(psyBNC $+ $remove($sockname,proxy.server)) (34)
    .noticeauth $remove($sockname,proxy.server) $+ * $date $time :User $puser(psyBNC $+ $remove($sockname,proxy.server)) got disconnected from server.
    sockclose $sockname
    sockclose $remove($sockname,proxy.)
    .timer $+ psyBNC $+ $remove($sockname,proxy.server) $+ .BCONNECT 1 20 psyBNC psyBNC $+ $remove($sockname,proxy.server) BCONNECT $pserver($puser(psyBNC $+ $remove($sockname,proxy.server)))
  }
  if ($SOCK(psyBNC $+ $remove($sockname,proxy.server)).IP == $NULL) {
  }
}
;;;;;;;;;;;;;;;;;;;ALIAS;;;;;;;;;;;;;;;;;;;;;;;;
alias psyencrypt {
  %psy.ec = $1
  if (%psy.ec == localhost) %psy.ec = 127.0.0.1
  return $base($longip(%psy.ec),10,36) $+ . $+ $iif(%psy.name,%psy.name,$psyBNC_Name) $+ .IP
}
alias psybanlist return system\script\psyBNC\BANS.txt
alias psy.encrypt { return %encryptIP }
alias psy.maxuser { return %psy.maxuser }
alias setmaxusers { :lol | set %psy.maxuser $$?="Please enter numerical value" | if (!$$!) || ($$! !isnum) goto lol }
alias setpsyname { :loli | set %psy.name $?="Define a name (used for linking)" | if (!$$!) || ($$! !isalnum) goto loli }
alias psy.name return %psy.name

alias listen.bouncer { 
  psybnc start $iif(%psybnc.port == $null,13337,%psybnc.port)
}
alias p.error {
  if ($2 == 1) { noticeauth $1 $+ * No port given. Syntax is ADDSERVER ip:port | halt }
  if ($2 == 2) { noticeauth $1 $+ * No server given. Syntax is ADDSERVER ip:port | halt  }
  if ($2 == 3) { noticeauth $1 $+ * Syntax Error. Syntax is MADMIN user }
  if ($2 == 4) { noticeauth $1 $+ * Username already in use, choose another. }
  if ($2 == ALREADY_EXISTS) { noticeauth $1 $+ * Already an administrator. }
  if ($2 == 5) { noticeauth $1 $+ * No username given. Syntax is ADDUSER ident :username }
  if ($2 == 6) { noticeauth $1 $+ * No ident given. Syntax is ADDUSER ident :username }
  if ($2 == 7) { noticeauth $1 $+ * Username in use, choose another. }
  if ($2 == 8) { noticeauth $1 $+ * No username given. Syntax is ADDUSER ident :username }
  if ($2 == nosyntax) { noticeauth $1 $+ * Syntax Error. Syntax is SETUSERNAME (username). | halt }
  if ($2 == ERROR_FORMAT) { noticeauth $1 $+ * Syntax Error. Syntax is BCONNECT ( $+ $chr(35) or ip:port) }
  if ($2 == pnonamespecified) { noticeauth $1 $+ * No Name given. Use NAMEBOUNCER name.  }
  if ($2 == pnameillegal) { noticeauth $1 $+ * Name illegal, use only alpha numerical values.  }
  if ($2 == plinkerrhost) { noticeauth $1 $+ * No Host given. Use LINKTO name :host:port.  }
  if ($2 == plinkerrport) { noticeauth $1 $+ * No Port given. Use LINKTO name :host:port.  }
  if ($2 == plinkerrname) { noticeauth $1 $+ * No Name given. Use LINKTO name :host:port.  }
  if ($2 == p.linkerrhost) { noticeauth $1 $+ * No Host given. Use LINKFROM name :host:port.  }
  if ($2 == p.linkerrport) { noticeauth $1 $+ * No Port given. Use LINKFROM name :host:port.  }
  if ($2 == p.linkerrname) { noticeauth $1 $+ * No Name given. Use LINKFROM name :host:port.  }
  if ($2 == plinkerrdup) { noticeauth $1 $+ * Duplicated entry found, select another name. | halt  }
  if ($2 == ALREADY_CONNECTED) { noticeauth $1 $+ * You are still connected. }
  if ($2 == 9) { noticeauth $1 $+ * Syntax Error. Syntax is BKILL user reason  }
  if ($2 == 10) { noticeauth $1 $+ * No kill reason given. Syntax is BKILL user reason }
  if ($2 == NO_USER) { sockwrite -n $1 401 $pnick($1) -psyBNC ERROR: No such user $3 $+ . | sockwrite -n $1 401 $pnick($1) $3 ERROR: $3 not online. }
  if ($2 == NO_USER2kill) { noticeauth $1 He isnt online. Why killing a dead?. | halt }
  if ($2 = NO_ADMIN) { noticeauth $1 $+ * User specified is not an admin. }
  if ($2 == 13) { noticeauth $1 $+ * Syntax Error. Syntax is BNOTICE user message }
  if ($2 == 14) { noticeauth $1 $+ * No text given. Syntax is BNOTICE user message }
  if ($2 == 15) { noticeauth $1 $+ * Syntax Error. Syntax is PROXY (0/1/ip:port) [s4/s5/proxy]  }
  if ($2 == NO_LOG) { noticeauth $1 $+ * Specified log does not exist. }
  if ($2 = 18) { noticeauth $1 $+ * Syntax Error (1)  }
  if ($2 = 20) { noticeauth $1 $+ * Syntax Error (2)  }
  if ($2 = 19) { noticeauth $1 $+ * Syntax Error Invalid password .  }
  if ($2 = 232) { noticeauth $1 $+ * There's nothing to delete. | HALT }
  if ($2 = ADMIN_NEEDED) { noticeauth $1 $+ * GLOBAL needs admin flag to use.   }
  if ($2 = NO_SERV_SET) { noticeauth $1 $date $time :User $puser($1) () has no server added | halt }
}
alias psyBNC.sock { 
  set %psyBNC.sock.max $ini($userfile,0)
  :START
  inc %psybnc.sock.inc 
  if (%psyBNC.sock.inc > %psyBNC.sock.max) { goto END }
  if ($check(offline,$ini($userfile,%psybnc.sock.inc),u) == yes) {
    set %psyBNC.sock.server $pserver($ini($userfile,%psybnc.sock.inc))
    psyBNC $usersock($ini($userfile,%psybnc.sock.inc)) BCONNECT $pserver($ini($userfile,%psybnc.sock.inc))
    goto start
  }
  :END
  unset %psyBNC.sock*
  halt
}
alias check { if ($3 == $null) return $readini($userfile,$remove($matchtok($sock($2).mark,USER=,1,32),USER=),$1) | if ($3 == u) return $readini($userfile,$2,$1) }
alias puser { return $remove($matchtok($sock($1).mark,USER=,1,32),USER=) }
alias pnick { return $iif(!$remove($matchtok($sock($1).mark,NICK=,1,32),NICK=),$check(Currentnick,$1),$remove($matchtok($sock($1).mark,NICK=,1,32),NICK=)) }
alias noticeauth { if ($sock($1).name) sockwrite -n $1 : $+ -psyBNC!psyBNC@Lam3rz.de PRIVMSG * : $+ $2- }

alias psy.priv { return $iif($check(ADMIN,$1,u) == yes,ADMIN,USER) }
alias msgauth { sockwrite -n $1 : $+ -psyBNC!psyBNC@Lam3rz.de PRIVMSG *: $+ $2- }
alias socket.join.channels {
  if ($1 == $null) { halt }
  set %socket.chan.total $numtok($check(CHANNELS,$1,u),44)
  :START
  inc %socket.chan.tok 
  if (%socket.chan.tok > %socket.chan.total) { goto end }
  sockwrite -n $replace($usersock($1),psybnc,server)  $+ * JOIN $gettok($check(CHANNELS,$1,u),%socket.chan.tok,44)
  sockwrite -n $usersock($1) $+ * : $+ $pnick($replace($usersock($1),psyBNC,server)) $+ ! $+ $puser($usersock($1)) $+ @ $+ $sock($usersock($1)).ip JOIN : $+ $gettok($check(CHANNELS,$1,u),%socket.chan.tok,44)
  sockwrite -n $replace($usersock($1),psybnc,server)  $+ * NAMES $gettok($check(CHANNELS,$1,u),%socket.chan.tok,44)
  sockwrite -n $replace($usersock($1),psybnc,server)  $+ * TOPIC $gettok($check(CHANNELS,$1,u),%socket.chan.tok,44)
  goto START 
  :END
  unset %socket.chan*
}
alias pserver {
  .remove $psydir $+ temp.txt
  write $psydir $+ temp.txt $readini($userfile,$1,server1)
  write $psydir $+ temp.txt $readini($userfile,$1,server2)
  write $psydir $+ temp.txt $readini($userfile,$1,server3)
  write $psydir $+ temp.txt $readini($userfile,$1,server4)
  write $psydir $+ temp.txt $readini($userfile,$1,server5)
  :read
  if ($read($psydir $+ temp.txt) == $null) { return $def.s $+ : $+ %def.p | return }
  if ($read($psydir $+ temp.txt) == none) { return $def.s $+ : $+ %def.p | return }
  :return
  return $read($psydir $+ temp.txt)
}
alias openpsybncsocks {
  set %psyBNC.users $ini($userfile,0)
  :START
  inc %psybnc.users.inc 
  if (%psyBNC.users.inc > %psyBNC.users) { goto end }
  if ($sock($replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,*)).name != $null) { goto start }
  if ($check(sockname,$ini($userfile,%psyBNC.users.inc),u) == $null) { goto START }
  if ($check(CURRENTNICK,$ini($userfile,%psyBNC.users.inc),u) == $null) { goto START }
  if ($check(bproxy,$ini($userfile,%psyBNC.users.inc),u) == ON) { sockopen $replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,proxy.server) $proxy | sockmark $replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,proxy.server) !SERVER! USER= $+ $ini($userfile,%psyBNC.users.inc) NICK= $+ $check(currentnick,$ini($userfile,%psyBNC.users.inc),u) (35) }
  if (*.*.* iswm $check(bproxy,$ini($userfile,%psyBNC.users.inc),u)) { sockopen $replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,proxy.server) $check(bproxy,$ini($userfile,%psyBNC.users.inc),u) | sockmark $replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,proxy.server) !SERVER! USER= $+ $ini($userfile,%psyBNC.users.inc) NICK= $+ $check(CURRENTNICK,$ini($userfile,%psyBNC.users.inc),u) (36) }
  elseif (!$check(bproxy,$ini($userfile,%psyBNC.users.inc),u)) { sockopen $replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,server) $replace($pserver($ini($userfile,%psyBNC.users.inc)),:,$chr(32)) | sockmark $replace($check(sockname,$ini($userfile,%psyBNC.users.inc),u),psyBNC,server) !SERVER! USER= $+ $ini($userfile,%psyBNC.users.inc) NICK= $+ $check(CURRENTNICK,$ini($userfile,%psyBNC.users.inc),u) (37) }
  goto START
  :END
  unset %psyBNC.users*
} 
alias ssww1 { if ($sock($1).name != $null) sockwrite -n $1 $2- }
alias proxy { 
  :R
  set %randomnumber $r(1,3)
  if (%randomnumber = 1) && ($isfile(sock4.txt)) {
    :S4
    inc %p.incs4
    set %p.maxs4 $lines(sock4.txt)
    set %s4 $replace($read(sock4.txt,%p.incs4),:,$chr(32))
    if (%p.incs4 >= %p.maxs4) { unset %p.incs4 | goto s4 }
    return %s4 s4
  }
  if (!isfile(sock4.txt)) && (%randomnumber == 1) goto r
  if (%randomnumber = 2) && ($isfile(sock5.txt))  {
    :S5
    inc %p.incs5
    set %p.maxs5 $lines(sock5.txt)
    set %s5 $replace($read(sock5.txt,%p.incs5),:,$chr(32))
    if (%p.incs5 >= %p.maxs5) { unset %p.incs5 | goto s5 }
    return %s5 s5
  }
  if (!isfile(sock5.txt)) && (%randomnumber == 2) goto r
  if (%randomnumber = 3)  && ($isfile($pxy)) {
    :PROXY
    inc %p.inc
    set %p.max $lines($pxy)
    set %pxy $replace($read($pxy,%p.inc),:,$chr(32))
    if (%p.inc >= %p.max) { unset %p.inc | goto PROXY }
    return %pxy pxy
  }
}
alias tell { if ($sock($sockname).ip != $null) sockwrite -n $sockname $1- | else echo -a $1- }
alias phadd { hadd psyBNC $1- | return $1- }
alias usersock { return $readini($userfile,$1,sockname) }
alias pbfile return $log.dir $+ $remove($1,server,psyBNC) $+ .log
alias welcome { return $log.dir $+ $puser($sockname) $+ .welcome }
alias spaces return $+ $str($chr(32) $cr,$calc($1 -1)) $+
on 1:EXIT:.remove $partyline
alias logo return psyBNC2.3.2-4

Comments

Sign in to comment.
s3b   -  Mar 23, 2014

http://searchirc.com/boards/irc-8091.html

What are your comments with regards to these allegations against your name and script?

independentt  -  Apr 10, 2014

can say I have time to update the script now

Sign in to comment

independentt   -  Feb 08, 2010

thanks

 Respond  
FordLawnmower   -  Feb 07, 2010

I think it broke because I had to update some scripts that used it. If so you can find that alias in this script -->> http://www.hawkee.com/snippet/6029/
The alias in this script -->> http://www.hawkee.com/snippet/6925/ <<-- is a lot smoother and faster. It's alias name is autotrans and the syntax is a little different but it uses the google api so it's faster.

 Respond  
independentt   -  Feb 07, 2010

i think it does that'S why i put in it so i can use addtranslate with it, i tested it once and i think it's still working

 Respond  
FordLawnmower   -  Feb 07, 2010

I see my old Google translator alias at the bottom of the script.
Does that code still work?

 Respond  
independentt   -  Feb 07, 2010

im not done with it im actually writing it and pasting the code here till i finish it, improving it everydays.

 Respond  
Flux   -  Jan 10, 2010

How to do this thinG??? can u explain how to do this psyBnc sir??

 Respond  
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.