Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Typing Indicators on AdiIRC Statusbar for Koragg
; --- Settings ---
alias -l tagmsg_receive { return 1 } ; 1 = Will receive any +typing spec messages, use 0 to disable it.
alias -l tagmsg_share { return 1 } ; 1 = Will send +typing spec when you write something on editbox, 0 to disable it.
alias -l tagmsg_share_delay { return 3 } ; 3 = The seconds that client will send the typing share, default says it is 3, do not get lower than that it will be spammy.
alias -l tagmsg_position { return 5 } ; 5 = the position number , use 1 to be in 1st place top left on the statusbar or whatever number you want.
alias -l tagmsg_auto_done_secs { return 6 } ; 6 = the automatically typing=done seconds, spec says 6 is the correct here.
alias -l tagmsg_icon_file { return $envvar(windir) $+ \System32\comres.dll } ; = Use only DLL that includes icons. (example: shell32.dll), works only on Windows
alias -l tagmsg_icon_index { return 6 } ; = The $tagmsg_icon_file DLL index icon number, works only on Windows.
alias -l tagmsg_icon_size { return 2 } ; 1 = small, 2 = large, 3 = actual, works only on Windows.
; --- Settings ---
ON *:KEYUP:*:*: {
var %editbox = $editbox($active,0)
var %editbox_old = $editboxhistory($active,1)
if (!$tagmsg_share) || (!$ircv3caps(message-tags).enabled) || ($left(%editbox,1) == $comchar) || ($keychar == $null) || ($status !== connected) || (!$statusbar) { return }
if ($servervars(CLIENTTAGDENY).key && !$istok($servervars(CLIENTTAGDENY).value,-typing,44)) || ($active !ischan && !$query($active)) || ($keyval == 13 && $left(%editbox_old,1) == $comchar) { return }
if ($istok(8 13,$keyval,32)) && (%editbox == $null) {
if ($timer([TAGMSG_ $+ $me $+ ])) { .timer[TAGMSG_ $+ $me $+ ] off | .quote @+typing=done TAGMSG $active }
return
}
if (!$timer([TAGMSG_ $+ $me $+ ])) { .quote @+typing=active TAGMSG $active }
.timer[TAGMSG_ $+ $me $+ ] 1 $tagmsg_share_delay tagmsg_send $active
}
ON *:ACTIVE:*: {
if ($activecid !== $lactivecid) { tagmsg_close }
if ($activecid == $lactivecid) && ($active !== $lactive) { tagmsg_close }
}
ON *:KICK:#: {
if ($cid !== $activecid) || ($wid !== $activewid) { return }
if ($knick == $me) { tagmsg_close }
else { tagmsg_del $knick }
}
ON *:PART:#: {
if ($cid !== $activecid) || ($wid !== $activewid) { return }
if ($nick == $me) { tagmsg_close }
else { tagmsg_del $nick }
}
ON *:QUIT: {
if ($cid !== $activecid) { return }
if ($nick == $me) { tagmsg_close }
else { tagmsg_del $nick }
}
ON !*:NICK: {
if ($cid !== $activecid) { return }
tagmsg_del $nick
}
ON *:DISCONNECT: {
if ($cid !== $activecid) { return }
tagmsg_close
}
RAW TAGMSG:*: {
if (!$tagmsg_receive) || (!$statusbar) || ($cid !== $activecid) { return }
if ($msgtags(+typing) == done) || ($msgtags(+typing) && $iswine && $nick == $me) { tagmsg_del $nick | return }
if ($msgtags(+typing) !== active) { return }
if ($active !== $nick) && ($active !== $1) { tagmsg_close | return }
.timer[TAGMSG_ $+ $nick $+ ] 1 $tagmsg_auto_done_secs tagmsg_del $nick
hadd -m TAGMSG $nick 1
var %total = $hget(TAGMSG,0).item
if (%total == 1) { var %line = $tagmsg_nicks is typing... }
if (%total isnum 2-5) { var %line = $tagmsg_nicks are typing... }
if (%total >= 6) { var %line = %total nicknames are typing... }
if (!$statusbar(TAGMSG)) {
if (!$iswine) { statusbar $+(-iz,$tagmsg_icon_size,n,$tagmsg_icon_index) $tagmsg_position TAGMSG $qt(%line) @TAGMSG $qt($tagmsg_icon_file) $qt(%line) }
else { statusbar -i $tagmsg_position TAGMSG $qt(%line) @TAGMSG $qt(%line) }
return
}
statusbar -g TAGMSG $qt(%line)
}
alias tagmsg_send {
; /tagmsg_send <target>
if (!$1) || ($active !== $1) || ($status !== connected) { return }
if ($editbox($active,0) !== $null) { .quote @+typing=paused TAGMSG $1 | return }
.quote @+typing=active TAGMSG $1
}
alias tagmsg_close {
; /tagmsg_close
.timer[TAGMSG_*] off
if ($hget(TAGMSG)) { hfree $v1 }
if ($statusbar(TAGMSG)) { statusbar -d $v1 }
}
alias tagmsg_del {
; /tagmsg_del <nick>
if (!$1) || (!$hget(TAGMSG,$1)) { return }
hdel TAGMSG $1
if (!$hget(TAGMSG,0).item) {
.timer[TAGMSG_*] off
if ($hget(TAGMSG)) { hfree $v1 }
if ($statusbar(TAGMSG)) { statusbar -d $v1 }
}
}
alias tagmsg_nicks {
; $tagmsg_nicks
var %total = $hget(TAGMSG,0).item
if (!%total) { return 0 }
var %i = 1
while (%i <= %total) {
var %nick = $hget(TAGMSG,%i).item
if (%nick) { var %results = $addtok(%results,%nick,44) }
inc %i
}
if (%results) { var %results = $replace(%results,$chr(44),$+($chr(44),$chr(32))) }
return $iif(%results,$v1,0)
}
@westor7
Copy link
Author

westor7 commented Aug 5, 2021

Thanks Valware for some suggestions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment