All pastes #885585 Raw Edit

Away script for IRC

public text v1 · immutable
#885585 ·published 2008-01-30 23:57 UTC
rendered paste body
alias b { return $+($chr(2),$1-,$chr(2)) }
alias afk {
  set %afk.reason $1- | set %afk.time $ctime | set %afk.msg.total 0 | away $1-
  ame is now AFK: $b($1-) [Left at $time $+ ]
}
alias back {
  if (%afk.reason) {
    ame is now back from AFK: $b(%afk.reason) [Gone for $duration($calc($ctime - %afk.time)) $+ ]
    if (%afk.msg.total == 0) { echo -a There are $b(0) messages recorded in your away box. }
    else {
      echo -a There are $b(%afk.msg.total) messages recorded in your away box.
      var %afk.x = 1
      while (%afk.x <= %afk.msg.total) {
        tokenize 32 $($+(%,afk.msg.,%afk.x),2)
        echo -a Message $b(%afk.x) from $b($1) in $b($2) $+ : $3-
        inc %afk.x
      }
      echo -a End of messages.
    }
    unset %afk.* | away
  }
}
on *:INPUT:#: { if ($readini($mircini,text,commandchar) != $left($1,1)) { back } }