diff options
Diffstat (limited to 'weechat/.weechat/python/colorize_nicks.py')
-rw-r--r-- | weechat/.weechat/python/colorize_nicks.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/weechat/.weechat/python/colorize_nicks.py b/weechat/.weechat/python/colorize_nicks.py index d0cdc0e..19be2fc 100644 --- a/weechat/.weechat/python/colorize_nicks.py +++ b/weechat/.weechat/python/colorize_nicks.py @@ -21,6 +21,9 @@ # # # History: +# 2020-05-09: Sébastien Helleu <flashcode@flashtux.org> +# version 27: add compatibility with new weechat_print modifier data +# (WeeChat >= 2.9) # 2018-04-06: Joey Pabalinas <joeypabalinas@gmail.com> # version 26: fix freezes with too many nicks in one line # 2018-03-18: nils_2 @@ -85,7 +88,7 @@ w = weechat SCRIPT_NAME = "colorize_nicks" SCRIPT_AUTHOR = "xt <xt@bash.no>" -SCRIPT_VERSION = "26" +SCRIPT_VERSION = "27" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "Use the weechat nick colors in the chat area" @@ -172,11 +175,16 @@ def colorize_cb(data, modifier, modifier_data, line): global ignore_nicks, ignore_channels, colored_nicks + if modifier_data.startswith('0x'): + # WeeChat >= 2.9 + buffer, tags = modifier_data.split(';', 1) + else: + # WeeChat <= 2.8 + plugin, buffer_name, tags = modifier_data.split(';', 2) + buffer = w.buffer_search(plugin, buffer_name) - full_name = modifier_data.split(';')[1] - channel = '.'.join(full_name.split('.')[1:]) + channel = w.buffer_get_string(buffer, 'localvar_channel') - buffer = w.buffer_search('', full_name) # Check if buffer has colorized nicks if buffer not in colored_nicks: return line |