#LinuxGER

Sirc + Farben

Matthias L Jugel (leo@mud.de)
Tue, 02 Dec 1997 13:18:55 -0100

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 "$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], "[^]*", "([^]*)", "");
$_[0] = colorize($_[0], "$nick", "($nick)", "");
}
&addhook("print", "expression");

sub hook_self {
local ($nick, $msg) = @_;
if($nick =~ /$talkchannel/i) { $nick = ">"; }
else { $nick = "*$nick*"; }
&tell("$nick $msg");
$silent=1;
}
&addhook("send_text", "self");

sub hook_public {
local ($channel, $msg) = @_;
if($channel =~ /$talkchannel/i) {
&tell("<$who> $msg");
} else {
&tell("<$who:$channel> $msg");
}
$silent=1;
}
&addhook("public", "public");

sub hook_msg {
local $msg = shift;
&tell("*$who!$host* $msg");
$silent=1;
}
&addhook("msg", "msg");

------- =_aaaaaaaaaa0--


This archive was generated by hypermail 1.02.