This snippet logs the private messages and highlights while you're away.
To be in a away mode you have to write /away and to return from the away mode you just need to write /away.
When someone mentions your nick or pm's you, the snippet will inform the user that you are away.
The snippet has 4 second flood protection preventing flooding from same user@host.
You can see the logged messages in a dialog by using the command /log. Hopefully you enjoy the script and find it usefull :)
on *:load:{
echo -a You have succesfully loaded the away system made by shitbreak. When you are away this script will log the messages and highlights you get, afterwards you can see them in a dialog by typing /log.
}
dialog away_log {
title "Away log"
size -1 -1 400 159
option dbu
list 1, 4 19 65 110, size
button "Clear the log", 2, 22 139 37 12
text "Date", 3, 9 10 25 8
text "Channel", 4, 77 10 25 8
list 5, 68 19 65 110, size
list 6, 132 19 65 110, size
text "Message", 7, 206 10 25 8
list 8, 196 19 200 110, size
text "Nick", 9, 144 10 25 8
}
on *:dialog:away_log:init:*:{
up_away
}
alias up_away {
did -r away_log 1
did -r away_log 5
did -r away_log 6
did -r away_log 8
if ($lines(away_log.txt) > 0) {
var %i = 1
while (%i <= $lines(away_log.txt)) {
did -a away_log 1 $gettok($read(away_log.txt,%i),1-2,32)
did -a away_log 5 $gettok($read(away_log.txt,%i),3,32)
did -a away_log 6 $gettok($read(away_log.txt,%i),4,32)
did -a away_log 8 $gettok($read(away_log.txt,%i),5-,32)
inc %i
}
}
}
on *:dialog:away_log:sclick:*:{
if ($did == 2) {
if ($lines(away_log.txt) == 0) { noop $input(There are no messages to be deleted,uho,Away log) }
elseif ($lines(away_log.txt) > 0) {
noop $input(Cleared the away log: $lines(away_log.txt) messages were removed,uho,Away log)
write -c away_log.txt
up_away
}
}
}
alias log { dialog -m away_log away_log }
alias away {
raw -q away : $+ $1-
if ($1) { set %away $date $time $1- | echo -a * You have now being marked as away: $1- }
if (!$1) { unset %away | echo -a * You are no longer marked as being away: $iif($lines(away_log.txt) == 0,you have no new messages waiting.,you have $lines(away_log.txt) messages waiting. Type /log to see them.) }
}
raw 305:*: haltdef
raw 306:*:haltdef
on *:text:*:*:{
if ($away == $true) {
if (!%flood. [ $+ [ $address($nick,1) ] ]) {
set -u4 %flood. $+ $address($nick,1) 1
if ($me iswm $1-) && ($chan) {
write away_log.txt $date $time $chan $nick $1-
notice $nick I am away ( $+ $gettok(%away,3-,32) $+ ) since $gettok(%away,1-2,32) ( $+ $duration($calc($ctime - $ctime($gettok(%away,1-2,32)))) $+ ). Your PM is logged.
}
if (!$chan) {
write away_log.txt $date $time Private $nick $1-
notice $nick I am away ( $+ $gettok(%away,3-,32) $+ ) since $gettok(%away,1-2,32) ( $+ $duration($calc($ctime - $ctime($gettok(%away,1-2,32)))) $+ ). Your PM is logged.
}
}
}
}