about summary refs log tree commit diff
path: root/weechat/.weechat
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2020-07-18 14:14:12 -0400
committerBen Harris <ben@tilde.team>2020-07-18 14:14:12 -0400
commitb6a7d6446382af4db967ca7212efa2f591bfa268 (patch)
treee95d5e6d8dfda8207eae28a59ae93002a9a9d695 /weechat/.weechat
parent655cdf37df0560ebd28d2edba26e65278d82f637 (diff)
update scripts and configs for weechat 2.9
Diffstat (limited to 'weechat/.weechat')
-rw-r--r--weechat/.weechat/irc.conf6
-rw-r--r--weechat/.weechat/perl/colorize_lines.pl25
-rw-r--r--weechat/.weechat/perl/highmon.pl16
l---------weechat/.weechat/python/autoload/fzf.py1
-rw-r--r--weechat/.weechat/python/colorize_nicks.py16
-rw-r--r--weechat/.weechat/python/fzf.py74
-rw-r--r--weechat/.weechat/python/grep.py30
-rw-r--r--weechat/.weechat/relay.conf4
-rw-r--r--weechat/.weechat/spell.conf2
-rw-r--r--weechat/.weechat/weechat.conf15
10 files changed, 160 insertions, 29 deletions
diff --git a/weechat/.weechat/irc.conf b/weechat/.weechat/irc.conf
index 79b9a88..09b4a87 100644
--- a/weechat/.weechat/irc.conf
+++ b/weechat/.weechat/irc.conf
@@ -58,6 +58,7 @@ pv_tags = "notify_private"
 raw_messages = 256
 server_buffer = independent
 smart_filter = on
+smart_filter_account = on
 smart_filter_chghost = on
 smart_filter_delay = 5
 smart_filter_join = on
@@ -74,6 +75,7 @@ item_channel_modes = lightcyan
 item_lag_counting = default
 item_lag_finished = 130
 item_nick_modes = lightgreen
+message_account = cyan
 message_chghost = brown
 message_join = green
 message_kick = red
@@ -187,7 +189,7 @@ tilde.local_hostname
 tilde.usermode
 tilde.command = "/msg operserv login ${sec.data.pass}"
 tilde.command_delay
-tilde.autojoin = "#meta,#secret-sudoers,#admin,#opers,#music,#politics,#gopher,#tildeverse,#idlerpg,#tilderadio,#minecraft,#cosmic,#institute,#.tilde,#tildetel,#thunix,#theasylum,#aussie,#uucp,#projects,#hamradio,#vim,#black,#pink,#bots,#ctrl-c,#radiofreqs,#envs,#wilde,#tildenet,#gemini,#club,#zine,#team,#geocities,#helpdesk,#flamewars,#counting,#covid19,#rw.rs,#counting-meta,#irctokens,#linux,#fr,#factorio,#cute,#the1024club,#wotd,#nsfw,#crawl,#mumble,#tilderadio-djs,#tilde.zone-admin,#tildebot :10:20,secretsudoteam,adminsonly"
+tilde.autojoin = "#meta,#secret-sudoers,#admin,#opers,#music,#politics,#gopher,#tildeverse,#idlerpg,#tilderadio,#minecraft,#cosmic,#institute,#.tilde,#tildetel,#thunix,#theasylum,#aussie,#uucp,#projects,#hamradio,#vim,#black,#pink,#bots,#ctrl-c,#radiofreqs,#envs,#wilde,#tildenet,#gemini,#club,#zine,#team,#geocities,#helpdesk,#flamewars,#counting,#covid19,#rw.rs,#counting-meta,#irctokens,#linux,#fr,#factorio,#the1024club,#wotd,#nsfw,#crawl,#mumble,#tilderadio-djs,#tilde.zone-admin,#tildebot,#submeta,#coffee,#envs_german,#wtf,#beer :10:20,secretsudoteam,adminsonly"
 tilde.autorejoin
 tilde.autorejoin_delay
 tilde.connection_timeout
@@ -359,7 +361,7 @@ sdf.local_hostname
 sdf.usermode
 sdf.command
 sdf.command_delay
-sdf.autojoin = "#sdf,#gopher,#anonradio,#spanish,#minecraft :kick:20:75"
+sdf.autojoin = "#sdf,#gopher,#spanish,#minecraft :kick:20:75"
 sdf.autorejoin
 sdf.autorejoin_delay
 sdf.connection_timeout
diff --git a/weechat/.weechat/perl/colorize_lines.pl b/weechat/.weechat/perl/colorize_lines.pl
index d828620..93a4465 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 <http://www.gnu.org/licenses/>.
 
 # history:
+# 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)
 # 3.6: new option "own_lines_color" (idea by Linkandzelda)
@@ -86,7 +87,7 @@
 
 use strict;
 my $PRGNAME     = "colorize_lines";
-my $VERSION     = "3.8";
+my $VERSION     = "3.9";
 my $AUTHOR      = "Nils Görs <weechatter\@arcor.de>";
 my $LICENCE     = "GPL3";
 my $DESCR       = "Colorize users' text in chat area with their nick color, including highlights";
@@ -146,9 +147,21 @@ sub colorize_cb
         return $string unless (@tags_found);
     }
 
-# find buffer pointer
-    $modifier_data =~ m/([^;]*);([^;]*);/;
-    my $buf_ptr = weechat::buffer_search($1, $2);
+    # find buffer pointer and tags
+    my $buf_ptr = "";
+    my $tags = "";
+    if ($modifier_data =~ /^0x/)
+    {
+        # WeeChat >= 2.9
+        $modifier_data =~ m/([^;]*);(.*)/;
+        $buf_ptr = $1;
+        $tags = $2;
+    } else {
+        # WeeChat <= 2.8
+        $modifier_data =~ m/([^;]*);([^;]*);(.*)/;
+        $buf_ptr = weechat::buffer_search($1, $2);
+        $tags = $3;
+    }
     return $string if ($buf_ptr eq "");
 
     # find buffer name, server name
@@ -164,8 +177,8 @@ sub colorize_cb
 
     # find nick of the sender
     # find out if we are doing an action
-    my $nick = ($modifier_data =~ m/(^|,)nick_([^,]*)/) ? $2 : weechat::string_remove_color($left, "");
-    my $action = ($modifier_data =~ m/\birc_action\b/) ? 1 : 0;
+    my $nick = ($tags =~ m/(^|,)nick_([^,]*)/) ? $2 : weechat::string_remove_color($left, "");
+    my $action = ($tags =~ m/\birc_action\b/) ? 1 : 0;
 
     ######################################## get color
 
diff --git a/weechat/.weechat/perl/highmon.pl b/weechat/.weechat/perl/highmon.pl
index 066fa43..f843cad 100644
--- a/weechat/.weechat/perl/highmon.pl
+++ b/weechat/.weechat/perl/highmon.pl
@@ -1,6 +1,5 @@
 #
 # highmon.pl - Highlight Monitoring for weechat 0.3.0
-# Version 2.6
 #
 # Add 'Highlight Monitor' buffer/bar to log all highlights in one spot
 #
@@ -73,6 +72,8 @@
 # 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>:
@@ -266,7 +267,14 @@ sub highmon_bar_open
 	# 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;
 }
@@ -717,7 +725,7 @@ sub highmon_new_message
 	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
@@ -1131,7 +1139,7 @@ sub format_buffer_name
 }
 
 # 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");
diff --git a/weechat/.weechat/python/autoload/fzf.py b/weechat/.weechat/python/autoload/fzf.py
new file mode 120000
index 0000000..b723ed3
--- /dev/null
+++ b/weechat/.weechat/python/autoload/fzf.py
@@ -0,0 +1 @@
+../fzf.py
\ No newline at end of file
diff --git a/weechat/.weechat/python/colorize_nicks.py b/weechat/.weechat/python/colorize_nicks.py
index d0cdc0e..19be2fc 100644
--- a/weechat/.weechat/python/colorize_nicks.py
+++ b/weechat/.weechat/python/colorize_nicks.py
@@ -21,6 +21,9 @@
 #
 #
 # History:
+# 2020-05-09: Sébastien Helleu <flashcode@flashtux.org>
+#   version 27: add compatibility with new weechat_print modifier data
+#               (WeeChat >= 2.9)
 # 2018-04-06: Joey Pabalinas <joeypabalinas@gmail.com>
 #   version 26: fix freezes with too many nicks in one line
 # 2018-03-18: nils_2
@@ -85,7 +88,7 @@ w = weechat
 
 SCRIPT_NAME    = "colorize_nicks"
 SCRIPT_AUTHOR  = "xt <xt@bash.no>"
-SCRIPT_VERSION = "26"
+SCRIPT_VERSION = "27"
 SCRIPT_LICENSE = "GPL"
 SCRIPT_DESC    = "Use the weechat nick colors in the chat area"
 
@@ -172,11 +175,16 @@ def colorize_cb(data, modifier, modifier_data, line):
 
     global ignore_nicks, ignore_channels, colored_nicks
 
+    if modifier_data.startswith('0x'):
+        # WeeChat >= 2.9
+        buffer, tags = modifier_data.split(';', 1)
+    else:
+        # WeeChat <= 2.8
+        plugin, buffer_name, tags = modifier_data.split(';', 2)
+        buffer = w.buffer_search(plugin, buffer_name)
 
-    full_name = modifier_data.split(';')[1]
-    channel = '.'.join(full_name.split('.')[1:])
+    channel = w.buffer_get_string(buffer, 'localvar_channel')
 
-    buffer = w.buffer_search('', full_name)
     # Check if buffer has colorized nicks
     if buffer not in colored_nicks:
         return line
diff --git a/weechat/.weechat/python/fzf.py b/weechat/.weechat/python/fzf.py
new file mode 100644
index 0000000..c43f503
--- /dev/null
+++ b/weechat/.weechat/python/fzf.py
@@ -0,0 +1,74 @@
+from typing import Iterator, Tuple
+import weechat
+
+
+SCRIPT_NAME = "fzf"
+SCRIPT_AUTHOR = "Trygve Aaberge <trygveaa@gmail.com>"
+SCRIPT_VERSION = "0.1.0"
+SCRIPT_LICENSE = "MIT"
+SCRIPT_DESC = "Switch buffer using fzf (currently only works inside tmux)"
+REPO_URL = "https://github.com/trygveaa/weechat-fzf"
+
+
+def print_error(message: str) -> None:
+    weechat.prnt("", weechat.prefix("error") + message)
+
+
+def fzf_process_cb(
+    data: str, command: str, return_code: int, out: str, err: str
+) -> int:
+    if return_code == weechat.WEECHAT_HOOK_PROCESS_ERROR or return_code == 2 or err:
+        print_error("Error running fzf (code {}): {}".format(return_code, err))
+        return weechat.WEECHAT_RC_OK
+    if out != "":
+        pointer, _ = out.split("\t", 1)
+        weechat.buffer_set(pointer, "display", "1")
+    return weechat.WEECHAT_RC_OK
+
+
+def fzf_command_cb(data: str, buffer: str, args: str) -> int:
+    cmd = (
+        "fzf-tmux -- --delimiter='\t' --with-nth=3.. "
+        "--preview='tail -$LINES {2} 2>/dev/null'"
+    )
+    hook = weechat.hook_process_hashtable(cmd, {"stdin": "1"}, 0, "fzf_process_cb", "")
+    for buffer_info in buffers():
+        weechat.hook_set(hook, "stdin", "\t".join(buffer_info) + "\n")
+    weechat.hook_set(hook, "stdin_close", "")
+    return weechat.WEECHAT_RC_OK
+
+
+def buffers() -> Iterator[Tuple[str, str, str, str]]:
+    logger_filenames = {}
+    logger_infolist = weechat.infolist_get("logger_buffer", "", "")
+    while weechat.infolist_next(logger_infolist):
+        buffer = weechat.infolist_pointer(logger_infolist, "buffer")
+        filename = weechat.infolist_string(logger_infolist, "log_filename")
+        logger_filenames[buffer] = filename
+    weechat.infolist_free(logger_infolist)
+
+    buffer_infolist = weechat.infolist_get("buffer", "", "")
+    while weechat.infolist_next(buffer_infolist):
+        pointer = weechat.infolist_pointer(buffer_infolist, "pointer")
+        number = weechat.infolist_integer(buffer_infolist, "number")
+        name = weechat.infolist_string(buffer_infolist, "name")
+        yield (pointer, logger_filenames.get(pointer, ""), str(number), name)
+    weechat.infolist_free(buffer_infolist)
+
+
+def main() -> None:
+    if not weechat.register(
+        SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""
+    ):
+        return
+
+    tmux = weechat.string_eval_expression("${env:TMUX}", {}, {}, {})
+    if not tmux:
+        print_error("Error: fzf.py currently only supports being run inside tmux")
+        return
+
+    weechat.hook_command(SCRIPT_NAME, SCRIPT_DESC, "", "", "", "fzf_command_cb", "")
+
+
+if __name__ == "__main__":
+    main()
diff --git a/weechat/.weechat/python/grep.py b/weechat/.weechat/python/grep.py
index 64dbc52..c176ffe 100644
--- a/weechat/.weechat/python/grep.py
+++ b/weechat/.weechat/python/grep.py
@@ -69,6 +69,9 @@
 #
 #   History:
 #
+#   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
@@ -230,7 +233,7 @@ except ImportError:
 
 SCRIPT_NAME    = "grep"
 SCRIPT_AUTHOR  = "Elián Hanisch <lambdae2@gmail.com>"
-SCRIPT_VERSION = "0.8.2"
+SCRIPT_VERSION = "0.8.3"
 SCRIPT_LICENSE = "GPL3"
 SCRIPT_DESC    = "Search in buffers and logs"
 SCRIPT_COMMAND = "grep"
@@ -596,7 +599,10 @@ def get_file_by_name(buffer_name):
             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('%', '$')
@@ -984,7 +990,7 @@ def show_matching_lines():
             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,
@@ -1009,14 +1015,17 @@ def grep_process(*args):
     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):
@@ -1548,7 +1557,7 @@ def cmd_logs(data, buffer, args):
     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)
@@ -1738,8 +1747,11 @@ Examples:
             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))
diff --git a/weechat/.weechat/relay.conf b/weechat/.weechat/relay.conf
index 975fbad..6a7350c 100644
--- a/weechat/.weechat/relay.conf
+++ b/weechat/.weechat/relay.conf
@@ -27,12 +27,16 @@ text_selected = white
 [network]
 allow_empty_password = off
 allowed_ips = ""
+auth_timeout = 60
 bind_address = "0::1"
 clients_purge_delay = 0
 compression_level = 6
 ipv6 = on
 max_clients = 5
+nonce_size = 16
 password = "${sec.data.relaypass}"
+password_hash_algo = "*"
+password_hash_iterations = 100000
 ssl_cert_key = "%h/ssl/relay.pem"
 ssl_priorities = "NORMAL:-VERS-SSL3.0"
 totp_secret = ""
diff --git a/weechat/.weechat/spell.conf b/weechat/.weechat/spell.conf
index c0355f3..ef9e2c8 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 = off
+enabled = on
 real_time = off
 suggestions = 2
 word_min_length = 2
diff --git a/weechat/.weechat/weechat.conf b/weechat/.weechat/weechat.conf
index 7e9b3f7..199102c 100644
--- a/weechat/.weechat/weechat.conf
+++ b/weechat/.weechat/weechat.conf
@@ -247,6 +247,7 @@ save_config_on_unload = on
 
 [bar]
 buflist.color_bg = default
+buflist.color_bg_inactive = default
 buflist.color_delim = default
 buflist.color_fg = default
 buflist.conditions = ""
@@ -261,6 +262,7 @@ buflist.size = 0
 buflist.size_max = 18
 buflist.type = root
 fset.color_bg = default
+fset.color_bg_inactive = default
 fset.color_delim = cyan
 fset.color_fg = default
 fset.conditions = "${buffer.full_name} == fset.fset"
@@ -275,6 +277,7 @@ fset.size = 3
 fset.size_max = 3
 fset.type = window
 isetbar.color_bg = default
+isetbar.color_bg_inactive = default
 isetbar.color_delim = cyan
 isetbar.color_fg = default
 isetbar.conditions = ""
@@ -289,6 +292,7 @@ isetbar.size = 3
 isetbar.size_max = 3
 isetbar.type = window
 nicklist.color_bg = default
+nicklist.color_bg_inactive = default
 nicklist.color_delim = cyan
 nicklist.color_fg = default
 nicklist.conditions = "${nicklist}"
@@ -303,13 +307,14 @@ nicklist.size = 0
 nicklist.size_max = 15
 nicklist.type = window
 rootinput.color_bg = default
+rootinput.color_bg_inactive = default
 rootinput.color_delim = cyan
 rootinput.color_fg = default
 rootinput.conditions = ""
 rootinput.filling_left_right = vertical
 rootinput.filling_top_bottom = horizontal
 rootinput.hidden = off
-rootinput.items = "[input_prompt]+(away),[input_search],[input_paste],input_text"
+rootinput.items = "[input_prompt]+(away),[input_search],[input_paste],scroll,input_text"
 rootinput.position = bottom
 rootinput.priority = 50
 rootinput.separator = off
@@ -317,13 +322,14 @@ rootinput.size = 1
 rootinput.size_max = 0
 rootinput.type = root
 rootstatus.color_bg = black
+rootstatus.color_bg_inactive = default
 rootstatus.color_delim = lightcyan
 rootstatus.color_fg = default
 rootstatus.conditions = ""
 rootstatus.filling_left_right = vertical
 rootstatus.filling_top_bottom = horizontal
 rootstatus.hidden = off
-rootstatus.items = "[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,[lag],spell_suggest,[hotlist],(mouse_status),completion,scroll"
+rootstatus.items = "[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,[lag],spell_suggest,[hotlist],(mouse_status),completion"
 rootstatus.position = bottom
 rootstatus.priority = 25
 rootstatus.separator = off
@@ -331,6 +337,7 @@ rootstatus.size = 1
 rootstatus.size_max = 0
 rootstatus.type = root
 title.color_bg = black
+title.color_bg_inactive = darkgray
 title.color_delim = lightcyan
 title.color_fg = default
 title.conditions = ""
@@ -354,7 +361,7 @@ default.window = "3;1;0;0;core;weechat"
 default.current = on
 
 [notify]
-irc.bitlbee = highlight
+irc.bitlbee.#tilde.zone_@ben = highlight
 irc.server.tilde = highlight
 perl.highmon = none
 
@@ -375,6 +382,7 @@ ctrl-Cv = "/input insert \x16"
 ctrl-D = "/input delete_next_char"
 ctrl-E = "/input move_end_of_line"
 ctrl-F = "/input move_next_char"
+ctrl-G = "/fzf"
 ctrl-H = "/input delete_previous_char"
 ctrl-I = "/input complete_next"
 ctrl-J = "/input return"
@@ -421,6 +429,7 @@ meta-9 = "/buffer *9"
 meta-< = "/input jump_previously_visited_buffer"
 meta-= = "/filter toggle"
 meta-> = "/input jump_next_visited_buffer"
+meta-B = "/buflist toggle"
 meta-OA = "/input history_global_previous"
 meta-OB = "/input history_global_next"
 meta-OC = "/input move_next_word"