From: darac Date: Tue, 27 Jun 2017 15:32:45 +0000 (+0100) Subject: Update nickcolor_expando.pl X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=dd6c32aee54ce7e0025eb40b9e1a09bf87006247;p=irssi-scripts.irssi.org.git Update nickcolor_expando.pl Allow usage of the colour as a background (using $inickcolor). --- diff --git a/scripts/nickcolor_expando.pl b/scripts/nickcolor_expando.pl index ef9b084..a7d3667 100644 --- a/scripts/nickcolor_expando.pl +++ b/scripts/nickcolor_expando.pl @@ -1,7 +1,7 @@ use strict; use warnings; -our $VERSION = '0.3.7'; # 6edfe656246780e +our $VERSION = '0.4.0'; # 6edfe656246780e our %IRSSI = ( authors => 'Nei', name => 'nickcolor_expando', @@ -117,7 +117,8 @@ use Irssi; my @action_protos = qw(irc silc xmpp); my (%set_colour, %avoid_colour, %has_colour, %last_time, %netchan_hist); -my ($expando, $ignore_re, $ignore_setting, $global_colours, $retain_colour_time, @colours, $exited, $session_load_time); +my ($expando, $iexpando, $ignore_re, $ignore_setting, $global_colours, $retain_colour_time, @colours, $exited, $session_load_time); +($expando, $iexpando) = ('', ''); # Initialise to empty # the numbers for the scoring system, highest colour value will be chosen my %scores = ( @@ -170,6 +171,10 @@ sub expando_neatcolour { return $expando; } +sub expando_neatcolour_inv { + return $iexpando; +} + # one-at-a-time hash sub simple_hash { use integer; @@ -405,6 +410,7 @@ sub msg_line_tag { $nick = $nickobj->{nick} if $nickobj; my $colour = colourise_nt($srv->{tag}.'/'.$obj->{name}, $nick); $expando = $colour ? format_expand('%X'.$colour) : ''; + $iexpando = $colour ? format_expand('%x'.$colour) : ''; } sub msg_line_tag_xmppaction { @@ -424,6 +430,7 @@ sub prnt_clear_public { sub clear_ref { $expando = ''; + $iexpando = ''; } sub nicklist_changed { @@ -990,7 +997,15 @@ Irssi::expando_create('nickcolor', \&expando_neatcolour, { "message $_ own_action" => 'none') } @action_protos), }); - + +Irssi::expando_create('inickcolor', \&expando_neatcolour_inv, { + 'message public' => 'none', + 'message own_public' => 'none', + (map { ("message $_ action" => 'none', + "message $_ own_action" => 'none') + } @action_protos), + }); + Irssi::signal_add({ 'message public' => 'msg_line_tag', 'message own_public' => 'msg_line_clear', @@ -1021,6 +1036,8 @@ Irssi::signal_add_last('setup changed' => 'setup_changed'); # Changelog # ========= +# 0.4.0 +# - Allow usage of the colour as a background (using $inickcolor) # 0.3.7 # - fix crash if xmpp action signal is not registered (just ignore it) # 0.3.6