/*
 *  playdough away module by BlackJac (blackjac@geeks.org)
 *  original code by BlackJac: away.irc
 *  mods for playdough by fudd
 */

  # Where appropriate, 0 means off/no, 1 means on/yes.

  @ back.channels = 0
  @ back.notify = 0

alias away if (!A) {
    $(K)$(K)away ${[$0] ? [$*] : default_away_reason}
    ^umode $away_usermodes
}

on #-kick 368 '$N *' if (A && extra_away_logging) {
    @ kick.nick = [$1] ;@ kick.channel = [$2] ;@ kick.reason = [$3-]
    ^on ^302 * {
	^local kick_log
	@ kick_log = open($msglog_file W T)
	@ write($kick_log [KICK    ] [$Z] - Kicked by $kick.nick \($3@$4\) from $kick.channel\: $kick.reason)
	@ close($kick_log)
    }
    @ kick.nick = kick.channel = kick.reason = [];^on 302 -*
    quote userhost $1
}
on #-ar_public 368 * if (A && extra_away_logging) {
    ^local ar_public_log
    @ ar_public_log = open($msglog_file W T)
    @ write($ar_public_log [AUTO_RES] [$Z] - <$0:$1> $2-)
    @ close($ar_public_log)
}
on #-ar_public_other 368 * if (A && extra_away_logging) {
    ^local ar_public_other_log
    @ ar_public_other_log = open($msglog_file W T)
    @ write($ar_public_other_log [AUTO_RES] [$Z] - <$0:$1> $2-)
    @ close($ar_public_other_log)
}
on #-server_notice 368 '% *** Notice -- Received KILL message for *$N*' if (A && extra_away_logging) {
    ^local server_notice_kill_log
    @ server_notice_kill_log = open($msglog_file W T)
    @ write($server_notice_kill_log [KILL    ] [$Z] - Killed by $10 for: $13-)
    @ close($server_notice_kill_log)
}

alias back if (A) {
    if (back.notify) {notify}
    if (back.channels) {
	eval echo $G Current channels: $mychannels()
    }
    ^local _back.reason
    @ _back.reason = [$0] ? [$*] : default_back_reason
    ^fset FORMAT_BACK has returned: $_back.reason [Gone \$1 hr$fix.pl($1) \$2 min$fix.pl($2) \$3 sec$fix.pl($3)]
    $(K)$(K)back
    ^umode $back_usermodes
}
