diff --git a/weechat/.weechat/irc.conf b/weechat/.weechat/irc.conf index 108ae90..12355d7 100644 --- a/weechat/.weechat/irc.conf +++ b/weechat/.weechat/irc.conf @@ -190,7 +190,7 @@ tilde.local_hostname tilde.usermode tilde.command = "/msg operserv login ${sec.data.pass}" tilde.command_delay -tilde.autojoin = "##ekbots,#.tilde,#ZfA,#anarchism,#anelki,#ascii.town,#aussie,#bots,#bungame,#club,#cosmic,#counting,#counting-meta,#covid19,#ctrl-c,#envs,#envs_german,#espanol,#factorio,#fr,#gopher,#helpdesk,#homegrown,#ilos,#institute,#irctokens,#linux,#meta,#minecraft,#mops,#music,#netnews,#ninja,#nsfw,#opers,#pink,#politics,#prepping,#projects,#red,#secret-sudoers,#southlondon,#sus,#team,#theasylum,#thunix,#tilde.zone-admin,#tildebot,#tilderadio,#tilderadio-djs,#tildetel,#tildeverse,#vim,#zine" +tilde.autojoin = "##ekbots,#.tilde,#ZfA,#allhandsactive,#anarchism,#anelki,#ascii.town,#aussie,#bots,#bungame,#club,#cosmic,#counting,#counting-meta,#covid19,#ctrl-c,#deutsch,#envs,#envs_german,#espanol,#factorio,#fr,#gopher,#helpdesk,#homegrown,#ilos,#institute,#irctokens,#linux,#meta,#minecraft,#mops,#music,#netnews,#nsfw,#opers,#pink,#politics,#prepping,#programming,#projects,#red,#secret-sudoers,#southlondon,#sus,#team,#theasylum,#thunix,#tilde.zone-admin,#tildebot,#tilderadio,#tilderadio-djs,#tildetel,#tildeverse,#town,#vim,#zine" tilde.autorejoin tilde.autorejoin_delay tilde.connection_timeout @@ -454,7 +454,7 @@ oftc.local_hostname oftc.usermode oftc.command oftc.command_delay -oftc.autojoin = "#bitlbee,#debian,#debian-devel,#debian-offtopic,#fish,#mobian,#moocows,#oftc,#tilde.team" +oftc.autojoin = "#bitlbee,#debian-devel,#fish,#moocows,#oftc" oftc.autorejoin oftc.autorejoin_delay oftc.connection_timeout @@ -630,7 +630,7 @@ bitlbee.local_hostname bitlbee.usermode bitlbee.command bitlbee.command_delay -bitlbee.autojoin = "#biboumi,#btlgeneral,#cifuzofu,#darwin,#ejabberd,#gritty,#gta5,#harris,#hmm,#joinjabber,#lobby,#meeting,#onlythereals,#soprani.ca,#texto-plano,#xsf,&SMS,&bitlbee,&hmm,&tilde" +bitlbee.autojoin = "#biboumi,#btlgeneral,#cifuzofu,#conversations,#darwin,#dino,#ejabberd,#gajim,#gritty,#gta5,#harris,#hmm,#joinjabber,#lobby,#meeting,#movim,#onlythereals,#openhardware,#operators,#soprani.ca,#texto-plano,#tilde.team,#xsf,&SMS,&bitlbee,&hmm,&tilde" bitlbee.autorejoin bitlbee.autorejoin_delay bitlbee.connection_timeout @@ -762,7 +762,7 @@ libera.local_hostname libera.usermode libera.command libera.command_delay -libera.autojoin = "#,#!,##,##Ben,##crustaceans,##ircv3-chat,##oodnet,##proxmox,#among-sus,#bitbot,#fosshost,#fosshost-volunteers,#gitea,#gopher,#gophernicus,#libera-dev,#lobsters,#mastodon,#oragono,#ovh,#pleroma,#sr.ht,#sr.ht.watercooler,#tilde.team,#tildeverse,#weechat,#weechat-android" +libera.autojoin = "#!,##Ben,##crustaceans,##ircv3-chat,##oodnet,##proxmox,#among-sus,#bitbot,#ergo.chat,#fosshost,#fosshost-volunteers,#gitea,#gopher,#gophernicus,#hetzner,#ircpuzzles,#irctokens,#libera-communities,#libera-dev,#lobsters,#mastodon,#ovh,#sr.ht,#sr.ht.watercooler,#tilde.team,#tildeverse,#weechat,#weechat-android" libera.autorejoin libera.autorejoin_delay libera.connection_timeout @@ -777,3 +777,47 @@ libera.notify libera.split_msg_max_length libera.charset_message libera.default_chantypes +ergo.addresses = "irc.ergo.chat/6697" +ergo.proxy +ergo.ipv6 +ergo.ssl = on +ergo.ssl_cert +ergo.ssl_password +ergo.ssl_priorities +ergo.ssl_dhkey_size +ergo.ssl_fingerprint +ergo.ssl_verify +ergo.password +ergo.capabilities +ergo.sasl_mechanism = external +ergo.sasl_username +ergo.sasl_password +ergo.sasl_key +ergo.sasl_timeout +ergo.sasl_fail +ergo.autoconnect +ergo.autoreconnect +ergo.autoreconnect_delay +ergo.nicks = "ben" +ergo.nicks_alternate +ergo.username +ergo.realname +ergo.local_hostname +ergo.usermode +ergo.command +ergo.command_delay +ergo.autojoin = "#ergo" +ergo.autorejoin +ergo.autorejoin_delay +ergo.connection_timeout +ergo.anti_flood_prio_high +ergo.anti_flood_prio_low +ergo.away_check +ergo.away_check_max_nicks +ergo.msg_kick +ergo.msg_part +ergo.msg_quit +ergo.notify +ergo.split_msg_max_length +ergo.charset_message +ergo.default_chantypes diff --git a/weechat/.weechat/logger.conf b/weechat/.weechat/logger.conf index df97888..91a1c42 100644 --- a/weechat/.weechat/logger.conf +++ b/weechat/.weechat/logger.conf @@ -32,6 +32,7 @@ replacement_char = "_" time_format = "%Y-%m-%d %H:%M:%S" [level] +core.weechat = 0 irc = 3 [mask] diff --git a/weechat/.weechat/perl/colorize_lines.pl b/weechat/.weechat/perl/colorize_lines.pl index 93a4465..c03ff4f 100644 --- a/weechat/.weechat/perl/colorize_lines.pl +++ b/weechat/.weechat/perl/colorize_lines.pl @@ -19,6 +19,7 @@ # along with this program. If not, see . # history: +# 4.0: add compatibility with XDG directories (WeeChat >= 3.2) # 3.9: add compatibility with new weechat_print modifier data (WeeChat >= 2.9) # 3.8: new option custom_action_text (https://github.com/weechat/scripts/issues/313) (idea by 3v1n0) # 3.7: new option "alternate_color" (https://github.com/weechat/scripts/issues/333) (idea by snuffkins) @@ -87,7 +88,7 @@ use strict; my $PRGNAME = "colorize_lines"; -my $VERSION = "3.9"; +my $VERSION = "4.0"; my $AUTHOR = "Nils Görs "; my $LICENCE = "GPL3"; my $DESCR = "Colorize users' text in chat area with their nick color, including highlights"; @@ -111,7 +112,7 @@ my %help_desc = ("buffers" => "Buffer type affected by the scri "blacklist_buffers" => "Comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)", "lines" => "Apply nickname color to the lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'. You can use a localvar to color all lines with a given color (eg: /buffer set localvar_set_colorize_lines *yellow). You'll have enable this option to use alternate_color.", "highlight" => "Apply highlight color to the highlighted lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'. Options 'weechat.color.chat_highlight' and 'weechat.color.chat_highlight_bg' will be used as colors.", - "nicks" => "Comma-separater list of nicks (e.g. freenode.cat,*.dog) OR file name starting with '/' (e.g. /file.txt). In the latter case, nicknames will get loaded from that file inside weechat folder (e.g. from ~/.weechat/file.txt). Nicknames in file are newline-separated (e.g. freenode.dog\\n*.cat)", + "nicks" => "Comma-separater list of nicks (e.g. freenode.cat,*.dog) OR file name starting with '/' (e.g. /file.txt). In the latter case, nicknames will get loaded from that file inside weechat config folder. Nicknames in file are newline-separated (e.g. freenode.dog\\n*.cat)", "own_lines" => "Apply nickname color to own lines (off/on/only). The latter turns off all other kinds of coloring altogether. This option has an higher priority than alternate_color option.", "own_lines_color" => "this color will be used for own messages. Set an empty value to use weechat.color.chat_nick_self option", "tags" => "Comma-separated list of tags to accept (see /debug tags)", @@ -324,7 +325,8 @@ sub get_alternate_color sub nicklist_read { return if (substr($config{nicks}, 0, 1) ne "/"); - my $file = weechat::info_get("weechat_dir", "") . $config{nicks}; + my $options = { "directory" => "config" }; + my $file = weechat::string_eval_path_home("%h" . $config{nicks}, {}, {}, $options); return unless -e $file; my $nili = ""; open (WL, "<", $file) || DEBUG("$file: $!"); diff --git a/weechat/.weechat/plugins.conf b/weechat/.weechat/plugins.conf index 277dea6..7d4dd62 100644 --- a/weechat/.weechat/plugins.conf +++ b/weechat/.weechat/plugins.conf @@ -77,6 +77,7 @@ python.go.color_number_selected = "yellow,red" python.go.fuzzy_search = "on" python.go.message = "Go to: " 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" @@ -87,6 +88,12 @@ python.grep.max_lines = "4000" python.grep.show_summary = "on" python.grep.size_limit = "2048" python.grep.timeout_secs = "300" +python.listbuffer.autofocus = "on" +python.listbuffer.channel_min_width = "25" +python.listbuffer.modes_min_width = "8" +python.listbuffer.sort_inverted = "on" +python.listbuffer.sort_order = "users" +python.listbuffer.users_min_width = "8" python.screen_away.away_suffix = "" python.screen_away.command_on_attach = "" python.screen_away.command_on_detach = "" @@ -193,8 +200,15 @@ python.go.color_number_selected = "color for selected buffer number (default: "y 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.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.listbuffer.autofocus = "Focus the listbuffer in the current window if it isn't already displayed by a window." +python.listbuffer.channel_min_width = "The minimum width used for the channel name in the channel list. If a channelname is shorter than this amount, the column will be padded with spaces." +python.listbuffer.modes_min_width = "The minimum width used for modes in the channel list. If a channel has less modes than this amount, the column will be padded with spaces." +python.listbuffer.sort_inverted = "Invert the sort order for the channel list." +python.listbuffer.sort_order = "Last used sort order for the channel list." +python.listbuffer.users_min_width = "The minimum width used for the usercount in the channel list. If the usercount has less digits than this amount, the column will be padded with spaces." python.screen_away.away_suffix = "What to append to your nick when you're away." python.screen_away.command_on_attach = "Commands to execute on attach, separated by semicolon" python.screen_away.command_on_detach = "Commands to execute on detach, separated by semicolon" diff --git a/weechat/.weechat/python/autoload/listbuffer.py b/weechat/.weechat/python/autoload/listbuffer.py new file mode 120000 index 0000000..e7089b2 --- /dev/null +++ b/weechat/.weechat/python/autoload/listbuffer.py @@ -0,0 +1 @@ +../listbuffer.py \ No newline at end of file diff --git a/weechat/.weechat/python/go.py b/weechat/.weechat/python/go.py index 2ab47ed..77c5774 100644 --- a/weechat/.weechat/python/go.py +++ b/weechat/.weechat/python/go.py @@ -21,6 +21,8 @@ # # History: # +# 2021-05-25, Tomáš Janoušek : +# version 2.7: add new option to prefix short names with server names # 2019-07-11, Simmo Saan # version 2.6: fix detection of "/input search_text_here" # 2017-04-01, Sébastien Helleu : @@ -94,7 +96,7 @@ from __future__ import print_function SCRIPT_NAME = 'go' SCRIPT_AUTHOR = 'Sébastien Helleu ' -SCRIPT_VERSION = '2.6' +SCRIPT_VERSION = '2.7' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Quick jump to buffers' @@ -137,6 +139,9 @@ SETTINGS = { '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 ' @@ -317,9 +322,14 @@ def go_matching_buffers(strinput): 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' \ @@ -332,7 +342,6 @@ def go_matching_buffers(strinput): 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()) diff --git a/weechat/.weechat/python/grep.py b/weechat/.weechat/python/grep.py index 7fd1bc8..68e067d 100644 --- a/weechat/.weechat/python/grep.py +++ b/weechat/.weechat/python/grep.py @@ -68,6 +68,10 @@ # # # History: +# +# 2021-05-02, Sébastien Helleu +# version 0.8.5: add compatibility with WeeChat >= 3.2 (XDG directories) +# # 2020-10-11, Thom Wiggers # version 0.8.4: Python3 compatibility fix # @@ -235,7 +239,7 @@ except ImportError: SCRIPT_NAME = "grep" SCRIPT_AUTHOR = "Elián Hanisch " -SCRIPT_VERSION = "0.8.4" +SCRIPT_VERSION = "0.8.5" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Search in buffers and logs" SCRIPT_COMMAND = "grep" @@ -451,9 +455,13 @@ def get_config_log_filter(): 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=''): diff --git a/weechat/.weechat/python/listbuffer.py b/weechat/.weechat/python/listbuffer.py new file mode 100644 index 0000000..a8843be --- /dev/null +++ b/weechat/.weechat/python/listbuffer.py @@ -0,0 +1,474 @@ +# -*- coding: utf-8 -*- +# +# ListBuffer, version 0.8.1 for WeeChat version 0.3 +# Latest development version: https://github.com/FiXato/listbuffer +# +# Show /list results in a common buffer and interact with them. +# +# This script allows you to easily join channels from the /list output. +# It will open a common buffer for the /list result, through which you +# browse with your cursor keys, and join with the meta-enter keys. +# Adjust sorting with meta->, meta-< and meta-/ keybindings. +# +## History: +### 2011-09-08: FiXato: +# +# * version 0.1: initial release. +# * added a common buffer for /list results +# * added highlighting for currently selected line +# * added /join support via enter key +# * added scroll_top and scroll_bottom support +# +# * version 0.2: /list format bugfix +# * added support for /list results without modes +# * some servers don't send 321 (/list start). Taken into account. +# +# * version 0.3: Sorting support +# * Added some basic sorting support. Scroll through sort options +# with meta-> and meta-< (users, channel, topic, modes) +# +### 2011-09-19: FiXato +# +# * version 0.4: +# * Case-insensitive buffer lookup fix. +# * Removed default enter keybind +# +### 2011-12-28: troydm: +# +# * version 0.5: It's an upside-down-world +# * Added inverted sorting support provided by Dmitry "troydm" Geurkov +# Use meta-/ to switch between inverted and regular sorting. +# +### 2012-02-10: FiXato: +# +# * version 0.6: Stop shoving that buffer in my face! +# * The listbuffer should no longer pop up by itself when you load the script. +# It should only pop up now when you actually do a /list query. +# +# * version 0.7: .. but please pop it up in my current window when I ask for it +# * Added setting plugins.var.python.listbuffer.autofocus +# This will autofocus the listbuffer in the current window if another window isn't +# already showing it, and of course only when the user issues /list +# +### 2012-07-10: FiXato: +# +# * version 0.7.1: Forgetful bugfix +# * Made sure lb_curline global variable is defined +# +### 2013-03-19: FiXato: +# +# * version 0.8: Sorted out the sorting +# * Added automatically updating options for sorting: +# * plugins.var.python.listbuffer.sort_inverted +# * plugins.var.python.listbuffer.sort_order +# * version 0.8.1: Pad it baby! +# * Channel modes are equally padded even when there are no channel modes. +# * Added padding options: +# * plugins.var.python.listbuffer.modes_min_width +# * plugins.var.python.listbuffer.channel_min_width +# * plugins.var.python.listbuffer.users_min_width +# +### 2019-07-05: Sébastien Helleu: +# +# * version 0.8.2: Make script compatible with Python 3. +# +## Acknowledgements: +# * Dmitry "troydm" Geurkov, for providing the inverse-sorting patch to the project. +# * Sebastien "Flashcode" Helleu, for developing the kick-ass IRC client WeeChat +# and the iset.pl script which inspired me to this script. +# * Nils "nils_2" Görs, for his contributions to iset.pl which served as +# example code. +# * David "drubin" Rubin, for his urlgrab.py script, which also served +# as example code. +# * ArZa, whose listsort.pl script helped me getting started with +# grabbing the /list results. Parts of his code have been shamelessly +# copied and ported to Python. +# * Khaled Mardam-Bey, for making me yearn for similar /list support in +# WeeChat as mIRC already offered. :P +# * mave_, for pointing out that sort orders weren't remembered. +# +## TODO: +# - Auto-scroll selected line upon window scroll. +# - Add option to hide already joined channels. +# - Improve sorting methods +# - Add auto-join support +# - Detect if channel is already in auto-join +# - Allow automatically switching to the listbuffer +# - Add support for ALIS (/squery alis LIST * -mix 100 (IRCNet) +# - Make colours configurable +# - Limit number of channels to parse +# - Add filter support a la iset +# - Allow selecting multiple channels +# - Add optional command redirection. +# +## Copyright (c) 2011,2012,2013 Filip H.F. "FiXato" Slagter, +# +# http://profile.fixato.org +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +from __future__ import print_function + +SCRIPT_NAME = "listbuffer" +SCRIPT_AUTHOR = "Filip H.F. 'FiXato' Slagter " +SCRIPT_VERSION = "0.8.2" +SCRIPT_LICENSE = "MIT" +SCRIPT_DESC = "A common buffer for /list output." +SCRIPT_COMMAND = "listbuffer" + +import_ok = True + +try: + import weechat +except ImportError: + print("This script must be run under WeeChat.") + import_ok = False + +import re + +lb_settings = ( + ("autofocus", "on", "Focus the listbuffer in the current window if it isn't already displayed by a window."), + ("sort_order", "users", "Last used sort order for the channel list."), + ("sort_inverted", "on", "Invert the sort order for the channel list."), + ("modes_min_width", "8", "The minimum width used for modes in the channel list. If a channel has less modes than this amount, the column will be padded with spaces."), + ("channel_min_width", "25", "The minimum width used for the channel name in the channel list. If a channelname is shorter than this amount, the column will be padded with spaces."), + ("users_min_width", "8", "The minimum width used for the usercount in the channel list. If the usercount has less digits than this amount, the column will be padded with spaces."), +) +lb_buffer = None +lb_curline = 0 +lb_channels = [] +lb_network = None +lb_list_started = False +lb_current_sort = None +lb_sort_inverted = False +lb_sort_options = ( + 'channel', + 'users', + 'modes', + 'topic', +) + +# server numeric Nick Chan Users Modes Topic +lb_channel_list_expression = '(:\S+) (\d{3}) (\S+) (\S+) (\d+) :(\[(.*?)\] )?(.*)' + +# Create listbuffer. +def lb_create_buffer(): + global lb_buffer, lb_curline + + if not lb_buffer: + lb_buffer = weechat.buffer_new("listbuffer", "lb_input_cb", \ + "", "lb_close_cb", "") + lb_set_buffer_title() + # Sets notify to 0 as this buffer does not need to be in hotlist. + weechat.buffer_set(lb_buffer, "notify", "0") + weechat.buffer_set(lb_buffer, "nicklist", "0") + weechat.buffer_set(lb_buffer, "type", "free") + weechat.buffer_set(lb_buffer, "key_bind_ctrl-L", "/listbuffer **refresh") + weechat.buffer_set(lb_buffer, "key_bind_meta2-A", "/listbuffer **up") + weechat.buffer_set(lb_buffer, "key_bind_meta2-B", "/listbuffer **down") + weechat.buffer_set(lb_buffer, "key_bind_meta2-1~", "/listbuffer **scroll_top") + weechat.buffer_set(lb_buffer, "key_bind_meta2-4~", "/listbuffer **scroll_bottom") + weechat.buffer_set(lb_buffer, "key_bind_meta-ctrl-J", "/listbuffer **enter") + weechat.buffer_set(lb_buffer, "key_bind_meta-ctrl-M", "/listbuffer **enter") + weechat.buffer_set(lb_buffer, "key_bind_meta->", "/listbuffer **sort_next") + weechat.buffer_set(lb_buffer, "key_bind_meta-<", "/listbuffer **sort_previous") + weechat.buffer_set(lb_buffer, "key_bind_meta-/", "/listbuffer **sort_invert") + lb_curline = 0 + if weechat.config_get_plugin("autofocus") == "on": + if not weechat.window_search_with_buffer(lb_buffer): + weechat.command("", "/buffer " + weechat.buffer_get_string(lb_buffer,"name")) + +def lb_set_buffer_title(): + global lb_buffer, lb_current_sort + ascdesc = '(v)' if lb_sort_inverted else '(^)' + weechat.buffer_set(lb_buffer, "title", lb_line_format({ + 'channel': 'Channel name%s' % (ascdesc if lb_current_sort == 'channel' else ''), + 'users': 'Users%s' % (ascdesc if lb_current_sort == 'users' else ''), + 'modes': 'Modes%s' % (ascdesc if lb_current_sort == 'modes' else ''), + 'topic': 'Topic%s' % (ascdesc if lb_current_sort == 'topic' else ''), + 'nomodes': None, + })) + +def lb_list_start(data, signal, message): + lb_initialise_list + + return weechat.WEECHAT_RC_OK + +def lb_initialise_list(signal): + global lb_channels, lb_network, lb_list_started + + lb_create_buffer() + lb_channels = [] + lb_network = signal.split(',')[0] + lb_list_started = True + return + + +def lb_list_chan(data, signal, message): + global lb_channels, lb_buffer, lb_list_started + + # Work-around for IRCds which don't send 321 Numeric (/List start) + if not lb_list_started: + lb_initialise_list(signal) + + for chan_data in re.findall(lb_channel_list_expression,message): + lb_channels.append({ + 'server': chan_data[0][1:-1], + 'numeric': chan_data[1], + 'nick': chan_data[2], + 'channel': chan_data[3], + 'users': chan_data[4], + 'nomodes': chan_data[5] == '', + 'modes': chan_data[6], + 'topic': weechat.hook_modifier_exec("irc_color_decode", "1", chan_data[7]) + }) + return weechat.WEECHAT_RC_OK + +def lb_list_end(data, signal, message): + global lb_list_started + + # Work-around for IRCds which don't send 321 Numeric (/List start) + if not lb_list_started: + lb_initialise_list(signal) + + lb_list_started = False + if lb_current_sort: + lb_sort() + lb_refresh() + return weechat.WEECHAT_RC_OK + +def keyEvent (data, buffer, args): + global lb_options + lb_options[args]() + +def lb_input_cb(data, buffer, input_data): + global lb_options, lb_curline + lb_options[input_data]() + return weechat.WEECHAT_RC_OK + +def lb_refresh(): + global lb_channels, lb_buffer + weechat.buffer_clear(lb_buffer) + + y = 0 + for list_data in lb_channels: + lb_refresh_line(y) + y += 1 + return + +def lb_refresh_line(y): + global lb_buffer, lb_curline, lb_channels + if y >= 0 and y < len(lb_channels): + formatted_line = lb_line_format(lb_channels[y], y == lb_curline) + weechat.prnt_y(lb_buffer, y, formatted_line) + +def lb_refresh_curline(): + global lb_curline + lb_refresh_line(lb_curline-1) + lb_refresh_line(lb_curline) + lb_refresh_line(lb_curline+1) + return + +def lb_line_format(list_data,curr=False): + str = "" + if (curr): + str += weechat.color("yellow,red") + channel_text = list_data['channel'].ljust(int(weechat.config_get_plugin('channel_min_width'))) + users_text = "(%s)" % list_data['users'] + padded_users_text = users_text.rjust(int(weechat.config_get_plugin('users_min_width')) + 2) + str += "%s%s %s " % (weechat.color("bold"), channel_text, padded_users_text) + if not list_data['nomodes']: + modes = "[%s]" % list_data['modes'] + else: + modes = "[]" + str += "%s: " % modes.rjust(int(weechat.config_get_plugin('modes_min_width')) + 2) + str += "%s" % list_data['topic'] + return str + +def lb_line_up(): + global lb_curline + if lb_curline <= 0: + return + lb_curline -= 1 + lb_refresh_curline() + lb_check_outside_window() + return + +def lb_line_down(): + global lb_curline, lb_channels + if lb_curline+1 >= len(lb_channels): + return + lb_curline += 1 + lb_refresh_curline() + lb_check_outside_window() + return + +def lb_line_run(): + global lb_channels, lb_curline, lb_network + buff = weechat.info_get("irc_buffer", lb_network) + channel = lb_channels[lb_curline]['channel'] + command = "/join %s" % channel + weechat.command(buff, command) + return + +def lb_line_select(): + return + +def lb_scroll_top(): + global lb_curline + old_y = lb_curline + lb_curline = 0 + lb_refresh_curline() + lb_refresh_line(old_y) + weechat.command(lb_buffer, "/window scroll_top") + return + +def lb_scroll_bottom(): + global lb_curline, lb_channels + old_y = lb_curline + lb_curline = len(lb_channels)-1 + lb_refresh_curline() + lb_refresh_line(old_y) + weechat.command(lb_buffer, "/window scroll_bottom") + return + +def lb_check_outside_window(): + global lb_buffer, lb_curline + if (lb_buffer): + infolist = weechat.infolist_get("window", "", "current") + if (weechat.infolist_next(infolist)): + start_line_y = weechat.infolist_integer(infolist, "start_line_y") + chat_height = weechat.infolist_integer(infolist, "chat_height") + if(start_line_y > lb_curline): + weechat.command(lb_buffer, "/window scroll -%i" %(start_line_y - lb_curline)) + elif(start_line_y <= lb_curline - chat_height): + weechat.command(lb_buffer, "/window scroll +%i"%(lb_curline - start_line_y - chat_height + 1)) + weechat.infolist_free(infolist) + +def lb_sort_next(): + global lb_current_sort, lb_sort_options + if lb_current_sort: + new_index = lb_sort_options.index(lb_current_sort) + 1 + else: + new_index = 0 + + if len(lb_sort_options) <= new_index: + new_index = 0 + + lb_set_current_sort_order(lb_sort_options[new_index]) + lb_sort() + +def lb_set_current_sort_order(value): + global lb_current_sort + lb_current_sort = value + weechat.config_set_plugin('sort_order', lb_current_sort) + +def lb_set_invert_sort_order(value): + global lb_sort_inverted + lb_sort_inverted = value + weechat.config_set_plugin('sort_inverted', ('on' if lb_sort_inverted else 'off')) + +def lb_sort_previous(): + global lb_current_sort, lb_sort_options + if lb_current_sort: + new_index = lb_sort_options.index(lb_current_sort) - 1 + else: + new_index = 0 + + if new_index < 0: + new_index = len(lb_sort_options) - 1 + + lb_set_current_sort_order(lb_sort_options[new_index]) + lb_sort() + +def lb_sort(sort_key=None): + global lb_channels, lb_current_sort, lb_sort_inverted + if sort_key: + lb_set_current_sort_order(sort_key) + if lb_current_sort == 'users': + lb_channels = sorted(lb_channels, key=lambda chan_data: int(chan_data[lb_current_sort])) + else: + lb_channels = sorted(lb_channels, key=lambda chan_data: chan_data[lb_current_sort]) + if lb_sort_inverted: + lb_channels.reverse() + lb_set_buffer_title() + lb_refresh() + +def lb_sort_invert(): + global lb_current_sort, lb_sort_inverted + if lb_current_sort: + lb_set_invert_sort_order(not lb_sort_inverted) + lb_sort() + +def lb_close_cb(*kwargs): + """ A callback for buffer closing. """ + global lb_buffer + + lb_buffer = None + return weechat.WEECHAT_RC_OK + +lb_options = { + 'refresh' : lb_refresh, + 'up' : lb_line_up, + 'down' : lb_line_down, + 'enter' : lb_line_run, + 'space' : lb_line_select, + 'scroll_top' : lb_scroll_top, + 'scroll_bottom': lb_scroll_bottom, + 'sort_next' : lb_sort_next, + 'sort_previous': lb_sort_previous, + 'sort_invert': lb_sort_invert +} + +def lb_command_main(data, buffer, args): + if args[0:2] == "**": + keyEvent(data, buffer, args[2:]) + return weechat.WEECHAT_RC_OK + +def lb_set_default_settings(): + global lb_settings + # Set default settings + for option, default_value, description in lb_settings: + if not weechat.config_is_set_plugin(option): + weechat.config_set_plugin(option, default_value) + version = weechat.info_get("version_number", "") or 0 + if int(version) >= 0x00030500: + weechat.config_set_desc_plugin(option, description) + +def lb_reset_stored_sort_order(): + global lb_current_sort, lb_sort_inverted + lb_current_sort = weechat.config_get_plugin('sort_order') + lb_sort_inverted = (True if weechat.config_get_plugin('sort_inverted') == 'on' else False) + +if __name__ == "__main__" and import_ok: + if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, + SCRIPT_LICENSE, SCRIPT_DESC, "lb_close_cb", ""): + lb_set_default_settings() + lb_reset_stored_sort_order() + lb_buffer = weechat.buffer_search("python", "listbuffer") + + weechat.hook_signal("*,irc_in_321", "lb_list_start", "") + weechat.hook_signal("*,irc_in_322", "lb_list_chan", "") + weechat.hook_signal("*,irc_in_323", "lb_list_end", "") + weechat.hook_command(SCRIPT_COMMAND, + "List Buffer", + "", "", "", + "lb_command_main", "") diff --git a/weechat/.weechat/spell.conf b/weechat/.weechat/spell.conf index ef9e2c8..c0355f3 100644 --- a/weechat/.weechat/spell.conf +++ b/weechat/.weechat/spell.conf @@ -19,7 +19,7 @@ suggestion_delimiter_word = cyan commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic" default_dict = "en" during_search = off -enabled = on +enabled = off real_time = off suggestions = 2 word_min_length = 2 diff --git a/weechat/.weechat/trigger.conf b/weechat/.weechat/trigger.conf index 8409a21..4d262fc 100644 --- a/weechat/.weechat/trigger.conf +++ b/weechat/.weechat/trigger.conf @@ -33,14 +33,6 @@ autojoin.hook = signal autojoin.post_action = none autojoin.regex = "" autojoin.return_code = ok -autojoinem_on_quit.arguments = "quit" -autojoinem_on_quit.command = "/allchan /autojoinem add" -autojoinem_on_quit.conditions = "" -autojoinem_on_quit.enabled = on -autojoinem_on_quit.hook = signal -autojoinem_on_quit.post_action = none -autojoinem_on_quit.regex = "" -autojoinem_on_quit.return_code = ok autopart.arguments = "*,irc_in_part" autopart.command = "/autojoinem del ${server} ${channel};/mute save" autopart.conditions = "" @@ -73,6 +65,22 @@ greentext.hook = modifier greentext.post_action = none greentext.regex = "/(.*)/${tg_prefix}\t${color:34}${tg_message}" greentext.return_code = ok +input_backtick.arguments = "500|input_text_display" +input_backtick.command = "" +input_backtick.conditions = "" +input_backtick.enabled = on +input_backtick.hook = modifier +input_backtick.post_action = none +input_backtick.regex = "/(^| )(`[^`]+)($|(`)($|[,.?!:; ]))/${re:1}${color:,darkgray}${re:2}${re:4}${color:,default}${re:5}/" +input_backtick.return_code = ok +input_command_color.arguments = "500|input_text_display" +input_command_color.command = "" +input_command_color.conditions = "${tg_string} =~ ^/($|[^/])" +input_command_color.enabled = on +input_command_color.hook = modifier +input_command_color.post_action = none +input_command_color.regex = "#/(.+)#${color:39}/${color:74}${re:1}#" +input_command_color.return_code = ok ircd_notice_con.arguments = "weechat_print" ircd_notice_con.command = "" ircd_notice_con.conditions = "${tg_tags} =~ irc_notice" @@ -113,6 +121,22 @@ msg_auth.hook = modifier msg_auth.post_action = none msg_auth.regex = "==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+) +)(.*)==${re:1}${hide:*,${re:+}}" msg_auth.return_code = ok +preview_nick_colors.arguments = "2000|input_text_display" +preview_nick_colors.command = "" +preview_nick_colors.conditions = "${tg_string} =~ ^/set\s+weechat\.color\.chat_nick_colors\s+" +preview_nick_colors.enabled = on +preview_nick_colors.hook = modifier +preview_nick_colors.post_action = none +preview_nick_colors.regex = "/^\S+\s+\S+(.+)$/${re:1}/tg_string_nocolor /([^",]+)/${color:${re:1}}${re:1}${color:default}/tg_string_nocolor /^(\S+\s+\S+).*$/${re:1}${tg_string_nocolor}/tg_string" +preview_nick_colors.return_code = ok +print_backtick.arguments = "weechat_print" +print_backtick.command = "" +print_backtick.conditions = "" +print_backtick.enabled = on +print_backtick.hook = modifier +print_backtick.post_action = none +print_backtick.regex = "/(^|\t|\d| )(`[^`]+`)([,.?!:; ]|$)/${re:1}${color:,darkgray}${re:2}${color:,default}${re:3}/" +print_backtick.return_code = ok resize_big.arguments = "signal_sigwinch" resize_big.command = "/bar show nicklist" resize_big.conditions = "${info:term_width} >= 100" diff --git a/weechat/.weechat/weechat.conf b/weechat/.weechat/weechat.conf index 22eaf8a..ad2914c 100644 --- a/weechat/.weechat/weechat.conf +++ b/weechat/.weechat/weechat.conf @@ -157,7 +157,7 @@ chat_host = cyan chat_inactive_buffer = default chat_inactive_window = default chat_nick = lightcyan -chat_nick_colors = "cyan,magenta,green,brown,lightblue,default,lightcyan,lightgreen,blue,22,31,35,38,40,49,63,70,80,87,92,99,112,119,126,130,138,142,146,148,160,162,167,169,174,176,178,184,186,191,200,202,206,210,212,215,225,226,247" +chat_nick_colors = "cyan,magenta,green,brown,lightblue,lightcyan,lightgreen,blue,22,31,35,38,40,49,63,67,70,87,99,112,119,130,136,138,142,146,148,160,162,167,169,174,176,178,184,186,191,202,206,210,212,215,225,226,247" chat_nick_offline = blue chat_nick_offline_highlight = default chat_nick_offline_highlight_bg = blue @@ -365,6 +365,7 @@ default.current = on [notify] irc.server.tilde = highlight perl.highmon = none +python.listbuffer = none python.slack.haulerads.#device-dev = highlight [filter]