insomnia

A frontend for the hii IRC client

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

 1#!/bin/sh
 2set -e
 3
 4# Host on which insomnia / hii are runnig.
 5HOST="someuser@example.org"
 6
 7# Absolute path to the hii IRC directory on the host (no trailing slash).
 8IDIR="/home/someuser/irc"
 9
10sheet() {
11	tr '\n' ',' | xargs termux-dialog sheet -t "${0##*/}" -v | jq -r .text
12}
13
14channels() {
15	ssh "${HOST}" "sh -c 'find \"${IDIR}\" -maxdepth 3 -name in \
16		-a -type p | sed \"s|^${IDIR}/\(.*\)/in|\1|\"'"
17}
18
19target=$(channels | sheet)
20if [ -z "${target}" ]; then
21	termux-toast "No target selected, aborting."
22	exit 1
23elif [ "${target}" = "${target%%/*}" ]; then
24	server="${target}"
25	target=""
26else
27	server="${target%%/*}"
28	target="${target##*/}"
29fi
30
31exec mosh "${HOST}" -- insomnia "${server}" "${target}"