From b6a7d6446382af4db967ca7212efa2f591bfa268 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 18 Jul 2020 14:14:12 -0400 Subject: update scripts and configs for weechat 2.9 --- weechat/.weechat/perl/colorize_lines.pl | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'weechat/.weechat/perl/colorize_lines.pl') diff --git a/weechat/.weechat/perl/colorize_lines.pl b/weechat/.weechat/perl/colorize_lines.pl index d828620..93a4465 100644 --- a/weechat/.weechat/perl/colorize_lines.pl +++ b/weechat/.weechat/perl/colorize_lines.pl @@ -19,6 +19,7 @@ # along with this program. If not, see . # history: +# 3.9: add compatibility with new weechat_print modifier data (WeeChat >= 2.9) # 3.8: new option custom_action_text (https://github.com/weechat/scripts/issues/313) (idea by 3v1n0) # 3.7: new option "alternate_color" (https://github.com/weechat/scripts/issues/333) (idea by snuffkins) # 3.6: new option "own_lines_color" (idea by Linkandzelda) @@ -86,7 +87,7 @@ use strict; my $PRGNAME = "colorize_lines"; -my $VERSION = "3.8"; +my $VERSION = "3.9"; my $AUTHOR = "Nils Görs "; my $LICENCE = "GPL3"; my $DESCR = "Colorize users' text in chat area with their nick color, including highlights"; @@ -146,9 +147,21 @@ sub colorize_cb return $string unless (@tags_found); } -# find buffer pointer - $modifier_data =~ m/([^;]*);([^;]*);/; - my $buf_ptr = weechat::buffer_search($1, $2); + # find buffer pointer and tags + my $buf_ptr = ""; + my $tags = ""; + if ($modifier_data =~ /^0x/) + { + # WeeChat >= 2.9 + $modifier_data =~ m/([^;]*);(.*)/; + $buf_ptr = $1; + $tags = $2; + } else { + # WeeChat <= 2.8 + $modifier_data =~ m/([^;]*);([^;]*);(.*)/; + $buf_ptr = weechat::buffer_search($1, $2); + $tags = $3; + } return $string if ($buf_ptr eq ""); # find buffer name, server name @@ -164,8 +177,8 @@ sub colorize_cb # find nick of the sender # find out if we are doing an action - my $nick = ($modifier_data =~ m/(^|,)nick_([^,]*)/) ? $2 : weechat::string_remove_color($left, ""); - my $action = ($modifier_data =~ m/\birc_action\b/) ? 1 : 0; + my $nick = ($tags =~ m/(^|,)nick_([^,]*)/) ? $2 : weechat::string_remove_color($left, ""); + my $action = ($tags =~ m/\birc_action\b/) ? 1 : 0; ######################################## get color -- cgit 1.4.1