commit 435185d923dac2f0df2705b85b14353ddbe32952
Author: sin <sin@2f30.org>
Date: Mon, 14 Apr 2014 20:20:42 +0100
Initial commit
Diffstat:
A | hiii | | | 66 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | hysteria | | | 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' => "[1;30m",
+ 'red' => "[1;31m",
+ 'green' => "[1;32m",
+ 'yellow' => "[1;33m",
+ 'blue' => "[1;34m",
+ 'magenta' => "[1;35m",
+ 'cyan' => "[1;36m",
+ 'white' => "[1;37m",
+ 'light_black' => "[30m",
+ 'light_red' => "[31m",
+ 'light_green' => "[32m",
+ 'light_yellow' => "[33m",
+ 'light_blue' => "[34m",
+ 'light_magenta' => "[35m",
+ 'light_cyan' => "[36m",
+ 'light_white' => "[37m",
+ 'reset' => "[1;0m"
+);
+
+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"