; --- "Away with Time" (multiserver version) ---
; ••• MENU •••
menu status,channel,query {
$iif(($awt.cons),Away with Time $iif($awt.count,$+([,away $iif(($awt.cons > 1),at $awt.count of $awt.cons),])))
.$iif($away,Turn Back,Go Away) on this network $+([,$network,$iif($away,$chr(44) gone $iif($awt.duration,$v1,$duration($awaytime,2))),]))
..$iif($away,back,away) with message : $iif($away,awt.back,awt.away)
..$iif($away,back,away) silently : $iif($away,awt.back,awt.away) silent
.$iif($away,Change Away Reason on this network $+([,$network,$chr(44) $iif($awt.reason,$strip($v1),$strip($awaymsg)),]))
..change with message : awt.change
..change silently : awt.change silent
.-
.$iif(($awt.count < $awt.cons),Go Away on all networks $+([away at $v1 of $awt.cons,]))
..away with message : awt.away.all
..away silently : awt.away.all silent
.$iif(($awt.count),Turn Back on all networks $+([away at $v1 of $awt.cons,]))
..back with message : awt.back.all
..back silently : awt.back.all silent
.$iif($away && ($awt.count > 1),Change Away Reason on all networks $+([away at $v1 of $awt.cons,])))
..change with message : awt.change.all
..change silently : awt.change.all silent
}
; ••• EVENTS •••
; "you're back"
raw 305:*: { awt.unset }
; "you're now away"
raw 306:*: if ($awt.reason) { haltdef }
on *:disconnect: { awt.unset }
; ••• ALIASES •••
; set the update delay here (N in seconds)
alias -l awt.delay { return 120 }
; go away on "current" network
alias -l awt.away {
away $$input(Enter away reason:,qeg,Set Away $iif(($1 == silent),Silently) on $network)
if ($1 == silent) { echo -agc info * You're now away. $+([,$!,$chr(15),]) }
else { ame ladies and gentlemen! have to go now... see you soon $+([,$!,$chr(15),]) }
set -e $+(%,awt.msg.,$cid) $!
set -e $+(%,awt.time.,$cid) $ctime
$+(.timer.awt.,$cid) 0 $awt.delay away $!awt.reason $chr(15) $+ - duration: $!awt.duration
}
; go away on all networks (overriding previous aways)
alias -l awt.away.all {
noop $$input(Enter away reasons:,qeg,Set Away $iif(($1 == silent),Silently) on all $awt.cons networks)
scon -at1 away $($!,0)
if ($1 == silent) { echo -agc info * You're now away on all networks. $+([,$!,$chr(15),]) }
else { scon -at1 ame ladies and gentlemen! have to go now... see you soon $!+([,$!,$chr(15),]) }
scon -at1 set -e $($+(%,awt.msg.,$cid),0) $($!,0)
scon -at1 set -e $($+(%,awt.time.,$cid),0) $ctime
scon -at1 $!+(.timer.awt.,$cid) 0 $!awt.delay away $!!awt.reason $chr(15) $+ - duration: $!!awt.duration
}
; turn back on "current" network
alias -l awt.back {
away
if ($1 == silent) { echo -agc info * You're now back. $+([,$awaymsg,$chr(15),]) }
else { ame is back from away $+([,$awaymsg,$chr(15),]) }
awt.unset
}
; turn back on all (away) networks
alias -l awt.back.all {
if ($1 == silent) { echo -agc info * You're now back on all networks. }
else { scon -at1 if ($away) ame is back from away $!+([,$awaymsg,$chr(15),]) }
scon -at1 if ($away) awt.unset
scon -at1 if ($away) away
}
; change away reason of "current" network
alias -l awt.change {
away $$input(Enter new away reason:,qeg,Change Away Reason $iif(($1 == silent),Silently) on $network,$awt.reason) $&
$iif(($awt.duration),$chr(15) $+ - duration: $awt.duration)
if ($1 == silent) { echo -agc info * Away reason changed. $+([,$!,$chr(15),]) }
else { ame is away: $+([,$!,$chr(15),]) }
set -e $+(%,awt.msg.,$cid) $!
if (!$timer($+(.awt.,$cid))) {
set -e $+(%,awt.time.,$cid) $ctime
$+(.timer.awt.,$cid) 0 $awt.delay away $!awt.reason $chr(15) $+ - duration: $!awt.duration
}
}
; change away reason of all away networks (overriding previous aways)
alias -l awt.change.all {
noop $$input(Enter new away reason:,qeg,Change Away Reasons $iif(($1 == silent),Silently) on $awt.count of $awt.cons networks)
scon -at1 if ($away) away $($!,0) $!iif(($awt.duration),$chr(15) $!+ - duration: $!awt.duration)
if ($1 == silent) { echo -agc info * Away resons changed on the $awt.count of $awt.cons networks you're away at. $+([,$!,$chr(15),]) }
else { scon -at1 if ($away) ame is away: $!+([,$!,$chr(15),]) }
scon -at1 set -e $($+(%,awt.msg.,$cid),0) $($!,0)
scon -at1 if (!$timer($+(.awt.,$cid))) set -e $($+(%,awt.time.,$cid),0) $ctime
scon -at1 if (!$timer($+(.awt.,$cid))) $!+(.timer.awt.,$cid) 0 $!awt.delay away $!!awt.reason $chr(15) $+ - duration: $!!awt.duration
}
; stop update and unset stored data (manual back/back via script/disconnect)
alias -l awt.unset {
$+(.timer.awt.,$cid) off
unset $+(%,awt.*.,$cid)
}
; return away reason for "current" connection
alias -l awt.reason { return $($+(%,awt.msg.,$cid),2) }
; return away time for "current" connection (not resetting if changing away reason)
alias -l awt.duration {
if $($+(%,awt.time.,$cid),2) { return $duration($calc($ctime - $v1),2) }
}
; return total connected connections
alias -l awt.cons {
var %n = 0
scon -at1 inc % $+ n
return %n
}
; return total connections you're away at
alias -l awt.count {
var %n = 0
scon -at1 if ($away) inc % $+ n
return %n
}