Message-Id: <199712021218.NAA25622@tanis.first.gmd.de>
To: linuxger@infodrom.north.de
Subject: Sirc + Farben
Date: Tue, 02 Dec 1997 13:18:55 -0100
From: Matthias L Jugel <leo@mud.de>
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <25618.881065135.1@tanis.first.gmd.de>
Hi,
vielleicht interessierts ja wen. Ich habe fuer sirc ein kleines .sircrc.pl
gestrickt, was einem lokal die channels einfaerbt (_kein_ mIRC scheiss!).
Wichtig ist, dass vor dem start von sirc die env-var SSFE=-raw sein muss!
Leo.
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <25618.881065135.2@tanis.first.gmd.de>
Content-Description: Signature of Matthias L. Jugel
Matthias L. Jugel -- GMD FIRST Berlin Adlershof
Tel: +49 030 6392 1821 Email: leo@first.gmd.de
Es gibt zwei Arten von Narren. Der eine sagt: "Dies ist alt und
deshalb gut." Und der andere sagt: "Dies ist neu und deshalb besser."
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <25618.881065135.3@tanis.first.gmd.de>
Content-Description: .sircrc.pl
#
# allow for embedded colors, search for all color sequences before the
# expression (until we find ^[[0m or beginning of line) and return the
# resulting sequence.
sub pcolor {
local @line = reverse split /(\[[0-9]+m)/, shift;
local $str = "";
for (@line) {
last if /\[0m/;
$str = $_.$str if /\[[1-9]+m/;
}
return "[0m$str";
}
# colorize a line splitted by an expression with the given color
sub colorize {
local ($str, $find, $subst, $color) = @_;
local @line = split(/($find)/i, $str);
return $str if $#line == 1;
$str = "";
local $prev = "";
for(@line) {
$_ =~ s/$subst/"$color$1".&pcolor($str)/ie;
$str .= $_;
}
return $str;
}
# colorize certain parts and respect underlying color
sub hook_expression {
$_[0] = colorize($_[0], "[^]*", "([^]*)", "[1m");
$_[0] = colorize($_[0], "$nick", "($nick)", "[31m");
}
&addhook("print", "expression");
sub hook_self {
local ($nick, $msg) = @_;
if($nick =~ /$talkchannel/i) { $nick = ">"; }
else { $nick = "*$nick*"; }
&tell("$nick [32m$msg[0m");
$silent=1;
}
&addhook("send_text", "self");
sub hook_public {
local ($channel, $msg) = @_;
if($channel =~ /$talkchannel/i) {
&tell("<[1m$who[0m> [34m$msg[0m");
} else {
&tell("<[1m$who[0m:$channel> $msg");
}
$silent=1;
}
&addhook("public", "public");
sub hook_msg {
local $msg = shift;
&tell("*[31m[1m$who!$host[0m* [31m$msg[0m");
$silent=1;
}
&addhook("msg", "msg");
------- =_aaaaaaaaaa0--