I block 301's entirely. I don't care if you're /away.
However, your idea would be simple to script. When you receive a 301 for them, add the text of the message to hash table; this will be ideal since the only time all your values will only be reset if you 1) exit mIRC (no need to save the hash table), or 2) manually (or through a popup) free the table. The only time you will see their away message is the first 301 you get for them, either by sending them a message and having the server send it back to you or by /whois-ing them; if their away message changes, you will see the message again.
A simple idea for deciding which window to send the away message to would be like this:
- If you have an open query window for them, put it in there; or,
- if you don't, but share common channels with them, put it in all of the common channels; or,
- if neither of those two, put it in the status window.
raw 301:*:{
[color:#005500]
; These variables are only used to make the event more self-descriptive.
[/color]
var %Nick = $2 | ; Replaces $nick with %Nick.
var %AwayMsg = $3- | ; Holds the text of the away message.
var %i = 1 | ; Loop index for cycling through common channels.
[color:#005500]
; Compare any stored AwayMsg you have for this nick with the current one. If you have already seen this
; message, halt the script: no need to proceed.
[/color]
if %AwayMsg == $hget(AwayMsg, $+($network, ., %Nick)) halt
[color:#005500]
; Since you haven't seen this message, store it for the next time you get a 301 from them.
[/color]
hadd -m AwayMsg $+($network, ., %Nick) %AwayMsg
[color:#005500]
; Now decide where to echo this 301 to: query or status window, or common channels. If you have an open
; query window with them or if you are not in any common channels with them:
[/color]
if $query(%Nick) == %Nick || $comchan(%Nick, 0) != 0 {
echo $color(whois) $iif($query(%Nick), -mbflirt %Nick, -smbflirt) * %nick is away: %AwayMsg
}
[color:#005500]
; Otherwise, you share common channels with them. Loop through each and echo to each.
[/color]
else while $comchan(%Nick, %i) {
echo $color(whois) -mbflirt $ifmatch * %Nick is away: %AwayMsg
inc %i
}
[color:#005500]
; Now halt the default text.
[/color]
halt
}
When you restart your mIRC each time, the AwayMsg hash table "goes softly and silently away": garbage collection at its finest!
If you wanted to, though, you could hsave the table on EXIT and reload it on START. You would need to implement some method of clearing out stale members occasionally. You might store the $ctime (or $gmt) of the last time you saw that 301 in addition to the text of the message. Then on DISCONNECT, you might do a little cleanup for each item from that $network whose value was greater than 1 day (86400 seconds) or whatever you choose.
The above script is rather polluted with comments. Here it is without comments (to make it easier to paste) and unnecessary variables.
raw 301:*:{
if $3- != $hget(AwayMsg,$+($network,.,$2)) {
hadd -m AwayMsg $+($network,.,$2) $3-
var %i = 1
if ($query($2)) || (!$comchan($2,0)) echo $color(whois) $iif($query($2),-mbflirt $2,-smbflirt) * $2 is away: $3-
else while $comchan($2,%i) { echo $color(whois) -mbflirt $ifmatch * $2 is away: $3- | inc %i }
}
halt
}