Simplest way to show user messages from an irc channel in a terminal - Servers Administration, Networking, & Virtualization

Users browsing this thread: 3 Guest(s)
josuah
Long time nixers
Well, this was not exactly what you asked for, sorry. But this looked like the beginning on an ii/sic thread, so I jumped in the train.

Code:
# http://tools.suckless.org/ii

awk '

BEGIN {
    WIDTH = 80 - 17;
}
$3 ~ "-!-" {
    next;
}

{
    last = date;
    date = $1;
}

date != last {
    printf("----------------------------------");
    printf(" %s ", date);
    printf("----------------------------------\n")
}

{
    if ($3 ~ "<.*>") {
        sub("<", "", $3);
        sub(">", "", $3);

        if (nick != $3) {
            printf("\n");
            printf("%s %10s  ", $2, $3);
            nick = $3;
        } else {
            printf("%s %10s  ", $2, "");
        }

        sub("[^ ]* [^ ]* [^ ]* ", "");

    } else {
        printf("%s %10s  ", $2, "");
        sub("[^ ]* [^ ]* ", "");
    }

    sub("^\001ACTION ", "~~ ");
    sub("\001$", " ~~");

    for (offset = 0; length($0) > 0; offset = 18) {
        row = substr($0, 1, WIDTH);

        if (length(row) >= WIDTH)
            sub(" [^ ]*$", "", row);

        $0 = substr($0, length(row) + 1);
        sub(" *", "");

        printf("%" offset "s%s\n", "", row);
    }
}'

This does the same, but without non-user messages.


Messages In This Thread
RE: Simplest way to show user messages from an irc channel in a terminal - by josuah - 23-05-2017, 02:29 AM