insomnia

A frontend for the hii IRC client

git clone https://git.8pit.net/insomnia.git

 1#!/usr/bin/awk -f
 2
 3BEGIN {
 4	idfp = ENVIRON["INSOMNIA_DIR"] "/id"
 5	getline name < idfp
 6	close(name)
 7}
 8
 9function ischan(channel) {
10	# This is a stripped down variant of IsValidChannel from girc
11	# which only checks the first character to determine channels.
12
13	first = substr(channel, 1, 1)
14	return index("!#&*~+", first)
15}
16
17/^[0-9]* \[.+\] \(.+\) .+$/ {
18	source = substr($3, 0, length($3) - 1)
19	if (!ischan(source))
20		source = substr($4, 2, length($4) - 2)
21
22	if (source != name || name == "") {
23		printf("%s\a\n", $0)
24		fflush()
25		next
26	}
27}
28
29{
30	print
31	fflush()
32}