From 3f27cb2124fea90248493d32b3ecb0cc9d9b07aa Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sat, 17 Mar 2018 13:20:15 +0100 Subject: weechat: Update plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- weechat/python/colorize_nicks.py | 23 +++++++++++++++++++++-- weechat/python/infolist.py | 13 +++++++++++-- weechat/python/whois_on_query.py | 6 ++++-- 3 files changed, 36 insertions(+), 6 deletions(-) (limited to 'weechat/python') diff --git a/weechat/python/colorize_nicks.py b/weechat/python/colorize_nicks.py index 1460f01..5d268b5 100644 --- a/weechat/python/colorize_nicks.py +++ b/weechat/python/colorize_nicks.py @@ -21,6 +21,8 @@ # # # History: +# 2017-06-20: lbeziaud +# version 24: colorize utf8 nicks # 2017-03-01, arza # version 23: don't colorize nicklist group names # 2016-05-01, Simmo Saan @@ -79,11 +81,13 @@ w = weechat SCRIPT_NAME = "colorize_nicks" SCRIPT_AUTHOR = "xt " -SCRIPT_VERSION = "23" +SCRIPT_VERSION = "24" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "Use the weechat nick colors in the chat area" -VALID_NICK = r'([@~&!%+])?([-a-zA-Z0-9\[\]\\`_^\{|\}]+)' +# Based on the recommendations in RFC 7613. A valid nick is composed +# of anything but " ,*?.!@". +VALID_NICK = r'([@~&!%+-])?([^\s,\*?\.!@]+)' valid_nick_re = re.compile(VALID_NICK) ignore_channels = [] ignore_nicks = [] @@ -189,6 +193,21 @@ def colorize_cb(data, modifier, modifier_data, line): if len(nick) < min_length or nick in ignore_nicks: continue + # If the matched word is not a known nick, we try to match the + # word without its first or last character (if not a letter). + # This is necessary as "foo:" is a valid nick, which could be + # adressed as "foo::". + if nick not in colored_nicks[buffer]: + if not nick[-1].isalpha() and not nick[0].isalpha(): + if nick[1:-1] in colored_nicks[buffer]: + nick = nick[1:-1] + elif not nick[0].isalpha(): + if nick[1:] in colored_nicks[buffer]: + nick = nick[1:] + elif not nick[-1].isalpha(): + if nick[:-1] in colored_nicks[buffer]: + nick = nick[:-1] + # Check that nick is in the dictionary colored_nicks if nick in colored_nicks[buffer]: nick_color = colored_nicks[buffer][nick] diff --git a/weechat/python/infolist.py b/weechat/python/infolist.py index 471f63c..5c57ecd 100644 --- a/weechat/python/infolist.py +++ b/weechat/python/infolist.py @@ -18,6 +18,8 @@ # Display infolist in a buffer. # # History: +# 2017-10-22, nils_2 : +# version 0.6: add string_eval_expression() # 2012-10-02, nils_2 : # version 0.5: switch to infolist buffer (if exists) when command /infolist # is called with arguments, add some examples to help page @@ -35,7 +37,7 @@ SCRIPT_NAME = "infolist" SCRIPT_AUTHOR = "Sebastien Helleu " -SCRIPT_VERSION = "0.5" +SCRIPT_VERSION = "0.6" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Display infolist in a buffer" @@ -165,6 +167,8 @@ def infolist_buffer_new(): def infolist_cmd(data, buffer, args): global infolist_buffer + args = string_eval_expression(args) + if infolist_buffer == "": infolist_buffer_new() if infolist_buffer != "" and args != "": @@ -173,6 +177,9 @@ def infolist_cmd(data, buffer, args): return weechat.WEECHAT_RC_OK +def string_eval_expression(string): + return weechat.string_eval_expression(string,{},{},{}) + if __name__ == "__main__" and import_ok: if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""): @@ -190,6 +197,8 @@ if __name__ == "__main__" and import_ok: " Show information about nick \"FlashCode\" in channel \"#weechat\" on server \"freenode\":\n" " /infolist irc_nick freenode,#weechat,FlashCode\n" " Show nicklist from a specific buffer:\n" - " /infolist nicklist " + " /infolist nicklist \n" + " Show current buffer:\n" + " /infolist buffer ${buffer}" "", "%(infolists)", "infolist_cmd", "") diff --git a/weechat/python/whois_on_query.py b/weechat/python/whois_on_query.py index 4721437..be5572c 100644 --- a/weechat/python/whois_on_query.py +++ b/weechat/python/whois_on_query.py @@ -24,6 +24,8 @@ # # History: # +# 2017-05-28, Jos Ahrens : +# version 0.6.1: Corrected a typo in help description for option self_query # 2012-01-03, Sebastien Helleu : # version 0.6: make script compatible with Python 3.x # 2011-10-17, Sebastien Helleu : @@ -52,13 +54,13 @@ except ImportError: SCRIPT_NAME = 'whois_on_query' SCRIPT_AUTHOR = 'Sebastien Helleu ' -SCRIPT_VERSION = '0.6' +SCRIPT_VERSION = '0.6.1' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Whois on query' # script options woq_settings_default = { - 'command' : ('/whois $nick $nick', 'the command sent to do the whois ($nick is repladed by nick)'), + 'command' : ('/whois $nick $nick', 'the command sent to do the whois ($nick is replaced by nick)'), 'self_query': ('off', 'if on, send whois for self queries'), } -- cgit v1.2.3-70-g09d2