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 girc11 # which only checks the first character to determine channels.1213 first = substr(channel, 1, 1)14 return index("!#&*~+", first)15}1617/^[0-9]* \[.+\] \(.+\) .+$/ {18 source = substr($3, 0, length($3) - 1)19 if (!ischan(source))20 source = substr($4, 2, length($4) - 2)2122 if (source != name || name == "") {23 printf("%s\a\n", $0)24 fflush()25 next26 }27}2829{30 print31 fflush()32}