2006年 09月 20日

all

#!/usr/bin/perl 

use strict;
use warnings;

use Irssi;
use vars qw($VERSION %IRSSI); 

use Data::Dumper;

$VERSION = "0.01";
%IRSSI = (
	authors     => "cho45",
	contact     => "cho45\@lowreal.net",
	name        => "all",
	description => "show all message in a window",
	license     => "Public Domain",
	url         => "http://irssi.org/",
	changed     => "2006-09-20T21:46:00+09:00"
);

sub print_text {
	my ($dest, $text, $stripped) = @_;
	my $window = Irssi::window_find_name('all');

	return if $dest->{level} & MSGLEVEL_CLIENTCRAP;
	return if !$window;

	if ($dest->{level} & MSGLEVEL_PUBLIC) {
		my $n = $dest->{window}->{refnum};
		my $c = $dest->{target};
		$text =  "[$n]$c: $text";
	}
	$window->print($text, MSGLEVEL_CLIENTCRAP);
}
Irssi::signal_add('print text', 'print_text');

charset 入れなければこれでいけるっぽい。charset 入れてる場合一個前のエラーがでてしまう。