1# Simple script for removing colours in public channels :)
2
3use strict;
4use Irssi;
5use vars qw($VERSION %IRSSI);
6
7# Dev. info ^_^
8$VERSION = "0.3";
9%IRSSI = (
10	authors     => "J�rgen Tjern�",
11	contact     => "darkthorne\@samsen.com",
12	name        => "CleanPublic",
13	description => "Simple script that removes colors and other formatting (bold, etc) from public channels",
14	license     => "GPL",
15	url         => "http://mental.mine.nu",
16	changed     => "Wed Sep 24 13:17:15 CEST 2003"
17);
18
19# All the works
20sub strip_formatting {
21	my ($server, $data, $nick, $mask, $target) = @_;
22	# Channel *allowed* to be colorful?
23	foreach my $chan (split(' ', Irssi::settings_get_str('colored_channels'))) {
24		if ($target eq $chan) { return }
25	}
26
27	# Ruthlessly_ripped_from_Garion {
28	my $twin = Irssi::window_find_name($target);
29	# Beam it to window 1 if we cant find any other suitable target.
30	if (!defined($twin)) { $twin = Irssi::window_find_refnum(1); }
31	# }
32
33	# Remove formatting
34	$data =~ s/\x03\d?\d?(,\d?\d?)?|\x02|\x1f|\x16|\x06|\x07//g;
35	# Let it flow
36	Irssi::signal_continue($server, $data, $nick, $mask, $target);
37}
38
39# Hook me up
40Irssi::signal_add('message public', 'strip_formatting');
41Irssi::settings_add_str('lookandfeel', 'colored_channels', '');
42