diff options
| author | Trevor Slocum | 2016-04-25 18:46:30 -0700 | 
|---|---|---|
| committer | Trevor Slocum | 2016-04-25 18:46:30 -0700 | 
| commit | 8024d0c91f8fd270f8141b9ec02cf416df6a33cb (patch) | |
| tree | e7e5d44c222ec5691ddf82487b03981ca30671eb /scripts | |
| parent | f5dceffae94d7c79a8ed0aa9157e0e777dd3122b (diff) | |
| download | scripts.irssi.org-8024d0c91f8fd270f8141b9ec02cf416df6a33cb.tar.bz2 | |
chanact: allow case-insensitive aliases, silence extraneous /window_alias error message
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/chanact.pl | 36 | 
1 files changed, 29 insertions, 7 deletions
| diff --git a/scripts/chanact.pl b/scripts/chanact.pl index c3fb3e0..ee6ef3c 100644 --- a/scripts/chanact.pl +++ b/scripts/chanact.pl @@ -5,7 +5,7 @@ use Irssi::TextUI;  use vars qw($VERSION %IRSSI); -$VERSION = "0.5.14"; +$VERSION = "0.5.15";  %IRSSI = (      authors     => 'BC-bd, Veli',      contact     => 'bd@bc-bd.org, veli@piipiip.net', @@ -34,6 +34,7 @@ $VERSION = "0.5.14";  #                     chanact_filter_windowlist basis  # Jan 'jast' Krueger <jast@heapsort.de>, 2004-06-22  # Ivo Timmermans <ivo@o2w.nl>	win->{hilight} patch +# Trevor 'tee' Slocum <tslocum@gmail.com> Case-insensitive aliases, bugfix  #   #########  # USAGE @@ -108,6 +109,12 @@ $VERSION = "0.5.14";  #  #		    with '3:+.' highlighted and the channel name printed in regular color  # +# /set chanact_case_sensitive <ON|OFF> +# 		* ON  : Aliases are case-sensitive +# 		* OFF : Aliases are case-insensitive +# +#		Existing aliases must be reapplied after switching to case-insensitive. +#  # /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. @@ -424,9 +431,9 @@ sub setup_changed {  # Remove alias  sub cmd_window_unalias { -	my ($data, $server, $witem) = @_; +	my ($data, $server, $witem, $internal) = @_; -	if ($data ne '') { +	if ($data ne '' && !$internal) {  		Irssi::print("chanact: /window_unalias does not take any ".  			"parameters, Run it in the window you want to unalias");  		return; @@ -443,8 +450,13 @@ sub cmd_window_unalias {  	# haven't the name was not set by chanact, so we won't blindly unset  	# stuff  	if (length($key) == 1) { -		$server->command("/bind -delete meta-$key"); -	} else { +		if (Irssi::settings_get_bool('chanact_case_sensitive')) { +			$server->command("/bind -delete meta-$data"); +		} else { +			$server->command("/bind -delete meta-" . lc($data)); +			$server->command("/bind -delete meta-" . uc($data)); +		} +	} elsif (!$internal) {  		Irssi::print("chanact: could not determine keybinding. ".  			"Won't unbind anything");  	} @@ -496,7 +508,7 @@ sub cmd_window_alias {  		$winname = $window->{name};  	} -	cmd_window_unalias($data, $server, $witem); +	cmd_window_unalias($data, $server, $witem, 1);  	my $winnum = $window->{refnum}; @@ -519,7 +531,12 @@ sub cmd_window_alias {  	my $name = "$data:$winhandle";  	$window->set_name($name); -	$server->command("/bind meta-$data change_window $name"); +	if (Irssi::settings_get_bool('chanact_case_sensitive')) { +		$server->command("/bind meta-$data change_window $name"); +	} else { +		$server->command("/bind meta-" . lc($data) . " change_window $name"); +		$server->command("/bind meta-" . uc($data) . " change_window $name"); +	}  	Irssi::print("Window $winhandle is now accessible with meta-$data");  } @@ -533,6 +550,7 @@ Irssi::command_bind('window_unalias','cmd_window_unalias');  Irssi::settings_add_str('chanact', 'chanact_display', '$H$N:$M$C$S');  Irssi::settings_add_str('chanact', 'chanact_display_alias', '$H$N$M$S');  Irssi::settings_add_int('chanact', 'chanact_abbreviate_names', 0); +Irssi::settings_add_bool('chanact', 'chanact_case_sensitive', 1);  Irssi::settings_add_bool('chanact', 'chanact_show_alias', 1);  Irssi::settings_add_str('chanact', 'chanact_separator', " ");  Irssi::settings_add_bool('chanact', 'chanact_autorenumber', 0); @@ -569,6 +587,10 @@ Irssi::signal_add('nick mode changed', 'chanactHasChanged');  #  # Changelog  # +# 0.5.15 +# 	- fixed unbind error when aliasing a previously un-aliased window +# 	- added setting to allow case-insensitive window aliases +#  # 0.5.14  # 	- fix itemless window handling, thx Bazerka  # 	- fix /window_alias for itemless windows | 
