#
# highmon.pl - Highlight Monitoring for weechat 0.3.0
-# Version 2.6
#
# Add 'Highlight Monitor' buffer/bar to log all highlights in one spot
#
# Bugs and feature requests at: https://github.com/KenjiE20/highmon
# History:
+# 2020-06-21, Sebastien Helleu <flashcode@flashtux.org>:
+# v2.7: make call to bar_new compatible with WeeChat >= 2.9
# 2019-05-13, HubbeKing <hubbe128@gmail.com>
# v2.6: -add: send "logger_backlog" signal on buffer open if logging is enabled
# 2014-08-16, KenjiE20 <longbow@longbowslair.co.uk>:
# Make the bar item
weechat::bar_item_new("highmon", "highmon_bar_build", "");
- $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "on", "highmon");
+ if (weechat::info_get("version_number", "") >= 0x02090000)
+ {
+ $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "default", "on", "highmon");
+ }
+ else
+ {
+ $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "on", "highmon");
+ }
return weechat::WEECHAT_RC_OK;
}
if ($cb_high == "1" || (weechat::config_get_plugin("merge_private") eq "on" && $cb_tags =~ /notify_private/))
{
# Pre bug #29618 (0.3.3) away detect
- if (weechat::info_get("version_number", "") <= 197120)
+ if (weechat::info_get("version_number", "") <= 0x00030200)
{
$away = '';
# Get infolist for this server
}
# Check result of register, and attempt to behave in a sane manner
-if (!weechat::register("highmon", "KenjiE20", "2.6", "GPL3", "Highlight Monitor", "", ""))
+if (!weechat::register("highmon", "KenjiE20", "2.7", "GPL3", "Highlight Monitor", "", ""))
{
# Double load
weechat::print ("", "\tHighmon is already loaded");
python.go.color_number_selected = "yellow,red"
python.go.fuzzy_search = "off"
python.go.message = "Go to: "
+python.go.min_chars = "0"
python.go.short_name = "off"
+python.go.short_name_server = "off"
python.go.sort = "number,beginning"
python.go.use_core_instead_weechat = "off"
python.grep.clear_buffer = "off"
python.go.color_number_selected = "color for selected buffer number (default: "yellow,red")"
python.go.fuzzy_search = "search buffer matches using approximation (default: "off")"
python.go.message = "message to display before list of buffers (default: "Go to: ")"
+python.go.min_chars = "Minimum chars to search and display list of matching buffers (default: "0")"
python.go.short_name = "display and search in short names instead of buffer name (default: "off")"
+python.go.short_name_server = "prefix short names with server names for search and display (default: "off")"
python.go.sort = "comma-separated list of keys to sort buffers (the order is important, sorts are performed in the given order): name = sort by name (or short name), (default: "number,beginning")"
python.go.use_core_instead_weechat = "use name "core" instead of "weechat" for core buffer (default: "off")"
python.screen_away.away_suffix = "What to append to your nick when you're away."
python.slack.short_buffer_names = "Use `foo.#channel` rather than `foo.slack.com.#channel` as the internal name for Slack buffers."
python.slack.show_buflist_presence = "Display a `+` character in the buffer list for present users."
python.slack.show_reaction_nicks = "Display the name of the reacting user(s) alongside each reactji."
-python.slack.slack_api_token = "List of Slack API tokens, one per Slack instance you want to connect to. See the README for details on how to get these."
+python.slack.slack_api_token = "List of Slack API tokens, one per Slack instance you want to connect to; see the README for details on how to get these (note: content is evaluated, see /help eval)."
python.slack.slack_timeout = "How long (ms) to wait when communicating with Slack."
python.slack.switch_buffer_on_join = "When /joining a channel, automatically switch to it as well."
python.slack.thread_broadcast_prefix = "Prefix to distinguish thread messages that were also sent to the channel, when thread_messages_in_channel is enabled."
#
# Changelog:
+# 3.9:
+# * Remove `buffers.pl` from recommended settings.
+# 3,8:
+# * Fix relative sorting on script name in default rules.
+# * Document a useful property of stable sort algorithms.
+# 3.7:
+# * Make default rules work with bitlbee, matrix and slack.
# 3.6:
# * Add more documentation on provided info hooks.
# 3.5:
SCRIPT_NAME = 'autosort'
SCRIPT_AUTHOR = 'Maarten de Vries <maarten@de-vri.es>'
-SCRIPT_VERSION = '3.6'
+SCRIPT_VERSION = '3.9'
SCRIPT_LICENSE = 'GPL3'
SCRIPT_DESC = 'Flexible automatic (or manual) buffer sorting based on eval expressions.'
default_rules = json.dumps([
'${core_first}',
- '${irc_last}',
- '${buffer.plugin.name}',
+ '${info:autosort_order,${info:autosort_escape,${script_or_plugin}},core,*,irc,bitlbee,matrix,slack}',
+ '${script_or_plugin}',
'${irc_raw_first}',
- '${if:${plugin}==irc?${server}}',
- '${if:${plugin}==irc?${info:autosort_order,${type},server,*,channel,private}}',
- '${if:${plugin}==irc?${hashless_name}}',
+ '${server}',
+ '${info:autosort_order,${type},server,*,channel,private}',
+ '${hashless_name}',
'${buffer.full_name}',
])
default_helpers = json.dumps({
- 'core_first': '${if:${buffer.full_name}!=core.weechat}',
- 'irc_first': '${if:${buffer.plugin.name}!=irc}',
- 'irc_last': '${if:${buffer.plugin.name}==irc}',
- 'irc_raw_first': '${if:${buffer.full_name}!=irc.irc_raw}',
- 'irc_raw_last': '${if:${buffer.full_name}==irc.irc_raw}',
- 'hashless_name': '${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}',
+ 'core_first': '${if:${buffer.full_name}!=core.weechat}',
+ 'irc_raw_first': '${if:${buffer.full_name}!=irc.irc_raw}',
+ 'irc_raw_last': '${if:${buffer.full_name}==irc.irc_raw}',
+ 'hashless_name': '${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}',
+ 'script_or_plugin': '${if:${script_name}?${script_name}:${plugin}}',
})
default_signal_delay = 5
be sane enough for most people. It can also group IRC channel/private buffers
under their server buffer if you like.
+Autosort uses a stable sorting algorithm, meaning that you can manually move buffers
+to change their relative order, if they sort equal with your rule set.
+
{*white}# Sort rules{reset}
Autosort evaluates a list of eval expressions (see {*default}/help eval{reset}) and sorts the
buffers based on evaluated result. Earlier rules will be considered first. Only
{*white}# Recommended settings
For the best visual effect, consider setting the following options:
{*white}/set {cyan}irc.look.server_buffer{reset} {brown}independent{reset}
- {*white}/set {cyan}buffers.look.indenting{reset} {brown}on{reset}
-The first setting allows server buffers to be sorted independently, which is
+This setting allows server buffers to be sorted independently, which is
needed to create a hierarchical tree view of the server and channel buffers.
-The second one indents channel and private buffers in the buffer list of the
-`{*default}buffers.pl{reset}` script.
If you are using the {*default}buflist{reset} plugin you can (ab)use Unicode to draw a tree
structure with the following setting (modify to suit your need):
#
# History:
#
+# 2021-06-02, Sébastien Helleu <flashcode@flashtux.org>:
+# version 1.2: fix /help buffer_autoset
# 2018-04-14, Kim B. Heino:
# version 1.1: on startup apply settings to already opened buffers
# 2017-06-21, Sébastien Helleu <flashcode@flashtux.org>:
# 2015-07-12, Sébastien Helleu <flashcode@flashtux.org>:
# version 0.8: add option buffer_autoset.look.timer to add a small timer
# before setting buffer properties
-# 2015-04-05, Nils Görs <freenode@#weechat>:
+# 2015-04-05, Nils Görs <libera@#weechat>:
# version 0.7: increase priority of hook_signal('buffer_opened')
-# 2012-12-09, Nils Görs <freenode@#weechat>:
+# 2012-12-09, Nils Görs <libera@#weechat>:
# version 0.6: add support of core buffer
# 2012-03-09, Sébastien Helleu <flashcode@flashtux.org>:
# version 0.5: fix reload of config file
SCRIPT_NAME = "buffer_autoset"
SCRIPT_AUTHOR = "Sébastien Helleu <flashcode@flashtux.org>"
-SCRIPT_VERSION = "1.1"
+SCRIPT_VERSION = "1.2"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened"
"[add buffer property value] | [del option]",
" add: add a buffer/property/value in configuration file\n"
" del: delete an option from configuration file\n"
- " buffer: name of a buffer (can start or end with \"*\" as "
- "wildcard)\n"
+ " buffer: name of a buffer (wildcard \"*\" is allowed)\n"
"property: buffer property\n"
" value: value for property\n"
" option: name of option from configuration file\n\n"
"Examples:\n"
" disable timestamp on channel #weechat:\n"
- " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
+ " /" + SCRIPT_COMMAND + " add irc.libera.#weechat "
"time_for_each_line 0\n"
" add word \"weechat\" in highlight list on channel "
"#savannah:\n"
- " /" + SCRIPT_COMMAND + " add irc.freenode.#savannah "
+ " /" + SCRIPT_COMMAND + " add irc.libera.#savannah "
"highlight_words_add weechat\n"
- " disable highlights from nick \"mike\" on freenode server, "
+ " disable highlights from nick \"mike\" on libera server, "
"channel #weechat (requires WeeChat >= 0.3.4):\n"
- " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
+ " /" + SCRIPT_COMMAND + " add irc.libera.#weechat "
"hotlist_max_level_nicks_add mike:2\n"
- " disable hotlist changes for nick \"bot\" on freenode "
+ " disable hotlist changes for nick \"bot\" on libera "
"server (all channels) (requires WeeChat >= 0.3.4):\n"
- " /" + SCRIPT_COMMAND + " add irc.freenode.* "
+ " /" + SCRIPT_COMMAND + " add irc.libera.* "
"hotlist_max_level_nicks_add bot:-1",
"add %(buffers_plugins_names)|"
"%(buffer_autoset_current_buffer) "
#
#
# History:
+# 2022-11-07: mva
+# version 30: add ":" and "," to VALID_NICK regexp,
+# to don't reset colorization in input_line
# 2022-07-11: ncfavier
# version 29: check nick for exclusion *after* stripping
# decrease minimum min_nick_length to 1
SCRIPT_NAME = "colorize_nicks"
SCRIPT_AUTHOR = "xt <xt@bash.no>"
-SCRIPT_VERSION = "29"
+SCRIPT_VERSION = "30"
SCRIPT_LICENSE = "GPL"
SCRIPT_DESC = "Use the weechat nick colors in the chat area"
# Based on the recommendations in RFC 7613. A valid nick is composed
# of anything but " ,*?.!@".
-VALID_NICK = r'([@~&!%+-])?([^\s,\*?\.!@]+)'
+VALID_NICK = r'([@~&!%+-])?([^\s,\*?\.!@:,]+)'
valid_nick_re = re.compile(VALID_NICK)
ignore_channels = []
ignore_nicks = []
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2009-2014 Sébastien Helleu <flashcode@flashtux.org>
+# Copyright (C) 2009-2023 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2010 m4v <lambdae2@gmail.com>
# Copyright (C) 2011 stfn <stfnmd@googlemail.com>
#
#
# History:
#
+# 2023-06-21, Sébastien Helleu <flashcode@flashtux.org>:
+# version 2.9: add option "min_chars"
+# 2023-01-08, Sébastien Helleu <flashcode@flashtux.org>:
+# version 2.8: send buffer pointer with signal "input_text_changed"
+# 2021-05-25, Tomáš Janoušek <tomi@nomi.cz>:
+# version 2.7: add new option to prefix short names with server names
# 2019-07-11, Simmo Saan <simmo.saan@gmail.com>
# version 2.6: fix detection of "/input search_text_here"
# 2017-04-01, Sébastien Helleu <flashcode@flashtux.org>:
SCRIPT_NAME = 'go'
SCRIPT_AUTHOR = 'Sébastien Helleu <flashcode@flashtux.org>'
-SCRIPT_VERSION = '2.6'
+SCRIPT_VERSION = '2.9'
SCRIPT_LICENSE = 'GPL3'
SCRIPT_DESC = 'Quick jump to buffers'
import weechat
except ImportError:
print('This script must be run under WeeChat.')
- print('Get WeeChat now at: http://www.weechat.org/')
+ print('Get WeeChat now at: https://weechat.org/')
IMPORT_OK = False
import re
# script options
SETTINGS = {
+ 'auto_jump': (
+ 'off',
+ 'automatically jump to buffer when it is uniquely selected'),
+ 'buffer_number': (
+ 'on',
+ 'display buffer number'),
'color_number': (
'yellow,magenta',
'color for buffer number (not selected)'),
'color_name_highlight_selected': (
'red,brown',
'color for highlight in a selected buffer name'),
+ 'fuzzy_search': (
+ 'off',
+ 'search buffer matches using approximation'),
'message': (
'Go to: ',
'message to display before list of buffers'),
+ 'min_chars': (
+ '0',
+ 'Minimum chars to search and display list of matching buffers'),
'short_name': (
'off',
'display and search in short names instead of buffer name'),
+ 'short_name_server': (
+ 'off',
+ 'prefix short names with server names for search and display'),
'sort': (
'number,beginning',
'comma-separated list of keys to sort buffers '
'use_core_instead_weechat': (
'off',
'use name "core" instead of "weechat" for core buffer'),
- 'auto_jump': (
- 'off',
- 'automatically jump to buffer when it is uniquely selected'),
- 'fuzzy_search': (
- 'off',
- 'search buffer matches using approximation'),
- 'buffer_number': (
- 'on',
- 'display buffer number'),
}
# hooks management
strinput = strinput.lower()
infolist = weechat.infolist_get('buffer', '', '')
while weechat.infolist_next(infolist):
+ pointer = weechat.infolist_pointer(infolist, 'pointer')
short_name = weechat.infolist_string(infolist, 'short_name')
+ server = weechat.buffer_get_string(pointer, 'localvar_server')
if go_option_enabled('short_name'):
- name = weechat.infolist_string(infolist, 'short_name')
+ if go_option_enabled('short_name_server') and server:
+ name = server + '.' + short_name
+ else:
+ name = short_name
else:
name = weechat.infolist_string(infolist, 'name')
if name == 'weechat' \
full_name = '%s.%s' % (
weechat.infolist_string(infolist, 'plugin_name'),
weechat.infolist_string(infolist, 'name'))
- pointer = weechat.infolist_pointer(infolist, 'pointer')
matching = name.lower().find(strinput) >= 0
if not matching and strinput[-1] == ' ':
matching = name.lower().endswith(strinput.strip())
def go_buffers_to_string(listbuf, pos, strinput):
"""Return string built with list of buffers found (matching user input)."""
+ try:
+ if len(strinput) < int(weechat.config_get_plugin('min_chars')):
+ return ''
+ except:
+ pass
string = ''
strinput = strinput.lower()
for i in range(len(listbuf)):
if buffers_pos >= len(buffers):
buffers_pos = 0
weechat.hook_signal_send('input_text_changed',
- weechat.WEECHAT_HOOK_SIGNAL_STRING, '')
+ weechat.WEECHAT_HOOK_SIGNAL_POINTER, buf)
return weechat.WEECHAT_RC_OK_EAT
elif command == '/input complete_previous':
# choose previous buffer in list
if buffers_pos < 0:
buffers_pos = len(buffers) - 1
weechat.hook_signal_send('input_text_changed',
- weechat.WEECHAT_HOOK_SIGNAL_STRING, '')
+ weechat.WEECHAT_HOOK_SIGNAL_POINTER, buf)
return weechat.WEECHAT_RC_OK_EAT
elif command == '/input return':
# switch to selected buffer (if any)
#
# History:
#
+# 2022-11-11, anonymous2ch
+# version 0.8.6: ignore utf-8 decoding errors
+#
+# 2021-05-02, Sébastien Helleu <flashcode@flashtux.org>
+# version 0.8.5: add compatibility with WeeChat >= 3.2 (XDG directories)
+#
+# 2020-10-11, Thom Wiggers <thom@thomwiggers.nl>
+# version 0.8.4: Python3 compatibility fix
+#
+# 2020-05-06, Dominique Martinet <asmadeus@codewreck.org> and hexa-
+# version 0.8.3: more python3 compatibility fixes...
+#
# 2019-06-30, dabbill <dabbill@gmail.com>
# and Sébastien Helleu <flashcode@flashtux.org>
# version 0.8.2: make script compatible with Python 3
SCRIPT_NAME = "grep"
SCRIPT_AUTHOR = "Elián Hanisch <lambdae2@gmail.com>"
-SCRIPT_VERSION = "0.8.2"
+SCRIPT_VERSION = "0.8.6"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Search in buffers and logs"
SCRIPT_COMMAND = "grep"
return []
def get_home():
- home = weechat.config_string(weechat.config_get('logger.file.path'))
- home = home.replace('%h', weechat.info_get('weechat_dir', ''))
- home = path.abspath(path.expanduser(home))
+ options = {
+ 'directory': 'data',
+ }
+ home = weechat.string_eval_path_home(
+ weechat.config_string(weechat.config_get('logger.file.path')),
+ {}, {}, options,
+ )
return home
def strip_home(s, dir=''):
if '$server' in mask:
mask = mask.replace('$server', server)
# change the unreplaced vars by '*'
- from string import letters
+ try:
+ from string import letters
+ except ImportError:
+ from string import ascii_letters as letters
if '%' in mask:
# vars for time formatting
mask = mask.replace('%', '$')
check = lambda s: check_string(s, regexp, hilight, exact)
try:
- file_object = open(file, 'r')
+ file_object = open(file, 'r', errors='ignore')
except IOError:
# file doesn't exist
return lines
check = lambda s: check_string(s, regexp, hilight, exact)
if before_context:
- before_context_range = range(1, before_context + 1)
- before_context_range.reverse()
+ before_context_range = reversed(range(1, before_context + 1))
while infolist_next(infolist):
line = get_line(infolist)
buffer_update()
else:
global hook_file_grep, grep_stdout, grep_stderr, pattern_tmpl
- grep_stdout = grep_stderr = ''
+ grep_stdout = grep_stderr = b''
hook_file_grep = weechat.hook_process(
'func:grep_process',
get_config_int('timeout_secs') * 1000,
except Exception as e:
result = e
- return pickle.dumps(result)
-
-grep_stdout = grep_stderr = ''
+ return pickle.dumps(result, 0)
def grep_process_cb(data, command, return_code, out, err):
global grep_stdout, grep_stderr, matched_lines, hook_file_grep
+ if isinstance(out, str):
+ out = out.encode()
grep_stdout += out
+
+ if isinstance(err, str):
+ err = err.encode()
grep_stderr += err
def set_buffer_error(message):
buffer = buffer_create()
if get_config_boolean('clear_buffer'):
weechat.buffer_clear(buffer)
- file_list = zip(file_list, file_sizes)
+ file_list = list(zip(file_list, file_sizes))
msg = 'Found %s logs.' %len(file_list)
print_line(msg, buffer, display=True)
debug = pybuffer.debugBuffer(globals(), '%s_debug' % SCRIPT_NAME)
except:
def debug(s, *args):
- if not isinstance(s, basestring):
- s = str(s)
+ try:
+ if not isinstance(s, basestring):
+ s = str(s)
+ except NameError:
+ pass
if args:
s = s %args
prnt('', '%s\t%s' %(script_nick, s))
-Subproject commit 39ff696e6ad2c3c6381b2556786394adb06bf935
+Subproject commit 5302c8701c5411c28a00b022600ee7cd723718e2
# Changelog:
#
# 0.1: Initial release.
-#
+# 0.2: Add compatibility with new weechat_print modifier data (WeeChat >= 2.9).
+# 0.3: Fix the compatibility checker
SCRIPT_NAME = 'colorizer'
SCRIPT_AUTHOR = 'Michael B. Hix'
SCRIPT_DESC = 'Colorize text in buffers based on rules.'
-SCRIPT_VERSION = '0.1'
+SCRIPT_VERSION = '0.3'
SCRIPT_LICENSE = 'BSD'
# A default coloring rule.
# 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?('0x')
+ # 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|
+# coding: utf-8
#
# (c) 2013 Hendrik 'henk' Jaeger <weechat@henk.geekmail.org>
# (c) 2015 arza <arza@arza.us>
# 2015-09-24 0.1 arza:
# - option -m/--minimum for minimum count of mutual channels
# - fixed completion
+# 2021-11-06 0.2 Sébastien Helleu:
+# - make script compatible with WeeChat >= 3.4
+# (new parameters in function hdata_search)
def weechat_init
Weechat.register(
"samechannel",
"henk",
- "0.1",
+ "0.2",
"GPL3",
"Lists multiple occurences of the same nick(s) in a set of channels.",
"",
end
def find_servers( names )
+ weechat_version = Weechat.info_get('version_number', '').to_i
serverptrlist = Weechat.hdata_get_list($hdata_ircserver, 'irc_servers')
if names
matching_servers = names.map do |name|
- foundserverptr = Weechat.hdata_search($hdata_ircserver, serverptrlist, '${irc_server.name} =~ ' + name, 1)
+ if weechat_version >= 0x03040000
+ foundserverptr = Weechat.hdata_search($hdata_ircserver, serverptrlist,
+ '${irc_server.name} =~ ${name}',
+ {}, {'name' => name}, {}, 1)
+ else
+ foundserverptr = Weechat.hdata_search($hdata_ircserver, serverptrlist, '${irc_server.name} =~ ' + name, 1)
+ end
end
else
return hhh_get_ptrarray($hdata_ircserver, serverptrlist)