on *:INPUT:#,?:{ away.system.auto }
on *:CONNECT:{ if (!$timer(.Auto.Away) { .timer -oi .Auto.Away 0 1 away.system.auto } }
alias away.system.auto {
var %x = $scon(0)
while ($scon(%x)) {
if ($scon(%x).status == Connected) { inc %Away.Connection.Check }
dec %x
}
if (!%Away.Connection.Check) {
.timer.Auto.Away off
}
else {
if (!$timer(.Auto.Away)) { .timer -oi .Auto.Away 0 1 away.system.auto }
scon -a if ($status == Connected && %away.system.auto == on && $idle >= %away.system.auto.check) inc %away.system.check.idle
var %x = $scon(%x)
while (%x) {
scon %x if ($status == Connected) && ($away) && (%away.system.check.idle != %Away.Connection.Check) { away $chr(124) echo -a unset }
scon %x if ($status == Connected) && (!$away) && (%away.system.check.idle == %Away.Connection.Check) { away Auto away after $duration(%away.system.auto.check,2) of idle $chr(124) echo -a unset }
dec %x
}
}
unset %Away.Connection.Check
unset %away.system.check.idle
}