Retribution V101 : Syndicate — File Browser

RetributionSyndicatev1.01 / RetributionSyndicatev1.01 / System / Syndicate / bounce.mrc

bounce.mrc — 2.77 KB — Download this file

;[----------------------------------------------------------------------]
;[	Name	: Syndicate : Retribution V101				]
;[	Support	: DefCon Industries					]
;[	Author	: Risc							]
;[									]
;[	This Code, Content, is CopyRight 1999 : DefCon Industries	]
;[	No Copying, Ripping, or calling this Code your own		]
;[									]
;[----------------------------------------------------------------------]

alias bouncesetup {
  window -al +nt @bounce_setup %bounce_setup.x %bounce_setup.y 250 110
  clear @bounce_setup
  aline @bounce_setup $str($chr(160),20) $+ $ug1 $+ $banner
  aline @bounce_setup %theme.2 $+ $str(-,100)
  aline @bounce_setup %theme.1 $+ bouncer: $+ %theme.2 $+  %bounce.switch
  aline @bounce_setup %theme.1 $+ bounce port: $+ %theme.2 $+  %bounce.port
  aline @bounce_setup %theme.1 $+ bounce server: $+ %theme.2 $+  %bounce.server
}

menu @bounce_setup {
  dclick:{
    if ($1 == 1) { beep }
    if ($1 == 2) { beep }
    if ($1 == 3) { if (%bounce.switch == on) { sockclose agi1 | set %bounce.switch off } | else { socklisten agi1 %bounce.port | set %bounce.switch on } | bouncesetup }
    if ($1 == 4) { set %bounce.port $$?="enter bounce port" | sockclose agi1 | socklisten agi1 %bounce.port | bouncesetup }
    if ($1 == 5) { set %bounce.server $$?="enter bounce server and port $cr $+ (ex: irc.klis.com 6667)" | bouncesetup }
  }
}

on 1:START:{
  if (%bounce.switch == on) { socklisten agi1 %bounce.port }
}
on 1:socklisten:agi1: {
  /set %nick 0

  if ($sock(agi).status == active) { sockaccept temp | sockwrite -nt temp 4 $+ $timestamp Bounce Server is currently occupied! | sockclose temp }
  else {
    sockaccept agi
    echo 6 -s $timestamp *** $sock(agi).ip Connected to Bounce Server
    sockopen ago %bounce.server
  }
}

on 1:sockclose:agi:{
  sockclose ago | echo 4 $+ $timestamp *** $sock(agi).ip Disconnected from Bounce Server
}

on 1:sockclose:ago:{
  sockclose agi | echo 4 $+ $timestamp *** $sock(agi).ip Disconnected from Bounce Server
}

on 1:sockopen:ago: {
  /sockwrite -n agi 4 $+ $timestamp *** Connected to Bounce Server
  /sockwrite -n ago %nick.say
  /sockwrite -n ago USER bounce "the-server" "0.0.0.0" Bounce $+ $chr(160) $+ Server 
}

on 1:sockread:agi:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp1
  if ($sockbr == 0) return
  if (%temp1 == $null) { /sockwrite -n ago | goto nextread }
  if ($left(%temp1,4) == NICK && %nick == 0) { | /set %nick 1 | set %nick.say %temp1 | goto nextread }

  if ($sock(ago).status == active) { sockwrite -n ago %temp1 }
  goto nextread
}

on 1:sockread:ago:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) { /sockwrite -n agi | goto nextread }
  /sockwrite -n agi %temp
  goto nextread
}