hysteria

ii wrapper script
git clone git://git.2f30.org/hysteria
Log | Files | Refs | README | LICENSE

commit 435185d923dac2f0df2705b85b14353ddbe32952
Author: sin <sin@2f30.org>
Date:   Mon, 14 Apr 2014 20:20:42 +0100

Initial commit

Diffstat:
Ahiii | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ahysteria | 44++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 0 deletions(-)

diff --git a/hiii b/hiii @@ -0,0 +1,66 @@ +#!/usr/bin/perl +# +# Taken from: https://github.com/berkoz/hiii + +use v5.10; +use strict; +use warnings; + +my %config = ( + # You can specify multiple nicknames like, 'berk|bozbalci' + + 'nick' => 'berk', + 'color_nicks' => 'light_green', + 'color_own_nick' => 'light_red', + 'color_url' => 'light_blue', + 'color_actions' => 'magenta', + 'color_server' => 'black' +); + +my %color = ( + 'black' => "", + 'red' => "", + 'green' => "", + 'yellow' => "", + 'blue' => "", + 'magenta' => "", + 'cyan' => "", + 'white' => "", + 'light_black' => "", + 'light_red' => "", + 'light_green' => "", + 'light_yellow' => "", + 'light_blue' => "", + 'light_magenta' => "", + 'light_cyan' => "", + 'light_white' => "", + 'reset' => "" +); + +my $timestamp = "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}"; +my $url = "(((https?|ftp)|mailto):(//)?[^ <>\"[:blank:]]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)"; +my $nick = "<(.*?)>"; +my $action = "ACTION (.*)?"; +my $useless = "^-!- (.*)"; + +while (<>) { + # Remove the huge timestamp from the line's beginning + s/^$timestamp //; + + # Highlight nicknames, remove <> around them + s/^$nick/$color{$config{'color_nicks'}}$1$color{'reset'} /; + + # Highlight me + s/($config{'nick'})/$color{$config{'color_own_nick'}}$1$color{'reset'}/; + + # Highlight URLs + s/$url/$color{$config{'color_url'}}$1$color{'reset'}/; + + # Highlight /me actions + s/$action/$color{$config{'color_actions'}}* $1 *$color{'reset'}/; + + # Highlight "has joined", "changed mode", etc. + s/^$useless/$color{$config{'color_server'}}$1$color{'reset'}/; + + print; +} diff --git a/hysteria b/hysteria @@ -0,0 +1,44 @@ +#!/bin/sh -x + +nick="your_nickname" +fullname="your_fullname" + +waitfile() { + while :; do + if test -e "$1"; then + break + fi + sleep 1 + done +} + +init() { + rm -rf irc + tmux new-session -s hysteria -d + tmux rename-window shell +} + +connectserver() { + host="$1" + tmux new-window "ii -i irc -s $host -n $nick -f $fullname" + waitfile "irc/$host/out" + tmux new-window "tail -f irc/$host/out | ./hiii" + tmux split-window "cat > irc/$host/in" + tmux rename-window "$host" +} + +join() { + host="$1" + shift + for c in $*; do + echo "/join $c" > "irc/$host/in" + waitfile "irc/$host/$c/out" + tmux new-window "tail -f irc/$host/$c/out | ./hiii" + tmux split-window "cat > irc/$host/$c/in" + tmux rename-window "$c" + done +} + +init +connectserver "irc.freenode.net" +join "irc.freenode.net" "#2f30" "#ninja-turtles"