From c51952f4c2bb784fe1c09099a4546585c9344762 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 16 Aug 2017 08:37:20 -0700 Subject: [PATCH] [weechat] More fiddling with options Lots of stuff taken from here: https://benoliver999.com/technology/2017/07/15/weechat/ --- .weechat/autosort.conf | 4 +- .weechat/buflist.conf | 2 +- .weechat/plugins.conf | 70 +++++++++++++++++++++++++++++++ .weechat/python/colorize_nicks.py | 7 +++- .weechat/trigger.conf | 48 +++++++++++++++++++++ .weechat/weechat.conf | 8 ++-- 6 files changed, 131 insertions(+), 8 deletions(-) diff --git a/.weechat/autosort.conf b/.weechat/autosort.conf index d64b7e1..9718abe 100644 --- a/.weechat/autosort.conf +++ b/.weechat/autosort.conf @@ -12,7 +12,7 @@ [sorting] case_sensitive = off group_irc = on -replacements = "[["##", "#"]]" -rules = "[["core", 0], ["irc", 2], ["*", 1], ["irc.irc_raw", 0], ["irc.server", 1], ["irc.server.*.&*", 0], ["irc.server.*.&*", 0], ["irc.server.*.#*", 1], ["irc.server.*.\\*status", 2]]" +replacements = "[["##", "#"], ["##", "#"]]" +rules = "[["core", 0], ["irc", 2], ["*", 1], ["irc.irc_raw", 0], ["irc.server", 1], ["irc.server.*.&*", 0], ["irc.server.*.#*", 1], ["irc.server.*.\\*status", 2]]" signals = "buffer_opened buffer_merged buffer_unmerged buffer_renamed" sort_on_config_change = on diff --git a/.weechat/buflist.conf b/.weechat/buflist.conf index b9824f0..b8bc5a3 100644 --- a/.weechat/buflist.conf +++ b/.weechat/buflist.conf @@ -11,7 +11,7 @@ [look] auto_scroll = 50 -display_conditions = "${buffer.hidden}==0" +display_conditions = "${buffer.active}==1 && ${buffer.hidden}==0" enabled = on mouse_jump_visited_buffer = off mouse_move_buffer = on diff --git a/.weechat/plugins.conf b/.weechat/plugins.conf index a1fae49..cdc1fa4 100644 --- a/.weechat/plugins.conf +++ b/.weechat/plugins.conf @@ -37,6 +37,41 @@ python.go.message = "Go to: " python.go.short_name = "off" python.go.sort = "number,beginning" python.go.use_core_instead_weechat = "off" +python.urlserver.buffer_short_name = "off" +python.urlserver.color = "darkgray" +python.urlserver.color_in_msg = "" +python.urlserver.debug = "off" +python.urlserver.display_urls = "on" +python.urlserver.display_urls_in_msg = "off" +python.urlserver.http_allowed_ips = "" +python.urlserver.http_auth = "" +python.urlserver.http_auth_redirect = "on" +python.urlserver.http_autostart = "on" +python.urlserver.http_bg_color = "#f4f4f4" +python.urlserver.http_css_url = "" +python.urlserver.http_embed_image = "off" +python.urlserver.http_embed_youtube = "off" +python.urlserver.http_embed_youtube_size = "480*350" +python.urlserver.http_fg_color = "#000" +python.urlserver.http_hostname = "localhost" +python.urlserver.http_hostname_display = "" +python.urlserver.http_open_in_new_page = "on" +python.urlserver.http_port = "60211" +python.urlserver.http_port_display = "" +python.urlserver.http_prefix_suffix = " " +python.urlserver.http_scheme_display = "http" +python.urlserver.http_time_format = "%d/%m/%y %H:%M:%S" +python.urlserver.http_title = "WeeChat URLs" +python.urlserver.http_url_prefix = "" +python.urlserver.msg_filtered = "off" +python.urlserver.msg_ignore_buffers = "core.weechat,python.grep" +python.urlserver.msg_ignore_dup_urls = "off" +python.urlserver.msg_ignore_regex = "" +python.urlserver.msg_ignore_tags = "irc_quit,irc_part,notify_none" +python.urlserver.msg_require_tags = "nick_" +python.urlserver.separators = "[|]" +python.urlserver.url_min_length = "0" +python.urlserver.urls_amount = "100" ruby.check_license = "off" tcl.check_license = "off" @@ -54,3 +89,38 @@ 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.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.urlserver.buffer_short_name = "use buffer short name on dedicated buffer (default: "off")" +python.urlserver.color = "color for urls displayed after message (default: "darkgray")" +python.urlserver.color_in_msg = "color for urls displayed inside irc message: it is a number (irc color) between 00 and 15 (see doc for a list of irc colors) (default: "")" +python.urlserver.debug = "print some debug messages (default: "off")" +python.urlserver.display_urls = "display URLs below messages (default: "on")" +python.urlserver.display_urls_in_msg = "add shorten url next to the original url (only in IRC messages) (useful for urlserver behind relay/irc) (default: "off")" +python.urlserver.http_allowed_ips = "regex for IPs allowed to use server (example: "^(123.45.67.89|192.160.*)$") (default: "")" +python.urlserver.http_auth = "login and password (format: "login:password") required to access to page with list of URLs (note: content is evaluated, see /help eval) (default: "")" +python.urlserver.http_auth_redirect = "require the login/password (if option "http_auth" is set) for URLs redirections (default: "on")" +python.urlserver.http_autostart = "start the built-in HTTP server automatically) (default: "on")" +python.urlserver.http_bg_color = "background color for HTML page (default: "#f4f4f4")" +python.urlserver.http_css_url = "URL of external Cascading Style Sheet to add (BE CAREFUL: the HTTP referer will be sent to site hosting CSS file!) (empty value = use default embedded CSS) (default: "")" +python.urlserver.http_embed_image = "embed images in HTML page (BE CAREFUL: the HTTP referer will be sent to site hosting image!) (default: "off")" +python.urlserver.http_embed_youtube = "embed youtube videos in HTML page (BE CAREFUL: the HTTP referer will be sent to youtube!) (default: "off")" +python.urlserver.http_embed_youtube_size = "size for embedded youtube video, format is "xxx*yyy" (default: "480*350")" +python.urlserver.http_fg_color = "foreground color for HTML page (default: "#000")" +python.urlserver.http_hostname = "force hostname/IP in bind of socket (empty value = auto-detect current hostname) (default: "")" +python.urlserver.http_hostname_display = "display this hostname in shortened URLs (default: "")" +python.urlserver.http_open_in_new_page = "open links in new pages/tabs (default: "on")" +python.urlserver.http_port = "force port for listening (empty value = find a random free port) (default: "")" +python.urlserver.http_port_display = "display this port in shortened URLs. Useful if you forward a different external port to the internal port (default: "")" +python.urlserver.http_prefix_suffix = "suffix displayed between prefix and message in HTML page (default: " ")" +python.urlserver.http_scheme_display = "display this scheme in shortened URLs (default: "http")" +python.urlserver.http_time_format = "time format in the HTML page (default: "%d/%m/%y %H:%M:%S")" +python.urlserver.http_title = "title of the HTML page (default: "WeeChat URLs")" +python.urlserver.http_url_prefix = "prefix to add in URLs to prevent external people to scan your URLs (for example: prefix "xx" will give URL: http://host.com:1234/xx/8) (default: "")" +python.urlserver.msg_filtered = "shorten URLs in filtered messages (with /filter) (default: "off")" +python.urlserver.msg_ignore_buffers = "comma-separated list (without spaces) of buffers to ignore (full name like "irc.freenode.#weechat") (default: "core.weechat,python.grep")" +python.urlserver.msg_ignore_dup_urls = "ignore duplicated URLs (do not add an URL in list if it is already) (default: "off")" +python.urlserver.msg_ignore_regex = "ignore messages matching this regex (default: "")" +python.urlserver.msg_ignore_tags = "comma-separated list (without spaces) of tags (or beginning of tags) to ignore (for example, use "notify_none" to ignore self messages or "nick_weebot" to ignore messages from nick "weebot") (default: "irc_quit,irc_part,notify_none")" +python.urlserver.msg_require_tags = "comma-separated list (without spaces) of tags (or beginning of tags) required to shorten URLs (for example "nick_" to shorten URLs only in messages from other users) (default: "nick_")" +python.urlserver.separators = "separators for short url list (string with exactly 3 chars) (default: "[|]")" +python.urlserver.url_min_length = "minimum length for an URL to be shortened (0 = shorten all URLs, -1 = detect length based on shorten URL) (default: "0")" +python.urlserver.urls_amount = "number of URLs to keep in memory (and in file when script is not loaded) (default: "100")" diff --git a/.weechat/python/colorize_nicks.py b/.weechat/python/colorize_nicks.py index 506a3ab..1460f01 100644 --- a/.weechat/python/colorize_nicks.py +++ b/.weechat/python/colorize_nicks.py @@ -21,6 +21,8 @@ # # # History: +# 2017-03-01, arza +# version 23: don't colorize nicklist group names # 2016-05-01, Simmo Saan # version 22: invalidate cached colors on hash algorithm change # 2015-07-28, xt @@ -77,7 +79,7 @@ w = weechat SCRIPT_NAME = "colorize_nicks" SCRIPT_AUTHOR = "xt " -SCRIPT_VERSION = "22" +SCRIPT_VERSION = "23" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "Use the weechat nick colors in the chat area" @@ -276,6 +278,9 @@ def populate_nicks(*args): if buffer_ptr not in colored_nicks: colored_nicks[buffer_ptr] = {} + if w.infolist_string(nicklist, 'type') != 'nick': + continue + nick = w.infolist_string(nicklist, 'name') nick_color = colorize_nick_color(nick, my_nick) diff --git a/.weechat/trigger.conf b/.weechat/trigger.conf index 7544137..c2f63f9 100644 --- a/.weechat/trigger.conf +++ b/.weechat/trigger.conf @@ -33,6 +33,14 @@ beep.hook = print beep.post_action = none beep.regex = "" beep.return_code = ok +bufferswitch.arguments = "buffer_switch" +bufferswitch.command = "/perlexec weechat::buffer_set(weechat::hdata_get_list(weechat::hdata_get('buffer'),'gui_buffer_last_displayed'), 'unread', 0)\;" +bufferswitch.conditions = "" +bufferswitch.enabled = on +bufferswitch.hook = signal +bufferswitch.post_action = none +bufferswitch.regex = "" +bufferswitch.return_code = ok cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth" cmd_pass.command = "" cmd_pass.conditions = "" @@ -41,6 +49,22 @@ cmd_pass.hook = modifier cmd_pass.post_action = none cmd_pass.regex = "==^((/(msg|m|quote) +nickserv +(id|identify|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+|recover +[^ ]+) +)|/oper +[^ ]+ +|/quote +pass +|/set +[^ ]*password[^ ]* +|/secure +(passphrase|decrypt|set +[^ ]+) +)(.*)==${re:1}${hide:*,${re:+}}" cmd_pass.return_code = ok +detach.arguments = "10000;0;0" +detach.command = "/allchan /eval /perlexec weechat::command('', '/command -buffer irc.\${server}.\${channel} core /buffer hide') if ((${date:%s} - \${buffer[\${info:irc_buffer,\${server},\${channel}}].lines.last_line.data.date}) > 100 && '\${window.buffer.full_name}' !~ 'irc.\${server}.\${channel}' && '\${buffer[\${info:irc_buffer,\${server},\${channel}}].hotlist}' eq '0x0')" +detach.conditions = "" +detach.enabled = on +detach.hook = timer +detach.post_action = none +detach.regex = "" +detach.return_code = ok +force_redraw.arguments = "window_switch;buffer_switch" +force_redraw.command = "/wait 1ms /redraw" +force_redraw.conditions = "" +force_redraw.enabled = on +force_redraw.hook = signal +force_redraw.post_action = none +force_redraw.regex = "" +force_redraw.return_code = ok msg_auth.arguments = "5000|irc_message_auth" msg_auth.command = "" msg_auth.conditions = "" @@ -49,6 +73,22 @@ msg_auth.hook = modifier msg_auth.post_action = none msg_auth.regex = "==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+|recover +[^ ]+) +)(.*)==${re:1}${hide:*,${re:+}}" msg_auth.return_code = ok +reattach.arguments = "" +reattach.command = "/command -buffer irc.$server.$channel core /buffer unhide" +reattach.conditions = "${buffer.hidden} == 1 && ${tg_tag_notify} == message" +reattach.enabled = on +reattach.hook = print +reattach.post_action = none +reattach.regex = "" +reattach.return_code = ok +reattach_on_switch.arguments = "buffer_switch" +reattach_on_switch.command = "/command -buffer ${buffer[${tg_signal_data}].full_name} core /buffer unhide" +reattach_on_switch.conditions = "${buffer[${tg_signal_data}].hidden} == 1" +reattach_on_switch.enabled = on +reattach_on_switch.hook = signal +reattach_on_switch.post_action = none +reattach_on_switch.regex = "" +reattach_on_switch.return_code = ok server_pass.arguments = "5000|input_text_display;5000|history_add" server_pass.command = "" server_pass.conditions = "" @@ -57,6 +97,14 @@ server_pass.hook = modifier server_pass.post_action = none server_pass.regex = "==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==${re:1}${hide:*,${re:4}}${re:5}" server_pass.return_code = ok +windowswitch.arguments = "window_switch" +windowswitch.command = "/perlexec weechat::buffer_set(weechat::window_get_pointer('${tg_signal_data}','buffer'), 'hotlist', -1);" +windowswitch.conditions = "" +windowswitch.enabled = on +windowswitch.hook = signal +windowswitch.post_action = none +windowswitch.regex = "" +windowswitch.return_code = ok znctoserver.arguments = "irc_in_privmsg" znctoserver.command = "/print -buffer server.${server} znc: ${text}" znctoserver.conditions = "${host} == *status!znc@znc.in || ${host} == *controlpanel!znc@znc.in || ${host} == *identfile!znc@znc.in || ${host} == *q!znc@znc.in" diff --git a/.weechat/weechat.conf b/.weechat/weechat.conf index 4eac9fa..4fbd3be 100644 --- a/.weechat/weechat.conf +++ b/.weechat/weechat.conf @@ -34,7 +34,7 @@ buffer_search_case_sensitive = off buffer_search_force_default = off buffer_search_regex = off buffer_search_where = prefix_message -buffer_time_format = "%H:%M:%S" +buffer_time_format = "${253}%H:${245}%M" color_basic_force_bold = off color_inactive_buffer = on color_inactive_message = on @@ -57,7 +57,7 @@ emphasized_attributes = "" highlight = "alpha,kejadlen" highlight_regex = "" highlight_tags = "" -hotlist_add_conditions = "${away} || ${buffer.num_displayed} == 0" +hotlist_add_conditions = "${away} || ${buffer} != ${window.buffer}" hotlist_buffer_separator = ", " hotlist_count_max = 2 hotlist_count_min_msg = 2 @@ -247,9 +247,9 @@ buflist.color_fg = default buflist.conditions = "" buflist.filling_left_right = vertical buflist.filling_top_bottom = columns_vertical -buflist.hidden = on +buflist.hidden = off buflist.items = "buflist" -buflist.position = left +buflist.position = top buflist.priority = 0 buflist.separator = on buflist.size = 0