Package: irssi-scripts
Version: 20060513
Severity: wishlist
Tags: patch

Hi,

here's a patch that allows to remove common prefixes from channel
names. Especially useful if all your channels are named
#debian-something :)

Additionally, it allows to remove the # from channel names to save
more space. I'm using it with the following settings:

chanact_remove_hash = ON
chanact_remove_prefix = deb(ian.(devel-)?)?
chanact_abbreviate_names = 2

--- /usr/share/irssi/scripts/chanact.pl 2003-03-10 21:12:20.000000000 +0100
+++ ./chanact.pl        2006-07-22 19:33:18.102988024 +0200
@@ -175,7 +175,9 @@
 sub remake() {
        my ($afternumber,$finish,$hilight,$mode,$number,$display);
        my $separator = Irssi::settings_get_str('chanact_separator'); 
+       my $remove_prefix = Irssi::settings_get_str('chanact_remove_prefix');
        my $abbrev = Irssi::settings_get_int('chanact_abbreviate_names');
+       my $remove_hash = Irssi::settings_get_bool('chanact_remove_hash');
        
        $actString = "";
        foreach my $win (sort { ($a->{refnum}) <=> ($b->{refnum})} 
Irssi::windows) {
@@ -231,6 +233,9 @@
                        }
                }
 
+               if ($remove_prefix) {
+                       $name =~ s/^([&#+!=]?)$remove_prefix/$1/;
+               }
                if ($abbrev) {
                        if ($name =~ /^[&#+!=]/) {
                                $name = substr($name, 0, $abbrev + 1);
@@ -238,6 +243,9 @@
                                $name = substr($name, 0, $abbrev);
                        }
                }
+               if ($remove_hash) {
+                       $name =~ s/^[&#+!=]//;
+               }
 
                if (Irssi::settings_get_bool('chanact_show_alias') == 1 && 
                                $win->{name} =~ /^[a-zA-Z+]$/) {
@@ -379,6 +387,8 @@
 Irssi::settings_add_bool('chanact', 'chanact_show_alias', 1);
 Irssi::settings_add_str('chanact', 'chanact_separator', " ");
 Irssi::settings_add_bool('chanact', 'chanact_autorenumber', 0);
+Irssi::settings_add_bool('chanact', 'chanact_remove_hash', 0);
+Irssi::settings_add_str('chanact', 'chanact_remove_prefix', "");
 Irssi::settings_add_int('chanact', 'chanact_renumber_start', 50);
 Irssi::settings_add_str('chanact', 'chanact_header', "Act: ");
 Irssi::settings_add_bool('chanact', 'chanact_chop_status', 1);


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-686
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Christoph
-- 
[EMAIL PROTECTED] | http://www.df7cb.de/

Attachment: signature.asc
Description: Digital signature

Reply via email to