/awaypop {
  if ($window(@AWAY_STATUS) != $null) { /window -ro @AWAY_STATUS | halt }
  window -aro @AWAY_STATUS 0 0 350 150 
  aline @AWAY_STATUS 1,8  !  16,12 AWAY  $+ %logo2 16,12F6 is Back
  .timer888 0 1 /away-update
  aline @AWAY_STATUS 12LOGGER:12 %away.log  
  aline @AWAY_STATUS 12Pager:12 %Pager
  aline @AWAY_STATUS 12IDLE:12 $duration($idle)
  aline @AWAY_STATUS 12AWAY_MSG:12 %reason 
  if (%away.log == on) aline @AWAY_STATUS 12MESSAGES:12 %msgs
}
/awaypop2 {
  if ($window(@AWAY_STATUS2) != $null) { /window -ro @AWAY_STATUS2 | halt }
  window -aro @AWAY_STATUS2 0 151 640 300 
}

/away-update {
  if $window(@AWAY_STATUS) == $null { echo -a 1,8  !  16,14 AWAY STATUS CLOSED    | .timer888 off | halt }
  {
    rline @AWAY_STATUS 1 1,8  !  16,12 AWAY  $+ %logo2 16,12F6 is Back
    rline @AWAY_STATUS 2 12LOGGER:12 %away.log  
    rline @AWAY_STATUS 3 12Pager:12 %Pager
    rline @AWAY_STATUS 4 12IDLE:12 $duration($idle)
    rline @AWAY_STATUS 5 12AWAY_MSG:12 %reason 
  if (%away.log == on) rline @AWAY_STATUS 6 12MESSAGES:4 %msgs }
}
awaylog {
  if ( %away.log == on ) { .enable #record }
}  

autoaway {
  if (%auto.away != On) { halt }
  if ($away) { halt }
  if ($idle > %auto.away.idle.time) { /naway $duration( %auto.away.idle.time )  Auto Away Starting  }
}

naway {
  if (%away == Yes) { echo 2 -a * You are already set away - [ $+ %reason $+ ] | halt }
  if ($1 == $null) { set %reason $$?="Why are you away?" }
  else { set %reason $1 }
  blast $mircdir $+ syssnd\away.wav  
  .timer29 off
  .disable #back
  .set %tf1 %f1
  .set %f1 1
  .set %awaytime $ctime
  .set %quietaway No
  .set %current.time $time
  .set %f6 2  
  .set %taway Away
  /title
  ;write -c $mircdir $+ data\away.txt 
  awaypop 
  awaypop2
  awaylog
  if (%
  .obj5 == $true) { set %aanick $me | /nick $me $+ %vaway.obj6 }
  .set %away Yes | /set %stime $time
  .timer55 0 1 .inc %gone.sec 1
  .timer56 0 60 .inc %gone.min 1  
  .timer57 0 60 .set %gone.sec 0
  .timer58 0 3600 .inc %gone.hours 1  
  .timer59 0 3600 .set %gone.min 0
  .timer60 0 86400 .inc %gone.day 1  
  .timer61 0 86400 .set %gone.hours 0
  .timer 1 5 /.enable #back
  if ($1 == $null) { 
    /ame away: 4(10 $+ %reason $+ 4)12 at : $+ 4 $time12 $+ : (p/ $+ %Pager $+ ) %logo
    /away - : [ $+ %current.time $+ ] - Msg: [ $+ %reason $+ ] 
  }
  else { 
    set %reason $strip(*1)
    /ame away: 4(10 $+ %reason $+ 4)12 at : $+ 4 $time12 $+ : (p/ $+ %Pager $+ ) %logo
    /away - Away: [ $+ %current.time $+ ] - Msg: [ $+ %reason $+ ] %logo
  }
}

nback {
  set %sback No
  set %away No
  set %taway Not Away
  /resetidle
  /title
  if (%vaway.obj5 == $true) { /nick %aanick | unset %aanick }
  blast $mircdir $+ syssnd\off.wav
  if (%auto.away != Off) { .timer29 0 10 /autoaway }
  .disable #back
  .disable #record
  set %f1 %tf1
  window -c @AWAY_STATUS2
  window -c @AWAY_STATUS
  if (%messages == no) { echo -a 16,4 AWAY LOG  | echo -a 12 Awayken gelen mesajlar kaydedilmesin. } 
  ; if (%messages == yes) { echo -a 16,12 AWAY LOG  You have received: 16,4 %msgs  | echo -a  Now Viewing Log...  | set %messages No | set %msgs 0 | log2  }  
  if (%messages == yes) { set %messages No | set %msgs 0  }  
  away
}

saway {
  if (%away == Yes) { echo 2 -a * You are already set away - [ $+ %reason $+ ] | halt }
  set %reason $$?="Why are you away?"
  set %awaytime $ctime
  set %current.time $time
  set %quietaway Yes
  set %away Yes
  .set %taway Away
  if (%vaway.obj5 == $true) { set %aanick $me | /nick $me $+ %vaway.obj6  }
  .timer55 0 1 .inc %gone.sec 1
  .timer56 0 60 .inc %gone.min 1  
  .timer57 0 60 .set %gone.sec 0
  .timer58 0 3600 .inc %gone.hours 1  
  .timer59 0 3600 .set %gone.min 0
  .timer60 0 86400 .inc %gone.day 1  
  .timer61 0 86400 .set %gone.hours 0
  if *1 == $null { away - Away Since: [ %current.time ] - Msg: [ %reason ] - Pager: [ %pager ] }
  else { set %reason *1 | away - Since: [ %current.time ] - [ %reason ] - Page: [ %pager ] }
  /title
}

sback {
  window -c @AwayPageMessages
  set %away No
  .set %taway Not Away
  set %sback Yes
  if (%vaway.obj5 == $true) { /nick %aanick | unset %aanick }
  away
  /title
}

away {
  if (*1 != $null) { set %awayt $time | .timer1212 off | set %awaytime $ctime | set %awaymsg *1 | away *1 }
  if (*1 == $null) {
    away
    if (%sback == Yes) { 
      echo 1 -a :i: set back, away for : $+ %gone.hours hrs %gone.min min %gone.sec secs:
      goto end
    } 
    elseif (%quietaway == No) {    
      if (%gone.min == 0) {
        /ame back: stoned for : $+ 4 %gone.sec secs ; %logo
        goto end
      }
      if (%gone.hours == 0) {
        /ame back: stoned for : $+ 4 %gone.min min %gone.sec secs; %logo
        goto end
      }
      else {
        /ame back: stoned for : $+ 4 %gone.hours hrs %gone.min min %gone.sec secs; %logo
      }
    }
    :end
    .set %sback No
    .set %quietaway No
    .set %gone.sec 0
    .set %gone.min 0
    .set %gone.hours 0
    .set %gone.day 0
    .timer55 off
    .timer56 off
    .timer57 off
    .timer58 off
    .timer59 off
    .timer60 off
    .timer61 off
  }
  .unset %awaymsg
  set %away No
  halt
}

/pager {
  if $1 == $null {
    echo 1 -a * Pager Syntax: /pager <on/off>
  }
  if $1 == on { %Pager = On | echo 1 -a :-: pager enabled }
  if $1 == off { %Pager = Off | echo 1 -a :-: pager disabled }
}
nbackx {
  set %sback No
  set %away No
  set %taway Not Away
  set %msgs 0
  /resetidle
  /title
  if (%auto.away != Off) { .timer29 0 10 /autoaway }
  .disable #back
  .disable #record
  set %f1 %tf1
}
