From e581779d5e4efc99d1dfa74ad3880be840ed3393 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 26 May 2009 20:03:36 +0200 Subject: [PATCH] semi-consistent use of tabs Signed-off-by: martin f. krafft --- chanact.pl | 190 +++++++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 94 deletions(-) diff --git a/chanact.pl b/chanact.pl index f9bb0e3..f1f69f1 100644 --- a/chanact.pl +++ b/chanact.pl @@ -6,12 +6,12 @@ use vars qw($VERSION %IRSSI); $VERSION = "0.5.10"; %IRSSI = ( - authors => 'BC-bd, Veli', - contact => 'bd@bc-bd.org, veli@piipiip.net', - name => 'chanact', - description => 'Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias). Lets you give alias characters to windows so that you can select those with meta-', - license => 'GNU GPLv2 or later', - url => 'http://bc-bd.org/blog/irssi/' + authors => 'BC-bd, Veli', + contact => 'bd@bc-bd.org, veli@piipiip.net', + name => 'chanact', + description => 'Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias). Lets you give alias characters to windows so that you can select those with meta-', + license => 'GNU GPLv2 or later', + url => 'http://bc-bd.org/blog/irssi/' ); # Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias). @@ -26,17 +26,17 @@ $VERSION = "0.5.10"; # Contributors ######### # -# veli@piipiip.net /window_alias code -# qrczak@knm.org.pl chanact_abbreviate_names -# qerub@home.se Extra chanact_show_mode and chanact_chop_status -# madduck@madduck.net Better channel aliasing (case-sensitive, cross-network) +# veli@piipiip.net /window_alias code +# qrczak@knm.org.pl chanact_abbreviate_names +# qerub@home.se Extra chanact_show_mode and chanact_chop_status +# madduck@madduck.net Better channel aliasing (case-sensitive, cross-network) # Jan 'jast' Krueger , 2004-06-22 # Ivo Timmermans win->{hilight} patch -# +# ######### # USAGE ### -# +# # copy the script to ~/.irssi/scripts/ # # In irssi: @@ -52,7 +52,7 @@ $VERSION = "0.5.10"; # # To see all chanact options type: # -# / set chanact_ +# /set chanact_ # # After these steps you have your new statusbar item and you can start giving # aliases to your windows. Go to the window you want to give the alias to @@ -77,16 +77,16 @@ $VERSION = "0.5.10"; ######### # # /set chanact_chop_status -# * ON : shorten (Status) to S -# * OFF : don't do it +# * ON : shorten (Status) to S +# * OFF : don't do it # # /set chanact_show_mode -# * ON : show channel modes -# * OFF : don't show channel modes +# * ON : show channel modes +# * OFF : don't show channel modes # # /set chanact_sort_by_activity -# * ON : sorts the list by last activity -# * OFF : sorts the list by window number +# * ON : sorts the list by last activity +# * OFF : sorts the list by window number # # /set chanact_display # * string : Format String for one Channel. The following $'s are expanded: @@ -96,11 +96,11 @@ $VERSION = "0.5.10"; # $H : Start highlightning # $S : Stop highlightning # * example: -# +# # /set chanact_display $H$N:$M.$S$C -# +# # will give you on #irssi.de if you have voice -# +# # [3:+.#irssi.de] # # with '3:+.' highlighted and the channel name printed in regular color @@ -108,57 +108,57 @@ $VERSION = "0.5.10"; # /set chanact_display_alias # as 'chanact_display' but is used if the window has an alias and # 'chanact_show_alias' is set to on. -# +# # /set chanact_show_names # * ON : show the channelnames after the number/alias # * OFF : don't show the names # # /set chanact_abbreviate_names -# * 0 : don't abbreviate -# * : strip channel name prefix character and leave only -# that many characters of the proper name +# * 0 : don't abbreviate +# * : strip channel name prefix character and leave only +# that many characters of the proper name # # /set chanact_show_alias # * ON : show the aliase instead of the refnum # * OFF : shot the refnum # # /set chanact_header -# * : Characters to be displayed at the start of the item. -# Defaults to: "Act: " +# * : Characters to be displayed at the start of the item. +# Defaults to: "Act: " # # /set chanact_separator # * : Charater to use between the channel entries # # /set chanact_autorenumber # * ON : Move the window automatically to first available slot -# starting from "chanact_renumber_start" when assigning -# an alias to window. Also moves the window back to a -# first available slot from refnum 1 when the window -# loses it's alias. +# starting from "chanact_renumber_start" when assigning +# an alias to window. Also moves the window back to a +# first available slot from refnum 1 when the window +# loses it's alias. # * OFF : Don't move the windows automatically # # /set chanact_renumber_start -# * : Move the window to first available slot after this -# num when "chanact_autorenumber" is ON. +# * : Move the window to first available slot after this +# num when "chanact_autorenumber" is ON. # # /set chanact_remove_hash -# * ON : Remove &#+!= from channel names -# * OFF : Don't touch channel names +# * ON : Remove &#+!= from channel names +# * OFF : Don't touch channel names # # /set chanact_remove_prefix -# * : Regular expression used to remove from the -# beginning of the channel name. -# * example : -# To shorten a lot of debian channels: -# -# /set chanact_remove_prefix deb(ian.(devel-)?)? +# * : Regular expression used to remove from the +# beginning of the channel name. +# * example : +# To shorten a lot of debian channels: +# +# /set chanact_remove_prefix deb(ian.(devel-)?)? # # /set chanact_filter -# * 0 : show all channels -# * 1 : hide channels without activity -# * 2 : hide channels with only join/part/etc messages -# * 3 : hide channels with text messages -# * 4 : hide all channels (now why would you want to do that) +# * 0 : show all channels +# * 1 : hide channels without activity +# * 2 : hide channels with only join/part/etc messages +# * 3 : hide channels with text messages +# * 4 : hide all channels (now why would you want to do that) # ######### # HINTS @@ -167,7 +167,7 @@ $VERSION = "0.5.10"; # If you have trouble with wrong colored entries your 'default.theme' might # be too old. Try on a shell: # -# $ mv ~/.irssi/default.theme /tmp/ +# $ mv ~/.irssi/default.theme /tmp/ # # And in irssi: # /reload @@ -186,10 +186,10 @@ my %show = ( my ($actString,$needRemake); sub expand { - my ($string, %format) = @_; - my ($exp, $repl); - $string =~ s/\$$exp/$repl/g while (($exp, $repl) = each(%format)); - return $string; + my ($string, %format) = @_; + my ($exp, $repl); + $string =~ s/\$$exp/$repl/g while (($exp, $repl) = each(%format)); + return $string; } # method will get called every time the statusbar item will be displayed @@ -203,19 +203,19 @@ sub chanact { if ($needRemake) { remake(); } - + $item->default_handler($get_size_only, $actString, undef, 1); } # this is the real creation method sub remake() { my ($afternumber,$finish,$hilight,$mode,$number,$display,@windows); - my $separator = Irssi::settings_get_str('chanact_separator'); + my $separator = Irssi::settings_get_str('chanact_separator'); my $abbrev = Irssi::settings_get_int('chanact_abbreviate_names'); my $remove_prefix = Irssi::settings_get_str('chanact_remove_prefix'); my $remove_hash = Irssi::settings_get_bool('chanact_remove_hash'); - if (Irssi::settings_get_bool('chanact_sort_by_activity')) { + if (Irssi::settings_get_bool('chanact_sort_by_activity')) { @windows = sort { ($b->{last_line} <=> $a->{last_line}) } Irssi::windows; } else { @@ -225,7 +225,7 @@ sub remake() { $actString = ""; foreach my $win (@windows) { - + # since irssi is single threaded this shouldn't happen !ref($win) && next; @@ -237,10 +237,10 @@ sub remake() { # (status) is an awfull long name, so make it short to 'S' # some people don't like it, so make it configurable if (Irssi::settings_get_bool('chanact_chop_status') - && $name eq "(status)") { + && $name eq "(status)") { $name = "S"; } - + # check if we should show the mode $mode = ""; if ($active->{type} eq "CHANNEL") { @@ -252,7 +252,7 @@ sub remake() { my $nick = $channel->nick_find($server->{nick}); !ref($nick) && next; - + if ($nick->{op}) { $mode = "@"; } elsif ($nick->{voice}) { @@ -285,13 +285,13 @@ sub remake() { $name =~ s/^[&#+!=]//; } - if (Irssi::settings_get_bool('chanact_show_alias') == 1 && + if (Irssi::settings_get_bool('chanact_show_alias') == 1 && $win->{name} =~ /^([a-zA-Z+]):(.+)$/) { $number = "$1"; - $display = Irssi::settings_get_str('chanact_display_alias'); + $display = Irssi::settings_get_str('chanact_display_alias'); } else { $number = $win->{refnum}; - $display = Irssi::settings_get_str('chanact_display'); + $display = Irssi::settings_get_str('chanact_display'); } $actString .= expand($display,"C",$name,"N",$number,"M",$mode,"H",$hilight,"S","}{sb_background}").$separator; @@ -301,7 +301,7 @@ sub remake() { if ($actString ne "") { # Remove the last separator $actString =~ s/$separator$//; - + if (Irssi::settings_get_int('chanact_filter')) { $actString = "{sb ".Irssi::settings_get_str('chanact_header').$actString."}"; } else { @@ -331,29 +331,29 @@ sub chanactHasChanged() sub cmd_window_unalias { my ($data, $server, $witem) = @_; my $rn_start = Irssi::settings_get_int('chanact_renumber_start'); - - unless ($data =~ /^[a-zA-Z]$/ || + + unless ($data =~ /^[a-zA-Z]$/ || Irssi::active_win()->{name} =~ /^[a-zA-Z]$/) { Irssi::print("Usage: /window_unalias "); Irssi::print("or /window_alias in window that has an alias."); return; } - + if ($data eq '') { $data = Irssi::active_win()->{name}; } if (my $oldwin = Irssi::window_find_name($data)) { $oldwin->set_name(undef); Irssi::print("Removed alias with the key '$data'."); - - if (Irssi::settings_get_bool('chanact_autorenumber') == 1 && + + if (Irssi::settings_get_bool('chanact_autorenumber') == 1 && $oldwin->{refnum} >= $rn_start) { my $old_refnum = $oldwin->{refnum}; - + # Find the first available slot and move the window my $newnum = 1; while (Irssi::window_find_refnum($newnum) ne "") { $newnum++; } $oldwin->set_refnum($newnum); - + Irssi::print("and moved it to from $old_refnum to $newnum"); } } @@ -371,23 +371,23 @@ sub cmd_window_alias { } cmd_window_unalias($data, $server, $witem); - + my $window = $witem->window(); my $winnum = $window->{refnum}; - + if (Irssi::settings_get_bool('chanact_autorenumber') == 1 && $window->{refnum} < $rn_start) { my $old_refnum = $window->{refnum}; $winnum = $rn_start; - + # Find the first available slot and move the window while (Irssi::window_find_refnum($winnum) ne "") { $winnum++; } $window->set_refnum($winnum); - + Irssi::print("Moved the window from $old_refnum to $winnum"); } - + my $winname = $witem->{name}; my $winserver = $window->{active_server}->{tag}; my $winhandle = "$winserver/$winname"; @@ -465,25 +465,25 @@ Irssi::signal_add_last('window refnum changed', 'refnum_changed'); # Changelog # # 0.5.10 -# - fixed irssi crash when using Irssi::print from within remake() -# - added option to filter out some data levels, based on a patch by -# Juergen Jung , see -# https://bc-bd.org/trac/irssi/ticket/15 -# + retired chanact_show_all in favour of chanact_filter +# - fixed irssi crash when using Irssi::print from within remake() +# - added option to filter out some data levels, based on a patch by +# Juergen Jung , see +# https://bc-bd.org/trac/irssi/ticket/15 +# + retired chanact_show_all in favour of chanact_filter # # 0.5.9 -# - changes by stefan voelkel -# + sort channels by activity, see -# https://bc-bd.org/trac/irssi/ticket/5, based on a patch by jan -# krueger -# + fixed chrash on /exec -interactive, see -# https://bc-bd.org/trac/irssi/ticket/7 +# - changes by stefan voelkel +# + sort channels by activity, see +# https://bc-bd.org/trac/irssi/ticket/5, based on a patch by jan +# krueger +# + fixed chrash on /exec -interactive, see +# https://bc-bd.org/trac/irssi/ticket/7 # -# - changes by Jan 'jast' Krueger , 2004-06-22 -# + updated documentation in script's comments +# - changes by Jan 'jast' Krueger , 2004-06-22 +# + updated documentation in script's comments # -# - changes by Ivo Timmermans -# + honor actcolor /hilight setting if present +# - changes by Ivo Timmermans +# + honor actcolor /hilight setting if present # # 0.5.8 # - made aliases case-sensitive and include network in channel names by madduck @@ -493,10 +493,10 @@ Irssi::signal_add_last('window refnum changed', 'refnum_changed'); # # 0.5.6 # - fixed a bug (#1) reported by Wouter Coekaert -# +# # 0.5.5 # - some speedups from David Leadbeater -# +# # # 0.5.4 # - added help for chanact_display_alias @@ -510,7 +510,7 @@ Irssi::signal_add_last('window refnum changed', 'refnum_changed'); # - removed unused chanact_show_name settings (thx to Qerub) # - fixed $mode display # - guarded reference operations to (hopefully) fix errors on server disconnect -# +# # 0.5.1 # - small typo fixed # @@ -518,7 +518,7 @@ Irssi::signal_add_last('window refnum changed', 'refnum_changed'); # - changed chanact_show_mode to chanact_display. reversed changes from # Qerub through that, but kept funcionality. # - removed chanact_color_all since it is no longer needed -# +# # 0.4.3 # - changes by Qerub # + added chanact_show_mode to show the mode just before the channel name @@ -569,3 +569,5 @@ Irssi::signal_add_last('window refnum changed', 'refnum_changed'); # ### ################ +# +# vim:noet -- 2.39.5