From bbd60a96ecd0e190625c68bedca4e46928ee2b4d Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Tue, 30 Nov 2021 13:56:56 +0100 Subject: [PATCH 01/19] fish: enable the legacy provider if build against OpenSSL3 OpenSSL 3.0 disables a number of "legacy" algorithms by default, and we need to enable them manually using their provider system. Note that explicitly loading a provider will disable the implicit default provider, which is why we need to load it explicitly. Closes #2629 Signed-off-by: Simon Chopin V2: * use a local OSSL_LIB_CTX to avoid leaking the legacy algorithms into the main SSL context. * Simplify the fish_init() error paths by calling fish_deinit() --- plugins/fishlim/fish.c | 58 ++++++++++++++++++++++++++++++++ plugins/fishlim/fish.h | 2 ++ plugins/fishlim/plugin_hexchat.c | 4 +++ plugins/fishlim/tests/tests.c | 5 ++- 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index c2c2b9da..5a27e4cb 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -87,6 +87,54 @@ static const signed char fish_unbase64[256] = { dest |= (uint8_t)*((source)++); \ } while (0); +#if OPENSSL_VERSION_NUMBER >= 0x30000000L +#include +static OSSL_PROVIDER *legacy_provider; +static OSSL_PROVIDER *default_provider; +static OSSL_LIB_CTX* *ossl_ctx; +#endif + +int fish_init(void) +{ +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + ossl_ctx = OSSL_LIB_CTX_new(); + if (!ossl_ctx) + return 0; + + legacy_provider = OSSL_PROVIDER_load(ossl_ctx, "legacy"); + if (!legacy_provider) { + fish_deinit(); + return 0; + } + + default_provider = OSSL_PROVIDER_load(ossl_ctx, "default"); + if (!default_provider) { + fish_deinit(); + return 0; + } +#endif + return 1; +} + +void fish_deinit(void) +{ +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + if (legacy_provider) { + OSSL_PROVIDER_unload(legacy_provider); + legacy_provider = NULL; + } + + if (default_provider) { + OSSL_PROVIDER_unload(default_provider); + default_provider = NULL; + } + + if (ossl_ctx) { + OSSL_LIB_CTX_free(ossl_ctx); + ossl_ctx = NULL; + } +#endif +} /** * Encode ECB FiSH Base64 @@ -228,9 +276,19 @@ char *fish_cipher(const char *plaintext, size_t plaintext_len, const char *key, plaintext_len -= 8; } +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + cipher = EVP_CIPHER_fetch(ossl_ctx, "BF-CBC", NULL); +#else cipher = (EVP_CIPHER *) EVP_bf_cbc(); +#endif + } else if (mode == EVP_CIPH_ECB_MODE) { + +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + cipher = EVP_CIPHER_fetch(ossl_ctx, "BF-ECB", NULL); +#else cipher = (EVP_CIPHER *) EVP_bf_ecb(); +#endif } /* Zero Padding */ diff --git a/plugins/fishlim/fish.h b/plugins/fishlim/fish.h index 6a2e911c..75829061 100644 --- a/plugins/fishlim/fish.h +++ b/plugins/fishlim/fish.h @@ -35,6 +35,8 @@ enum fish_mode { FISH_CBC_MODE = 0x2 }; +int fish_init(void); +void fish_deinit(void); char *fish_base64_encode(const char *message, size_t message_len); char *fish_base64_decode(const char *message, size_t *final_len); char *fish_encrypt(const char *key, size_t keylen, const char *message, size_t message_len, enum fish_mode mode); diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 93e28487..a8b127f2 100644 --- a/plugins/fishlim/plugin_hexchat.c +++ b/plugins/fishlim/plugin_hexchat.c @@ -815,6 +815,9 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle, hexchat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL); + if (!fish_init()) + return 0; + if (!dh1080_init()) return 0; @@ -828,6 +831,7 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle, int hexchat_plugin_deinit(void) { g_clear_pointer(&pending_exchanges, g_hash_table_destroy); dh1080_deinit(); + fish_deinit(); hexchat_printf(ph, "%s plugin unloaded\n", plugin_name); return 1; diff --git a/plugins/fishlim/tests/tests.c b/plugins/fishlim/tests/tests.c index f3e852d2..12b10d1d 100644 --- a/plugins/fishlim/tests/tests.c +++ b/plugins/fishlim/tests/tests.c @@ -278,5 +278,8 @@ main(int argc, char *argv[]) { g_test_add_func("/fishlim/max_text_command_len", test_max_text_command_len); g_test_add_func("/fishlim/foreach_utf8_data_chunks", test_foreach_utf8_data_chunks); - return g_test_run(); + fish_init(); + int ret = g_test_run(); + fish_deinit(); + return ret; } From 3ebb2c5eec5dfa29b9b3e70ff51e50256bb1ef2f Mon Sep 17 00:00:00 2001 From: John Villalovos Date: Wed, 1 Dec 2021 11:07:34 -0800 Subject: [PATCH 02/19] Make build job names more descriptive (#2657) Previously every build showed up in the CI as "build". Update the job names to reflect what they are. For example the Ubuntu build is now called "ubuntu_build" Co-authored-by: Patrick --- .github/workflows/flatpak-build.yml | 2 +- .github/workflows/msys-build.yml | 2 +- .github/workflows/ubuntu-build.yml | 2 +- .github/workflows/windows-build.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/flatpak-build.yml b/.github/workflows/flatpak-build.yml index 5a0371b9..66cd890b 100644 --- a/.github/workflows/flatpak-build.yml +++ b/.github/workflows/flatpak-build.yml @@ -1,7 +1,7 @@ name: Flatpak Build on: [push, pull_request] jobs: - build: + flatpak_build: runs-on: ubuntu-latest container: image: bilelmoussaoui/flatpak-github-actions:gnome-40 diff --git a/.github/workflows/msys-build.yml b/.github/workflows/msys-build.yml index 9311b79e..b7779da6 100644 --- a/.github/workflows/msys-build.yml +++ b/.github/workflows/msys-build.yml @@ -2,7 +2,7 @@ name: MSYS2 Build on: [push, pull_request] jobs: - build: + msys2_build: runs-on: windows-latest defaults: run: diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index c25db74b..0e8deb34 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -1,7 +1,7 @@ name: Ubuntu Build on: [push, pull_request] jobs: - build: + ubuntu_build: runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index f5e20e12..f1eddbbd 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -2,7 +2,7 @@ name: Windows Build on: [push, pull_request] jobs: - build: + windows_build: runs-on: windows-2019 strategy: matrix: From d07e8a8ab27e4677605759468acce11452345ba9 Mon Sep 17 00:00:00 2001 From: Noah Keck Date: Thu, 2 Dec 2021 10:38:58 -0500 Subject: [PATCH 03/19] Remove wallchan command This command doesn't have many legitimate, non-spam applications and is easily confused for the similarly named 'wallops'. Moreover, many netowrks now automatically punish or drop users who message many channels at the same time, rendering the command mostly useless. It also is too easy to tab-complete 'wall' into 'wallchan' when you expect 'wallops' to come up first, which can lead to two very different functions. If this is to be reintroduced it should be named something with less similarity to 'wallops' or 'wallchops'. --- src/common/outbound.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/common/outbound.c b/src/common/outbound.c index fcc731e2..da57ea33 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3881,34 +3881,6 @@ cmd_wallchop (struct session *sess, char *tbuf, char *word[], return TRUE; } -static int -cmd_wallchan (struct session *sess, char *tbuf, char *word[], - char *word_eol[]) -{ - GSList *list; - - if (*word_eol[2]) - { - list = sess_list; - while (list) - { - sess = list->data; - if (sess->type == SESS_CHANNEL) - { - message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; - - inbound_chanmsg (sess->server, NULL, sess->channel, - sess->server->nick, word_eol[2], TRUE, FALSE, - &no_tags); - sess->server->p_message (sess->server, sess->channel, word_eol[2]); - } - list = list->next; - } - return TRUE; - } - return FALSE; -} - static int cmd_hop (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { @@ -4147,8 +4119,6 @@ const struct commands xc_cmds[] = { {"USERLIST", cmd_userlist, 1, 1, 1, 0}, {"VOICE", cmd_voice, 1, 1, 1, N_("VOICE , gives voice status to someone (needs chanop)")}, - {"WALLCHAN", cmd_wallchan, 1, 1, 1, - N_("WALLCHAN , writes the message to all channels")}, {"WALLCHOP", cmd_wallchop, 1, 1, 1, N_("WALLCHOP , sends the message to all chanops on the current channel")}, {0, 0, 0, 0, 0, 0} From 7c27dcd5243b59d3da425ea0b5c25097c32b090c Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Wed, 22 Dec 2021 11:46:55 -0600 Subject: [PATCH 04/19] build: Set G_LOG_DOMAIN --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 6b23230f..bc22671d 100644 --- a/meson.build +++ b/meson.build @@ -34,6 +34,7 @@ config_h.set_quoted('PACKAGE_NAME', meson.project_name()) config_h.set_quoted('GETTEXT_PACKAGE', 'hexchat') config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale')) +config_h.set_quoted('G_LOG_DOMAIN', 'hexchat') config_h.set10('ENABLE_NLS', true) # Optional features From ba5d79b496d0f7d2c01626a90c2de934eb918a10 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Wed, 22 Dec 2021 11:50:36 -0600 Subject: [PATCH 05/19] Be smarter about conditionally escaping URIs that are opened Fixes #2659 --- src/fe-gtk/fe-gtk.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 3d3c8052..285ba42b 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -1054,6 +1054,46 @@ osx_show_uri (const char *url) #endif +static inline char * +escape_uri (const char *uri) +{ + return g_uri_escape_string(uri, G_URI_RESERVED_CHARS_GENERIC_DELIMITERS G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, FALSE); +} + +static inline gboolean +uri_contains_forbidden_characters (const char *uri) +{ + while (*uri) + { + /* This is not an exhaustive list, the full URI has segments that allow characters like "[]:" for example. */ + if (strchr ("`<> ${}\"+", *uri) != NULL || (*uri & 0x80) /* non-ascii */) + return TRUE; + uri++; + } + + return FALSE; +} + +static char * +maybe_escape_uri (const char *uri) +{ + /* There isn't an exact way to know if a string has already been escaped or not + * so we can try some heuristics. */ + + /* If we find characters that should clearly be escaped. */ + if (uri_contains_forbidden_characters (uri)) + return escape_uri (uri); + + /* If it fails to be unescaped then it was not escaped. */ + char *unescaped = g_uri_unescape_string (uri, NULL); + if (!unescaped) + return escape_uri (uri); + g_free (unescaped); + + /* At this point it is probably safe to pass through as-is. */ + return g_strdup (uri); +} + static void fe_open_url_inner (const char *url) { @@ -1071,8 +1111,8 @@ fe_open_url_inner (const char *url) #elif defined(__APPLE__) osx_show_uri (url); #else - char *escaped_url = g_uri_escape_string (url, G_URI_RESERVED_CHARS_GENERIC_DELIMITERS G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, - FALSE); + char *escaped_url = maybe_escape_uri (url); + g_debug ("Opening URL \"%s\" (%s)", escaped_url, url); gtk_show_uri (NULL, escaped_url, GDK_CURRENT_TIME, NULL); g_free (escaped_url); #endif From 66f596822509c0d2adb3b90caba1edd09dd61d65 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Wed, 22 Dec 2021 12:04:48 -0600 Subject: [PATCH 06/19] Update comment --- src/fe-gtk/fe-gtk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 285ba42b..7eca0710 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -1077,8 +1077,8 @@ uri_contains_forbidden_characters (const char *uri) static char * maybe_escape_uri (const char *uri) { - /* There isn't an exact way to know if a string has already been escaped or not - * so we can try some heuristics. */ + /* The only way to know if a string has already been escaped or not + * is by fulling parsing each segement but we can try some more simple heuristics. */ /* If we find characters that should clearly be escaped. */ if (uri_contains_forbidden_characters (uri)) From d889a8e019d29b26813e8ca3bb5989ec1a043a1b Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Thu, 6 Jan 2022 00:15:52 +0530 Subject: [PATCH 07/19] meson: Remove unused wbemcore dependency --- src/common/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/meson.build b/src/common/meson.build index 6ca0f20c..84e2fca3 100644 --- a/src/common/meson.build +++ b/src/common/meson.build @@ -47,7 +47,6 @@ if host_machine.system() == 'windows' ] common_sysinfo_deps += [ cc.find_library('wbemuuid'), # sysinfo - cc.find_library('wbemcore'), ] common_sources += 'sysinfo/win32/backend.c' From d936b653ac0c6c265f676f5b92a8da2375b59402 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 6 Jan 2022 20:36:14 -0600 Subject: [PATCH 08/19] Add missing header https://github.com/hexchat/hexchat/issues/2652#issuecomment-1007015314 --- src/fe-gtk/notifications/notification-freedesktop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fe-gtk/notifications/notification-freedesktop.c b/src/fe-gtk/notifications/notification-freedesktop.c index 80ae0e1d..a23284e5 100644 --- a/src/fe-gtk/notifications/notification-freedesktop.c +++ b/src/fe-gtk/notifications/notification-freedesktop.c @@ -18,6 +18,7 @@ #include "config.h" +#include #include static GDBusProxy *fdo_notifications; From 9c7109b57869881660fefeaf98a10b7911118117 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Tue, 11 Jan 2022 21:51:52 +0530 Subject: [PATCH 09/19] meson: Fix exported functions for python plugin This fixes loading python plugin in Windows by exporting functions using python.def file. Otherwise, hexchat_plugin_init symbol error is shown. --- plugins/python/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/python/meson.build b/plugins/python/meson.build index 5fd7ec2f..1e9b41ad 100644 --- a/plugins/python/meson.build +++ b/plugins/python/meson.build @@ -28,4 +28,5 @@ shared_module('python', python3_source, install: true, install_dir: plugindir, name_prefix: '', + vs_module_defs: 'python.def' ) From 91adfb5917d31a7c29d6c0536f1e301542577e81 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 17 Jan 2022 12:08:16 +0000 Subject: [PATCH 10/19] Fix handling invalid ports. Instead of wrapping around, which is not behaviour any reasonable user would expect, just use the default port if above 65535. Disallow connecting on port 0. This port has special meaning and servers can not listen on it. It is more likely the user just gave an invalid value to the port field as atoi("invalid") == 0. --- src/common/server.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/server.c b/src/common/server.c index f90ce28f..c2965eb3 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1559,7 +1559,7 @@ server_connect (server *serv, char *hostname, int port, int no_login) if (!hostname[0]) return; - if (port < 0) + if (port < 1 || port > 65535) { /* use default port for this server type */ port = 6667; @@ -1568,7 +1568,6 @@ server_connect (server *serv, char *hostname, int port, int no_login) port = 6697; #endif } - port &= 0xffff; /* wrap around */ if (serv->connected || serv->connecting || serv->recondelay_tag) server_disconnect (sess, TRUE, -1); From 7df34cdcb2039678356f9dd44bb52e670dbcf8ce Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 17 Jan 2022 21:51:40 +0000 Subject: [PATCH 11/19] Log when the user specifies an invalid port. --- src/common/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/server.c b/src/common/server.c index c2965eb3..e14da237 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1567,6 +1567,7 @@ server_connect (server *serv, char *hostname, int port, int no_login) if (serv->use_ssl) port = 6697; #endif + g_debug ("Attempted to connect to invalid port, assuming default port %d", port); } if (serv->connected || serv->connecting || serv->recondelay_tag) From a330c1cf4dc4a5a7be2e44e8622a566f01da594c Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Fri, 21 Jan 2022 14:05:09 +0530 Subject: [PATCH 12/19] sysinfo: Fix architecture detection in AArch64 Windows AArch64 should be detected as 64 bit OS. --- src/common/sysinfo/win32/backend.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/sysinfo/win32/backend.c b/src/common/sysinfo/win32/backend.c index 1d88b139..67a0fd2b 100644 --- a/src/common/sysinfo/win32/backend.c +++ b/src/common/sysinfo/win32/backend.c @@ -84,7 +84,8 @@ sysinfo_get_cpu_arch (void) GetNativeSystemInfo (&si); - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || + si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) { return cpu_arch = 64; } @@ -106,7 +107,8 @@ sysinfo_get_build_arch (void) GetSystemInfo (&si); - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || + si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) { return build_arch = 64; } From 1de339dfbcbc167f14345a75512b1e2658eafdad Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Fri, 21 Jan 2022 12:11:19 +0530 Subject: [PATCH 13/19] meson: Fix exported functions in plugins This adds DEF file names in meson. Without the DEF files, every functions are exproted from plugins. --- plugins/checksum/meson.build | 1 + plugins/exec/meson.build | 3 ++- plugins/fishlim/meson.build | 1 + plugins/perl/meson.build | 1 + plugins/sysinfo/meson.build | 1 + plugins/upd/meson.build | 1 + plugins/winamp/meson.build | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/checksum/meson.build b/plugins/checksum/meson.build index 25835457..e3008f75 100644 --- a/plugins/checksum/meson.build +++ b/plugins/checksum/meson.build @@ -3,4 +3,5 @@ shared_module('checksum', 'checksum.c', install: true, install_dir: plugindir, name_prefix: '', + vs_module_defs: 'checksum.def', ) diff --git a/plugins/exec/meson.build b/plugins/exec/meson.build index 3f9e8a32..782814da 100644 --- a/plugins/exec/meson.build +++ b/plugins/exec/meson.build @@ -1,5 +1,6 @@ shared_module('exec', 'exec.c', dependencies: hexchat_plugin_dep, install: true, - install_dir: plugindir + install_dir: plugindir, + vs_module_defs: 'exec.def', ) diff --git a/plugins/fishlim/meson.build b/plugins/fishlim/meson.build index 65ccc9ea..232c9a33 100644 --- a/plugins/fishlim/meson.build +++ b/plugins/fishlim/meson.build @@ -19,4 +19,5 @@ shared_module('fishlim', fishlim_sources, install: true, install_dir: plugindir, name_prefix: '', + vs_module_defs: 'fishlim.def', ) diff --git a/plugins/perl/meson.build b/plugins/perl/meson.build index 06ffd54b..ebcf35bb 100644 --- a/plugins/perl/meson.build +++ b/plugins/perl/meson.build @@ -88,4 +88,5 @@ shared_module('perl', install_dir: plugindir, install_rpath: perl_rpath, name_prefix: '', + vs_module_defs: 'perl.def', ) diff --git a/plugins/sysinfo/meson.build b/plugins/sysinfo/meson.build index 7e2cdb6c..08f08c2c 100644 --- a/plugins/sysinfo/meson.build +++ b/plugins/sysinfo/meson.build @@ -57,4 +57,5 @@ shared_module('sysinfo', sysinfo_sources, install: true, install_dir: plugindir, name_prefix: '', + vs_module_defs: 'sysinfo.def', ) diff --git a/plugins/upd/meson.build b/plugins/upd/meson.build index 7ab9d830..68217b31 100644 --- a/plugins/upd/meson.build +++ b/plugins/upd/meson.build @@ -5,4 +5,5 @@ shared_module('upd', 'upd.c', install: true, install_dir: plugindir, name_prefix: '', + vs_module_defs: 'upd.def', ) diff --git a/plugins/winamp/meson.build b/plugins/winamp/meson.build index b07e7071..8d298651 100644 --- a/plugins/winamp/meson.build +++ b/plugins/winamp/meson.build @@ -3,4 +3,5 @@ shared_module('winamp', 'winamp.c', install: true, install_dir: plugindir, name_prefix: '', + vs_module_defs: 'winamp.def', ) From 7cff05c7ac4efe30a34f7f1bc5d5aa7463cb4f16 Mon Sep 17 00:00:00 2001 From: orcus <29999282+orcus-de@users.noreply.github.com> Date: Mon, 24 Jan 2022 18:38:21 +0100 Subject: [PATCH 14/19] Add -q/-- flags to /execwrite to EXECWRITE and cmd_execW (#2675) added two flags to EXECWRITE and cmd_execw -q : (quiet) to allow suppressing of additional (debug) output at the text box -- : (stop parsing for further flags) for the edge cases where -q itself migh be part of used data and the user wants to show that at the text box Closes #2666 --- src/common/outbound.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/common/outbound.c b/src/common/outbound.c index da57ea33..6f0241be 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -1579,9 +1579,26 @@ cmd_execw (struct session *sess, char *tbuf, char *word[], char *word_eol[]) EMIT_SIGNAL (XP_TE_NOCHILD, sess, NULL, NULL, NULL, NULL, 0); return FALSE; } - len = strlen(word_eol[2]); - temp = g_strconcat (word_eol[2], "\n", NULL); - PrintText(sess, temp); + if (strcmp (word[2], "--") == 0) + { + len = strlen(word_eol[3]); + temp = g_strconcat (word_eol[3], "\n", NULL); + PrintText(sess, temp); + } + else + { + if (strcmp (word[2], "-q") == 0) + { + len = strlen(word_eol[3]); + temp = g_strconcat (word_eol[3], "\n", NULL); + } + else + { + len = strlen(word_eol[2]); + temp = g_strconcat (word_eol[2], "\n", NULL); + PrintText(sess, temp); + } + } write(sess->running_exec->myfd, temp, len + 1); g_free(temp); @@ -3977,7 +3994,7 @@ const struct commands xc_cmds[] = { N_("EXECKILL [-9], kills a running exec in the current session. If -9 is given the process is SIGKILL'ed")}, #ifndef __EMX__ {"EXECSTOP", cmd_execs, 0, 0, 1, N_("EXECSTOP, sends the process SIGSTOP")}, - {"EXECWRITE", cmd_execw, 0, 0, 1, N_("EXECWRITE, sends data to the processes stdin")}, + {"EXECWRITE", cmd_execw, 0, 0, 1, N_("EXECWRITE [-q|--], sends data to the processes stdin; use -q flag to quiet/suppress output at text box; use -- flag to stop interpreting arguments as flags, needed if -q itself would occur as data")}, #endif #endif #if 0 From 73c0b672a26bb02885de87c898dea94404dc7199 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Sat, 12 Feb 2022 12:28:17 -0600 Subject: [PATCH 15/19] Bump to 2.16.1 --- data/misc/io.github.Hexchat.appdata.xml.in | 13 +++++++++++++ meson.build | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/data/misc/io.github.Hexchat.appdata.xml.in b/data/misc/io.github.Hexchat.appdata.xml.in index bc436988..9ee4343b 100644 --- a/data/misc/io.github.Hexchat.appdata.xml.in +++ b/data/misc/io.github.Hexchat.appdata.xml.in @@ -26,6 +26,19 @@ hexchat.desktop + + +

This is a minor release with mostly bug-fixes:

+
    +
  • Add `-NOOVERRIDE` flag to the `GUI COLOR` command
  • +
  • Add `-q` (quiet) flag to the `EXECWRITE` command
  • +
  • Rename installed icon to match app-id (Fixes notification icon)
  • +
  • Fix escaping already escaped URLs when opening them
  • +
  • Fix Python scripts not being opened as UTF-8
  • +
  • Fix `TIMER` command supporting decimals regardless of locale
  • +
+
+

This is a feature release:

diff --git a/meson.build b/meson.build index bc22671d..8b0bd404 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('hexchat', 'c', - version: '2.16.0', + version: '2.16.1', meson_version: '>= 0.47.0', default_options: [ 'c_std=gnu89', From ccf6f431bbd96f04369875d72a61976bb6609a69 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Wed, 16 Feb 2022 10:24:40 -0500 Subject: [PATCH 16/19] Return userdata from pluginprefs __pairs metamethod to avoid immediate GC. --- plugins/lua/lua.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index d1370eaf..f8f051f4 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -957,16 +957,21 @@ static int api_hexchat_pluginprefs_meta_pairs(lua_State *L) hexchat_plugin *h; if(!script->name) + return luaL_error(L, "cannot use hexchat.pluginprefs before registering with hexchat.register"); dest = lua_newuserdata(L, 4096); + h = script->handle; if(!hexchat_pluginpref_list(h, dest)) strcpy(dest, ""); lua_pushlightuserdata(L, dest); lua_pushlightuserdata(L, dest); lua_pushcclosure(L, api_hexchat_pluginprefs_meta_pairs_closure, 2); - return 1; + lua_insert(L, -2); // Return the userdata (second return value from pairs), + // even though it's not used by the closure (first return + // value from pairs), so that Lua knows not to GC it. + return 2; } static int api_attrs_meta_index(lua_State *L) @@ -1764,4 +1769,3 @@ G_MODULE_EXPORT int hexchat_plugin_deinit(hexchat_plugin *plugin_handle) g_clear_pointer(&expand_buffer, g_free); return 1; } - From 94efa378f7f7329514b04a2f8dadf2b9d57b9f8e Mon Sep 17 00:00:00 2001 From: Masoud Naservand Date: Thu, 17 Feb 2022 15:39:05 +0330 Subject: [PATCH 17/19] Reverse the notify.conf linked list before writing hexchat populates the single linked list `notify_list` defined in `src/common/notify.c` from `notify.conf` file. Each new line read from the file is added to the list by `g_slist_prepend()` which adds it to the front of the list. But in `notify_save()` the list elements are read from the start to end of the list and written to the `notify.conf`. This means everytime hexchat is opened and closed, the contents of `notify.conf` get reversed. This commit creates a temporary glist in `notify_save()` and applies `g_slist_reverse()` on it and writes the contents of this reversed list to `notify.conf`. And solves issue #2680 --- src/common/notify.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/notify.c b/src/common/notify.c index b5316c36..ef52889b 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -123,7 +123,11 @@ notify_save (void) { int fh; struct notify *notify; - GSList *list = notify_list; + // while reading the notify.conf file, elements are added by prepending to the + // list. reverse the list before writing to disk to keep the original + // order of the list + GSList *list = g_slist_copy(notify_list); + list = g_slist_reverse(list); fh = hexchat_open_file ("notify.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE); if (fh != -1) @@ -142,6 +146,7 @@ notify_save (void) } close (fh); } + g_slist_free(list); } void From d99a98ff4cc9d9184ceb5b625abe0e737e009fbe Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 26 Mar 2022 11:18:00 -0500 Subject: [PATCH 18/19] notification: Don't print failure to load backend in UI This isn't actually helpful information to users generally Closes #2152 Closes #2684 --- src/fe-gtk/plugin-notification.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-gtk/plugin-notification.c b/src/fe-gtk/plugin-notification.c index 29478d7a..875b50f4 100644 --- a/src/fe-gtk/plugin-notification.c +++ b/src/fe-gtk/plugin-notification.c @@ -218,7 +218,7 @@ notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, cha if (!notification_backend_init (&error)) { if (error) - hexchat_printf(plugin_handle, "Failed loading notification plugin: %s\n", error); + g_debug("Failed loading notification plugin: %s\n", error); return 0; } From 133f62806441a5db1156653aa1f077d2e8deeb34 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 1 Apr 2022 17:24:59 +0100 Subject: [PATCH 19/19] Display common help numerics as SERVTEXT. This makes it a lot easier for users to actually read. --- src/common/proto-irc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index a8d997b6..32cc47f2 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -920,6 +920,14 @@ process_numeric (session * sess, int n, notify_set_online (serv, word[4], tags_data); break; + case 524: // ERR_HELPNOTFOUND + case 704: // RPL_HELPSTART + case 705: // RPL_HELPTXT + case 706: // RPL_ENDOFHELP + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, sess, STRIP_COLON(word, word_eol, 5), NULL, NULL, NULL, + 0, tags_data->timestamp); + break; + case 728: /* +q-list entry */ /* NOTE: FREENODE returns these results inconsistent with e.g. +b */ /* Who else has imlemented MODE_QUIET, I wonder? */