insomnia

A frontend for the hii IRC client

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

 1#!/bin/sh
 2
 3if [ ! -S "${INSOMNIA_DIR}/usr" ]; then
 4	name="$(cat "${INSOMNIA_DIR}/id" 2>/dev/null)"
 5	echo "[(insomnia)]${name:+ $name}"
 6	exit
 7fi
 8
 9# Find the most recent topic change and exit. Since we don't want to
10# search through the entire backlog we reverse it first by sorting it
11# using the unix timestamp.
12sort -k1 -r "${INSOMNIA_DIR}/out" | sed -n '
13	/^[0-9][0-9]* \*\*\* ..* has set the topic to: .*$/ {
14		s/^[0-9][0-9]* \*\*\* ..* has set the topic to: \(.*\)$/\1/p
15		q
16	}
17
18	/^[0-9][0-9]* \[\*\] topic for ..* is: .*$/ {
19		s/^[0-9][0-9]* \[\*\] topic for ..* is: \(.*\)$/\1/p
20		q
21	}
22'