···1919# along with this program. If not, see <http://www.gnu.org/licenses/>.
20202121# history:
2222+# 4.0: add compatibility with XDG directories (WeeChat >= 3.2)
2223# 3.9: add compatibility with new weechat_print modifier data (WeeChat >= 2.9)
2324# 3.8: new option custom_action_text (https://github.com/weechat/scripts/issues/313) (idea by 3v1n0)
2425# 3.7: new option "alternate_color" (https://github.com/weechat/scripts/issues/333) (idea by snuffkins)
···87888889use strict;
8990my $PRGNAME = "colorize_lines";
9090-my $VERSION = "3.9";
9191+my $VERSION = "4.0";
9192my $AUTHOR = "Nils Görs <weechatter\@arcor.de>";
9293my $LICENCE = "GPL3";
9394my $DESCR = "Colorize users' text in chat area with their nick color, including highlights";
···111112 "blacklist_buffers" => "Comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)",
112113 "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.",
113114 "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.",
114114- "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)",
115115+ "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)",
115116 "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.",
116117 "own_lines_color" => "this color will be used for own messages. Set an empty value to use weechat.color.chat_nick_self option",
117118 "tags" => "Comma-separated list of tags to accept (see /debug tags)",
···324325sub nicklist_read
325326{
326327 return if (substr($config{nicks}, 0, 1) ne "/");
327327- my $file = weechat::info_get("weechat_dir", "") . $config{nicks};
328328+ my $options = { "directory" => "config" };
329329+ my $file = weechat::string_eval_path_home("%h" . $config{nicks}, {}, {}, $options);
328330 return unless -e $file;
329331 my $nili = "";
330332 open (WL, "<", $file) || DEBUG("$file: $!");
+14
weechat/.weechat/plugins.conf
···7777python.go.fuzzy_search = "on"
7878python.go.message = "Go to: "
7979python.go.short_name = "off"
8080+python.go.short_name_server = "off"
8081python.go.sort = "number,beginning"
8182python.go.use_core_instead_weechat = "off"
8283python.grep.clear_buffer = "off"
···8788python.grep.show_summary = "on"
8889python.grep.size_limit = "2048"
8990python.grep.timeout_secs = "300"
9191+python.listbuffer.autofocus = "on"
9292+python.listbuffer.channel_min_width = "25"
9393+python.listbuffer.modes_min_width = "8"
9494+python.listbuffer.sort_inverted = "on"
9595+python.listbuffer.sort_order = "users"
9696+python.listbuffer.users_min_width = "8"
9097python.screen_away.away_suffix = ""
9198python.screen_away.command_on_attach = ""
9299python.screen_away.command_on_detach = ""
···193200python.go.fuzzy_search = "search buffer matches using approximation (default: "off")"
194201python.go.message = "message to display before list of buffers (default: "Go to: ")"
195202python.go.short_name = "display and search in short names instead of buffer name (default: "off")"
203203+python.go.short_name_server = "prefix short names with server names for search and display (default: "off")"
196204python.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")"
197205python.go.use_core_instead_weechat = "use name "core" instead of "weechat" for core buffer (default: "off")"
206206+python.listbuffer.autofocus = "Focus the listbuffer in the current window if it isn't already displayed by a window."
207207+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."
208208+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."
209209+python.listbuffer.sort_inverted = "Invert the sort order for the channel list."
210210+python.listbuffer.sort_order = "Last used sort order for the channel list."
211211+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."
198212python.screen_away.away_suffix = "What to append to your nick when you're away."
199213python.screen_away.command_on_attach = "Commands to execute on attach, separated by semicolon"
200214python.screen_away.command_on_detach = "Commands to execute on detach, separated by semicolon"
···11+# -*- coding: utf-8 -*-
22+#
33+# ListBuffer, version 0.8.1 for WeeChat version 0.3
44+# Latest development version: https://github.com/FiXato/listbuffer
55+#
66+# Show /list results in a common buffer and interact with them.
77+#
88+# This script allows you to easily join channels from the /list output.
99+# It will open a common buffer for the /list result, through which you
1010+# browse with your cursor keys, and join with the meta-enter keys.
1111+# Adjust sorting with meta->, meta-< and meta-/ keybindings.
1212+#
1313+## History:
1414+### 2011-09-08: FiXato:
1515+#
1616+# * version 0.1: initial release.
1717+# * added a common buffer for /list results
1818+# * added highlighting for currently selected line
1919+# * added /join support via enter key
2020+# * added scroll_top and scroll_bottom support
2121+#
2222+# * version 0.2: /list format bugfix
2323+# * added support for /list results without modes
2424+# * some servers don't send 321 (/list start). Taken into account.
2525+#
2626+# * version 0.3: Sorting support
2727+# * Added some basic sorting support. Scroll through sort options
2828+# with meta-> and meta-< (users, channel, topic, modes)
2929+#
3030+### 2011-09-19: FiXato
3131+#
3232+# * version 0.4:
3333+# * Case-insensitive buffer lookup fix.
3434+# * Removed default enter keybind
3535+#
3636+### 2011-12-28: troydm:
3737+#
3838+# * version 0.5: It's an upside-down-world
3939+# * Added inverted sorting support provided by Dmitry "troydm" Geurkov
4040+# Use meta-/ to switch between inverted and regular sorting.
4141+#
4242+### 2012-02-10: FiXato:
4343+#
4444+# * version 0.6: Stop shoving that buffer in my face!
4545+# * The listbuffer should no longer pop up by itself when you load the script.
4646+# It should only pop up now when you actually do a /list query.
4747+#
4848+# * version 0.7: .. but please pop it up in my current window when I ask for it
4949+# * Added setting plugins.var.python.listbuffer.autofocus
5050+# This will autofocus the listbuffer in the current window if another window isn't
5151+# already showing it, and of course only when the user issues /list
5252+#
5353+### 2012-07-10: FiXato:
5454+#
5555+# * version 0.7.1: Forgetful bugfix
5656+# * Made sure lb_curline global variable is defined
5757+#
5858+### 2013-03-19: FiXato:
5959+#
6060+# * version 0.8: Sorted out the sorting
6161+# * Added automatically updating options for sorting:
6262+# * plugins.var.python.listbuffer.sort_inverted
6363+# * plugins.var.python.listbuffer.sort_order
6464+# * version 0.8.1: Pad it baby!
6565+# * Channel modes are equally padded even when there are no channel modes.
6666+# * Added padding options:
6767+# * plugins.var.python.listbuffer.modes_min_width
6868+# * plugins.var.python.listbuffer.channel_min_width
6969+# * plugins.var.python.listbuffer.users_min_width
7070+#
7171+### 2019-07-05: Sébastien Helleu:
7272+#
7373+# * version 0.8.2: Make script compatible with Python 3.
7474+#
7575+## Acknowledgements:
7676+# * Dmitry "troydm" Geurkov, for providing the inverse-sorting patch to the project.
7777+# * Sebastien "Flashcode" Helleu, for developing the kick-ass IRC client WeeChat
7878+# and the iset.pl script which inspired me to this script.
7979+# * Nils "nils_2" Görs, for his contributions to iset.pl which served as
8080+# example code.
8181+# * David "drubin" Rubin, for his urlgrab.py script, which also served
8282+# as example code.
8383+# * ArZa, whose listsort.pl script helped me getting started with
8484+# grabbing the /list results. Parts of his code have been shamelessly
8585+# copied and ported to Python.
8686+# * Khaled Mardam-Bey, for making me yearn for similar /list support in
8787+# WeeChat as mIRC already offered. :P
8888+# * mave_, for pointing out that sort orders weren't remembered.
8989+#
9090+## TODO:
9191+# - Auto-scroll selected line upon window scroll.
9292+# - Add option to hide already joined channels.
9393+# - Improve sorting methods
9494+# - Add auto-join support
9595+# - Detect if channel is already in auto-join
9696+# - Allow automatically switching to the listbuffer
9797+# - Add support for ALIS (/squery alis LIST * -mix 100 (IRCNet)
9898+# - Make colours configurable
9999+# - Limit number of channels to parse
100100+# - Add filter support a la iset
101101+# - Allow selecting multiple channels
102102+# - Add optional command redirection.
103103+#
104104+## Copyright (c) 2011,2012,2013 Filip H.F. "FiXato" Slagter,
105105+# <FiXato [at] Gmail [dot] com>
106106+# http://profile.fixato.org
107107+#
108108+# Permission is hereby granted, free of charge, to any person obtaining
109109+# a copy of this software and associated documentation files (the
110110+# "Software"), to deal in the Software without restriction, including
111111+# without limitation the rights to use, copy, modify, merge, publish,
112112+# distribute, sublicense, and/or sell copies of the Software, and to
113113+# permit persons to whom the Software is furnished to do so, subject to
114114+# the following conditions:
115115+#
116116+# The above copyright notice and this permission notice shall be
117117+# included in all copies or substantial portions of the Software.
118118+#
119119+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
120120+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
121121+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
122122+# NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
123123+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
124124+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
125125+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
126126+#
127127+128128+from __future__ import print_function
129129+130130+SCRIPT_NAME = "listbuffer"
131131+SCRIPT_AUTHOR = "Filip H.F. 'FiXato' Slagter <fixato [at] gmail [dot] com>"
132132+SCRIPT_VERSION = "0.8.2"
133133+SCRIPT_LICENSE = "MIT"
134134+SCRIPT_DESC = "A common buffer for /list output."
135135+SCRIPT_COMMAND = "listbuffer"
136136+137137+import_ok = True
138138+139139+try:
140140+ import weechat
141141+except ImportError:
142142+ print("This script must be run under WeeChat.")
143143+ import_ok = False
144144+145145+import re
146146+147147+lb_settings = (
148148+ ("autofocus", "on", "Focus the listbuffer in the current window if it isn't already displayed by a window."),
149149+ ("sort_order", "users", "Last used sort order for the channel list."),
150150+ ("sort_inverted", "on", "Invert the sort order for the channel list."),
151151+ ("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."),
152152+ ("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."),
153153+ ("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."),
154154+)
155155+lb_buffer = None
156156+lb_curline = 0
157157+lb_channels = []
158158+lb_network = None
159159+lb_list_started = False
160160+lb_current_sort = None
161161+lb_sort_inverted = False
162162+lb_sort_options = (
163163+ 'channel',
164164+ 'users',
165165+ 'modes',
166166+ 'topic',
167167+)
168168+169169+# server numeric Nick Chan Users Modes Topic
170170+lb_channel_list_expression = '(:\S+) (\d{3}) (\S+) (\S+) (\d+) :(\[(.*?)\] )?(.*)'
171171+172172+# Create listbuffer.
173173+def lb_create_buffer():
174174+ global lb_buffer, lb_curline
175175+176176+ if not lb_buffer:
177177+ lb_buffer = weechat.buffer_new("listbuffer", "lb_input_cb", \
178178+ "", "lb_close_cb", "")
179179+ lb_set_buffer_title()
180180+ # Sets notify to 0 as this buffer does not need to be in hotlist.
181181+ weechat.buffer_set(lb_buffer, "notify", "0")
182182+ weechat.buffer_set(lb_buffer, "nicklist", "0")
183183+ weechat.buffer_set(lb_buffer, "type", "free")
184184+ weechat.buffer_set(lb_buffer, "key_bind_ctrl-L", "/listbuffer **refresh")
185185+ weechat.buffer_set(lb_buffer, "key_bind_meta2-A", "/listbuffer **up")
186186+ weechat.buffer_set(lb_buffer, "key_bind_meta2-B", "/listbuffer **down")
187187+ weechat.buffer_set(lb_buffer, "key_bind_meta2-1~", "/listbuffer **scroll_top")
188188+ weechat.buffer_set(lb_buffer, "key_bind_meta2-4~", "/listbuffer **scroll_bottom")
189189+ weechat.buffer_set(lb_buffer, "key_bind_meta-ctrl-J", "/listbuffer **enter")
190190+ weechat.buffer_set(lb_buffer, "key_bind_meta-ctrl-M", "/listbuffer **enter")
191191+ weechat.buffer_set(lb_buffer, "key_bind_meta->", "/listbuffer **sort_next")
192192+ weechat.buffer_set(lb_buffer, "key_bind_meta-<", "/listbuffer **sort_previous")
193193+ weechat.buffer_set(lb_buffer, "key_bind_meta-/", "/listbuffer **sort_invert")
194194+ lb_curline = 0
195195+ if weechat.config_get_plugin("autofocus") == "on":
196196+ if not weechat.window_search_with_buffer(lb_buffer):
197197+ weechat.command("", "/buffer " + weechat.buffer_get_string(lb_buffer,"name"))
198198+199199+def lb_set_buffer_title():
200200+ global lb_buffer, lb_current_sort
201201+ ascdesc = '(v)' if lb_sort_inverted else '(^)'
202202+ weechat.buffer_set(lb_buffer, "title", lb_line_format({
203203+ 'channel': 'Channel name%s' % (ascdesc if lb_current_sort == 'channel' else ''),
204204+ 'users': 'Users%s' % (ascdesc if lb_current_sort == 'users' else ''),
205205+ 'modes': 'Modes%s' % (ascdesc if lb_current_sort == 'modes' else ''),
206206+ 'topic': 'Topic%s' % (ascdesc if lb_current_sort == 'topic' else ''),
207207+ 'nomodes': None,
208208+ }))
209209+210210+def lb_list_start(data, signal, message):
211211+ lb_initialise_list
212212+213213+ return weechat.WEECHAT_RC_OK
214214+215215+def lb_initialise_list(signal):
216216+ global lb_channels, lb_network, lb_list_started
217217+218218+ lb_create_buffer()
219219+ lb_channels = []
220220+ lb_network = signal.split(',')[0]
221221+ lb_list_started = True
222222+ return
223223+224224+225225+def lb_list_chan(data, signal, message):
226226+ global lb_channels, lb_buffer, lb_list_started
227227+228228+ # Work-around for IRCds which don't send 321 Numeric (/List start)
229229+ if not lb_list_started:
230230+ lb_initialise_list(signal)
231231+232232+ for chan_data in re.findall(lb_channel_list_expression,message):
233233+ lb_channels.append({
234234+ 'server': chan_data[0][1:-1],
235235+ 'numeric': chan_data[1],
236236+ 'nick': chan_data[2],
237237+ 'channel': chan_data[3],
238238+ 'users': chan_data[4],
239239+ 'nomodes': chan_data[5] == '',
240240+ 'modes': chan_data[6],
241241+ 'topic': weechat.hook_modifier_exec("irc_color_decode", "1", chan_data[7])
242242+ })
243243+ return weechat.WEECHAT_RC_OK
244244+245245+def lb_list_end(data, signal, message):
246246+ global lb_list_started
247247+248248+ # Work-around for IRCds which don't send 321 Numeric (/List start)
249249+ if not lb_list_started:
250250+ lb_initialise_list(signal)
251251+252252+ lb_list_started = False
253253+ if lb_current_sort:
254254+ lb_sort()
255255+ lb_refresh()
256256+ return weechat.WEECHAT_RC_OK
257257+258258+def keyEvent (data, buffer, args):
259259+ global lb_options
260260+ lb_options[args]()
261261+262262+def lb_input_cb(data, buffer, input_data):
263263+ global lb_options, lb_curline
264264+ lb_options[input_data]()
265265+ return weechat.WEECHAT_RC_OK
266266+267267+def lb_refresh():
268268+ global lb_channels, lb_buffer
269269+ weechat.buffer_clear(lb_buffer)
270270+271271+ y = 0
272272+ for list_data in lb_channels:
273273+ lb_refresh_line(y)
274274+ y += 1
275275+ return
276276+277277+def lb_refresh_line(y):
278278+ global lb_buffer, lb_curline, lb_channels
279279+ if y >= 0 and y < len(lb_channels):
280280+ formatted_line = lb_line_format(lb_channels[y], y == lb_curline)
281281+ weechat.prnt_y(lb_buffer, y, formatted_line)
282282+283283+def lb_refresh_curline():
284284+ global lb_curline
285285+ lb_refresh_line(lb_curline-1)
286286+ lb_refresh_line(lb_curline)
287287+ lb_refresh_line(lb_curline+1)
288288+ return
289289+290290+def lb_line_format(list_data,curr=False):
291291+ str = ""
292292+ if (curr):
293293+ str += weechat.color("yellow,red")
294294+ channel_text = list_data['channel'].ljust(int(weechat.config_get_plugin('channel_min_width')))
295295+ users_text = "(%s)" % list_data['users']
296296+ padded_users_text = users_text.rjust(int(weechat.config_get_plugin('users_min_width')) + 2)
297297+ str += "%s%s %s " % (weechat.color("bold"), channel_text, padded_users_text)
298298+ if not list_data['nomodes']:
299299+ modes = "[%s]" % list_data['modes']
300300+ else:
301301+ modes = "[]"
302302+ str += "%s: " % modes.rjust(int(weechat.config_get_plugin('modes_min_width')) + 2)
303303+ str += "%s" % list_data['topic']
304304+ return str
305305+306306+def lb_line_up():
307307+ global lb_curline
308308+ if lb_curline <= 0:
309309+ return
310310+ lb_curline -= 1
311311+ lb_refresh_curline()
312312+ lb_check_outside_window()
313313+ return
314314+315315+def lb_line_down():
316316+ global lb_curline, lb_channels
317317+ if lb_curline+1 >= len(lb_channels):
318318+ return
319319+ lb_curline += 1
320320+ lb_refresh_curline()
321321+ lb_check_outside_window()
322322+ return
323323+324324+def lb_line_run():
325325+ global lb_channels, lb_curline, lb_network
326326+ buff = weechat.info_get("irc_buffer", lb_network)
327327+ channel = lb_channels[lb_curline]['channel']
328328+ command = "/join %s" % channel
329329+ weechat.command(buff, command)
330330+ return
331331+332332+def lb_line_select():
333333+ return
334334+335335+def lb_scroll_top():
336336+ global lb_curline
337337+ old_y = lb_curline
338338+ lb_curline = 0
339339+ lb_refresh_curline()
340340+ lb_refresh_line(old_y)
341341+ weechat.command(lb_buffer, "/window scroll_top")
342342+ return
343343+344344+def lb_scroll_bottom():
345345+ global lb_curline, lb_channels
346346+ old_y = lb_curline
347347+ lb_curline = len(lb_channels)-1
348348+ lb_refresh_curline()
349349+ lb_refresh_line(old_y)
350350+ weechat.command(lb_buffer, "/window scroll_bottom")
351351+ return
352352+353353+def lb_check_outside_window():
354354+ global lb_buffer, lb_curline
355355+ if (lb_buffer):
356356+ infolist = weechat.infolist_get("window", "", "current")
357357+ if (weechat.infolist_next(infolist)):
358358+ start_line_y = weechat.infolist_integer(infolist, "start_line_y")
359359+ chat_height = weechat.infolist_integer(infolist, "chat_height")
360360+ if(start_line_y > lb_curline):
361361+ weechat.command(lb_buffer, "/window scroll -%i" %(start_line_y - lb_curline))
362362+ elif(start_line_y <= lb_curline - chat_height):
363363+ weechat.command(lb_buffer, "/window scroll +%i"%(lb_curline - start_line_y - chat_height + 1))
364364+ weechat.infolist_free(infolist)
365365+366366+def lb_sort_next():
367367+ global lb_current_sort, lb_sort_options
368368+ if lb_current_sort:
369369+ new_index = lb_sort_options.index(lb_current_sort) + 1
370370+ else:
371371+ new_index = 0
372372+373373+ if len(lb_sort_options) <= new_index:
374374+ new_index = 0
375375+376376+ lb_set_current_sort_order(lb_sort_options[new_index])
377377+ lb_sort()
378378+379379+def lb_set_current_sort_order(value):
380380+ global lb_current_sort
381381+ lb_current_sort = value
382382+ weechat.config_set_plugin('sort_order', lb_current_sort)
383383+384384+def lb_set_invert_sort_order(value):
385385+ global lb_sort_inverted
386386+ lb_sort_inverted = value
387387+ weechat.config_set_plugin('sort_inverted', ('on' if lb_sort_inverted else 'off'))
388388+389389+def lb_sort_previous():
390390+ global lb_current_sort, lb_sort_options
391391+ if lb_current_sort:
392392+ new_index = lb_sort_options.index(lb_current_sort) - 1
393393+ else:
394394+ new_index = 0
395395+396396+ if new_index < 0:
397397+ new_index = len(lb_sort_options) - 1
398398+399399+ lb_set_current_sort_order(lb_sort_options[new_index])
400400+ lb_sort()
401401+402402+def lb_sort(sort_key=None):
403403+ global lb_channels, lb_current_sort, lb_sort_inverted
404404+ if sort_key:
405405+ lb_set_current_sort_order(sort_key)
406406+ if lb_current_sort == 'users':
407407+ lb_channels = sorted(lb_channels, key=lambda chan_data: int(chan_data[lb_current_sort]))
408408+ else:
409409+ lb_channels = sorted(lb_channels, key=lambda chan_data: chan_data[lb_current_sort])
410410+ if lb_sort_inverted:
411411+ lb_channels.reverse()
412412+ lb_set_buffer_title()
413413+ lb_refresh()
414414+415415+def lb_sort_invert():
416416+ global lb_current_sort, lb_sort_inverted
417417+ if lb_current_sort:
418418+ lb_set_invert_sort_order(not lb_sort_inverted)
419419+ lb_sort()
420420+421421+def lb_close_cb(*kwargs):
422422+ """ A callback for buffer closing. """
423423+ global lb_buffer
424424+425425+ lb_buffer = None
426426+ return weechat.WEECHAT_RC_OK
427427+428428+lb_options = {
429429+ 'refresh' : lb_refresh,
430430+ 'up' : lb_line_up,
431431+ 'down' : lb_line_down,
432432+ 'enter' : lb_line_run,
433433+ 'space' : lb_line_select,
434434+ 'scroll_top' : lb_scroll_top,
435435+ 'scroll_bottom': lb_scroll_bottom,
436436+ 'sort_next' : lb_sort_next,
437437+ 'sort_previous': lb_sort_previous,
438438+ 'sort_invert': lb_sort_invert
439439+}
440440+441441+def lb_command_main(data, buffer, args):
442442+ if args[0:2] == "**":
443443+ keyEvent(data, buffer, args[2:])
444444+ return weechat.WEECHAT_RC_OK
445445+446446+def lb_set_default_settings():
447447+ global lb_settings
448448+ # Set default settings
449449+ for option, default_value, description in lb_settings:
450450+ if not weechat.config_is_set_plugin(option):
451451+ weechat.config_set_plugin(option, default_value)
452452+ version = weechat.info_get("version_number", "") or 0
453453+ if int(version) >= 0x00030500:
454454+ weechat.config_set_desc_plugin(option, description)
455455+456456+def lb_reset_stored_sort_order():
457457+ global lb_current_sort, lb_sort_inverted
458458+ lb_current_sort = weechat.config_get_plugin('sort_order')
459459+ lb_sort_inverted = (True if weechat.config_get_plugin('sort_inverted') == 'on' else False)
460460+461461+if __name__ == "__main__" and import_ok:
462462+ if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
463463+ SCRIPT_LICENSE, SCRIPT_DESC, "lb_close_cb", ""):
464464+ lb_set_default_settings()
465465+ lb_reset_stored_sort_order()
466466+ lb_buffer = weechat.buffer_search("python", "listbuffer")
467467+468468+ weechat.hook_signal("*,irc_in_321", "lb_list_start", "")
469469+ weechat.hook_signal("*,irc_in_322", "lb_list_chan", "")
470470+ weechat.hook_signal("*,irc_in_323", "lb_list_end", "")
471471+ weechat.hook_command(SCRIPT_COMMAND,
472472+ "List Buffer",
473473+ "", "", "",
474474+ "lb_command_main", "")
+1-1
weechat/.weechat/spell.conf
···1919commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic"
2020default_dict = "en"
2121during_search = off
2222-enabled = on
2222+enabled = off
2323real_time = off
2424suggestions = 2
2525word_min_length = 2