; Display nick/part/quit messages if a user is active, so
; the rest can be suppressed, in Options > IRC > Events.
; "Active" is tracked with an entry in the "active nicks"
; hashtable, consisting of "[network] _ [nick]". Remove
; the entry on nick/quit, and part if not in any more
; mutual channels. Join is never shown. On Nick, On Part,
; and On Quit will need to be merged with other procedures
; if existing. Then the count of active nicks is:
; "$hget(active_nicks, 0).item".
; Echo $3- to the channels we and user $1 are both on in
; color $2, for displaying quit/nick events.
alias comchan_echo {
var %k $comchan($1, 0)
while (%k > 0) {
echo -ci2t $2 $comchan($1, %k) $3-
dec %k
}
}
alias on_nick_proc {
var %key $+($network, _, $nick)
if ($hget(active_nicks, %key)) {
hdel active_nicks %key
comchan_echo $newnick nick * $nick changed their nick to $newnick
}
}
alias on_part_proc {
var %key $+($network, _, $nick)
if ($hget(active_nicks, %key )) {
if ($comchan($nick, 0) == 1) {
hdel active_nicks %key
}
echo -ci2t part $chan * $nick $iif($len($1-) > 0, left:, left) $1-
}
}
alias on_quit_proc {
var %key $+($network, _, $nick)
if ($hget(active_nicks, %key )) {
hdel active_nicks %key
comchan_echo $nick quit * $nick $iif($len($1-) > 0, quit:, quit) $1-
}
}
; Reset the user's active timer to 1 hour (3600 sec.).
alias on_text_proc {
var %key $+($network, _, $nick)
hadd -mu3600 active_nicks %key 1
}
on *:NICK:on_nick_proc
on *:PART:*:on_part_proc $1-
on *:QUIT:on_quit_proc $1-
on *:TEXT:*:*:on_text_proc