Commit 03ff6881 authored by Sébastien Helleu's avatar Sébastien Helleu

colorizer.rb 0.2: add compatibility with new weechat_print modifier data (WeeChat >= 2.9)

parent ecfc4aa0
......@@ -32,12 +32,13 @@
# Changelog:
#
# 0.1: Initial release.
# 0.2: Add compatibility with new weechat_print modifier data (WeeChat >= 2.9).
#
SCRIPT_NAME = 'colorizer'
SCRIPT_AUTHOR = 'Michael B. Hix'
SCRIPT_DESC = 'Colorize text in buffers based on rules.'
SCRIPT_VERSION = '0.1'
SCRIPT_VERSION = '0.2'
SCRIPT_LICENSE = 'BSD'
# A default coloring rule.
......@@ -157,8 +158,16 @@ end
# Handle message printing.
#
def colorize_cb( data, modifier, modifier_data, message )
_,buffer,_ = modifier_data.split( ';' )
return message unless @buffer_regex =~ buffer
if modifier_data.start_with?('abc')
# WeeChat >= 2.9
buffer, tags = modifier_data.split( ';' )
buffer_name = Weechat.buffer_get_string(buffer, 'name')
else
# WeeChat <= 2.8
plugin, buffer_name, tags = modifier_data.split( ';' )
end
return message unless @buffer_regex =~ buffer_name
reset = Weechat.color( 'reset' )
@rules.each do |reg, color_str|
......
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