Commit bc8a9051 authored by Sébastien Helleu's avatar Sébastien Helleu

colorize_nicks.py 27: add compatibility with new weechat_print modifier data (WeeChat >= 2.9)

parent 49fe8a27
......@@ -21,6 +21,9 @@
#
#
# History:
# 2020-05-09: Sébastien Helleu <[email protected]>
# version 27: add compatibility with new weechat_print modifier data
# (WeeChat >= 2.9)
# 2018-04-06: Joey Pabalinas <[email protected]>
# 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 <[email protected]>"
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment