All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
Signed-off-by: martin f. krafft <madduck@madduck.net>
$VERSION = "0.5.10";
%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-<char>',
- 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-<char>',
+ license => 'GNU GPLv2 or later',
+ url => 'http://bc-bd.org/blog/irssi/'
);
# Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias).
);
# Adds new powerful and customizable [Act: ...] item (chanelnames,modes,alias).
# Contributors
#########
#
# 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 <jast@heapsort.de>, 2004-06-22
# Ivo Timmermans <ivo@o2w.nl> win->{hilight} patch
# Jan 'jast' Krueger <jast@heapsort.de>, 2004-06-22
# Ivo Timmermans <ivo@o2w.nl> win->{hilight} patch
# copy the script to ~/.irssi/scripts/
#
# In irssi:
# copy the script to ~/.irssi/scripts/
#
# In irssi:
#
# To see all chanact options type:
#
#
# To see all chanact options type:
#
#
# 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
#
# 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
#########
#
# /set chanact_chop_status <ON|OFF>
#########
#
# /set chanact_chop_status <ON|OFF>
-# * 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|OFF>
#
# /set chanact_show_mode <ON|OFF>
-# * 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|OFF>
#
# /set chanact_sort_by_activity <ON|OFF>
-# * 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>
# * string : Format String for one Channel. The following $'s are expanded:
#
# /set chanact_display <string>
# * string : Format String for one Channel. The following $'s are expanded:
# $H : Start highlightning
# $S : Stop highlightning
# * example:
# $H : Start highlightning
# $S : Stop highlightning
# * example:
# /set chanact_display $H$N:$M.$S$C
# /set chanact_display $H$N:$M.$S$C
# will give you on #irssi.de if you have voice
# will give you on #irssi.de if you have voice
# [3:+.#irssi.de]
#
# with '3:+.' highlighted and the channel name printed in regular color
# [3:+.#irssi.de]
#
# with '3:+.' highlighted and the channel name printed in regular color
# /set chanact_display_alias <string>
# as 'chanact_display' but is used if the window has an alias and
# 'chanact_show_alias' is set to on.
# /set chanact_display_alias <string>
# 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|OFF>
# * ON : show the channelnames after the number/alias
# * OFF : don't show the names
#
# /set chanact_abbreviate_names <int>
# /set chanact_show_names <ON|OFF>
# * ON : show the channelnames after the number/alias
# * OFF : don't show the names
#
# /set chanact_abbreviate_names <int>
-# * 0 : don't abbreviate
-# * <int> : strip channel name prefix character and leave only
-# that many characters of the proper name
+# * 0 : don't abbreviate
+# * <int> : strip channel name prefix character and leave only
+# that many characters of the proper name
#
# /set chanact_show_alias <ON|OFF>
# * ON : show the aliase instead of the refnum
# * OFF : shot the refnum
#
# /set chanact_header <str>
#
# /set chanact_show_alias <ON|OFF>
# * ON : show the aliase instead of the refnum
# * OFF : shot the refnum
#
# /set chanact_header <str>
-# * <str> : Characters to be displayed at the start of the item.
-# Defaults to: "Act: "
+# * <str> : Characters to be displayed at the start of the item.
+# Defaults to: "Act: "
#
# /set chanact_separator <str>
# * <str> : Charater to use between the channel entries
#
# /set chanact_autorenumber <ON|OFF>
# * ON : Move the window automatically to first available slot
#
# /set chanact_separator <str>
# * <str> : Charater to use between the channel entries
#
# /set chanact_autorenumber <ON|OFF>
# * 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 <int>
# * OFF : Don't move the windows automatically
#
# /set chanact_renumber_start <int>
-# * <int> : Move the window to first available slot after this
-# num when "chanact_autorenumber" is ON.
+# * <int> : Move the window to first available slot after this
+# num when "chanact_autorenumber" is ON.
#
# /set chanact_remove_hash <ON|OFF>
#
# /set chanact_remove_hash <ON|OFF>
-# * 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 <string>
#
# /set chanact_remove_prefix <string>
-# * <string> : 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-)?)?
+# * <string> : 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 <int>
#
# /set chanact_filter <int>
-# * 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)
# If you have trouble with wrong colored entries your 'default.theme' might
# be too old. Try on a shell:
#
# 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
#
# And in irssi:
# /reload
my ($actString,$needRemake);
sub expand {
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
}
# method will get called every time the statusbar item will be displayed
if ($needRemake) {
remake();
}
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);
$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');
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 {
@windows = sort { ($b->{last_line} <=> $a->{last_line}) }
Irssi::windows;
} else {
$actString = "";
foreach my $win (@windows) {
$actString = "";
foreach my $win (@windows) {
# since irssi is single threaded this shouldn't happen
!ref($win) && next;
# since irssi is single threaded this shouldn't happen
!ref($win) && next;
# (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')
# (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)") {
# check if we should show the mode
$mode = "";
if ($active->{type} eq "CHANNEL") {
# check if we should show the mode
$mode = "";
if ($active->{type} eq "CHANNEL") {
my $nick = $channel->nick_find($server->{nick});
!ref($nick) && next;
my $nick = $channel->nick_find($server->{nick});
!ref($nick) && next;
if ($nick->{op}) {
$mode = "@";
} elsif ($nick->{voice}) {
if ($nick->{op}) {
$mode = "@";
} elsif ($nick->{voice}) {
- 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";
$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};
} 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;
}
$actString .= expand($display,"C",$name,"N",$number,"M",$mode,"H",$hilight,"S","}{sb_background}").$separator;
if ($actString ne "") {
# Remove the last separator
$actString =~ s/$separator$//;
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 {
if (Irssi::settings_get_int('chanact_filter')) {
$actString = "{sb ".Irssi::settings_get_str('chanact_header').$actString."}";
} else {
sub cmd_window_unalias {
my ($data, $server, $witem) = @_;
my $rn_start = Irssi::settings_get_int('chanact_renumber_start');
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 <char>");
Irssi::print("or /window_alias in window that has an alias.");
return;
}
Irssi::active_win()->{name} =~ /^[a-zA-Z]$/) {
Irssi::print("Usage: /window_unalias <char>");
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 ($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};
$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);
# 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");
}
}
Irssi::print("and moved it to from $old_refnum to $newnum");
}
}
}
cmd_window_unalias($data, $server, $witem);
}
cmd_window_unalias($data, $server, $witem);
my $window = $witem->window();
my $winnum = $window->{refnum};
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;
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);
# 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");
}
Irssi::print("Moved the window from $old_refnum to $winnum");
}
my $winname = $witem->{name};
my $winserver = $window->{active_server}->{tag};
my $winhandle = "$winserver/$winname";
my $winname = $witem->{name};
my $winserver = $window->{active_server}->{tag};
my $winhandle = "$winserver/$winname";
-# - 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 <juergen@Winterkaelte.de>, 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 <juergen@Winterkaelte.de>, see
+# https://bc-bd.org/trac/irssi/ticket/15
+# + retired chanact_show_all in favour of chanact_filter
-# - 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 <jast@heapsort.de>, 2004-06-22
-# + updated documentation in script's comments
+# - changes by Jan 'jast' Krueger <jast@heapsort.de>, 2004-06-22
+# + updated documentation in script's comments
-# - changes by Ivo Timmermans <ivo@o2w.nl>
-# + honor actcolor /hilight setting if present
+# - changes by Ivo Timmermans <ivo@o2w.nl>
+# + honor actcolor /hilight setting if present
#
# 0.5.8
# - made aliases case-sensitive and include network in channel names by madduck
#
# 0.5.8
# - made aliases case-sensitive and include network in channel names by madduck
#
# 0.5.6
# - fixed a bug (#1) reported by Wouter Coekaert
#
# 0.5.6
# - fixed a bug (#1) reported by Wouter Coekaert
# 0.5.5
# - some speedups from David Leadbeater <dgl@dgl.cx>
# 0.5.5
# - some speedups from David Leadbeater <dgl@dgl.cx>
#
# 0.5.4
# - added help for chanact_display_alias
#
# 0.5.4
# - added help for chanact_display_alias
# - removed unused chanact_show_name settings (thx to Qerub)
# - fixed $mode display
# - guarded reference operations to (hopefully) fix errors on server disconnect
# - 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
#
# 0.5.1
# - small typo fixed
#
# - 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
# - 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
# 0.4.3
# - changes by Qerub
# + added chanact_show_mode to show the mode just before the channel name