From 700ec4c472dd415536a29ffe1509473d6cc588e9 Mon Sep 17 00:00:00 2001 From: ffrogman Date: Tue, 25 May 2021 23:37:36 -0400 Subject: [PATCH 001/392] Fix cursor getting stuck for auto completions that exclusively change the case of letters --- src/fe-common/core/completion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c index 06ac124c6..e2c4d2a91 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -104,7 +104,7 @@ char *auto_word_complete(const char *line, int *pos) /* check for words in autocompletion list */ replace = completion_find(word, TRUE); - if (replace == NULL) { + if (replace == NULL || (!g_strcmp0(replace, word))) { ret = NULL; g_string_free(result, TRUE); } else { From f147589e528722859d604446b6496a992602f3a9 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 28 Jul 2021 11:05:30 +0200 Subject: [PATCH 002/392] can do /server add -matrix -network my_matrix_network By Andrej Kacian --- src/fe-common/core/fe-server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index e0100618a..468ac4e79 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -91,7 +91,9 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist) if (rec == NULL) rec = chat_protocol_get_default(); else { - chatnet = g_hash_table_lookup(optlist, rec->chatnet); + chatnet = g_hash_table_lookup(optlist, "network"); + if (chatnet == NULL && g_hash_table_lookup(optlist, rec->chatnet) != NULL) + chatnet = rec->chatnet; if (chatnet_find(chatnet) == NULL) { printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_UNKNOWN_CHATNET, chatnet); From 6591c94635e4da69693cbe55dae747d970e6a52b Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 14 Jan 2021 14:27:57 +0100 Subject: [PATCH 003/392] add a limit to showing /NAMES on join only show the counts if too many nicks --- src/fe-common/core/fe-channels.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index 8c914cb8b..2d4e9ece8 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -107,9 +107,14 @@ static void signal_window_item_changed(WINDOW_REC *window, WI_ITEM_REC *item) static void sig_channel_joined(CHANNEL_REC *channel) { - if (settings_get_bool("show_names_on_join") && - !channel->session_rejoin) - fe_channels_nicklist(channel, CHANNEL_NICKLIST_FLAG_ALL); + if (settings_get_bool("show_names_on_join") && !channel->session_rejoin) { + int limit = settings_get_int("show_names_on_join_limit"); + int flags = CHANNEL_NICKLIST_FLAG_ALL; + if (limit > 0 && g_hash_table_size(channel->nicks) > limit) { + flags |= CHANNEL_NICKLIST_FLAG_COUNT; + } + fe_channels_nicklist(channel, flags); + } } /* SYNTAX: JOIN [-window] [-invite] [-] [] */ @@ -625,6 +630,7 @@ void fe_channels_init(void) { settings_add_bool("lookandfeel", "autoclose_windows", TRUE); settings_add_bool("lookandfeel", "show_names_on_join", TRUE); + settings_add_int("lookandfeel", "show_names_on_join_limit", 18); settings_add_int("lookandfeel", "names_max_columns", 6); settings_add_int("lookandfeel", "names_max_width", 0); From aecf0870143d9dc3530a9e6cc8b64928178d7794 Mon Sep 17 00:00:00 2001 From: Guntbert Reiter Date: Sun, 30 May 2021 21:11:10 +0200 Subject: [PATCH 004/392] Add documentation for escaping some characters this is especially important when using `sendcmd` to send a password for autologin --- docs/help/in/eval.in | 6 ++++++ docs/help/in/network.in | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/help/in/eval.in b/docs/help/in/eval.in index b2d4b6254..b0c904b49 100644 --- a/docs/help/in/eval.in +++ b/docs/help/in/eval.in @@ -11,11 +11,17 @@ Evaluates the given commands and executes them; you can use internal variables and separate multiple commands by using the ';' character. + If the command contains a string with '$', '\' or ';' those characters + need to be escaped: + '$' -> '$$' + '\' -> '\\' (or even '\\\\', depending on where they are used) + ';' -> '\;' %9Examples:%9 /EVAL echo I am connected to ${S} on ${chatnet} as ${N} /EVAL echo My user privileges are +${usermode}; echo Let's party! + to print '1;2$3\4': /EVAL echo 1\;2$$3\\4 %9References:%9 diff --git a/docs/help/in/network.in b/docs/help/in/network.in index 0542bd7d2..788c1c656 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -18,7 +18,8 @@ -usermode: Specifies the user modes to set on yourself. -autosendcmd: Specifies the commands, separated by the ';' character, and enclosed within two "'" characters, to perform after - connecting. + connecting. + (Some characters need to be escaped - see /help eval) -querychans: Specifies the maximum number of channels to put in one MODE or WHO command when synchronizing. -whois: Specifies the maximum number of nicknames in one WHOIS From 77741b187ca72ffef747eff3f36903bb1afbba21 Mon Sep 17 00:00:00 2001 From: Francis M Date: Tue, 22 Jun 2021 16:10:55 +0100 Subject: [PATCH 005/392] Fix minor typos in help text --- docs/help/in/otr.in | 2 +- docs/help/in/window.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/help/in/otr.in b/docs/help/in/otr.in index f76a2d532..fcfcd8752 100644 --- a/docs/help/in/otr.in +++ b/docs/help/in/otr.in @@ -51,7 +51,7 @@ GENKEY This process is done in a background worker and can take an arbitrary amount of time. The completion is checked when another irssi event is - catched. + caught. HELP Print this help. diff --git a/docs/help/in/window.in b/docs/help/in/window.in index aa133766a..9a7a7b108 100644 --- a/docs/help/in/window.in +++ b/docs/help/in/window.in @@ -33,12 +33,12 @@ THEME: %|Applies or removes a per-window theme. GROW: %|Increase the size of the active split window by the specified number of lines. SHRINK: %|Decrease the size of the active split window by the specified number of lines. - SIZE: %|Set the current split window size to the specified numer of lines. + SIZE: %|Set the current split window size to the specified number of lines. BALANCE: %|Balance the heights of all split windows. HIDE: %|Hides the current split window, or the split window specified by number or item name. SHOW: %|Show the window specified by number or item name as a new split windows. It is made sticky when autostick_split_windows is turned on. UP: %|Set the split window left or above the current one active. At the top, wraps to the bottom. - DOWN: %|Set the split window right or below the current one active. At the bottom, wraps teft. + DOWN: %|Set the split window right or below the current one active. At the bottom, wraps left. LEFT: %|Go to the previous window numerically that is part of the current sticky group (or not part of any sticky group). RIGHT: %|Go to the next window numerically that is part of the current sticky group (or not part of any sticky group). STICK: %|Make the currently active window sticky, or stick the window specified by number to the currently visible split window. Or turn off stickyness of the currently active window or the window specified by number. From d2062e34cf0e74faffb725928809837807ca67b9 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Wed, 23 Jun 2021 20:56:05 +0200 Subject: [PATCH 006/392] Update fe-common-core.c --- src/fe-common/core/fe-common-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index 63df16984..e981db334 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -500,7 +500,8 @@ gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest) str += server_tag_len + 1; } - if (g_strcmp0(str, "") == 0 || g_strcmp0(str, "::all") == 0) { + if (g_strcmp0(str, "") == 0 || g_strcmp0(str, "*") == 0 || + g_strcmp0(str, "::all") == 0) { return TRUE; } else if (g_ascii_strcasecmp(str, dest->target) == 0) { return TRUE; From 3aeebd310db1c026d90bb05c4f8e7d1ae9ffe544 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Wed, 23 Jun 2021 21:07:31 +0200 Subject: [PATCH 007/392] Update fe-common-core.c --- src/fe-common/core/fe-common-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index e981db334..1fcd5df11 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -500,8 +500,7 @@ gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest) str += server_tag_len + 1; } - if (g_strcmp0(str, "") == 0 || g_strcmp0(str, "*") == 0 || - g_strcmp0(str, "::all") == 0) { + if (g_strcmp0(str, "*") == 0 || g_strcmp0(str, "::all") == 0) { return TRUE; } else if (g_ascii_strcasecmp(str, dest->target) == 0) { return TRUE; From 554a8556d27c66917ed274a76d8ba47bdc7ba13a Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 12 Aug 2021 23:46:31 +0200 Subject: [PATCH 008/392] fix use of wrong "equal" function in meta hash tables --- src/core/servers.c | 2 +- src/fe-text/textbuffer-formats.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/servers.c b/src/core/servers.c index 159af0e15..30fc68445 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -369,7 +369,7 @@ void server_connect_init(SERVER_REC *server) server->type = module_get_uniq_id("SERVER", 0); server_ref(server); server->current_incoming_meta = - g_hash_table_new_full(g_str_hash, (GEqualFunc) g_strcmp0, + g_hash_table_new_full(g_str_hash, (GEqualFunc) g_str_equal, (GDestroyNotify) i_refstr_release, (GDestroyNotify) g_free); server->nick = g_strdup(server->connrec->nick); diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 2aa06cb24..2cd0d4a3d 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -116,7 +116,7 @@ void textbuffer_meta_rec_free(TEXT_BUFFER_META_REC *rec) static void meta_hash_create(struct _TEXT_BUFFER_META_REC *meta) { if (meta->hash == NULL) { - meta->hash = g_hash_table_new_full(g_str_hash, (GEqualFunc) g_strcmp0, + meta->hash = g_hash_table_new_full(g_str_hash, (GEqualFunc) g_str_equal, (GDestroyNotify) i_refstr_release, (GDestroyNotify) g_free); } From 7d13cfba074b7dc849f095a3281952ee38518a92 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 12 Aug 2021 23:48:37 +0200 Subject: [PATCH 009/392] add a meta table to all lines --- src/fe-common/core/formats.c | 32 +++++++++++++++++++++++++++++++- src/fe-common/core/formats.h | 12 ++++++++---- src/perl/ui/Formats.xs | 19 +++++++++++++++++++ 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index 51588afbb..b660b616d 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -34,6 +34,7 @@ #include #include #include +#include static const char *format_backs = "04261537"; static const char *format_fores = "kbgcrmyw"; @@ -46,6 +47,8 @@ static int hide_text_style, hide_server_tags, hide_colors; static int timestamp_level; static int timestamp_timeout; +static GHashTable *global_meta; + int format_find_tag(const char *module, const char *tag) { FORMAT_REC *formats; @@ -453,6 +456,27 @@ void format_read_arglist(va_list va, FORMAT_REC *format, } } +void format_dest_meta_stash(TEXT_DEST_REC *dest, const char *meta_key, const char *meta_value) +{ + g_hash_table_replace(dest->meta, i_refstr_intern(meta_key), g_strdup(meta_value)); +} + +const char *format_dest_meta_stash_find(TEXT_DEST_REC *dest, const char *meta_key) +{ + return g_hash_table_lookup(dest->meta, meta_key); +} + +void format_dest_meta_clear_all(TEXT_DEST_REC *dest) +{ + g_hash_table_remove_all(dest->meta); +} + +static void clear_global_meta(WINDOW_REC *window, TEXT_DEST_REC *dest) +{ + if (dest != NULL && dest->meta == global_meta) + g_hash_table_remove_all(global_meta); +} + void format_create_dest_tag_meta(TEXT_DEST_REC *dest, void *server, const char *server_tag, const char *target, int level, WINDOW_REC *window, GHashTable *meta) @@ -465,7 +489,7 @@ void format_create_dest_tag_meta(TEXT_DEST_REC *dest, void *server, const char * dest->level = level; dest->window = window != NULL ? window : window_find_closest(server, target, level); - dest->meta = meta; + dest->meta = meta != NULL ? meta : global_meta; } void format_create_dest_tag(TEXT_DEST_REC *dest, void *server, const char *server_tag, @@ -1705,12 +1729,18 @@ static void read_settings(void) void formats_init(void) { signal_gui_print_text = signal_get_uniq_id("gui print text"); + global_meta = + g_hash_table_new_full(g_str_hash, (GEqualFunc) g_str_equal, + (GDestroyNotify) i_refstr_release, (GDestroyNotify) g_free); read_settings(); signal_add("setup changed", (SIGNAL_FUNC) read_settings); + signal_add_last("gui print text finished", (SIGNAL_FUNC) clear_global_meta); } void formats_deinit(void) { + g_hash_table_destroy(global_meta); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); + signal_remove("gui print text finished", (SIGNAL_FUNC) clear_global_meta); } diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h index 122746389..c17bcc754 100644 --- a/src/fe-common/core/formats.h +++ b/src/fe-common/core/formats.h @@ -63,7 +63,7 @@ typedef struct _TEXT_DEST_REC { int hilight_priority; char *hilight_color; - int flags; + int flags; /* PRINT_FLAG */ GHashTable *meta; } TEXT_DEST_REC; @@ -116,12 +116,16 @@ char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t); void format_create_dest(TEXT_DEST_REC *dest, void *server, const char *target, int level, WINDOW_REC *window); -void format_create_dest_tag(TEXT_DEST_REC *dest, void *server, - const char *server_tag, const char *target, - int level, WINDOW_REC *window); +void format_create_dest_tag(TEXT_DEST_REC *dest, void *server, const char *server_tag, + const char *target, int level, WINDOW_REC *window); void format_newline(TEXT_DEST_REC *dest); +/* manipulate the meta table of a dest */ +void format_dest_meta_stash(TEXT_DEST_REC *dest, const char *meta_key, const char *meta_value); +const char *format_dest_meta_stash_find(TEXT_DEST_REC *dest, const char *meta_key); +void format_dest_meta_clear_all(TEXT_DEST_REC *dest); + /* Return how many characters in `str' must be skipped before `len' characters of text is skipped. */ int strip_real_length(const char *str, int len, diff --git a/src/perl/ui/Formats.xs b/src/perl/ui/Formats.xs index c03e6bb58..0f8b59b7f 100644 --- a/src/perl/ui/Formats.xs +++ b/src/perl/ui/Formats.xs @@ -156,3 +156,22 @@ print(dest, str) char *str CODE: printtext_dest(dest, "%s", str); + +#******************************* +MODULE = Irssi::UI::Formats PACKAGE = Irssi::UI::TextDest PREFIX = format_dest_ +#******************************* + +void +format_dest_meta_stash(dest, meta_key, meta_value) + Irssi::UI::TextDest dest + char *meta_key + char *meta_value + +char * +format_dest_meta_stash_find(dest, meta_key) + Irssi::UI::TextDest dest + char *meta_key +CODE: + RETVAL = (char *) format_dest_meta_stash_find(dest, meta_key); +OUTPUT: + RETVAL From 9677b07488b6b7b4ee7a425d8f2826669404d058 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 12 Aug 2021 23:49:40 +0200 Subject: [PATCH 010/392] fix wrong server_time in $line->get_meta --- src/perl/textui/TextBuffer.xs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/perl/textui/TextBuffer.xs b/src/perl/textui/TextBuffer.xs index 6695eae0d..301e2d4af 100644 --- a/src/perl/textui/TextBuffer.xs +++ b/src/perl/textui/TextBuffer.xs @@ -123,6 +123,8 @@ PPCODE: (void) hv_store(hv, key, strlen(key), new_pv(val), 0); } } - (void) hv_store(hv, "server_time", 11, newSViv(m->server_time), 0); + if (m->server_time) { + (void) hv_store(hv, "server_time", 11, newSViv(m->server_time), 0); + } } XPUSHs(sv_2mortal(newRV_noinc((SV *) hv))); From 8d314eadf1350619d481cc5729c7bd74eec85693 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 12 Aug 2021 23:51:18 +0200 Subject: [PATCH 011/392] move TEXT_BUFFER_META_REC -> LINE_INFO_META_REC --- src/fe-common/core/formats.h | 5 +++++ src/fe-text/textbuffer-formats.c | 12 ++++++------ src/fe-text/textbuffer-formats.h | 8 ++------ src/fe-text/textbuffer.h | 2 +- src/perl/textui/TextBuffer.xs | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h index c17bcc754..5666c73b5 100644 --- a/src/fe-common/core/formats.h +++ b/src/fe-common/core/formats.h @@ -67,6 +67,11 @@ typedef struct _TEXT_DEST_REC { GHashTable *meta; } TEXT_DEST_REC; +typedef struct _LINE_INFO_META_REC { + gint64 server_time; + GHashTable *hash; +} LINE_INFO_META_REC; + #define window_get_theme(window) \ (window != NULL && (window)->theme != NULL ? \ (window)->theme : current_theme) diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 2cd0d4a3d..b194a18a6 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -102,7 +102,7 @@ static void format_rec_set_dest(TEXT_BUFFER_FORMAT_REC *rec, const TEXT_DEST_REC rec->flags = dest->flags & ~PRINT_FLAG_FORMAT; } -void textbuffer_meta_rec_free(TEXT_BUFFER_META_REC *rec) +void textbuffer_meta_rec_free(LINE_INFO_META_REC *rec) { if (rec == NULL) return; @@ -113,7 +113,7 @@ void textbuffer_meta_rec_free(TEXT_BUFFER_META_REC *rec) g_free(rec); } -static void meta_hash_create(struct _TEXT_BUFFER_META_REC *meta) +static void meta_hash_create(struct _LINE_INFO_META_REC *meta) { if (meta->hash == NULL) { meta->hash = g_hash_table_new_full(g_str_hash, (GEqualFunc) g_str_equal, @@ -122,9 +122,9 @@ static void meta_hash_create(struct _TEXT_BUFFER_META_REC *meta) } } -static TEXT_BUFFER_META_REC *line_meta_create(GHashTable *meta_hash) +static LINE_INFO_META_REC *line_meta_create(GHashTable *meta_hash) { - struct _TEXT_BUFFER_META_REC *meta; + struct _LINE_INFO_META_REC *meta; GHashTableIter iter; const char *key; const char *val; @@ -132,7 +132,7 @@ static TEXT_BUFFER_META_REC *line_meta_create(GHashTable *meta_hash) if (meta_hash == NULL || g_hash_table_size(meta_hash) == 0) return NULL; - meta = g_new0(struct _TEXT_BUFFER_META_REC, 1); + meta = g_new0(struct _LINE_INFO_META_REC, 1); g_hash_table_iter_init(&iter, meta_hash); while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) { @@ -362,7 +362,7 @@ char *textbuffer_line_get_text(TEXT_BUFFER_REC *buffer, LINE_REC *line, gboolean THEME_REC *theme; int formatnum; TEXT_BUFFER_FORMAT_REC *format_rec; - TEXT_BUFFER_META_REC *meta; + LINE_INFO_META_REC *meta; char *str; curr = line; diff --git a/src/fe-text/textbuffer-formats.h b/src/fe-text/textbuffer-formats.h index 17a907c18..865875636 100644 --- a/src/fe-text/textbuffer-formats.h +++ b/src/fe-text/textbuffer-formats.h @@ -2,11 +2,7 @@ #define IRSSI_FE_TEXT_TEXTBUFFER_FORMATS_H #include - -typedef struct _TEXT_BUFFER_META_REC { - gint64 server_time; - GHashTable *hash; -} TEXT_BUFFER_META_REC; +#include typedef struct _TEXT_BUFFER_FORMAT_REC { char *module; @@ -22,7 +18,7 @@ typedef struct _TEXT_BUFFER_FORMAT_REC { } TEXT_BUFFER_FORMAT_REC; void textbuffer_format_rec_free(TEXT_BUFFER_FORMAT_REC *rec); -void textbuffer_meta_rec_free(TEXT_BUFFER_META_REC *rec); +void textbuffer_meta_rec_free(LINE_INFO_META_REC *rec); char *textbuffer_line_get_text(TEXT_BUFFER_REC *buffer, LINE_REC *line, gboolean raw); void textbuffer_formats_init(void); void textbuffer_formats_deinit(void); diff --git a/src/fe-text/textbuffer.h b/src/fe-text/textbuffer.h index 5f5f9a277..6c72a5698 100644 --- a/src/fe-text/textbuffer.h +++ b/src/fe-text/textbuffer.h @@ -24,7 +24,7 @@ typedef struct { int level; time_t time; char *text; - struct _TEXT_BUFFER_META_REC *meta; + struct _LINE_INFO_META_REC *meta; struct _TEXT_BUFFER_FORMAT_REC *format; } LINE_INFO_REC; diff --git a/src/perl/textui/TextBuffer.xs b/src/perl/textui/TextBuffer.xs index 301e2d4af..be83cc594 100644 --- a/src/perl/textui/TextBuffer.xs +++ b/src/perl/textui/TextBuffer.xs @@ -107,7 +107,7 @@ textbuffer_line_get_meta(line) PREINIT: HV *hv; LINE_REC *l; - TEXT_BUFFER_META_REC *m; + LINE_INFO_META_REC *m; GHashTableIter iter; char *key; char *val; From 5953b675b9411a87d111ea82ecd7c0876de3f186 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 12 Aug 2021 23:53:44 +0200 Subject: [PATCH 012/392] store the hilight result in the meta table and apply it during the "gui render line text" signal --- src/fe-common/core/hilight-text.c | 98 +++++++++++++++++++++++++++---- src/fe-text/textbuffer-formats.c | 28 ++++++--- 2 files changed, 108 insertions(+), 18 deletions(-) diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 153a7a154..4b5e4edde 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -323,6 +323,71 @@ void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec) static void hilight_print(int index, HILIGHT_REC *rec); +static void sig_render_line_text(TEXT_DEST_REC *dest, GString *str, LINE_INFO_META_REC *meta) +{ + char *color, *tmp, *tmp2; + + if (meta == NULL || meta->hash == NULL) + return; + + color = g_hash_table_lookup(meta->hash, "hilight-color"); + + if ((tmp = g_hash_table_lookup(meta->hash, "hilight-line")) != NULL) { + /* hilight whole line */ + + tmp = strip_codes(str->str); + + color = format_string_expand( + color != NULL ? color : settings_get_str("hilight_color"), NULL); + + g_string_truncate(str, 0); + g_string_append(str, color); + g_string_append(str, tmp); + + g_free(color); + g_free(tmp); + } else if ((tmp = g_hash_table_lookup(meta->hash, "hilight-start")) != NULL && + (tmp2 = g_hash_table_lookup(meta->hash, "hilight-end")) != NULL) { + /* hilight part of the line */ + int hilight_start, hilight_end; + int pos, color_pos, color_len; + char *middle; + GString *str2; + + hilight_start = atoi(tmp); + hilight_end = atoi(tmp2); + + /* start of the line */ + pos = strip_real_length(str->str, hilight_start, NULL, NULL); + + str2 = g_string_new_len(str->str, pos); + + /* color */ + color = format_string_expand( + color != NULL ? color : settings_get_str("hilight_color"), NULL); + g_string_append(str2, color); + g_free(color); + + /* middle of the line, stripped */ + middle = strip_codes(str->str + pos); + g_string_append_len(str2, middle, hilight_end - hilight_start); + g_free(middle); + + /* end of the line */ + pos = strip_real_length(str->str, hilight_end, &color_pos, &color_len); + if (color_pos > 0) { + g_string_append_len(str2, str->str + color_pos, color_len); + } else { + /* no colors in line, change back to default */ + g_string_append_c(str2, 4); + g_string_append_c(str2, FORMAT_STYLE_DEFAULTS); + } + g_string_append(str2, str->str + pos); + + g_string_assign(str, g_string_free(str2, FALSE)); + } +} + static void sig_print_text(TEXT_DEST_REC *dest, const char *text, const char *stripped) { @@ -372,38 +437,47 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text, char *tmp = strip_codes(text); newstr = g_strconcat(color, tmp, NULL); g_free(tmp); + + format_dest_meta_stash(dest, "hilight-line", "\001"); } else { /* hilight part of the line */ - GString *tmp; - char *middle; + GString *str; + char *middle, *tmp; int pos, color_pos, color_len; /* start of the line */ pos = strip_real_length(text, hilight_start, NULL, NULL); - tmp = g_string_new_len(text, pos); + str = g_string_new_len(text, pos); /* color */ - g_string_append(tmp, color); + g_string_append(str, color); /* middle of the line, stripped */ middle = strip_codes(text + pos); - g_string_append_len(tmp, middle, hilight_len); + g_string_append_len(str, middle, hilight_len); g_free(middle); /* end of the line */ pos = strip_real_length(text, hilight_end, &color_pos, &color_len); if (color_pos > 0) { - g_string_append_len(tmp, text + color_pos, color_len); + g_string_append_len(str, text + color_pos, color_len); } else { /* no colors in line, change back to default */ - g_string_append_c(tmp, 4); - g_string_append_c(tmp, FORMAT_STYLE_DEFAULTS); + g_string_append_c(str, 4); + g_string_append_c(str, FORMAT_STYLE_DEFAULTS); } - g_string_append(tmp, text + pos); + g_string_append(str, text + pos); + + newstr = str->str; + g_string_free(str, FALSE); - newstr = tmp->str; - g_string_free(tmp, FALSE); + format_dest_meta_stash(dest, "hilight-start", + tmp = g_strdup_printf("%d", hilight_start)); + g_free(tmp); + format_dest_meta_stash(dest, "hilight-end", + tmp = g_strdup_printf("%d", hilight_end)); + g_free(tmp); } signal_emit("print text", 3, dest, newstr, stripped); @@ -721,6 +795,7 @@ void hilight_text_init(void) read_hilight_config(); signal_add_first("print text", (SIGNAL_FUNC) sig_print_text); + signal_add("gui render line text", (SIGNAL_FUNC) sig_render_line_text); signal_add("setup reread", (SIGNAL_FUNC) read_hilight_config); signal_add("setup changed", (SIGNAL_FUNC) read_settings); @@ -735,6 +810,7 @@ void hilight_text_deinit(void) nickmatch_deinit(nickmatch); signal_remove("print text", (SIGNAL_FUNC) sig_print_text); + signal_remove("gui render line text", (SIGNAL_FUNC) sig_render_line_text); signal_remove("setup reread", (SIGNAL_FUNC) read_hilight_config); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index b194a18a6..5b15313f7 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -16,6 +16,7 @@ TEXT_BUFFER_REC *color_buf; gboolean scrollback_format; gboolean show_server_time; +int signal_gui_render_line_text; #if GLIB_CHECK_VERSION(2, 56, 0) /* nothing */ @@ -363,7 +364,7 @@ char *textbuffer_line_get_text(TEXT_BUFFER_REC *buffer, LINE_REC *line, gboolean int formatnum; TEXT_BUFFER_FORMAT_REC *format_rec; LINE_INFO_META_REC *meta; - char *str; + char *tmp2; curr = line; line = NULL; @@ -396,6 +397,8 @@ char *textbuffer_line_get_text(TEXT_BUFFER_REC *buffer, LINE_REC *line, gboolean } if (text != NULL && *text != '\0') { + GString *str; + reference_time = curr->info.time; if (show_server_time && meta != NULL && meta->server_time != 0) { current_time = meta->server_time; @@ -403,18 +406,27 @@ char *textbuffer_line_get_text(TEXT_BUFFER_REC *buffer, LINE_REC *line, gboolean current_time = curr->info.time; } + str = g_string_new(text); + signal_emit_id(signal_gui_render_line_text, 3, &dest, str, meta); + if (g_strcmp0(text, str->str) == 0) { + g_string_free(str, TRUE); + } else { + g_free(text); + text = g_string_free(str, FALSE); + } + tmp = format_get_level_tag(theme, &dest); - str = !theme->info_eol ? format_add_linestart(text, tmp) : - format_add_lineend(text, tmp); + tmp2 = !theme->info_eol ? format_add_linestart(text, tmp) : + format_add_lineend(text, tmp); g_free_not_null(tmp); g_free_not_null(text); - text = str; + text = tmp2; tmp = format_get_line_start(theme, &dest, current_time); - str = !theme->info_eol ? format_add_linestart(text, tmp) : - format_add_lineend(text, tmp); + tmp2 = !theme->info_eol ? format_add_linestart(text, tmp) : + format_add_lineend(text, tmp); g_free_not_null(tmp); g_free_not_null(text); - text = str; + text = tmp2; /* str = g_strconcat(text, "\n", NULL); */ /* g_free(text); */ @@ -447,6 +459,8 @@ static void read_settings(void) void textbuffer_formats_init(void) { + signal_gui_render_line_text = signal_get_uniq_id("gui render line text"); + settings_add_bool("lookandfeel", "scrollback_format", TRUE); settings_add_bool("lookandfeel", "show_server_time", FALSE); From 6a52b5ac07fe57ebd5973871db64b775e41a3f84 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 00:44:33 +0200 Subject: [PATCH 013/392] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index bdbafca7c..990cc0cf5 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 36 +#define IRSSI_ABI_VERSION 37 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 1602b506a69d12f6d15014f1c6b246066e29e404 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 17:31:14 +0200 Subject: [PATCH 014/392] add LINE_INFO_META_REC to Perl --- src/perl/get-signals.pl | 13 +++++++------ src/perl/textui/TextBuffer.xs | 30 +++++------------------------- src/perl/ui/UI.xs | 21 +++++++++++++++++++++ src/perl/ui/module.h | 1 + src/perl/ui/typemap | 1 + 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/perl/get-signals.pl b/src/perl/get-signals.pl index 12aebdbab..a76d7ecf9 100755 --- a/src/perl/get-signals.pl +++ b/src/perl/get-signals.pl @@ -52,12 +52,13 @@ CLIENT_REC => 'Irssi::Irc::Client', # fe-common - THEME_REC => 'Irssi::UI::Theme', - KEYINFO_REC => 'Irssi::UI::Keyinfo', - PROCESS_REC => 'Irssi::UI::Process', - TEXT_DEST_REC => 'Irssi::UI::TextDest', - WINDOW_REC => 'Irssi::UI::Window', - WI_ITEM_REC => 'iobject', + THEME_REC => 'Irssi::UI::Theme', + KEYINFO_REC => 'Irssi::UI::Keyinfo', + PROCESS_REC => 'Irssi::UI::Process', + TEXT_DEST_REC => 'Irssi::UI::TextDest', + LINE_INFO_META_REC => 'Irssi::UI::LineInfoMeta', + WINDOW_REC => 'Irssi::UI::Window', + WI_ITEM_REC => 'iobject', # fe-text TEXTBUFFER_VIEW_REC => 'Irssi::TextUI::TextBufferView', diff --git a/src/perl/textui/TextBuffer.xs b/src/perl/textui/TextBuffer.xs index be83cc594..655dbd3c0 100644 --- a/src/perl/textui/TextBuffer.xs +++ b/src/perl/textui/TextBuffer.xs @@ -101,30 +101,10 @@ PPCODE: } XPUSHs(sv_2mortal(newRV_noinc((SV *) hv))); -void +Irssi::UI::LineInfoMeta textbuffer_line_get_meta(line) Irssi::TextUI::Line line -PREINIT: - HV *hv; - LINE_REC *l; - LINE_INFO_META_REC *m; - GHashTableIter iter; - char *key; - char *val; -PPCODE: - hv = newHV(); - l = line->line; - if (l->info.meta != NULL) { - m = l->info.meta; - if (m->hash != NULL) { - g_hash_table_iter_init(&iter, m->hash); - while ( - g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) { - (void) hv_store(hv, key, strlen(key), new_pv(val), 0); - } - } - if (m->server_time) { - (void) hv_store(hv, "server_time", 11, newSViv(m->server_time), 0); - } - } - XPUSHs(sv_2mortal(newRV_noinc((SV *) hv))); +CODE: + RETVAL = line->line->info.meta; +OUTPUT: + RETVAL diff --git a/src/perl/ui/UI.xs b/src/perl/ui/UI.xs index 5ac3da4e1..30b0f6370 100644 --- a/src/perl/ui/UI.xs +++ b/src/perl/ui/UI.xs @@ -64,6 +64,26 @@ static void perl_text_dest_fill_hash(HV *hv, TEXT_DEST_REC *dest) (void) hv_store(hv, "hilight_color", 13, new_pv(dest->hilight_color), 0); } +static void perl_line_info_meta_fill_hash(HV *hv, LINE_INFO_META_REC *meta) +{ + GHashTableIter iter; + char *key; + char *val; + + if (meta != NULL) { + if (meta->hash != NULL) { + g_hash_table_iter_init(&iter, meta->hash); + while ( + g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) { + (void) hv_store(hv, key, strlen(key), new_pv(val), 0); + } + } + if (meta->server_time) { + (void) hv_store(hv, "server_time", 11, newSViv(meta->server_time), 0); + } + } +} + static void perl_exec_fill_hash(HV *hv, EXEC_WI_REC *item) { g_return_if_fail(hv != NULL); @@ -81,6 +101,7 @@ static PLAIN_OBJECT_INIT_REC fe_plains[] = { { "Irssi::UI::Process", (PERL_OBJECT_FUNC) perl_process_fill_hash }, { "Irssi::UI::Window", (PERL_OBJECT_FUNC) perl_window_fill_hash }, { "Irssi::UI::TextDest", (PERL_OBJECT_FUNC) perl_text_dest_fill_hash }, + { "Irssi::UI::LineInfoMeta", (PERL_OBJECT_FUNC) perl_line_info_meta_fill_hash }, { NULL, NULL } }; diff --git a/src/perl/ui/module.h b/src/perl/ui/module.h index 4e19d4c04..4106aec45 100644 --- a/src/perl/ui/module.h +++ b/src/perl/ui/module.h @@ -12,3 +12,4 @@ typedef WINDOW_REC *Irssi__UI__Window; typedef TEXT_DEST_REC *Irssi__UI__TextDest; typedef THEME_REC *Irssi__UI__Theme; typedef KEYINFO_REC *Irssi__UI__Keyinfo; +typedef LINE_INFO_META_REC *Irssi__UI__LineInfoMeta; diff --git a/src/perl/ui/typemap b/src/perl/ui/typemap index 2a16fe44f..4afb273dd 100644 --- a/src/perl/ui/typemap +++ b/src/perl/ui/typemap @@ -3,6 +3,7 @@ Irssi::UI::Theme T_PlainObj Irssi::UI::Window T_PlainObj Irssi::UI::Keyinfo T_PlainObj Irssi::UI::TextDest T_PlainObj +Irssi::UI::LineInfoMeta T_PlainObj INPUT From 425178e793f03dfaa3b42f4999f3b04eaad48732 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 17:31:49 +0200 Subject: [PATCH 015/392] add GString to Perl --- src/perl/get-signals.pl | 2 ++ src/perl/perl-signals.c | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/perl/get-signals.pl b/src/perl/get-signals.pl index a76d7ecf9..f7675f1b5 100755 --- a/src/perl/get-signals.pl +++ b/src/perl/get-signals.pl @@ -19,6 +19,8 @@ s/GList \* of ([^,]*)s/glistptr_\1/g; s/GSList of ([^,]*)s/gslist_\1/g; + s/GString \*[^,]*/gstring/g; + s/char \*[^,]*/string/g; s/ulong \*[^,]*/ulongptr/g; s/int \*[^,]*/intptr/g; diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 9f49fba80..897689e18 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -86,7 +86,8 @@ void perl_signal_args_to_c(void (*callback)(void *, int, void **), void *cb_arg, unsigned long v_ulong; GSList *v_gslist; GList *v_glist; - } saved_args[SIGNAL_MAX_ARGUMENTS]; + GString *v_gstring; + } saved_args[SIGNAL_MAX_ARGUMENTS]; AV *aargs; void *p[SIGNAL_MAX_ARGUMENTS]; PERL_SIGNAL_ARGS_REC *rec; @@ -146,6 +147,12 @@ void perl_signal_args_to_c(void (*callback)(void *, int, void **), void *cb_arg, } else if (g_strcmp0(rec->args[n], "intptr") == 0) { saved_args[n].v_int = SvIV(SvRV(arg)); c_arg = &saved_args[n].v_int; + } else if (g_strcmp0(rec->args[n], "gstring") == 0) { + char *pv; + size_t len; + + pv = SvPV(SvRV(arg), len); + c_arg = saved_args[n].v_gstring = g_string_new_len(pv, len); } else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { GList *gl; int is_str; @@ -220,6 +227,16 @@ void perl_signal_args_to_c(void (*callback)(void *, int, void **), void *cb_arg, SV *t = SvRV(arg); SvIOK_only(t); SvIV_set(t, saved_args[n].v_int); + } else if (g_strcmp0(rec->args[n], "gstring") == 0) { + GString *str; + SV *t; + + str = saved_args[n].v_gstring; + t = SvRV(arg); + SvPOK_only(t); + sv_setpvn(t, str->str, str->len); + + g_string_free(str, TRUE); } else if (strncmp(rec->args[n], "gslist_", 7) == 0) { g_slist_free(saved_args[n].v_gslist); } else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { @@ -306,7 +323,10 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, perlarg = newSViv(*(unsigned long *) arg); else if (g_strcmp0(rec->args[n], "intptr") == 0) saved_args[n] = perlarg = newRV_noinc(newSViv(*(int *) arg)); - else if (g_strcmp0(rec->args[n], "formatnum_args") == 0 && n >= 3) { + else if (g_strcmp0(rec->args[n], "gstring") == 0) { + GString *str = arg; + saved_args[n] = perlarg = newRV_noinc(newSVpvn(str->str, str->len)); + } else if (g_strcmp0(rec->args[n], "formatnum_args") == 0 && n >= 3) { const THEME_REC *theme; const MODULE_THEME_REC *rec; const FORMAT_REC *formats; @@ -415,8 +435,21 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, if (g_strcmp0(rec->args[n], "intptr") == 0) { int *val = arg; *val = SvIV(SvRV(saved_args[n])); + } else if (g_strcmp0(rec->args[n], "gstring") == 0) { + SV *os, *ns; + GString *str = arg; + + os = sv_2mortal(newSVpvn(str->str, str->len)); + ns = SvRV(saved_args[n]); + if (sv_cmp(os, ns) != 0) { + size_t len; + char *pv = SvPV(ns, len); + + g_string_truncate(str, 0); + g_string_append_len(str, pv, len); + } } else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { - GList **ret = arg; + GList **ret = arg; GList *out = NULL; void *val; int count; From ed23d89a5a69b324ed05b5f9bd8115c34ad4b7a9 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 17:32:09 +0200 Subject: [PATCH 016/392] fix recursive crash in Perl scripts --- src/perl/perl-signals.c | 1 + src/perl/perl-sources.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 897689e18..683b4c3f5 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -419,6 +419,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, if (SvTRUE(ERRSV)) { char *error = g_strdup(SvPV_nolen(ERRSV)); + perl_signal_remove_script(script); signal_emit("script error", 2, script, error); g_free(error); rec = NULL; diff --git a/src/perl/perl-sources.c b/src/perl/perl-sources.c index 9f5773f18..9f9ec6b50 100644 --- a/src/perl/perl-sources.c +++ b/src/perl/perl-sources.c @@ -83,6 +83,7 @@ static int perl_source_event(PERL_SOURCE_REC *rec) if (SvTRUE(ERRSV)) { char *error = g_strdup(SvPV_nolen(ERRSV)); + perl_source_remove_script(rec->script); signal_emit("script error", 2, rec->script, error); g_free(error); } From 96e9ab41e9f353fc9612c27e3d61bc8ab978564d Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 17:32:25 +0200 Subject: [PATCH 017/392] add "gui render line text" to signals.txt --- docs/signals.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/signals.txt b/docs/signals.txt index 1eefc7e01..4e5f85b4b 100644 --- a/docs/signals.txt +++ b/docs/signals.txt @@ -358,6 +358,9 @@ gui-printtext.c: textbuffer-view.c "gui textbuffer line removed", TEXTBUFFER_VIEW_REC *view, LINE_REC *line, LINE_REC *prev_line +textbuffer-formats.c + "gui render line text", TEXT_DEST_REC, GString *str, LINE_INFO_META_REC + Perl ---- From 5a8b23cab0f758f78c0dc495ce788d0c58b8a661 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 17:38:57 +0200 Subject: [PATCH 018/392] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 990cc0cf5..cc334476c 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 37 +#define IRSSI_ABI_VERSION 38 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 0c82a3adfd48df33c971a74ff862d69e23e6909e Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 15 Aug 2021 00:08:44 +0200 Subject: [PATCH 019/392] Workaround for google/oss-fuzz#3731 Run CIFuzz docker manually --- .github/workflows/cifuzz.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index a32e335d3..6325d6717 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -19,13 +19,23 @@ jobs: matrix: sanitizer: [address, undefined, memory] steps: + - uses: actions/checkout@main + with: + path: irssi + - name: Docker build build_fuzzers container + run: | + # google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + docker build -t build_fuzzers:actions -f "/home/runner/work/_actions/google/oss-fuzz/master/infra/build_fuzzers.Dockerfile" "/home/runner/work/_actions/google/oss-fuzz/master/infra" - name: Build Fuzzers (${{ matrix.sanitizer }}) id: build - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'irssi' - dry-run: false - sanitizer: ${{ matrix.sanitizer }} + env: + OSS_FUZZ_PROJECT_NAME: 'irssi' + DRY_RUN: false + SANITIZER: ${{ matrix.sanitizer }} + PROJECT_SRC_PATH: /github/workspace/irssi + REPOSITORY: 'irssi' + run: | + docker run --workdir /github/workspace --rm -e OSS_FUZZ_PROJECT_NAME -e DRY_RUN -e SANITIZER -e PROJECT_SRC_PATH -e REPOSITORY -e WORKSPACE=/github/workspace -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "$GITHUB_WORKSPACE":"/github/workspace" build_fuzzers:actions - name: Run Fuzzers (${{ matrix.sanitizer }}) uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master with: From fdd61f5898c8a97b6a1088db717c16691d601d60 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 21:11:22 +0200 Subject: [PATCH 020/392] add a log_server_time setting --- src/core/log.c | 14 +++++++------- src/core/log.h | 6 +++--- src/fe-common/core/fe-log.c | 33 ++++++++++++++++++++++++++------- src/perl/common/Log.xs | 3 ++- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/core/log.c b/src/core/log.c index cb6f1edd2..5bc953a1e 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -204,11 +204,10 @@ static void log_rotate_check(LOG_REC *log) g_free(new_fname); } -void log_write_rec(LOG_REC *log, const char *str, int level) +void log_write_rec(LOG_REC *log, const char *str, int level, time_t now) { char *colorstr; struct tm *tm; - time_t now; int hour, day; g_return_if_fail(log != NULL); @@ -217,7 +216,8 @@ void log_write_rec(LOG_REC *log, const char *str, int level) if (log->handle == -1) return; - now = time(NULL); + if (now == (time_t) -1) + now = time(NULL); tm = localtime(&now); hour = tm->tm_hour; day = tm->tm_mday; @@ -282,8 +282,8 @@ LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item, return NULL; } -void log_file_write(const char *server_tag, const char *item, int level, - const char *str, int no_fallbacks) +void log_file_write(const char *server_tag, const char *item, int level, time_t t, const char *str, + int no_fallbacks) { GSList *tmp, *fallbacks; char *tmpstr; @@ -309,7 +309,7 @@ void log_file_write(const char *server_tag, const char *item, int level, fallbacks = g_slist_append(fallbacks, rec); else if (log_item_find(rec, LOG_ITEM_TARGET, item, server_tag) != NULL) - log_write_rec(rec, str, level); + log_write_rec(rec, str, level, t); } if (!found && !no_fallbacks && fallbacks != NULL) { @@ -319,7 +319,7 @@ void log_file_write(const char *server_tag, const char *item, int level, g_strdup(str); for (tmp = fallbacks; tmp != NULL; tmp = tmp->next) - log_write_rec(tmp->data, tmpstr, level); + log_write_rec(tmp->data, tmpstr, level, t); g_free(tmpstr); } diff --git a/src/core/log.h b/src/core/log.h index 1c5296709..19bca4f31 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -51,9 +51,9 @@ void log_item_destroy(LOG_REC *log, LOG_ITEM_REC *item); LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item, const char *servertag); -void log_file_write(const char *server_tag, const char *item, int level, - const char *str, int no_fallbacks); -void log_write_rec(LOG_REC *log, const char *str, int level); +void log_file_write(const char *server_tag, const char *item, int level, time_t t, const char *str, + int no_fallbacks); +void log_write_rec(LOG_REC *log, const char *str, int level, time_t now); int log_start_logging(LOG_REC *log); void log_stop_logging(LOG_REC *log); diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index b5222059b..984b3548a 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -48,6 +48,7 @@ #define AUTOLOG_INACTIVITY_CLOSE (60*5) static int autolog_level; +static int log_server_time; static int autoremove_tag; static char *autolog_path; @@ -502,8 +503,8 @@ static void autolog_open_check(TEXT_DEST_REC *dest) autolog_open(server, server_tag, g_strcmp0(target, "*") ? target : deftarget); } -static void log_single_line(WINDOW_REC *window, const char *server_tag, - const char *target, int level, const char *text) +static void log_single_line(WINDOW_REC *window, const char *server_tag, const char *target, + int level, time_t t, const char *text) { char windownum[MAX_INT_STRLEN]; LOG_REC *log; @@ -514,15 +515,16 @@ static void log_single_line(WINDOW_REC *window, const char *server_tag, log = logs_find_item(LOG_ITEM_WINDOW_REFNUM, windownum, NULL, NULL); if (log != NULL) - log_write_rec(log, text, level); + log_write_rec(log, text, level, t); } - log_file_write(server_tag, target, level, text, FALSE); + log_file_write(server_tag, target, level, t, text, FALSE); } static void log_line(TEXT_DEST_REC *dest, const char *text) { char **lines, **tmp; + time_t t = (time_t) -1; if (dest->level == MSGLEVEL_NEVER) return; @@ -536,9 +538,18 @@ static void log_line(TEXT_DEST_REC *dest, const char *text) /* text may contain one or more lines, log wants to eat them one line at a time */ lines = g_strsplit(text, "\n", -1); + if (log_server_time && dest->meta != NULL) { + char *val; + if ((val = g_hash_table_lookup(dest->meta, "time")) != NULL) { + GDateTime *time; + if ((time = g_date_time_new_from_iso8601(val, NULL)) != NULL) { + t = g_date_time_to_unix(time); + g_date_time_unref(time); + } + } + } for (tmp = lines; *tmp != NULL; tmp++) - log_single_line(dest->window, dest->server_tag, - dest->target, dest->level, *tmp); + log_single_line(dest->window, dest->server_tag, dest->target, dest->level, t, *tmp); g_strfreev(lines); } @@ -720,6 +731,13 @@ static void read_settings(void) g_strfreev(autolog_ignore_targets); autolog_ignore_targets = g_strsplit(settings_get_str("autolog_ignore_targets"), " ", -1); + + log_server_time = settings_get_choice("log_server_time"); + if (log_server_time == 2) { + SETTINGS_REC *rec = settings_get_record("show_server_time"); + if (rec != NULL) + log_server_time = settings_get_bool("show_server_time"); + } } void fe_log_init(void) @@ -731,7 +749,8 @@ void fe_log_init(void) settings_add_bool("log", "autolog", FALSE); settings_add_bool("log", "autolog_colors", FALSE); settings_add_bool("log", "autolog_only_saved_channels", FALSE); - settings_add_str("log", "autolog_path", "~/irclogs/$tag/$0.log"); + settings_add_choice("log", "log_server_time", 2, "off;on;auto"); + settings_add_str("log", "autolog_path", "~/irclogs/$tag/$0.log"); settings_add_level("log", "autolog_level", "all -crap -clientcrap -ctcps"); settings_add_str("log", "log_theme", ""); settings_add_str("log", "autolog_ignore_targets", ""); diff --git a/src/perl/common/Log.xs b/src/perl/common/Log.xs index cdcdbd90a..532095fb2 100644 --- a/src/perl/common/Log.xs +++ b/src/perl/common/Log.xs @@ -54,10 +54,11 @@ log_close(log) Irssi::Log log void -log_write_rec(log, str, level) +log_write_rec(log, str, level, now = -1) Irssi::Log log char *str int level + time_t now void log_start_logging(log) From 6a331399399dc9b91d75fbe6b065e31a2db49fe0 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 14 Aug 2021 22:43:50 +0200 Subject: [PATCH 021/392] compat for glib 2.55 --- src/core/misc.c | 20 ++++++++++++++++---- src/core/misc.h | 7 +++++++ src/fe-text/textbuffer-formats.c | 16 +--------------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/core/misc.c b/src/core/misc.c index c66bbd6d4..f0bbf4e00 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -95,7 +95,6 @@ int i_input_add_poll(int fd, int priority, int condition, GInputFunction functio #pragma GCC diagnostic ignored "-Wdeprecated-declarations" int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2) { -#pragma GCC diagnostic pop if (tv1->tv_sec < tv2->tv_sec) return -1; if (tv1->tv_sec > tv2->tv_sec) @@ -105,11 +104,8 @@ int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2) tv1->tv_usec > tv2->tv_usec ? 1 : 0; } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) { -#pragma GCC diagnostic pop long secs, usecs; secs = tv1->tv_sec - tv2->tv_sec; @@ -122,6 +118,22 @@ long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) return usecs; } +#pragma GCC diagnostic pop + +#if GLIB_CHECK_VERSION(2, 56, 0) +/* nothing */ +#else +/* compatibility code for old GLib */ +GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz) +{ + GTimeVal time; + if (g_time_val_from_iso8601(iso_date, &time)) { + return g_date_time_new_from_timeval_utc(&time); + } else { + return NULL; + } +} +#endif int find_substr(const char *list, const char *item) { diff --git a/src/core/misc.h b/src/core/misc.h index 76f5644bb..622470f78 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -19,6 +19,13 @@ int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATED; long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATED; #pragma GCC diagnostic pop +#if GLIB_CHECK_VERSION(2, 56, 0) +/* nothing */ +#else +/* compatibility code for old GLib */ +GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz); +#endif + GSList *i_slist_find_string(GSList *list, const char *key); GSList *i_slist_find_icase_string(GSList *list, const char *key); GList *i_list_find_string(GList *list, const char *key); diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 5b15313f7..20abc0dfb 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -1,6 +1,7 @@ #include "module.h" #include #include +#include #include #include #include @@ -18,21 +19,6 @@ gboolean scrollback_format; gboolean show_server_time; int signal_gui_render_line_text; -#if GLIB_CHECK_VERSION(2, 56, 0) -/* nothing */ -#else -/* compatibility code for old GLib */ -static GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz) -{ - GTimeVal time; - if (g_time_val_from_iso8601(iso_date, &time)) { - return g_date_time_new_from_timeval_utc(&time); - } else { - return NULL; - } -} -#endif - static void collector_free(GSList **collector) { while (*collector) { From b3f74fe0ab1fd8dc145dab662e74eeaaeeb6fffe Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 15 Aug 2021 15:58:10 +0200 Subject: [PATCH 022/392] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index cc334476c..a89b4964b 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 38 +#define IRSSI_ABI_VERSION 39 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From a07a4c1ea886e35a17847ff004495e2f18b8b489 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 20:27:35 +0200 Subject: [PATCH 023/392] use an internal build of openssl when fuzzer is enabled --- meson.build | 7 ++++++- subprojects/openssl.wrap | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 subprojects/openssl.wrap diff --git a/meson.build b/meson.build index 1a5182af1..fe5aa99f6 100644 --- a/meson.build +++ b/meson.build @@ -273,7 +273,12 @@ endif dep += glib_dep dep += gmodule_dep -openssl_dep = dependency('openssl', static : want_static_dependency) +if glib_internal and want_static_dependency and want_fuzzer + openssl_proj = subproject('openssl', default_options : ['default_library=static', 'asm=disabled']) + openssl_dep = openssl_proj.get_variable('openssl_dep') +else + openssl_dep = dependency('openssl', static : want_static_dependency) +endif dep += openssl_dep ############ diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap new file mode 100644 index 000000000..4aaaba38d --- /dev/null +++ b/subprojects/openssl.wrap @@ -0,0 +1,14 @@ +[wrap-file] +directory = openssl-1.1.1l +source_url = https://www.openssl.org/source/openssl-1.1.1l.tar.gz +source_filename = openssl-1.1.1l.tar.gz +source_hash = 0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1 +patch_filename = openssl_1.1.1l-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_1.1.1l-1/get_patch +patch_hash = 670db31580039e06c17f48bcd31e489f453fe72c22006de6d693b9b033f1003a + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep + From 49903f41854114aec37a74a907135e17931b43c8 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 21:59:38 +0200 Subject: [PATCH 024/392] mess with server ports --- src/core/servers-setup.c | 31 ++++++++++++++------- src/core/servers-setup.h | 1 + src/fe-common/core/fe-server.c | 51 +++++++++++++++++++++++----------- 3 files changed, 57 insertions(+), 26 deletions(-) diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 357e8ebe2..fd719c38f 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -457,7 +457,7 @@ static SERVER_SETUP_REC *server_setup_read(CONFIG_NODE *node) port = config_node_get_int(node, "port", 0); chatnet = config_node_get_str(node, "chatnet", NULL); - if (server_setup_find(server, port, chatnet) != NULL) { + if ((rec = server_setup_find(server, port, chatnet)) != NULL && rec->port == port) { return NULL; } @@ -548,7 +548,7 @@ static int compare_server_setup (CONFIG_NODE *node, SERVER_SETUP_REC *server) return -1; address = config_node_get_str(node, "address", NULL); - chatnet = config_node_get_str(node, "chatnet", NULL); + chatnet = config_node_get_str(node, "chatnet", ""); port = config_node_get_int(node, "port", 0); if (address == NULL || chatnet == NULL) { @@ -556,7 +556,7 @@ static int compare_server_setup (CONFIG_NODE *node, SERVER_SETUP_REC *server) } if (g_ascii_strcasecmp(address, server->address) != 0 || - g_ascii_strcasecmp(chatnet, server->chatnet) != 0 || + g_ascii_strcasecmp(chatnet, server->chatnet != NULL ? server->chatnet : "") != 0 || port != server->port) { return 1; } @@ -564,16 +564,20 @@ static int compare_server_setup (CONFIG_NODE *node, SERVER_SETUP_REC *server) return 0; } -static void server_setup_save(SERVER_SETUP_REC *rec) +static void server_setup_save(SERVER_SETUP_REC *rec, int old_port, const char *old_chatnet) { CONFIG_NODE *parent_node, *node; + SERVER_SETUP_REC search_rec = { 0 }; GSList *config_node; parent_node = iconfig_node_traverse("(servers", TRUE); /* Try to find this channel in the configuration */ - config_node = g_slist_find_custom(parent_node->value, rec, - (GCompareFunc)compare_server_setup); + search_rec.address = rec->address; + search_rec.chatnet = old_chatnet != NULL ? (char *) old_chatnet : rec->chatnet; + search_rec.port = old_port; + config_node = g_slist_find_custom(parent_node->value, &search_rec, + (GCompareFunc) compare_server_setup); if (config_node != NULL) /* Let's update this server record */ node = config_node->data; @@ -654,16 +658,23 @@ static void server_setup_destroy(SERVER_SETUP_REC *rec) g_free(rec); } -void server_setup_add(SERVER_SETUP_REC *rec) +void server_setup_modify(SERVER_SETUP_REC *rec, int old_port, const char *old_chatnet) { + g_return_if_fail(g_slist_find(setupservers, rec) != NULL); + rec->type = module_get_uniq_id("SERVER SETUP", 0); - if (g_slist_find(setupservers, rec) == NULL) - setupservers = g_slist_append(setupservers, rec); - server_setup_save(rec); + server_setup_save(rec, old_port, old_chatnet); signal_emit("server setup updated", 1, rec); } +void server_setup_add(SERVER_SETUP_REC *rec) +{ + if (g_slist_find(setupservers, rec) == NULL) + setupservers = g_slist_append(setupservers, rec); + server_setup_modify(rec, -1, NULL); +} + void server_setup_remove_chatnet(const char *chatnet) { GSList *tmp, *next; diff --git a/src/core/servers-setup.h b/src/core/servers-setup.h index f35c3873c..742ed4dd9 100644 --- a/src/core/servers-setup.h +++ b/src/core/servers-setup.h @@ -41,6 +41,7 @@ SERVER_SETUP_REC *server_setup_find(const char *address, int port, const char *chatnet); void server_setup_add(SERVER_SETUP_REC *rec); +void server_setup_modify(SERVER_SETUP_REC *rec, int old_port, const char *old_chatnet); void server_setup_remove(SERVER_SETUP_REC *rec); /* Remove servers attached to chatne */ diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 468ac4e79..de45f8e9e 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -110,11 +110,11 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist) static void cmd_server_add_modify(const char *data, gboolean add) { GHashTable *optlist; - SERVER_SETUP_REC *rec; - char *addr, *portstr, *password, *value, *chatnet; + SERVER_SETUP_REC *rec, *tmp; + char *addr, *portstr, *password, *value, *chatnet, *old_chatnet; void *free_arg; gboolean newrec; - int port; + int port, old_port, add_port; if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS, "server add", &optlist, &addr, &portstr, &password)) @@ -122,27 +122,39 @@ static void cmd_server_add_modify(const char *data, gboolean add) if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - value = g_hash_table_lookup(optlist, "port"); + port = old_port = -1; if (*portstr != '\0') - port = atoi(portstr); - else if (value != NULL && *value != '\0') - port = atoi(value); + port = add_port = atoi(portstr); else if (g_hash_table_lookup(optlist, "tls") || g_hash_table_lookup(optlist, "ssl")) - port = DEFAULT_SERVER_ADD_TLS_PORT; + add_port = DEFAULT_SERVER_ADD_TLS_PORT; else - port = DEFAULT_SERVER_ADD_PORT; + add_port = DEFAULT_SERVER_ADD_PORT; + + value = g_hash_table_lookup(optlist, "port"); + if (value != NULL && *value != '\0') + old_port = atoi(value); chatnet = g_hash_table_lookup(optlist, "network"); - rec = server_setup_find(addr, port, chatnet); + rec = server_setup_find(addr, old_port != -1 ? old_port : add_port, chatnet); + if (old_port == -1 && rec != NULL) + old_port = rec->port; + + if (port == -1) + port = old_port != -1 ? old_port : add_port; - if (rec == NULL) { + /* make sure the new port doesn't exist */ + tmp = server_setup_find(addr, port, chatnet); + if (tmp != NULL && tmp->port == port) + rec = tmp; + + if (rec == NULL || (rec->port != old_port && rec->port != port)) { newrec = TRUE; if (add == FALSE) { - printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, - TXT_SETUPSERVER_NOT_FOUND, addr, port); + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_NOT_FOUND, + addr, old_port == -1 ? port : old_port); cmd_params_free(free_arg); return; } @@ -156,8 +168,9 @@ static void cmd_server_add_modify(const char *data, gboolean add) rec->port = port; } else { newrec = FALSE; - if (*portstr != '\0' || g_hash_table_lookup(optlist, "port")) - rec->port = port; + old_chatnet = g_strdup(rec->chatnet); + old_port = rec->port; + rec->port = port; if (*password != '\0') g_free_and_null(rec->password); if (g_hash_table_lookup(optlist, "host")) { @@ -261,7 +274,13 @@ static void cmd_server_add_modify(const char *data, gboolean add) signal_emit("server add fill", 3, rec, optlist, GINT_TO_POINTER(add)); - server_setup_add(rec); + if (newrec) { + server_setup_add(rec); + } else { + server_setup_modify(rec, old_port, old_chatnet); + g_free(old_chatnet); + } + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_ADDED, addr, port); From c4fd417ccef8f2af6b3efbc4afa72997949a79c9 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 31 Aug 2021 11:09:42 +0200 Subject: [PATCH 025/392] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index a89b4964b..245f22234 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 39 +#define IRSSI_ABI_VERSION 40 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 4b506fc45c518619f968377b925492a96c7041d5 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 31 Aug 2021 14:49:56 +0200 Subject: [PATCH 026/392] remove duplicated servers on load --- src/core/servers-setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index fd719c38f..59ca69974 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -458,7 +458,8 @@ static SERVER_SETUP_REC *server_setup_read(CONFIG_NODE *node) chatnet = config_node_get_str(node, "chatnet", NULL); if ((rec = server_setup_find(server, port, chatnet)) != NULL && rec->port == port) { - return NULL; + /* duplicate server setup */ + server_setup_remove(rec); } rec = NULL; From 63a5b80ba7c1df88544ee10fa66ca6202d7ed077 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 20:36:24 +0200 Subject: [PATCH 027/392] only enable sasl plain when username and password are set may fix #1325 --- src/irc/core/irc-servers-setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index 5299ef042..e0982550c 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -121,9 +121,9 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn, if (ircnet->sasl_mechanism != NULL) { if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "plain")) { /* The PLAIN method needs both the username and the password */ - conn->sasl_mechanism = SASL_MECHANISM_PLAIN; if (ircnet->sasl_username != NULL && *ircnet->sasl_username && ircnet->sasl_password != NULL && *ircnet->sasl_password) { + conn->sasl_mechanism = SASL_MECHANISM_PLAIN; conn->sasl_username = g_strdup(ircnet->sasl_username); conn->sasl_password = g_strdup(ircnet->sasl_password); } else From 6710b357369e561138b2ee18da6acca1be3f97ed Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 19:31:56 +0200 Subject: [PATCH 028/392] fix reading of starttls = "no" in config --- src/irc/core/irc-servers-setup.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/irc/core/irc-servers-setup.h b/src/irc/core/irc-servers-setup.h index 7b11a2fe3..d55507d89 100644 --- a/src/irc/core/irc-servers-setup.h +++ b/src/irc/core/irc-servers-setup.h @@ -12,8 +12,8 @@ (IRC_SERVER_SETUP(server) ? TRUE : FALSE) enum { - STARTTLS_DISALLOW = -1, /* */ - STARTTLS_NOTSET = 0, + STARTTLS_NOTSET = -1, /* */ + STARTTLS_DISALLOW = 0, STARTTLS_ENABLED = 1 }; From 92ade2f591475f310e83b4557012aa5480449fcb Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 19:40:41 +0200 Subject: [PATCH 029/392] fuzz server ssl init --- src/fe-fuzz/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fe-fuzz/server.c b/src/fe-fuzz/server.c index 83ce7bfaa..b74a29b95 100644 --- a/src/fe-fuzz/server.c +++ b/src/fe-fuzz/server.c @@ -152,6 +152,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) { args_execute(0, NULL); core_preinit((*argv)[0]); core_init(); + irssi_ssl_init(); irc_init(); fe_common_core_init(); fe_common_irc_init(); From e10e1c2da73a4af4ffc9acb3dd91b65feb93e6c7 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 18:43:50 +0200 Subject: [PATCH 030/392] fix reading of old config ssl_verify key --- src/core/servers-setup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 357e8ebe2..0664aa383 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -484,8 +484,9 @@ static SERVER_SETUP_REC *server_setup_read(CONFIG_NODE *node) rec->password = g_strdup(config_node_get_str(node, "password", NULL)); rec->use_tls = config_node_get_bool(node, "use_tls", FALSE) || config_node_get_bool(node, "use_ssl", FALSE); - rec->tls_verify = config_node_get_bool(node, "tls_verify", TRUE) || - config_node_get_bool(node, "ssl_verify", FALSE); + rec->tls_verify = config_node_find(node, "tls_verify") != NULL ? + config_node_get_bool(node, "tls_verify", TRUE) : + config_node_get_bool(node, "ssl_verify", TRUE); value = config_node_get_str(node, "tls_cert", NULL); if (value == NULL) From 215cf08828d14e5e307e0f334e51f7ac41e83329 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 30 Aug 2021 19:40:41 +0200 Subject: [PATCH 031/392] fuzz server ssl init --- src/fe-fuzz/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fe-fuzz/server.c b/src/fe-fuzz/server.c index 83ce7bfaa..b74a29b95 100644 --- a/src/fe-fuzz/server.c +++ b/src/fe-fuzz/server.c @@ -152,6 +152,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) { args_execute(0, NULL); core_preinit((*argv)[0]); core_init(); + irssi_ssl_init(); irc_init(); fe_common_core_init(); fe_common_irc_init(); From 21701a1299cd6b64db5b2fb3765f578ff1f9fc6b Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 31 Aug 2021 17:29:43 +0200 Subject: [PATCH 032/392] do not unconditionally enable tls on /connect -! --- src/core/servers-setup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index b1f57a999..82e5f6be8 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -191,8 +191,10 @@ static void server_setup_fill_optlist(SERVER_CONNECT_REC *conn, GHashTable *optl /* ad-hoc TLS settings from command optlist */ if ((tmp = g_hash_table_lookup(optlist, "tls_cert")) != NULL || - (tmp = g_hash_table_lookup(optlist, "ssl_cert")) != NULL) + (tmp = g_hash_table_lookup(optlist, "ssl_cert")) != NULL) { conn->tls_cert = g_strdup(tmp); + conn->use_tls = TRUE; + } if ((tmp = g_hash_table_lookup(optlist, "tls_pkey")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_pkey")) != NULL) conn->tls_pkey = g_strdup(tmp); @@ -220,10 +222,10 @@ static void server_setup_fill_optlist(SERVER_CONNECT_REC *conn, GHashTable *optl if (g_hash_table_lookup(optlist, "notls_verify") != NULL) conn->tls_verify = FALSE; if (g_hash_table_lookup(optlist, "tls_verify") != NULL || - g_hash_table_lookup(optlist, "ssl_verify") != NULL) + g_hash_table_lookup(optlist, "ssl_verify") != NULL) { conn->tls_verify = TRUE; - if ((conn->tls_cert != NULL && conn->tls_cert[0] != '\0') || conn->tls_verify) conn->use_tls = TRUE; + } if (g_hash_table_lookup(optlist, "notls") != NULL) conn->use_tls = FALSE; if (g_hash_table_lookup(optlist, "tls") != NULL || From 6c47fcf10d5a4b7718a3351ea0571da4d9f3c536 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 31 Aug 2021 21:49:29 +0200 Subject: [PATCH 033/392] Revert "Merge pull request #19 from ailin-nemui/starttls-no" This reverts commit 3324c5da89c694ce5bbd20ecb313da870d1bb914, reversing changes made to d3115f38550f26b935d4e22201d09287ce44e5ac. --- src/irc/core/irc-servers-setup.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/irc/core/irc-servers-setup.h b/src/irc/core/irc-servers-setup.h index d55507d89..7b11a2fe3 100644 --- a/src/irc/core/irc-servers-setup.h +++ b/src/irc/core/irc-servers-setup.h @@ -12,8 +12,8 @@ (IRC_SERVER_SETUP(server) ? TRUE : FALSE) enum { - STARTTLS_NOTSET = -1, /* */ - STARTTLS_DISALLOW = 0, + STARTTLS_DISALLOW = -1, /* */ + STARTTLS_NOTSET = 0, STARTTLS_ENABLED = 1 }; From 1a6d74ac2645cf4f1c980604894f60dbf29a2d95 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 31 Aug 2021 21:54:41 +0200 Subject: [PATCH 034/392] fix reading of starttls = "no" in config, attempt 2 --- src/irc/core/irc-servers-setup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index 5299ef042..2cc809461 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -188,6 +188,7 @@ static void init_userinfo(void) static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node) { + int starttls; g_return_if_fail(rec != NULL); g_return_if_fail(node != NULL); @@ -197,7 +198,10 @@ static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node) rec->max_cmds_at_once = config_node_get_int(node, "cmds_max_at_once", 0); rec->cmd_queue_speed = config_node_get_int(node, "cmd_queue_speed", 0); rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0); - rec->starttls = config_node_get_bool(node, "starttls", STARTTLS_NOTSET); + starttls = config_node_get_bool(node, "starttls", -1); + rec->starttls = starttls == -1 ? STARTTLS_NOTSET : + starttls == 0 ? STARTTLS_DISALLOW : + STARTTLS_ENABLED; if (rec->starttls == STARTTLS_ENABLED) { rec->use_tls = 0; } From 939b773b8bea76dcf4ab33bb53d9899c84c218fb Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 13:37:07 +0200 Subject: [PATCH 035/392] Revert "Changed the support channel to LiberaChat." This reverts commit a5d4fd5aa7ad1d57c0b8e11e382944a3654cfa00. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1232764c..d229391af 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,4 @@ Irssi is always looking for developers. Feel free to submit patches through GitHub pull requests. You can also contact the Irssi developers in -[#irssi](https://irssi.org/support/irc/) on irc.libera.chat. +[#irssi](https://irssi.org/support/irc/) on irc.example.com. From 1a30e646d9a450b19582bdf306d7aad66730a632 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 13:37:17 +0200 Subject: [PATCH 036/392] Revert "Applied the updated docs changes in line with the upcoming blog post." This reverts commit 1773fa8d191c9f1dcc7c1e59dbcdf31c1263c918. --- README.md | 2 +- docs/help/in/admin.in | 2 +- docs/help/in/channel.in | 8 +++--- docs/help/in/connect.in | 6 ++--- docs/help/in/disconnect.in | 2 +- docs/help/in/info.in | 2 +- docs/help/in/join.in | 2 +- docs/help/in/knock.in | 2 +- docs/help/in/log.in | 8 +++--- docs/help/in/motd.in | 2 +- docs/help/in/names.in | 2 +- docs/help/in/nctcp.in | 2 +- docs/help/in/network.in | 6 ++--- docs/help/in/part.in | 2 +- docs/help/in/query.in | 4 +-- docs/help/in/recode.in | 2 +- docs/help/in/reconnect.in | 2 +- docs/help/in/server.in | 16 +++++------ docs/manual.txt | 2 +- docs/proxy.txt | 2 +- docs/startup-HOWTO.html | 4 +-- docs/startup-HOWTO.txt | 4 +-- irssi.conf | 54 ++++++++++++++++---------------------- 23 files changed, 65 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index d229391af..08be65b4e 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,4 @@ Irssi is always looking for developers. Feel free to submit patches through GitHub pull requests. You can also contact the Irssi developers in -[#irssi](https://irssi.org/support/irc/) on irc.example.com. +[#irssi](https://irssi.org/support/irc/) on freenode. diff --git a/docs/help/in/admin.in b/docs/help/in/admin.in index cfe66eba9..2b6f8b736 100644 --- a/docs/help/in/admin.in +++ b/docs/help/in/admin.in @@ -15,7 +15,7 @@ %9Examples:%9 /ADMIN - /ADMIN irc.example.com + /ADMIN orwell.freenode.net /ADMIN mike %9See also:%9 INFO diff --git a/docs/help/in/channel.in b/docs/help/in/channel.in index 0e15b6d50..86e824c20 100644 --- a/docs/help/in/channel.in +++ b/docs/help/in/channel.in @@ -33,12 +33,12 @@ /CHANNEL /CHANNEL LIST - /CHANNEL ADD -auto #irssi ExampleNet + /CHANNEL ADD -auto #irssi Freenode /CHANNEL ADD -auto #basementcat Quakenet secret_lair - /CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout ExampleNet + /CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout Freenode /CHANNEL ADD -auto -bots 'Q!TheQBot@CServe.quakenet.org' -botcmd '^MSG Q op #irssi' #irssi Quakenet - /CHANNEL MODIFY -noauto #irssi ExampleNet - /CHANNEL REMOVE #hideout ExampleNet + /CHANNEL MODIFY -noauto #irssi Freenode + /CHANNEL REMOVE #hideout Freenode %9Special Example:%9 diff --git a/docs/help/in/connect.in b/docs/help/in/connect.in index 4d59dde13..e861ad747 100644 --- a/docs/help/in/connect.in +++ b/docs/help/in/connect.in @@ -34,9 +34,9 @@ %9Examples:%9 - /CONNECT ExampleNet - /CONNECT -6 ExampleNet - /CONNECT -4 -! -host staff.irssi.org -network ExampleNet irc.example.com + /CONNECT Freenode + /CONNECT -6 Freenode + /CONNECT -4 -! -host staff.irssi.org -network Freenode orwell.freenode.net /CONNECT irc.irssi.org 6667 WzerT8zq mike %9See also:%9 DISCONNECT, RMRECONNS, SERVER diff --git a/docs/help/in/disconnect.in b/docs/help/in/disconnect.in index 88772e1e1..bd4a4e17b 100644 --- a/docs/help/in/disconnect.in +++ b/docs/help/in/disconnect.in @@ -18,7 +18,7 @@ %9Examples:%9 - /DISCONNECT ExampleNet I'm off for today, take care! + /DISCONNECT Freenode I'm off for today, take care! /DISCONNECT * Vacation time :D /DISCONNECT diff --git a/docs/help/in/info.in b/docs/help/in/info.in index 415785016..275f349d1 100644 --- a/docs/help/in/info.in +++ b/docs/help/in/info.in @@ -15,7 +15,7 @@ %9Examples:%9 /INFO - /INFO irc.example.com + /INFO orwell.freenode.net %9See also:%9 ADMIN diff --git a/docs/help/in/join.in b/docs/help/in/join.in index 55190267d..39fa23f8f 100644 --- a/docs/help/in/join.in +++ b/docs/help/in/join.in @@ -20,7 +20,7 @@ /JOIN #irssi /JOIN #basementcat secret_lair /JOIN -invite - /JOIN -ExampleNet #github,#example,#irssi + /JOIN -freenode #github,#freenode,#irssi %9See also:%9 KICK, PART diff --git a/docs/help/in/knock.in b/docs/help/in/knock.in index 3e2fdbdb4..bb554d559 100644 --- a/docs/help/in/knock.in +++ b/docs/help/in/knock.in @@ -23,7 +23,7 @@ %9Examples:%9 /KNOCK #irssi - /KNOCK #example + /KNOCK #freenode /KNOCK #github %9See also:%9 INVITE, JOIN diff --git a/docs/help/in/log.in b/docs/help/in/log.in index dfe26e30e..e4743d46a 100644 --- a/docs/help/in/log.in +++ b/docs/help/in/log.in @@ -33,10 +33,10 @@ %9Examples:%9 /LOG OPEN -targets mike ~/irclogs/mike.log MSGS - /LOG OPEN -targets #irssi ~/irclogs/ExampleNet/irssi-%%Y-%%m-%%d - /LOG CLOSE ~/irclogs/ExampleNet/irssi-%%Y-%%m-%%d - /LOG STOP ~/irclogs/ExampleNet/irssi-%%Y-%%m-%%d - /LOG START ~/irclogs/ExampleNet/irssi-%%Y-%%m-%%d + /LOG OPEN -targets #irssi-freenode ~/irclogs/freenode/irssi-%%Y-%%m-%%d + /LOG CLOSE ~/irclogs/freenode/irssi-%%Y-%%m-%%d + /LOG STOP ~/irclogs/freenode/irssi-%%Y-%%m-%%d + /LOG START ~/irclogs/freenode/irssi-%%Y-%%m-%%d /SET autolog ON diff --git a/docs/help/in/motd.in b/docs/help/in/motd.in index ee1233b2f..e33a1c75a 100644 --- a/docs/help/in/motd.in +++ b/docs/help/in/motd.in @@ -15,7 +15,7 @@ %9Examples:%9 /MOTD - /MOTD irc.example.com + /MOTD orwel.freenode.org /MOTD bob %9See also:%9 ADMIN, INFO, LINKS, MAP diff --git a/docs/help/in/names.in b/docs/help/in/names.in index deccea403..8fd8cf912 100644 --- a/docs/help/in/names.in +++ b/docs/help/in/names.in @@ -21,7 +21,7 @@ %9Examples:%9 /NAMES -ops - /NAMES -voices #irssi,#example + /NAMES -voices #irssi,#freenode %9See also:%9 JOIN, PART, WHO, WHOIS diff --git a/docs/help/in/nctcp.in b/docs/help/in/nctcp.in index 68d789d60..93c3f3ec4 100644 --- a/docs/help/in/nctcp.in +++ b/docs/help/in/nctcp.in @@ -15,7 +15,7 @@ %9Examples:%9 /NCTCP #irssi VERSION King of the Jungle v1.0 - /NCTCP bob,#example USERINFO I am bob :p + /NCTCP bob,#freenode USERINFO I am bob :p %9See also:%9 CTCP diff --git a/docs/help/in/network.in b/docs/help/in/network.in index 183fd5b5c..fbdaa0b41 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -59,11 +59,11 @@ %9Examples:%9 /NETWORK ADD -usermode +giw EFnet - /NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org ExampleNet - /NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' ExampleNet + /NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org Freenode + /NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' Freenode /NETWORK ADD -autosendcmd '^MSG Q@CServe.quakenet.org AUTH mike WzerT8zq; WAIT 2000; OPER mike WzerT8zq; WAIT 2000; MODE mike +kXP' Quakenet /NETWORK MODIFY -usermode +gi EFnet - /NETWORK REMOVE ExampleNet + /NETWORK REMOVE Freenode %9See also:%9 CHANNEL, CONNECT, SERVER diff --git a/docs/help/in/part.in b/docs/help/in/part.in index 51be59bd0..e96abfbbe 100644 --- a/docs/help/in/part.in +++ b/docs/help/in/part.in @@ -14,7 +14,7 @@ %9Examples:%9 /PART #irssi - /PART #example,#irssi + /PART #freenode,#irssi %9See also:%9 JOIN, KICK diff --git a/docs/help/in/query.in b/docs/help/in/query.in index 85f2556ef..1c0ba5b97 100644 --- a/docs/help/in/query.in +++ b/docs/help/in/query.in @@ -17,8 +17,8 @@ %9Examples:%9 /QUERY mike - /QUERY -ExampleNet bob - /QUERY -ExampleNet -window sarah + /QUERY -freenode bob + /QUERY -freenode -window sarah %9See also:%9 MSG, UNQUERY, WINDOW diff --git a/docs/help/in/recode.in b/docs/help/in/recode.in index c34822de9..63f52339f 100644 --- a/docs/help/in/recode.in +++ b/docs/help/in/recode.in @@ -22,7 +22,7 @@ %9Examples:%9 /RECODE - /RECODE ADD ExampleNet/mike utf-8 + /RECODE ADD Freenode/mike utf-8 /RECODE ADD #korea euc-kr /RECODE REMOVE #korea diff --git a/docs/help/in/reconnect.in b/docs/help/in/reconnect.in index f2148c90d..aa1dc9465 100644 --- a/docs/help/in/reconnect.in +++ b/docs/help/in/reconnect.in @@ -15,7 +15,7 @@ %9Examples:%9 /RECONNECT - /RECONNECT ExampleNet + /RECONNECT Freenode /RECONNECT EFnet BRB :) %9See also:%9 CONNECT, DISCONNECT, NETWORK, RMRECONNS, SERVER diff --git a/docs/help/in/server.in b/docs/help/in/server.in index 8a4d8887a..beb751147 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -61,15 +61,15 @@ %9Examples:%9 /SERVER - /SERVER CONNECT irc.example.com - /SERVER CONNECT +irc.example.com - /SERVER ADD -network ExampleNet -noautosendcmd irc.example.com - /SERVER ADD -! -auto -host staff.irssi.org -4 -network ExampleNet -noproxy irc.example.com 6667 - /SERVER MODIFY -network ExampleNet -noauto irc.example.com - /SERVER MODIFY -network ExampleNet irc.example.com 6697 - - /SERVER REMOVE irc.example.com 6667 ExampleNet + /SERVER CONNECT chat.freenode.net + /SERVER CONNECT +chat.freenode.net + /SERVER ADD -network Freenode -noautosendcmd orwell.freenode.net + /SERVER ADD -! -auto -host staff.irssi.org -4 -network Freenode -noproxy orwell.freenode.net 6667 + /SERVER MODIFY -network Freenode -noauto orwell.freenode.net + /SERVER MODIFY -network Freenode orwell.freenode.net 6697 - + /SERVER REMOVE orwell.freenode.net 6667 Freenode /SERVER PURGE - /SERVER PURGE irc.example.com + /SERVER PURGE orwell.freenode.net %9See also:%9 CHANNEL, CONNECT, DISCONNECT, NETWORK, RECONNECT, RMRECONNS diff --git a/docs/manual.txt b/docs/manual.txt index 29065febb..0f24ffe38 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -349,7 +349,7 @@ after connecting to the network. This is useful for automatically identifying yourself to NickServ, for example - /NETWORK ADD -autosendcmd "/^msg NickServ identify secret" ExampleNet + /NETWORK ADD -autosendcmd "/^msg NickServ identify secret" freenode /NETWORK REMOVE diff --git a/docs/proxy.txt b/docs/proxy.txt index 9ed7ecdba..224d24e31 100644 --- a/docs/proxy.txt +++ b/docs/proxy.txt @@ -24,7 +24,7 @@ You really should set some password for the proxy with: Then you'll need to configure the ports/ircnets the proxy listens in, something like: - /SET irssiproxy_ports IRCnet=2777 EFNet=2778 ExampleNet=2779 + /SET irssiproxy_ports ircnet=2777 efnet=2778 freenode=2779 There we have 3 different irc networks answering in 3 ports. Note that you'll have to make the correct /IRCNET ADD and /SERVER ADD commands to diff --git a/docs/startup-HOWTO.html b/docs/startup-HOWTO.html index ecbeb4672..48f6e6dfd 100644 --- a/docs/startup-HOWTO.html +++ b/docs/startup-HOWTO.html @@ -68,7 +68,7 @@

1. First steps

And to connect to one of those networks and join a channel:

-
/CONNECT ExampleNet
+
/CONNECT Freenode
 /JOIN #irssi
 
@@ -94,7 +94,7 @@

1. First steps

If you have irssi 0.8.18 or higher and the irc network supports it, you can use SASL instead of nickserv, which is more reliable:

-
/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN ExampleNet
+
/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN Freenode
 

These commands have many more options, see their help for details:

diff --git a/docs/startup-HOWTO.txt b/docs/startup-HOWTO.txt index 84397f334..61de27e34 100644 --- a/docs/startup-HOWTO.txt +++ b/docs/startup-HOWTO.txt @@ -43,7 +43,7 @@ has a few predefined networks, to list them: And to connect to one of those networks and join a channel: -/CONNECT LiberaChat +/CONNECT Freenode /JOIN #irssi To add more networks: @@ -67,7 +67,7 @@ wait for 2 seconds before joining channels: If you have irssi 0.8.18 or higher and the irc network supports it, you can use SASL instead of nickserv, which is more reliable: -/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN ExampleNet +/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN Freenode These commands have many more options, see their help for details: diff --git a/irssi.conf b/irssi.conf index 9faa89733..edaeb3f56 100644 --- a/irssi.conf +++ b/irssi.conf @@ -1,19 +1,18 @@ servers = ( - { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, - { address = "ssl.efnet.org"; chatnet = "EFNet"; port = "9999"; use_tls = "yes"; tls_verify = "no"; }, - { address = "irc.esper.net"; chatnet = "EsperNet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "chat.freenode.net"; chatnet = "Freenode"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "irc.gamesurge.net"; chatnet = "GameSurge"; port = "6667"; }, - { address = "ssl.ircnet.ovh"; chatnet = "IRCnet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; }, - { address = "irc.ircsource.net"; chatnet = "IRCSource"; port = "6667"; }, - { address = "irc.libera.chat"; chatnet = "LiberaChat"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "irc.netfuze.net"; chatnet = "NetFuze"; port = "6667"; }, - { address = "irc.oftc.net"; chatnet = "OFTC"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "irc.quakenet.org"; chatnet = "QuakeNet"; port = "6667"; }, - { address = "irc.rizon.net"; chatnet = "Rizon"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "silc.silcnet.org"; chatnet = "SILC"; port = "706"; }, - { address = "irc.undernet.org"; chatnet = "Undernet"; port = "6667"; } + { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, + { address = "ssl.efnet.org"; chatnet = "EFNet"; port = "9999"; use_tls = "yes"; tls_verify = "no"; }, + { address = "irc.esper.net"; chatnet = "EsperNet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, + { address = "chat.freenode.net"; chatnet = "Freenode"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, + { address = "irc.gamesurge.net"; chatnet = "GameSurge"; port = "6667"; }, + { address = "ssl.ircnet.ovh"; chatnet = "IRCnet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, + { address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; }, + { address = "irc.ircsource.net"; chatnet = "IRCSource"; port = "6667"; }, + { address = "irc.netfuze.net"; chatnet = "NetFuze"; port = "6667"; }, + { address = "irc.oftc.net"; chatnet = "OFTC"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, + { address = "irc.quakenet.org"; chatnet = "QuakeNet"; port = "6667"; }, + { address = "irc.rizon.net"; chatnet = "Rizon"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, + { address = "silc.silcnet.org"; chatnet = "SILC"; port = "706"; }, + { address = "irc.undernet.org"; chatnet = "Undernet"; port = "6667"; } ); chatnets = { @@ -59,12 +58,6 @@ chatnets = { max_msgs = "4"; max_whois = "1"; }; - LiberaChat = { - type = "IRC"; - max_kicks = "1"; - max_msgs = "4"; - max_whois = "1"; - }; NetFuze = { type = "IRC"; max_kicks = "1"; @@ -101,16 +94,15 @@ chatnets = { }; channels = ( - { name = "#lobby"; chatnet = "EsperNet"; autojoin = "No"; }, - { name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; }, - { name = "#gamesurge"; chatnet = "GameSurge"; autojoin = "No"; }, - { name = "#irssi"; chatnet = "IRCNet"; autojoin = "No"; }, - { name = "#ircsource"; chatnet = "IRCSource"; autojoin = "No"; }, - { name = "#libera"; chatnet = "LiberaChat"; autojoin = "No"; }, - { name = "#irssi"; chatnet = "LiberaChat"; autojoin = "No"; }, - { name = "#netfuze"; chatnet = "NetFuze"; autojoin = "No"; }, - { name = "#oftc"; chatnet = "OFTC"; autojoin = "No"; }, - { name = "silc"; chatnet = "SILC"; autojoin = "No"; } + { name = "#lobby"; chatnet = "EsperNet"; autojoin = "No"; }, + { name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; }, + { name = "#irssi"; chatnet = "Freenode"; autojoin = "No"; }, + { name = "#gamesurge"; chatnet = "GameSurge"; autojoin = "No"; }, + { name = "#irssi"; chatnet = "IRCNet"; autojoin = "No"; }, + { name = "#ircsource"; chatnet = "IRCSource"; autojoin = "No"; }, + { name = "#netfuze"; chatnet = "NetFuze"; autojoin = "No"; }, + { name = "#oftc"; chatnet = "OFTC"; autojoin = "No"; }, + { name = "silc"; chatnet = "SILC"; autojoin = "No"; } ); aliases = { From 82d2cd88e78b4bffe0c710dd940d1771506eced6 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 13:37:37 +0200 Subject: [PATCH 037/392] Revert "Irssi does not take a political stance." This reverts commit a4486c236a3bf15192d0500b3a1892f7465826c7. --- README.md | 2 +- docs/help/in/admin.in | 2 +- docs/help/in/channel.in | 8 ++++---- docs/help/in/connect.in | 6 +++--- docs/help/in/disconnect.in | 2 +- docs/help/in/info.in | 2 +- docs/help/in/join.in | 2 +- docs/help/in/knock.in | 2 +- docs/help/in/log.in | 8 ++++---- docs/help/in/motd.in | 2 +- docs/help/in/names.in | 2 +- docs/help/in/nctcp.in | 2 +- docs/help/in/network.in | 6 +++--- docs/help/in/part.in | 2 +- docs/help/in/query.in | 4 ++-- docs/help/in/recode.in | 2 +- docs/help/in/reconnect.in | 2 +- docs/help/in/server.in | 16 ++++++++-------- docs/manual.txt | 2 +- docs/proxy.txt | 2 +- docs/startup-HOWTO.html | 4 ++-- docs/startup-HOWTO.txt | 4 ++-- irssi.conf | 8 ++++---- 23 files changed, 46 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 08be65b4e..d1232764c 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,4 @@ Irssi is always looking for developers. Feel free to submit patches through GitHub pull requests. You can also contact the Irssi developers in -[#irssi](https://irssi.org/support/irc/) on freenode. +[#irssi](https://irssi.org/support/irc/) on irc.libera.chat. diff --git a/docs/help/in/admin.in b/docs/help/in/admin.in index 2b6f8b736..acb6e1ae4 100644 --- a/docs/help/in/admin.in +++ b/docs/help/in/admin.in @@ -15,7 +15,7 @@ %9Examples:%9 /ADMIN - /ADMIN orwell.freenode.net + /ADMIN irc.libera.chat /ADMIN mike %9See also:%9 INFO diff --git a/docs/help/in/channel.in b/docs/help/in/channel.in index 86e824c20..d9be8cf5f 100644 --- a/docs/help/in/channel.in +++ b/docs/help/in/channel.in @@ -33,12 +33,12 @@ /CHANNEL /CHANNEL LIST - /CHANNEL ADD -auto #irssi Freenode + /CHANNEL ADD -auto #irssi liberachat /CHANNEL ADD -auto #basementcat Quakenet secret_lair - /CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout Freenode + /CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout liberachat /CHANNEL ADD -auto -bots 'Q!TheQBot@CServe.quakenet.org' -botcmd '^MSG Q op #irssi' #irssi Quakenet - /CHANNEL MODIFY -noauto #irssi Freenode - /CHANNEL REMOVE #hideout Freenode + /CHANNEL MODIFY -noauto #irssi liberachat + /CHANNEL REMOVE #hideout liberachat %9Special Example:%9 diff --git a/docs/help/in/connect.in b/docs/help/in/connect.in index e861ad747..d4375eec8 100644 --- a/docs/help/in/connect.in +++ b/docs/help/in/connect.in @@ -34,9 +34,9 @@ %9Examples:%9 - /CONNECT Freenode - /CONNECT -6 Freenode - /CONNECT -4 -! -host staff.irssi.org -network Freenode orwell.freenode.net + /CONNECT liberachat + /CONNECT -6 liberachat + /CONNECT -4 -! -host staff.irssi.org -network liberachat irc.libera.chat /CONNECT irc.irssi.org 6667 WzerT8zq mike %9See also:%9 DISCONNECT, RMRECONNS, SERVER diff --git a/docs/help/in/disconnect.in b/docs/help/in/disconnect.in index bd4a4e17b..c53b1e60b 100644 --- a/docs/help/in/disconnect.in +++ b/docs/help/in/disconnect.in @@ -18,7 +18,7 @@ %9Examples:%9 - /DISCONNECT Freenode I'm off for today, take care! + /DISCONNECT liberachat I'm off for today, take care! /DISCONNECT * Vacation time :D /DISCONNECT diff --git a/docs/help/in/info.in b/docs/help/in/info.in index 275f349d1..d8d8cfc98 100644 --- a/docs/help/in/info.in +++ b/docs/help/in/info.in @@ -15,7 +15,7 @@ %9Examples:%9 /INFO - /INFO orwell.freenode.net + /INFO irc.libera.chat %9See also:%9 ADMIN diff --git a/docs/help/in/join.in b/docs/help/in/join.in index 39fa23f8f..adf7158e8 100644 --- a/docs/help/in/join.in +++ b/docs/help/in/join.in @@ -20,7 +20,7 @@ /JOIN #irssi /JOIN #basementcat secret_lair /JOIN -invite - /JOIN -freenode #github,#freenode,#irssi + /JOIN -liberachat #github,#libera,#irssi %9See also:%9 KICK, PART diff --git a/docs/help/in/knock.in b/docs/help/in/knock.in index bb554d559..ce8f9aa02 100644 --- a/docs/help/in/knock.in +++ b/docs/help/in/knock.in @@ -23,7 +23,7 @@ %9Examples:%9 /KNOCK #irssi - /KNOCK #freenode + /KNOCK #libera /KNOCK #github %9See also:%9 INVITE, JOIN diff --git a/docs/help/in/log.in b/docs/help/in/log.in index e4743d46a..3ca8782ce 100644 --- a/docs/help/in/log.in +++ b/docs/help/in/log.in @@ -33,10 +33,10 @@ %9Examples:%9 /LOG OPEN -targets mike ~/irclogs/mike.log MSGS - /LOG OPEN -targets #irssi-freenode ~/irclogs/freenode/irssi-%%Y-%%m-%%d - /LOG CLOSE ~/irclogs/freenode/irssi-%%Y-%%m-%%d - /LOG STOP ~/irclogs/freenode/irssi-%%Y-%%m-%%d - /LOG START ~/irclogs/freenode/irssi-%%Y-%%m-%%d + /LOG OPEN -targets #irssi ~/irclogs/liberachat/irssi-%%Y-%%m-%%d + /LOG CLOSE ~/irclogs/liberachat/irssi-%%Y-%%m-%%d + /LOG STOP ~/irclogs/liberachat/irssi-%%Y-%%m-%%d + /LOG START ~/irclogs/liberachat/irssi-%%Y-%%m-%%d /SET autolog ON diff --git a/docs/help/in/motd.in b/docs/help/in/motd.in index e33a1c75a..6e86681ef 100644 --- a/docs/help/in/motd.in +++ b/docs/help/in/motd.in @@ -15,7 +15,7 @@ %9Examples:%9 /MOTD - /MOTD orwel.freenode.org + /MOTD irc.libera.chat /MOTD bob %9See also:%9 ADMIN, INFO, LINKS, MAP diff --git a/docs/help/in/names.in b/docs/help/in/names.in index 8fd8cf912..974b845f7 100644 --- a/docs/help/in/names.in +++ b/docs/help/in/names.in @@ -21,7 +21,7 @@ %9Examples:%9 /NAMES -ops - /NAMES -voices #irssi,#freenode + /NAMES -voices #irssi,#libera %9See also:%9 JOIN, PART, WHO, WHOIS diff --git a/docs/help/in/nctcp.in b/docs/help/in/nctcp.in index 93c3f3ec4..9f5167307 100644 --- a/docs/help/in/nctcp.in +++ b/docs/help/in/nctcp.in @@ -15,7 +15,7 @@ %9Examples:%9 /NCTCP #irssi VERSION King of the Jungle v1.0 - /NCTCP bob,#freenode USERINFO I am bob :p + /NCTCP bob,#libera USERINFO I am bob :p %9See also:%9 CTCP diff --git a/docs/help/in/network.in b/docs/help/in/network.in index fbdaa0b41..0542bd7d2 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -59,11 +59,11 @@ %9Examples:%9 /NETWORK ADD -usermode +giw EFnet - /NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org Freenode - /NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' Freenode + /NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org liberachat + /NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' liberachat /NETWORK ADD -autosendcmd '^MSG Q@CServe.quakenet.org AUTH mike WzerT8zq; WAIT 2000; OPER mike WzerT8zq; WAIT 2000; MODE mike +kXP' Quakenet /NETWORK MODIFY -usermode +gi EFnet - /NETWORK REMOVE Freenode + /NETWORK REMOVE liberachat %9See also:%9 CHANNEL, CONNECT, SERVER diff --git a/docs/help/in/part.in b/docs/help/in/part.in index e96abfbbe..f89769cc0 100644 --- a/docs/help/in/part.in +++ b/docs/help/in/part.in @@ -14,7 +14,7 @@ %9Examples:%9 /PART #irssi - /PART #freenode,#irssi + /PART #libera,#irssi %9See also:%9 JOIN, KICK diff --git a/docs/help/in/query.in b/docs/help/in/query.in index 1c0ba5b97..a34f85e80 100644 --- a/docs/help/in/query.in +++ b/docs/help/in/query.in @@ -17,8 +17,8 @@ %9Examples:%9 /QUERY mike - /QUERY -freenode bob - /QUERY -freenode -window sarah + /QUERY -liberachat bob + /QUERY -liberachat -window sarah %9See also:%9 MSG, UNQUERY, WINDOW diff --git a/docs/help/in/recode.in b/docs/help/in/recode.in index 63f52339f..760c66cdb 100644 --- a/docs/help/in/recode.in +++ b/docs/help/in/recode.in @@ -22,7 +22,7 @@ %9Examples:%9 /RECODE - /RECODE ADD Freenode/mike utf-8 + /RECODE ADD liberachat/mike utf-8 /RECODE ADD #korea euc-kr /RECODE REMOVE #korea diff --git a/docs/help/in/reconnect.in b/docs/help/in/reconnect.in index aa1dc9465..87beb95a1 100644 --- a/docs/help/in/reconnect.in +++ b/docs/help/in/reconnect.in @@ -15,7 +15,7 @@ %9Examples:%9 /RECONNECT - /RECONNECT Freenode + /RECONNECT liberachat /RECONNECT EFnet BRB :) %9See also:%9 CONNECT, DISCONNECT, NETWORK, RMRECONNS, SERVER diff --git a/docs/help/in/server.in b/docs/help/in/server.in index beb751147..f7d907f31 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -61,15 +61,15 @@ %9Examples:%9 /SERVER - /SERVER CONNECT chat.freenode.net - /SERVER CONNECT +chat.freenode.net - /SERVER ADD -network Freenode -noautosendcmd orwell.freenode.net - /SERVER ADD -! -auto -host staff.irssi.org -4 -network Freenode -noproxy orwell.freenode.net 6667 - /SERVER MODIFY -network Freenode -noauto orwell.freenode.net - /SERVER MODIFY -network Freenode orwell.freenode.net 6697 - - /SERVER REMOVE orwell.freenode.net 6667 Freenode + /SERVER CONNECT irc.libera.chat + /SERVER CONNECT +irc.libera.chat + /SERVER ADD -network liberachat -noautosendcmd irc.libera.chat + /SERVER ADD -! -auto -host staff.irssi.org -4 -network liberachat -noproxy irc.libera.chat 6667 + /SERVER MODIFY -network liberachat -noauto irc.libera.chat + /SERVER MODIFY -network liberachat irc.libera.chat 6697 - + /SERVER REMOVE irc.libera.chat 6667 liberachat /SERVER PURGE - /SERVER PURGE orwell.freenode.net + /SERVER PURGE irc.libera.chat %9See also:%9 CHANNEL, CONNECT, DISCONNECT, NETWORK, RECONNECT, RMRECONNS diff --git a/docs/manual.txt b/docs/manual.txt index 0f24ffe38..5f0eac518 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -349,7 +349,7 @@ after connecting to the network. This is useful for automatically identifying yourself to NickServ, for example - /NETWORK ADD -autosendcmd "/^msg NickServ identify secret" freenode + /NETWORK ADD -autosendcmd "/^msg NickServ identify secret" liberachat /NETWORK REMOVE diff --git a/docs/proxy.txt b/docs/proxy.txt index 224d24e31..172770e89 100644 --- a/docs/proxy.txt +++ b/docs/proxy.txt @@ -24,7 +24,7 @@ You really should set some password for the proxy with: Then you'll need to configure the ports/ircnets the proxy listens in, something like: - /SET irssiproxy_ports ircnet=2777 efnet=2778 freenode=2779 + /SET irssiproxy_ports IRCnet=2777 EFNet=2778 liberachat=2779 There we have 3 different irc networks answering in 3 ports. Note that you'll have to make the correct /IRCNET ADD and /SERVER ADD commands to diff --git a/docs/startup-HOWTO.html b/docs/startup-HOWTO.html index 48f6e6dfd..b0c68f1f4 100644 --- a/docs/startup-HOWTO.html +++ b/docs/startup-HOWTO.html @@ -68,7 +68,7 @@

1. First steps

And to connect to one of those networks and join a channel:

-
/CONNECT Freenode
+
/CONNECT liberachat
 /JOIN #irssi
 
@@ -94,7 +94,7 @@

1. First steps

If you have irssi 0.8.18 or higher and the irc network supports it, you can use SASL instead of nickserv, which is more reliable:

-
/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN Freenode
+
/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN liberachat
 

These commands have many more options, see their help for details:

diff --git a/docs/startup-HOWTO.txt b/docs/startup-HOWTO.txt index 61de27e34..bff33108b 100644 --- a/docs/startup-HOWTO.txt +++ b/docs/startup-HOWTO.txt @@ -43,7 +43,7 @@ has a few predefined networks, to list them: And to connect to one of those networks and join a channel: -/CONNECT Freenode +/CONNECT liberachat /JOIN #irssi To add more networks: @@ -67,7 +67,7 @@ wait for 2 seconds before joining channels: If you have irssi 0.8.18 or higher and the irc network supports it, you can use SASL instead of nickserv, which is more reliable: -/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN Freenode +/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN liberachat These commands have many more options, see their help for details: diff --git a/irssi.conf b/irssi.conf index edaeb3f56..21c3ba4c0 100644 --- a/irssi.conf +++ b/irssi.conf @@ -2,7 +2,7 @@ servers = ( { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, { address = "ssl.efnet.org"; chatnet = "EFNet"; port = "9999"; use_tls = "yes"; tls_verify = "no"; }, { address = "irc.esper.net"; chatnet = "EsperNet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, - { address = "chat.freenode.net"; chatnet = "Freenode"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, + { address = "irc.libera.chat"; chatnet = "liberachat";port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, { address = "irc.gamesurge.net"; chatnet = "GameSurge"; port = "6667"; }, { address = "ssl.ircnet.ovh"; chatnet = "IRCnet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; }, { address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; }, @@ -34,7 +34,7 @@ chatnets = { max_msgs = "4"; max_whois = "1"; }; - Freenode = { + liberachat = { type = "IRC"; max_kicks = "1"; max_msgs = "4"; @@ -95,8 +95,8 @@ chatnets = { channels = ( { name = "#lobby"; chatnet = "EsperNet"; autojoin = "No"; }, - { name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; }, - { name = "#irssi"; chatnet = "Freenode"; autojoin = "No"; }, + { name = "#libera"; chatnet = "liberachat";autojoin = "No"; }, + { name = "#irssi"; chatnet = "liberachat";autojoin = "No"; }, { name = "#gamesurge"; chatnet = "GameSurge"; autojoin = "No"; }, { name = "#irssi"; chatnet = "IRCNet"; autojoin = "No"; }, { name = "#ircsource"; chatnet = "IRCSource"; autojoin = "No"; }, From 240b79aa2677c5f21ec3350123eb573502bea85d Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 22:56:06 +0200 Subject: [PATCH 038/392] send channel sync requests "later" in the command queue --- src/irc/core/channels-query.c | 16 +++++---- src/irc/core/irc-servers.h | 1 + src/irc/core/irc.c | 59 ++++++++++++++++++++------------ src/irc/core/irc.h | 12 +++++-- src/irc/notifylist/notify-ison.c | 6 ++-- src/perl/irc/Server.xs | 7 ++++ 6 files changed, 69 insertions(+), 32 deletions(-) diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index 6cf3dd2bb..37fcb2d2b 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -53,9 +53,9 @@ /* here are the WHOX commands we send. the full spec can be found on [1]. (1) WHOX_CHANNEL_FULL_CMD for getting the user list when we join a channel. we request the fields - c (channel), u (user), h (host), n (nick), f (flags), d (hops), a (important, account!), and - r (the real name goes last because it os the only that can contain spaces.) we request all - those fields as they are also included in the "regular" WHO reply we would get without WHOX. + c (channel), u (user), h (host), n (nick), f (flags), d (hops), a (account), and r (the real + name goes last because it is the only that can contain spaces.) we request all those fields + as they are also included in the "regular" WHO reply we would get without WHOX. (2) WHOX_USERACCOUNT_CMD for getting the account names of people that joined. this code is obviously only used when we don't have extended-joins. we request n (nick) and a (account) @@ -265,7 +265,7 @@ static void query_send(IRC_SERVER_REC *server, int query) cmd = NULL; } - irc_send_cmd(server, cmd); + irc_send_cmd_later(server, cmd); g_free(chanstr); g_free(chanstr_commas); @@ -440,6 +440,7 @@ void irc_channels_query_purge_accountquery(IRC_SERVER_REC *server, const char *n g_free(cmd); server->cmdcount--; + server->cmdlater--; } else { prev = tmp->next; } @@ -528,7 +529,9 @@ static void sig_event_join(IRC_SERVER_REC *server, const char *data, const char } if (g_hash_table_size(chanrec->nicks) < settings_get_int("channel_max_who_sync") && - server->isupport != NULL && g_hash_table_lookup(server->isupport, "whox") != NULL) { + server->isupport != NULL && g_hash_table_lookup(server->isupport, "whox") != NULL && + g_hash_table_size(server->chanqueries->accountqueries) < + settings_get_int("account_max_chase")) { char *cmd; server_redirect_event(server, "who user", 1, nick, -1, "chanquery useraccount abort", /* failure signal */ @@ -538,7 +541,7 @@ static void sig_event_join(IRC_SERVER_REC *server, const char *data, const char cmd = g_strdup_printf(WHOX_USERACCOUNT_CMD, nick); g_hash_table_add(server->chanqueries->accountqueries, g_strdup(nick)); /* queue the command */ - irc_send_cmd_full(server, cmd, FALSE, FALSE, FALSE); + irc_send_cmd_later(server, cmd); g_free(cmd); } } @@ -635,6 +638,7 @@ void channels_query_init(void) { settings_add_bool("misc", "channel_sync", TRUE); settings_add_int("misc", "channel_max_who_sync", 1000); + settings_add_int("misc", "account_max_chase", 10); signal_add("server connected", (SIGNAL_FUNC) sig_connected); signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 544baba99..93fa02a45 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -119,6 +119,7 @@ struct _IRC_SERVER_REC { there actually is, to make flood control remember how many messages can be sent before starting the flood control */ + int cmdlater; /* number of commands in queue to be sent later */ GSList *cmdqueue; /* command, redirection, ... */ gint64 wait_cmd; /* don't send anything to server before this */ gint64 last_cmd; /* last time command was sent to server */ diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index 628d71305..e712c9bf3 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -47,8 +47,7 @@ static void strip_params_colon(char *const); /* The core of the irc_send_cmd* functions. If `raw' is TRUE, the `cmd' won't be checked at all if it's 512 bytes or not, or if it contains line feeds or not. Use with extreme caution! */ -void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, - int send_now, int immediate, int raw) +void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_when, int raw) { GString *str; int len; @@ -65,6 +64,8 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, if (server->cmdcount == 0) irc_servers_start_cmd_timeout(); + if (server->cmdlater > server->cmdcount) + server->cmdlater = server->cmdcount; server->cmdcount++; if (!raw) { @@ -105,7 +106,7 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, g_string_append(str, cmd); } - if (send_now) { + if (irc_send_when == IRC_SEND_NOW) { rawlog_output(server->rawlog, str->str); server_redirect_command(server, str->str, server->redirect_next); server->redirect_next = NULL; @@ -117,25 +118,31 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, g_string_append_c(str, 10); } - if (send_now) { - irc_server_send_data(server, str->str, str->len); + if (irc_send_when == IRC_SEND_NOW) { + irc_server_send_data(server, str->str, str->len); g_string_free(str, TRUE); - } else { - + } else if (irc_send_when == IRC_SEND_NEXT) { /* add to queue */ - if (immediate) { - server->cmdqueue = g_slist_prepend(server->cmdqueue, - server->redirect_next); - server->cmdqueue = g_slist_prepend(server->cmdqueue, - g_string_free(str, FALSE)); - } else { - server->cmdqueue = g_slist_append(server->cmdqueue, - g_string_free(str, FALSE)); - server->cmdqueue = g_slist_append(server->cmdqueue, - server->redirect_next); - } + server->cmdqueue = g_slist_prepend(server->cmdqueue, server->redirect_next); + server->cmdqueue = g_slist_prepend(server->cmdqueue, g_string_free(str, FALSE)); + } else if (irc_send_when == IRC_SEND_NORMAL) { + guint pos = g_slist_length(server->cmdqueue); + if (pos > 2 * server->cmdlater) + pos -= 2 * server->cmdlater; + else + pos = 0; + + server->cmdqueue = g_slist_insert(server->cmdqueue, server->redirect_next, pos); + server->cmdqueue = g_slist_insert(server->cmdqueue, g_string_free(str, FALSE), pos); + } else if (irc_send_when == IRC_SEND_LATER) { + server->cmdqueue = g_slist_append(server->cmdqueue, g_string_free(str, FALSE)); + server->cmdqueue = g_slist_append(server->cmdqueue, server->redirect_next); + server->cmdlater++; + } else { + g_warn_if_reached(); } - server->redirect_next = NULL; + + server->redirect_next = NULL; } /* Send command to IRC server */ @@ -149,7 +156,7 @@ void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd) (server->cmdcount < server->max_cmds_at_once || server->cmd_queue_speed <= 0); - irc_send_cmd_full(server, cmd, send_now, FALSE, FALSE); + irc_send_cmd_full(server, cmd, send_now ? IRC_SEND_NOW : IRC_SEND_NORMAL, FALSE); } /* Send command to IRC server */ @@ -173,7 +180,7 @@ void irc_send_cmd_now(IRC_SERVER_REC *server, const char *cmd) { g_return_if_fail(cmd != NULL); - irc_send_cmd_full(server, cmd, TRUE, TRUE, FALSE); + irc_send_cmd_full(server, cmd, IRC_SEND_NOW, FALSE); } /* Send command to server putting it at the beginning of the queue of @@ -183,7 +190,15 @@ void irc_send_cmd_first(IRC_SERVER_REC *server, const char *cmd) { g_return_if_fail(cmd != NULL); - irc_send_cmd_full(server, cmd, FALSE, TRUE, FALSE); + irc_send_cmd_full(server, cmd, IRC_SEND_NEXT, FALSE); +} + +/* Send command to server putting it at the end of the queue. */ +void irc_send_cmd_later(IRC_SERVER_REC *server, const char *cmd) +{ + g_return_if_fail(cmd != NULL); + + irc_send_cmd_full(server, cmd, IRC_SEND_LATER, FALSE); } static char *split_nicks(const char *cmd, char **pre, char **nicks, char **post, int arg) diff --git a/src/irc/core/irc.h b/src/irc/core/irc.h index 8803f6622..92fb4ccba 100644 --- a/src/irc/core/irc.h +++ b/src/irc/core/irc.h @@ -27,6 +27,13 @@ typedef struct _REDIRECT_REC REDIRECT_REC; extern char *current_server_event; /* current server event being processed */ +enum { + IRC_SEND_NOW, /* */ + IRC_SEND_NEXT, + IRC_SEND_NORMAL, + IRC_SEND_LATER +}; + /* Send command to IRC server */ void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd); void irc_send_cmdv(IRC_SERVER_REC *server, const char *cmd, ...) G_GNUC_PRINTF (2, 3); @@ -42,11 +49,12 @@ void irc_send_cmd_now(IRC_SERVER_REC *server, const char *cmd); commands to send -- it will go out as soon as possible in accordance to the flood protection settings. */ void irc_send_cmd_first(IRC_SERVER_REC *server, const char *cmd); +/* Send command to server putting it at the end of the queue. */ +void irc_send_cmd_later(IRC_SERVER_REC *server, const char *cmd); /* The core of the irc_send_cmd* functions. If `raw' is TRUE, the `cmd' won't be checked at all if it's 512 bytes or not, or if it contains line feeds or not. Use with extreme caution! */ -void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, - int send_now, int immediate, int raw); +void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_when, int raw); /* Extract a tag value from tags */ GHashTable *irc_parse_message_tags(const char *tags); diff --git a/src/irc/notifylist/notify-ison.c b/src/irc/notifylist/notify-ison.c index 32316038d..809394c42 100644 --- a/src/irc/notifylist/notify-ison.c +++ b/src/irc/notifylist/notify-ison.c @@ -92,7 +92,7 @@ static void ison_send(IRC_SERVER_REC *server, GString *cmd) server_redirect_event(server, "ison", 1, NULL, -1, NULL, "event 303", "notifylist event", NULL); - irc_send_cmd(server, cmd->str); + irc_send_cmd_later(server, cmd->str); g_string_truncate(cmd, 0); } @@ -183,7 +183,9 @@ static void whois_send(IRC_SERVER_REC *server, const char *nicks, "", "event empty", NULL); g_free(str); - irc_send_cmdv(server, "WHOIS %s", whois_request); + str = g_strdup_printf("WHOIS %s", whois_request); + irc_send_cmd_later(server, str); + g_free(str); } static void whois_send_server(IRC_SERVER_REC *server, char *nick) diff --git a/src/perl/irc/Server.xs b/src/perl/irc/Server.xs index fef3698fe..63e3111a5 100644 --- a/src/perl/irc/Server.xs +++ b/src/perl/irc/Server.xs @@ -86,6 +86,13 @@ send_raw_first(server, cmd) CODE: irc_send_cmd_first(server, cmd); +void +send_raw_later(server, cmd) + Irssi::Irc::Server server + char *cmd +CODE: + irc_send_cmd_later(server, cmd); + void send_raw_split(server, cmd, nickarg, max_nicks) Irssi::Irc::Server server From 157913bd98f1f95eb7eb58b2c73a8e6685f0c8cc Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 23:26:35 +0200 Subject: [PATCH 039/392] do not chase during netsplit --- src/irc/core/channels-query.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index 37fcb2d2b..05c9768c2 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -530,6 +530,7 @@ static void sig_event_join(IRC_SERVER_REC *server, const char *data, const char if (g_hash_table_size(chanrec->nicks) < settings_get_int("channel_max_who_sync") && server->isupport != NULL && g_hash_table_lookup(server->isupport, "whox") != NULL && + server->split_servers == NULL && g_hash_table_size(server->chanqueries->accountqueries) < settings_get_int("account_max_chase")) { char *cmd; From 2de9c25376c18776011a42dc9f2e3ff4370bb700 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 23:01:58 +0200 Subject: [PATCH 040/392] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 245f22234..d2dd2f7ca 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 40 +#define IRSSI_ABI_VERSION 41 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 37237f377e639650a4eb92168661fe4d53989400 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 2 Sep 2021 22:38:53 +0200 Subject: [PATCH 041/392] actually remember the hilight -color --- src/fe-common/core/hilight-text.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 4b5e4edde..d308bd04e 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -479,6 +479,8 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text, tmp = g_strdup_printf("%d", hilight_end)); g_free(tmp); } + if (hilight->color != NULL) + format_dest_meta_stash(dest, "hilight-color", hilight->color); signal_emit("print text", 3, dest, newstr, stripped); From cf903840233904de85858aa180f1a6b2e339a45d Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 2 Sep 2021 23:10:37 +0200 Subject: [PATCH 042/392] Allow -tls_ca{file,path} '' to unset an argument --- src/fe-common/core/fe-server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index de45f8e9e..78e7202c2 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -213,12 +213,16 @@ static void cmd_server_add_modify(const char *data, gboolean add) value = g_hash_table_lookup(optlist, "ssl_cafile"); if (value != NULL && *value != '\0') rec->tls_cafile = g_strdup(value); + else if (value != NULL && *value == '\0') + g_free_and_null(rec->tls_cafile); value = g_hash_table_lookup(optlist, "tls_capath"); if (value == NULL) value = g_hash_table_lookup(optlist, "ssl_capath"); if (value != NULL && *value != '\0') rec->tls_capath = g_strdup(value); + else if (value != NULL && *value == '\0') + g_free_and_null(rec->tls_capath); value = g_hash_table_lookup(optlist, "tls_ciphers"); if (value == NULL) From cb11fd9cf76a368d8672925d02272c8a24992017 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 3 Sep 2021 16:18:21 +0200 Subject: [PATCH 043/392] add a PACKAGE_VERSION override for meson --- meson.build | 10 ++++++++-- meson_options.txt | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index fe5aa99f6..bd192a926 100644 --- a/meson.build +++ b/meson.build @@ -53,6 +53,8 @@ require_glib_internal = get_option('install-glib') == 'force' want_static_dependency = get_option('static-dependency') == 'yes' +package_version = get_option('PACKAGE_VERSION') != '' ? get_option('PACKAGE_VERSION') : meson.project_version() + chat_modules = ['irc'] run_command('mkdir', meson.current_build_dir() / incdir) @@ -540,7 +542,7 @@ foreach h : headers endforeach conf.set('HAVE_LIBUTF8PROC', have_libutf8proc) -conf.set_quoted('PACKAGE_VERSION', meson.project_version()) +conf.set_quoted('PACKAGE_VERSION', package_version) conf.set_quoted('PACKAGE_TARNAME', meson.project_name()) configure_file(output : 'irssi-config.h', @@ -581,7 +583,11 @@ pc_requires = [] if not glib_internal pc_requires += glib_dep endif -pc.generate(filebase : 'irssi-1', name : 'Irssi', description : 'Irssi chat client', requires : pc_requires) +pc.generate(filebase : 'irssi-1', + name : 'Irssi', + description : 'Irssi chat client', + version : package_version, + requires : pc_requires) ########### # irssi.1 # diff --git a/meson_options.txt b/meson_options.txt index 5dc9c5143..1013166d9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -15,3 +15,4 @@ option('static-dependency', type : 'combo', description : 'Request static depen option('install-glib', type : 'combo', description : 'Download and install GLib for you', choices : ['no', 'yes', 'force']) option('docdir', type : 'string', description : 'Documentation directory') option('fhs-prefix', type : 'string', description : 'System prefix for Termux') +option('PACKAGE_VERSION', type : 'string', description : 'Override PACKAGE_VERSION in tarballs') From 37eb6c351cd46af6b5827a4f6cd58dbe493067ca Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 3 Sep 2021 19:34:11 +0200 Subject: [PATCH 044/392] fix queue bug --- src/irc/core/irc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index e712c9bf3..51b55a2bb 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -51,6 +51,7 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe { GString *str; int len; + guint pos; gboolean server_supports_tag; g_return_if_fail(server != NULL); @@ -64,10 +65,16 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe if (server->cmdcount == 0) irc_servers_start_cmd_timeout(); - if (server->cmdlater > server->cmdcount) - server->cmdlater = server->cmdcount; server->cmdcount++; + pos = g_slist_length(server->cmdqueue); + if (server->cmdlater > pos / 2) { + server->cmdlater = pos / 2; + pos = 0; + } else { + pos -= 2 * server->cmdlater; + } + if (!raw) { const char *tmp = cmd; @@ -126,12 +133,6 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe server->cmdqueue = g_slist_prepend(server->cmdqueue, server->redirect_next); server->cmdqueue = g_slist_prepend(server->cmdqueue, g_string_free(str, FALSE)); } else if (irc_send_when == IRC_SEND_NORMAL) { - guint pos = g_slist_length(server->cmdqueue); - if (pos > 2 * server->cmdlater) - pos -= 2 * server->cmdlater; - else - pos = 0; - server->cmdqueue = g_slist_insert(server->cmdqueue, server->redirect_next, pos); server->cmdqueue = g_slist_insert(server->cmdqueue, g_string_free(str, FALSE), pos); } else if (irc_send_when == IRC_SEND_LATER) { From 9e128901104afb61ca29926e4421aadda031f38d Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 13 Aug 2021 18:32:49 +0200 Subject: [PATCH 045/392] add a "server outgoing modify" signal to intercept outgoing messages --- docs/signals.txt | 1 + src/irc/core/irc-servers.c | 26 +++++++++++++++----------- src/irc/core/irc.c | 21 +++++++++++++-------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/docs/signals.txt b/docs/signals.txt index 4e5f85b4b..6128084be 100644 --- a/docs/signals.txt +++ b/docs/signals.txt @@ -151,6 +151,7 @@ irc.c: "whois default event", SERVER_REC, char *args, char *sender_nick, char *sender_address "server incoming", SERVER_REC, char *data + "server outgoing modify", SERVER_REC, GString *data (for perl parser..) "redir ", SERVER_REC, char *args, char *sender_nick, char *sender_address diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 676e8cb96..1c9f0cec6 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -734,9 +734,9 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now) { REDIRECT_REC *redirect; GSList *link; + GString *str; long usecs; char *cmd; - int len; if (!IS_IRC_SERVER(server)) return 0; @@ -759,16 +759,20 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now) redirect = server->cmdqueue->next->data; /* send command */ - len = strlen(cmd); - irc_server_send_data(server, cmd, len); - - /* add to rawlog without [CR+]LF */ - if (len > 2 && cmd[len-2] == '\r') - cmd[len-2] = '\0'; - else if (cmd[len-1] == '\n') - cmd[len-1] = '\0'; - rawlog_output(server->rawlog, cmd); - server_redirect_command(server, cmd, redirect); + str = g_string_new(cmd); + signal_emit("server outgoing modify", 2, server, str); + if (str->len) { + irc_server_send_data(server, str->str, str->len); + + /* add to rawlog without [CR+]LF */ + if (str->len > 2 && str->str[str->len - 2] == '\r') + str->str[str->len - 2] = '\0'; + else if (str->str[str->len - 1] == '\n') + str->str[str->len - 1] = '\0'; + rawlog_output(server->rawlog, str->str); + server_redirect_command(server, str->str, redirect); + } + g_string_free(str, TRUE); /* remove from queue */ server->cmdqueue = g_slist_remove(server->cmdqueue, cmd); diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index 51b55a2bb..c17e24704 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -113,20 +113,25 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe g_string_append(str, cmd); } - if (irc_send_when == IRC_SEND_NOW) { - rawlog_output(server->rawlog, str->str); - server_redirect_command(server, str->str, server->redirect_next); - server->redirect_next = NULL; - } - if (!raw) { - /* Add CR+LF to command */ + /* Add CR+LF to command */ g_string_append_c(str, 13); g_string_append_c(str, 10); } if (irc_send_when == IRC_SEND_NOW) { - irc_server_send_data(server, str->str, str->len); + signal_emit("server outgoing modify", 2, server, str); + if (str->len) { + irc_server_send_data(server, str->str, str->len); + + /* add to rawlog without [CR+]LF */ + if (str->len > 2 && str->str[str->len - 2] == '\r') + str->str[str->len - 2] = '\0'; + else if (str->str[str->len - 1] == '\n') + str->str[str->len - 1] = '\0'; + rawlog_output(server->rawlog, str->str); + server_redirect_command(server, str->str, server->redirect_next); + } g_string_free(str, TRUE); } else if (irc_send_when == IRC_SEND_NEXT) { /* add to queue */ From 2cdcf86174b420091372edd295dc81cda8b46d8f Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 1 Sep 2021 23:37:11 +0200 Subject: [PATCH 046/392] branding --- .github/workflows/check.yml | 2 +- NEWS | 274 ++++++++++++++++++++++++++++++++++- README.md | 33 ++--- src/core/expandos.c | 2 +- src/fe-text/module-formats.c | 6 +- 5 files changed, 291 insertions(+), 26 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index aeaf6c270..61de72ff3 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -118,5 +118,5 @@ jobs: echo load perl >> irssi-test/startup echo load proxy >> irssi-test/startup echo ^quit >> irssi-test/startup - irssi-build/bin/irssi --home irssi-test | ~/render.pl + irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl cat irc.log.* diff --git a/NEWS b/NEWS index 1bdffd822..b32827615 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,274 @@ -v1.3-head 2021-xx-xx The Irssi team +v1.3.0-an 2021-09-05 Ailin Nemui + * /SET resolve_reverse_lookup setting was removed (#1135) + * Irssi will try to connect on IPv4 if IPv6 connection failed + (#1146). By Shivaram Lingamneni + * The display system now renders formats on the fly (#1079, + #1188, #1191, #1192, #1204, #1205, #1209, an#13, an#14, an#28, + an#29) + + This major change will break scripts that try to modify + printed text during "print text" signal (#1189). They need + to be ported to modify the text during "print format" + instead. It also breaks the usage of using /FORMAT to add + different colours to a line. Such usage needs to be ported + to using $expando variables instead. Affected scripts + include format_identify.pl, friends_peder.pl, nickcolor.pl, + nm.pl, people.pl + + The "gui print text finished" and "gui print text after + finished" signals gained a TEXT_DEST_REC *parameter in the + process. + + A new "gui render line text" signal is available to change + the rendering of a line + + * made the $Z expando (time) dynamic (#1087, #1207, #1208) + + This change breaks the usage of /SET timestamp_format to + supply a custom displayed time stamp. Affected scripts + include binary_time.pl + + * /HILIGHT -priority now affects which hilight rule gets + applied (#1228, #1232) + * The NAMES list is now hidden by default if there are more + than 18 users on the channel (an#7) + + To revert to the previous behaviour + + /SET show_names_on_join_limit -1 + + * -tls_verify is now enabled by default (#1170, an#18, #1309, + an#23) + + This may cause an ugly display of notls_verify in the output + of /SERVER LIST, even on plain-text connection, on old + configs. Kindly remove the "tls_verify = "no";" entries from + your config file manually. + + * Irssi will now attempt STARTTLS if advertised (#1170, #1312, + an#19) + + Use -disallow_starttls if you absolutely do not want this + + In order to check for a STARTTLS advertisement, Irssi will + now wait for a response (even an error) to CAP LS 302. If + your bouncer/server does not want to communicate before + receiving USER/PASS at all, use -nocap to disable the CAP + check. + + * Channel sync requests (WHO, MODE) are now sent "later" than + user commands. This should improve responsiveness to user + commands in the autojoin phase (an#26, an#32, an#33) + * Irssi is now using full paths in #include directives and + consequently does not add all directories to the include + path anymore (#1040) + * The Build System was ported to Meson (#1064, #1065, #1068, + #1071, #1072, #1073, #1074, #1075, #1084, #1085, #1118, #1166, + #1223, #1224, #1245, #1313, #1314, an#31) + * Scriptassist was changed to use a YAML database (#1163) + + It will tell you when you need to update your setting + + * /BIND shows all partial matches (#1155) + * Cleanup of unused functions (#1017, #1132, #1145, #1182, + #1246, #1264) + + Functions removed: + + NET_CALLBACK + NET_HOST_CALLBACK + RESOLVED_NAME_REC + net_gethostbyaddr_nonblock + net_connect_nonblock + [ SIMPLE_THREAD_REC, simple_init, simple_readpipe ] + hash_save_key + + Functions deprecated: + + dec2octal + g_timeval_cmp + get_timeval_diff + + Function names corrected: + + g_input -> i_input + g_istr -> i_istr + g_io_channel -> i_io_channel + g_hash_free_value -> i_hash_free_value + remove g_free_true + gslist -> i_slist + glog_func -> i_log_func + glist -> i_list + + If multi-version compatibility is desired, module authors + can find an example of backwards compatible code in + cdidier/irssi-xmpp#55 + + + Add MSGLEVEL_HIDDEN to Perl (#1044) + + Add $view->set_hidden_level and $view->remove_lines_by_level + to Perl (#1026) + + Add a /SET scrollback_max_age setting (#1022). By Heikki + Orsila + + Add /SET actlist_prefer_window_name (#1025) + + Add -window option to /CAT (#1023, #1159) + + Add an option to list specific sections with + + /SET -section lookandfeel + + (#1048) + + + Add support for IRCv3 CAP LS 302 (#1091) + + Add a new "print noformat" signal that goes together with + "print format" (#1088, #1192) + + Add support for IRCv3 extended-join. /SET show_extended_join + to enable (#1097, #1107, #1124) + + There are two new /FORMATs, join_extended and + join_extended_account, that theme writers need to take into + account if desired. + + + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33, + #1104, #1254) + + Add support for IRCv3 account-notify (#1100, #1098, GL#33, + #1105, #1131). Credit to oss-fuzz + /SET show_account_notify to enable + + Add support for IRCv3 invite-notify (#1094) + + Add support for receiving IRCv3 message-tags (#576, #1090) + + Add support for sending IRCv3 message-tags (#1092) + + Add support for the oragono.io/maxline-2 CAP to increase IRC + protocol line length (#1092) + + Enable the znc.in/self-message CAP by default (#1123) + + Add support for IRCv3 away-notify. /SET away_notify_public + to enable (#1099, GL#33, #1105) + + Add support for IRCv3 chghost (#1096, GL#33, #1105) + + Add support for IRCv3 account-notify. + + Add support for IRCv3 server-time. /SET show_server_time to + enable (#1108) + + Add support for logging IRCv3 server-time. + /SET log_server_time to disable (#1318, an#16) + + Add IRCv3 features to signals.txt (#1111) + + In particular, "message join" now takes 2 additional + arguments, script and module authors must beware of this + change. + + + Show the unignore time in /IGNORE output (#1158, #1161) + + Add /SET quit_on_hup to make the behaviour of SIGHUP + configurable (#828, #1169). By Pinguin1234 + + Support numeric 489 as ERR_SECUREONLYCHAN (#1193, #1196). By + Michael Hansen + + Improve support for building Irssi in Termux-Android with + Meson (#1199) + + Add usermode key to Irssi::Irc::Chatnet in Perl (#1288). By + Jessica Sophie Porter + + Add format_string_expand and format_string_unexpand + functions to Perl (#1286) + + Add ...->format_create_dest(...)->printformat("format", + args...) and ...->printformat_module("module", "format", + args...) methods to Perl (#1284) + + You can avoid any CORE::GLOBAL::caller hacks using the + printformat_module method, especially sind that hack was not + safe during signal emissions + + + Add tracking of user accounts in the channel nicklist using + WHOX on join (#1250) + + Add auto-loading of the Perl and otr module from /SET + autoload_modules (#1295) + + Add /IGNORE ... NOHILIGHT to ignore some hilights (#1260) + + Do not beep on hidden lines with /SET beep_msg_level + ... -HIDDEN (#1259) + + Added /CS, /MS, /NS, and /OS aliases to the default config + (#1316). By Mathis Beer + + Allow -tls_ca{file,path} '' to unset an argument (#730, + #1060, an#30) + + Add a "server outgoing modify" signal to intercept outgoing + messages (#1148, #1151, an#15). Original by + JustAnotherArchivist + - remove some hard-coded 510 byte assumptions (#1086) + - Several fixes for error checks in SSL (#944, #1037, #943, + #1036). Reported by Chi Li + - Wrong variable tested in mask_match (#902, #1035) + - Fix bug where irssi-proxy with `?'-port would not reconnect + (#1041) + - Allow shrinking of /SET rawlog_lines (#957, #1020). By + Marcus "Teschi" Prinz + - Fix /WINDOW BALANCE warning (#1054) + - fix overflow when first command history entry expires + (#1070) + - begin modularising IRC module (#1067, #1112, #1113) + - fix some memory leaks in /DCC RESUME and settings_add + (#1077). By Zero King + - fix cut-off text with theme_indent module and /SET + indent_always OFF (#1078) + - fix the cap_queue order (#1095) + - add reference counted strings (#1089) + - Fix irc_op_public messages not triggering hilights (#354, + #891, #1129). By Dan Collins + - Fix /IGNORE not setting the right level in irc_op_public + messages (#1280). Credit to oss-fuzz + - Fix GTimeVal deprecation (#1141, #1144, #1145) + + If multi-version compatibility is desired, module authors + can find an example of backwards compatible code in + cdidier/irssi-xmpp#53 + + - Fix /IGNORE ... MODES NO_ACT not working (#1164) + - Deprecated -ssl* options are hidden from tab completion + (#1171) + - Make /SET actlist_sort a choice type (#1198) + - Fix crash from self-unloading script (#1206). By Thomas + Stagner + - Fix crash during Perl signal emission (#1233, #1234) + - Fix a case where empty lines or comments inside channels or + servers in the config would confuse Irssi (#1062, #1242, + #1243) + - Fix reported freezing in DCC GET on slow disks (#159, #1271) + - Fix message-tags parsing (#1274, #1275). Credit to oss-fuzz + - Fail redirects when receiving numeric 263 (RPL_TRYAGAIN) in + response to /WHO (#1283) + - Some updates to .gitignore (#1302). By Rene Kita + - Fix build on operating systems with X/Open Curses, version 2 + (#1305, #1308). By Nia Alarie (Regression introduced with + #1290, alternative fix for Irssi 1.2.3 no-term.h.patch) + - Fix otr module not using g_strndup, e.g. on Solaris 10 + (#1315). By Claes Nästén + - Fix cursor getting stuck for auto completions that changes + case (#1176, #1322, an#8). By ffrogman + - Restore operation of tag/* in /SET activity_hide_targets + (#1337, an#11) nb. the ::all syntax was working in Irssi 1.1 + and 1.2 (and continues to work) + - Fix /SERVER ADD -matrix -network my_matrix_network + (an#12). By Andrej Kacian + - Fix /SERVER ADD creating duplicated entries in the config + file (#1317, an#22) + - Fix critical when SASL user is set and SASL password is + empty (#1325, an#21) + - Misc fixes (#1106, #1141, #1272, #1297) + - Fuzz fixes (#1116, #1117, #1119, #1125, #1126, an#20) + - Build system fixes (#1101, #1102, #1069, #1140, #1181, #1253) + - Text and Help updates + - add -tls_* options to manual (#1029, #1030). By Jacob + V. Rasmussen + - missing targets in /MSG (#1032) + - wrong parameter in /ECHO (#1024) + - Spelling in OTR (#1047). By David Gall + - Clarify statusbar priority (#1049). By Marius Gedminas + - Document get_irssi_dir in Perl (#1051, #1052). By Alex + Shafer + - typo in /HILIGHT help (#1081). By DFrostByte + - improved clarity of your_nick_owned (#1138). By Mike Quin + - Update some URLs to https (#1163) + - Add documentation for escaping some characters (#1329, + #1330, an#9). By Guntbert Reiter + - Fix some typos (#1336, an#10). By Francis Mteo + - Infrastructure updates: + - Support for Github Actions (#1039, #1103, #1160, #1212, + #1231, #1252, #1261) + - Run clang-format on pull requests (#1172, #1173, #1184, + #1230, #1247, #1287) + - Run abidiff on pull requests (#1179, #1195) + - Test CI-Fuzz (#1279, #1304, an#17) v1.2.3 2021-04-11 The Irssi team - Fix the compilation of utf8proc (#1021) @@ -40,7 +310,7 @@ v1.2.3 2021-04-11 The Irssi team v1.2.2 2019-08-29 The Irssi team - Fix a use after free issue when receiving IRCv3 CAP - information from the server (GL#34) + information from the server (GL#34, GL!35) - Fix a crash during startup when windows weren't fully initialised yet (#1114, bdo#935813) diff --git a/README.md b/README.md index d1232764c..21fa14e8b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ -# [Irssi](https://irssi.org/) +# Neırssi -![Build Status](https://github.com/irssi/irssi/workflows/Check%20Irssi/badge.svg?branch=master) +![Build Status](https://github.com/ailin-nemui/irssi/workflows/Check%20Irssi/badge.svg?branch=master) -Irssi is a modular chat client that is most commonly known for its -text mode user interface, but 80% of the code isn't text mode -specific. Irssi comes with IRC support built in, and there are -third party [ICB](https://github.com/jperkin/irssi-icb), +Neırssi is a modular text mode chat client mostly compatible with +[Irssi](https://irssi.org). It comes with IRC support built in, and +there are third party [ICB](https://github.com/jperkin/irssi-icb), [SILC](http://www.silcnet.org/), [XMPP](http://cybione.org/~irssi-xmpp/) (Jabber), [PSYC](http://about.psyc.eu/Irssyc) and @@ -14,14 +13,14 @@ available. ![irssi](https://user-images.githubusercontent.com/5665186/32180643-cf127f60-bd92-11e7-8aa2-882313ce1d8e.png) -## [Download information](https://irssi.org/download/) +## [Download information](https://ailin-nemui.github.io/irssi/Getting.html) #### Development source installation [Ninja](https://ninja-build.org/) 1.5 and [Meson](https://mesonbuild.com/) 0.49 ``` -git clone https://github.com/irssi/irssi +git clone https://github.com/ailin-nemui/irssi cd irssi meson Build ninja -C Build && sudo ninja -C Build install @@ -29,13 +28,13 @@ ninja -C Build && sudo ninja -C Build install #### Release source installation -* Download [release](https://github.com/irssi/irssi/releases) -* [Verify](https://irssi.org/download/#release-sources) signature +* Download [release](https://github.com/ailin-nemui/irssi/releases) +* Verify signature ``` tar xJf irssi-*.tar.xz cd irssi-* -./configure -make && sudo make install +meson Build +ninja -C Build && sudo ninja -C Build install ``` ### Requirements @@ -47,23 +46,23 @@ make && sudo make install #### See the [INSTALL](INSTALL) file for details -## [Documentation](https://irssi.org/documentation/) +## Documentation -* [Frequently Asked Questions](https://irssi.org/documentation/faq) -* [Startup How-To](https://irssi.org/documentation/startup) +* [New users guide](https://ailin-nemui.github.io/irssi/New-users.html) * Check the built-in `/HELP`, it has all the details on command syntax +* Other random Irssi documentation on https://irssi.org/documentation/ ## [Themes](https://irssi-import.github.io/themes/) ## [Scripts](https://scripts.irssi.org/) -## [Modules](https://irssi.org/modules/) +## [Modules](https://ailin-nemui.github.io/irssi/Modules.html) ## [Security information](https://irssi.org/security/) Please report security issues to staff@irssi.org. Thanks! -## [Bugs](https://github.com/irssi/irssi/issues) / Suggestions / [Contributing](https://irssi.org/development/) +## [Bugs](https://github.com/irssi/irssi/issues) / Suggestions / Contributing Check the GitHub issues if it is already listed in there; if not, open an issue on GitHub or send a mail to [staff@irssi.org](mailto:staff@irssi.org). diff --git a/src/core/expandos.c b/src/core/expandos.c index 0f317e516..da84b568f 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -322,7 +322,7 @@ static char *expando_last_invite(SERVER_REC *server, void *item, int *free_ret) /* client version text string */ static char *expando_version(SERVER_REC *server, void *item, int *free_ret) { - return PACKAGE_VERSION; + return PACKAGE_VERSION "-an"; } /* current value of CMDCHARS */ diff --git a/src/fe-text/module-formats.c b/src/fe-text/module-formats.c index 7cdc56542..e9d4fab90 100644 --- a/src/fe-text/module-formats.c +++ b/src/fe-text/module-formats.c @@ -84,11 +84,7 @@ FORMAT_REC gui_text_formats[] = { NULL, "Welcome", 0 }, { "irssi_banner", - " ___ _%:" - "|_ _|_ _ _____(_)%:" - " | || '_(_-<_-< |%:" - "|___|_| /__/__/_|%:" - "Irssi v$J - https://irssi.org", 0 }, + "Neırssi v$J", 0 }, { "welcome_firsttime", "- - - - - - - - - - - - - - - - - - - - - - - - - - - -\n" "Hi there! If this is your first time using Irssi, you%:" From 2003446e988280d86aebd2bc2492670f3329a9b7 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 7 Sep 2021 01:21:35 +0200 Subject: [PATCH 047/392] continue head --- NEWS | 2 ++ configure.ac | 2 +- meson.build | 2 +- src/core/expandos.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b32827615..87cd3cfde 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +v1.4-head-an 2022-xx-xx Ailin Nemui + v1.3.0-an 2021-09-05 Ailin Nemui * /SET resolve_reverse_lookup setting was removed (#1135) * Irssi will try to connect on IPv4 if IPv6 connection failed diff --git a/configure.ac b/configure.ac index 3a9e7bd63..a51edf3c0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(irssi, 1.3-head) +AC_INIT(irssi, 1.4-head-an) AC_CONFIG_SRCDIR([src]) AC_CONFIG_AUX_DIR(build-aux) AC_PREREQ(2.50) diff --git a/meson.build b/meson.build index bd192a926..31bdfa9fe 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('irssi', 'c', - version : '1.3-head', + version : '1.4-head-an', meson_version : '>=0.49', default_options : ['warning_level=1']) diff --git a/src/core/expandos.c b/src/core/expandos.c index da84b568f..0f317e516 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -322,7 +322,7 @@ static char *expando_last_invite(SERVER_REC *server, void *item, int *free_ret) /* client version text string */ static char *expando_version(SERVER_REC *server, void *item, int *free_ret) { - return PACKAGE_VERSION "-an"; + return PACKAGE_VERSION; } /* current value of CMDCHARS */ From 521c0d4e6fb906f65855f13e70c063ec7eb13552 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 8 Sep 2021 11:57:25 +0200 Subject: [PATCH 048/392] remove oragono.io/maxline-2 --- src/irc/core/irc-servers.c | 21 --------------------- src/irc/core/irc-servers.h | 1 - 2 files changed, 22 deletions(-) diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 1c9f0cec6..664ca9a45 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -282,7 +282,6 @@ static void server_init_1(IRC_SERVER_REC *server) irc_cap_toggle(server, CAP_SASL, TRUE); } - irc_cap_toggle(server, CAP_MAXLINE, TRUE); irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE); irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE); irc_cap_toggle(server, CAP_SETNAME, TRUE); @@ -647,24 +646,6 @@ static void sig_server_quit(IRC_SERVER_REC *server, const char *msg) g_free(recoded); } -static void cap_maxline(IRC_SERVER_REC *server) -{ - unsigned int maxline = 0; - gboolean parse_successful = FALSE; - const char *maxline_str; - - maxline_str = g_hash_table_lookup(server->cap_supported, CAP_MAXLINE); - if (maxline_str != NULL) { - parse_successful = parse_uint(maxline_str, NULL, 10, &maxline); - - } - - if (parse_successful && - maxline >= MAX_IRC_MESSAGE_LEN + 2 /* 2 bytes for CR+LF */) { - server->max_message_len = maxline - 2; - } -} - void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const char *data) { char *recoded; @@ -1226,7 +1207,6 @@ void irc_servers_init(void) signal_add_first("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_add_last("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_add_last("server quit", (SIGNAL_FUNC) sig_server_quit); - signal_add("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline); signal_add("event 670", (SIGNAL_FUNC) event_starttls); signal_add("event 451", (SIGNAL_FUNC) event_registerfirst); signal_add("server cap end", (SIGNAL_FUNC) event_capend); @@ -1258,7 +1238,6 @@ void irc_servers_deinit(void) signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_remove("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_remove("server quit", (SIGNAL_FUNC) sig_server_quit); - signal_remove("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline); signal_remove("event 670", (SIGNAL_FUNC) event_starttls); signal_remove("event 451", (SIGNAL_FUNC) event_registerfirst); signal_remove("server cap end", (SIGNAL_FUNC) event_capend); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 93fa02a45..903de7739 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -15,7 +15,6 @@ #define MAX_IRC_USER_TAGS_LEN 4094 #define CAP_LS_VERSION "302" -#define CAP_MAXLINE "oragono.io/maxline-2" #define CAP_MESSAGE_TAGS "message-tags" #define CAP_SASL "sasl" #define CAP_MULTI_PREFIX "multi-prefix" From 85eb4f118fca71daaf67c0c1440f169c164bd87f Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 8 Sep 2021 12:03:05 +0200 Subject: [PATCH 049/392] also remove from NEWS --- NEWS | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 87cd3cfde..7ed441953 100644 --- a/NEWS +++ b/NEWS @@ -136,9 +136,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui /SET show_account_notify to enable + Add support for IRCv3 invite-notify (#1094) + Add support for receiving IRCv3 message-tags (#576, #1090) - + Add support for sending IRCv3 message-tags (#1092) - + Add support for the oragono.io/maxline-2 CAP to increase IRC - protocol line length (#1092) + + Add support for sending IRCv3 message-tags (#1092, an#34) + Enable the znc.in/self-message CAP by default (#1123) + Add support for IRCv3 away-notify. /SET away_notify_public to enable (#1099, GL#33, #1105) From 27a73e253b66240d02d0738e38c6162765e27726 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 8 Sep 2021 12:04:18 +0200 Subject: [PATCH 050/392] duplicate issue in NEWS reported by @tobbez --- NEWS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 87cd3cfde..0515314fd 100644 --- a/NEWS +++ b/NEWS @@ -129,8 +129,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui join_extended_account, that theme writers need to take into account if desired. - + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33, - #1104, #1254) + + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33) + Add support for IRCv3 account-notify (#1100, #1098, GL#33, #1105, #1131). Credit to oss-fuzz /SET show_account_notify to enable From 42f749346b375ccd5e46527a21ff2e7192273f5f Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 8 Sep 2021 13:03:03 +0200 Subject: [PATCH 051/392] Merge pull request #34 from ailin-nemui/no-maxline remove oragono.io/maxline-2 (cherry picked from commit 7e1401140412361b813accd99aa367658435c12f) --- NEWS | 4 +--- src/irc/core/irc-servers.c | 21 --------------------- src/irc/core/irc-servers.h | 1 - 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/NEWS b/NEWS index b32827615..8be7531e1 100644 --- a/NEWS +++ b/NEWS @@ -134,9 +134,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui /SET show_account_notify to enable + Add support for IRCv3 invite-notify (#1094) + Add support for receiving IRCv3 message-tags (#576, #1090) - + Add support for sending IRCv3 message-tags (#1092) - + Add support for the oragono.io/maxline-2 CAP to increase IRC - protocol line length (#1092) + + Add support for sending IRCv3 message-tags (#1092, an#34) + Enable the znc.in/self-message CAP by default (#1123) + Add support for IRCv3 away-notify. /SET away_notify_public to enable (#1099, GL#33, #1105) diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 1c9f0cec6..664ca9a45 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -282,7 +282,6 @@ static void server_init_1(IRC_SERVER_REC *server) irc_cap_toggle(server, CAP_SASL, TRUE); } - irc_cap_toggle(server, CAP_MAXLINE, TRUE); irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE); irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE); irc_cap_toggle(server, CAP_SETNAME, TRUE); @@ -647,24 +646,6 @@ static void sig_server_quit(IRC_SERVER_REC *server, const char *msg) g_free(recoded); } -static void cap_maxline(IRC_SERVER_REC *server) -{ - unsigned int maxline = 0; - gboolean parse_successful = FALSE; - const char *maxline_str; - - maxline_str = g_hash_table_lookup(server->cap_supported, CAP_MAXLINE); - if (maxline_str != NULL) { - parse_successful = parse_uint(maxline_str, NULL, 10, &maxline); - - } - - if (parse_successful && - maxline >= MAX_IRC_MESSAGE_LEN + 2 /* 2 bytes for CR+LF */) { - server->max_message_len = maxline - 2; - } -} - void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const char *data) { char *recoded; @@ -1226,7 +1207,6 @@ void irc_servers_init(void) signal_add_first("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_add_last("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_add_last("server quit", (SIGNAL_FUNC) sig_server_quit); - signal_add("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline); signal_add("event 670", (SIGNAL_FUNC) event_starttls); signal_add("event 451", (SIGNAL_FUNC) event_registerfirst); signal_add("server cap end", (SIGNAL_FUNC) event_capend); @@ -1258,7 +1238,6 @@ void irc_servers_deinit(void) signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_remove("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_remove("server quit", (SIGNAL_FUNC) sig_server_quit); - signal_remove("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline); signal_remove("event 670", (SIGNAL_FUNC) event_starttls); signal_remove("event 451", (SIGNAL_FUNC) event_registerfirst); signal_remove("server cap end", (SIGNAL_FUNC) event_capend); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 93fa02a45..903de7739 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -15,7 +15,6 @@ #define MAX_IRC_USER_TAGS_LEN 4094 #define CAP_LS_VERSION "302" -#define CAP_MAXLINE "oragono.io/maxline-2" #define CAP_MESSAGE_TAGS "message-tags" #define CAP_SASL "sasl" #define CAP_MULTI_PREFIX "multi-prefix" From 0f3e95892de7e7a360336fcc9739e770916a9156 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 8 Sep 2021 13:03:14 +0200 Subject: [PATCH 052/392] Merge pull request #35 from ailin-nemui/fixes duplicate issue in NEWS (cherry picked from commit d3e105a3963cbc693ac316ae884b000902999828) --- NEWS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8be7531e1..ced7bcd51 100644 --- a/NEWS +++ b/NEWS @@ -127,8 +127,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui join_extended_account, that theme writers need to take into account if desired. - + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33, - #1104, #1254) + + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33) + Add support for IRCv3 account-notify (#1100, #1098, GL#33, #1105, #1131). Credit to oss-fuzz /SET show_account_notify to enable From 949dc06af3a023436712ba5e2a1f90641fd56d23 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 15 Sep 2021 17:48:27 +0200 Subject: [PATCH 053/392] correctly store updated message levels e.g. from /hilight --- src/fe-text/textbuffer-formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 20abc0dfb..50d6250a7 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -265,7 +265,7 @@ static void sig_gui_print_text_finished(WINDOW_REC *window, TEXT_DEST_REC *dest) info->meta = line_meta_create(dest->meta); - info->level |= MSGLEVEL_FORMAT; + info->level = dest->level | MSGLEVEL_FORMAT; /* the line will be inserted into the view with textbuffer_view_insert_line by gui-printtext.c:view_add_eol */ From 515e493db392a9e6944551a156e1780d653cd208 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 15 Sep 2021 17:52:44 +0200 Subject: [PATCH 054/392] update news --- NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f4a7a199b..1934dfbf1 100644 --- a/NEWS +++ b/NEWS @@ -4,9 +4,10 @@ v1.3.0-an 2021-09-05 Ailin Nemui * /SET resolve_reverse_lookup setting was removed (#1135) * Irssi will try to connect on IPv4 if IPv6 connection failed (#1146). By Shivaram Lingamneni + * The display system now renders formats on the fly (#1079, - #1188, #1191, #1192, #1204, #1205, #1209, an#13, an#14, an#28, - an#29) + #1188, #1191, #1192, #1204, #1205, #1209, #1349, an#13, + an#14, an#28, an#29, an#36) This major change will break scripts that try to modify printed text during "print text" signal (#1189). They need From 8b49cd012dc4af4040eb4ef03939e80072d40a5f Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 15 Sep 2021 17:56:45 +0200 Subject: [PATCH 055/392] Merge pull request #36 from ailin-nemui/missing-hilights correctly store updated message levels e.g. from /hilight (cherry picked from commit ad8221835c90969a6ba87807b072ba9f4d63bd48) --- NEWS | 5 +++-- src/fe-text/textbuffer-formats.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ced7bcd51..b7c62b93b 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,10 @@ v1.3.0-an 2021-09-05 Ailin Nemui * /SET resolve_reverse_lookup setting was removed (#1135) * Irssi will try to connect on IPv4 if IPv6 connection failed (#1146). By Shivaram Lingamneni + * The display system now renders formats on the fly (#1079, - #1188, #1191, #1192, #1204, #1205, #1209, an#13, an#14, an#28, - an#29) + #1188, #1191, #1192, #1204, #1205, #1209, #1349, an#13, + an#14, an#28, an#29, an#36) This major change will break scripts that try to modify printed text during "print text" signal (#1189). They need diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 20abc0dfb..50d6250a7 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -265,7 +265,7 @@ static void sig_gui_print_text_finished(WINDOW_REC *window, TEXT_DEST_REC *dest) info->meta = line_meta_create(dest->meta); - info->level |= MSGLEVEL_FORMAT; + info->level = dest->level | MSGLEVEL_FORMAT; /* the line will be inserted into the view with textbuffer_view_insert_line by gui-printtext.c:view_add_eol */ From bcea697e7c3eba1df2affdfd68f6c54f2bb0da06 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 19 Sep 2021 20:59:14 +0200 Subject: [PATCH 056/392] fix pedantic error in MSGLEVEL enum reported by horgh --- src/core/levels.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/levels.h b/src/core/levels.h index 04893b34d..7f1aa931a 100644 --- a/src/core/levels.h +++ b/src/core/levels.h @@ -42,7 +42,7 @@ enum { MSGLEVEL_HIDDEN = 0x10000000, /* Hidden from view */ MSGLEVEL_RESERVED1 = 0x20000000, MSGLEVEL_RESERVED2 = 0x40000000, - MSGLEVEL_FORMAT = 0x80000000 /* Format data */ + MSGLEVEL_FORMAT = (int)0x80000000 /* Format data */ }; /* clang-format on */ From df227eb0946aa4967613a26bba74fcaf96880a95 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 22 Sep 2021 10:50:20 +0200 Subject: [PATCH 057/392] update github actions ubuntu version to 18.04 and meson to <0.60.0 --- .github/workflows/check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 61de72ff3..97cb3feb6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,7 +18,7 @@ jobs: steps: - name: prepare required software run: | - sudo apt install $apt_build_deps $apt_build_deps_autotools + sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_autotools - uses: actions/checkout@main - name: make dist run: | @@ -38,18 +38,18 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-16.04, ubuntu-latest] + os: [ubuntu-18.04, ubuntu-latest] builder: [meson, configure] compiler: [clang, gcc] flags: [regular] include: - - os: ubuntu-16.04 + - os: ubuntu-18.04 builder: meson meson_ver: ==0.49.2 setuptools_ver: <51 - os: ubuntu-latest builder: meson - meson_ver: <0.59.0 + meson_ver: <0.60.0 - os: ubuntu-latest builder: meson flags: meson-latest FAILURE-OK @@ -64,7 +64,7 @@ jobs: meson_ver: ${{ matrix.meson_ver }} setuptools_ver: ${{ matrix.setuptools_ver }} run: | - sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }} + sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }} eval "$get_pip_build_deps_${{ matrix.builder }}" curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl - name: unpack archive From 32a3f4463c435304717883f810d222c0f79492a9 Mon Sep 17 00:00:00 2001 From: bw1 Date: Sun, 19 Sep 2021 19:56:14 +0200 Subject: [PATCH 058/392] update docs + version() + $abiversion + parse_special() --- docs/perl.txt | 6 ++++++ docs/special_vars.txt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docs/perl.txt b/docs/perl.txt index 761b2f4de..964f4f723 100644 --- a/docs/perl.txt +++ b/docs/perl.txt @@ -205,6 +205,12 @@ Window::command(cmd) Windowitem::command(cmd) Send a command `cmd' (in current channel). The '/' char isn't needed. +version() - return client release date and time (format YYYYMMDD.hhmm) + +parse_special(cmd, data="", flags=0) +Server::parse_special(cmd, data="", flags=0) +Windowitem::parse_special(cmd, data="", flags=0) + evaluate a string with special vars *** Themes diff --git a/docs/special_vars.txt b/docs/special_vars.txt index 36517f78b..1101c8a69 100644 --- a/docs/special_vars.txt +++ b/docs/special_vars.txt @@ -94,6 +94,8 @@ $A .. $Z is important. $winname window name $itemname like $T, but use item's visible_name which may be different (eg. $T = !12345chan, $itemname = !chan) + $abiversion IRSSI_ABI_VERSION + https://github.com/irssi/irssi/wiki/irssi_abi_version For example, assume you have the following alias: From 6a83eddf84573acd0d489dc2eb18796699494a23 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 21 Sep 2021 22:40:14 +0200 Subject: [PATCH 059/392] run syncdocs.sh and syncscripts.sh --- docs/faq.html | 4 +- docs/faq.txt | 6 +- docs/startup-HOWTO.html | 4 +- docs/startup-HOWTO.txt | 4 +- scripts/quitmsg.pl | 27 +++----- scripts/scriptassist.pl | 135 +++++++++++++++++++++++++--------------- 6 files changed, 102 insertions(+), 78 deletions(-) diff --git a/docs/faq.html b/docs/faq.html index 7c17f45dd..50b404a07 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -2,7 +2,7 @@

Frequently Asked Questions

Q: Why doesn’t irssi display colors even when ircii etc. displays them?

-

A: They force ANSI colors even if terminal doesn’t support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like xterm-color or color_xterm (eg. TERM=xterm-color irssi). If this doesn’t help, then use the evil way of /SET term_force_colors ON.

+

A: They force ANSI colors even if terminal doesn’t support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like xterm-256color or color_xterm (eg. TERM=xterm-256color irssi). If this doesn’t help, then use the evil way of /SET term_force_colors ON.

Q: How do I easily write text to channel that starts with ‘/’ character?

@@ -54,7 +54,7 @@

Q: How to make UTF-8 suppor

Q: Will there be /DETACH-like feature?

-

A: tmux, screen and dtach can be used to do it just fine.

+

A: tmux, screen and dtach can be used to do it just fine.

Q: How do I run scripts automatically at startup?

diff --git a/docs/faq.txt b/docs/faq.txt index 0d0b5f461..0fcc156aa 100644 --- a/docs/faq.txt +++ b/docs/faq.txt @@ -4,8 +4,8 @@ Q: Why doesn’t irssi display colors even when ircii etc. displays them? A: They force ANSI colors even if terminal doesn’t support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like - xterm-color or color_xterm (eg. TERM=xterm-color irssi). If this doesn’t help, - then use the evil way of /SET term_force_colors ON. + xterm-256color or color_xterm (eg. TERM=xterm-256color irssi). If this doesn’t + help, then use the evil way of /SET term_force_colors ON. Q: How do I easily write text to channel that starts with ‘/’ character? A: / /text @@ -119,6 +119,6 @@ A: Check [6]here [1] https://github.com/irssi-import/xirssi [2] https://tmux.github.io/ [3] https://www.gnu.org/software/screen/screen.html - [4] http://dtach.sf.net/ + [4] https://sourceforge.net/projects/dtach/ [5] https://dgl.cx/irssi/hack-whois-in-current-window.pl [6] https://irssi.org/assets/irssi.wav diff --git a/docs/startup-HOWTO.html b/docs/startup-HOWTO.html index b0c68f1f4..696dea4de 100644 --- a/docs/startup-HOWTO.html +++ b/docs/startup-HOWTO.html @@ -226,7 +226,7 @@

3. Server and channel automation

And finally channels:

-
/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet
+
/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet
 /CHANNEL ADD -auto #secret IRCnet password
 
@@ -395,7 +395,7 @@

9. Changing keyboard bindings

/HELP bind tells pretty much everything there is to know about keyboard bindings. However, there’s the problem of how to bind some non-standard keys. They might differ a bit with each terminal, so you’ll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in cat. Here’s an example for pressing F1 key:

-
 [user@host] ~% cat
+
 [cras@hurina] ~% cat
  ^[OP
 
diff --git a/docs/startup-HOWTO.txt b/docs/startup-HOWTO.txt index bff33108b..90d278de6 100644 --- a/docs/startup-HOWTO.txt +++ b/docs/startup-HOWTO.txt @@ -218,7 +218,7 @@ IRC network, other servers are automatically connected in same network if the And finally channels: -/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet +/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet /CHANNEL ADD -auto #secret IRCnet password -bots and -botcmd should be the only ones needing a bit of explaining. They’re @@ -442,7 +442,7 @@ They might differ a bit with each terminal, so you’ll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in cat. Here’s an example for pressing F1 key: - [user@host] ~% cat + [cras@hurina] ~% cat ^[OP So in irssi you would use /BIND ^[OP /ECHO F1 pressed. If you use multiple diff --git a/scripts/quitmsg.pl b/scripts/quitmsg.pl index e289468ca..102d9aa5c 100644 --- a/scripts/quitmsg.pl +++ b/scripts/quitmsg.pl @@ -6,36 +6,27 @@ use strict; use vars qw($VERSION %IRSSI); -$VERSION = "1.00"; +$VERSION = "1.01"; %IRSSI = ( authors => 'Timo Sirainen', name => 'quitmsg', description => 'Random quit messages', license => 'Public Domain', - changed => 'Sun Mar 10 23:18 EET 2002' + changed => 'Mon Jul 22 20:00 EET 2020' ); -my $quitfile = glob "~/.irssi/irssi.quit"; +my $quitfile = Irssi::get_irssi_dir() . "/irssi.quit"; sub cmd_quit { my ($data, $server, $channel) = @_; return if ($data ne ""); + + open (my $fh, "<", $quitfile) || return; + my @lines = <$fh>; - open (f, "<", $quitfile) || return; - my $lines = 0; while() { $lines++; }; - - my $line = int(rand($lines))+1; - - my $quitmsg; - seek(f, 0, 0); $. = 0; - while() { - next if ($. != $line); - - chomp; - $quitmsg = $_; - last; - } - close(f); + my $quitmsg = $lines[int(rand(@lines))]; + chomp($quitmsg); + close($fh); foreach my $server (Irssi::servers) { $server->command("/disconnect ".$server->{tag}." $quitmsg"); diff --git a/scripts/scriptassist.pl b/scripts/scriptassist.pl index 536ef33a1..cf02d57e0 100644 --- a/scripts/scriptassist.pl +++ b/scripts/scriptassist.pl @@ -5,7 +5,7 @@ use strict; -our $VERSION = '2003020807'; +our $VERSION = '2020042700'; our %IRSSI = ( authors => 'Stefan \'tommie\' Tomanek', contact => 'stefan@pico.ruhr.de', @@ -23,12 +23,15 @@ use CPAN::Meta::YAML; use LWP::UserAgent; use POSIX; +use version; # GnuPG is not always needed $have_gpg = 0; eval "use GnuPG qw(:algo :trust);"; $have_gpg = 1 if not ($@); +my $irssi_version = qv(Irssi::parse_special('v$J') =~ s/-.*//r); + sub show_help { my $help = "scriptassist $VERSION /scriptassist check @@ -39,15 +42,15 @@ sub show_help { Search the script database /scriptassist info Display information about -".#/scriptassist ratings -# Retrieve the average ratings of the the scripts -#/scriptassist top -# Retrieve the first top rated scripts -"/scriptassist new +/scriptassist ratings + Retrieve the average ratings of the the scripts +/scriptassist top + Retrieve the first top rated scripts +/scriptassist new Display the newest scripts -".#/scriptassist rate )?\s*(
\s*){0,3})}{\1\2}g;' +s{(\s*)?\s*((\r?\n)*\s*\s*)?(
\s*){0,3})}{\1\2}g; +s{}{}g; +s{(.*?)}{\1}g;' srcdir=`dirname "$0"` test -z "$srcdir" && srcdir=. @@ -45,6 +48,7 @@ else any=false fi +addheadermark="perl -p -e s{\\K}{(q:#:x\$1).q: :}ge;s{(?=)}{q: :.(q:#:x\$1)}ge" if type w3m >/dev/null 2>&1 ; then converter="w3m -o display_link_number=1 -dump -T text/html" any=true @@ -83,25 +87,33 @@ download_it() { mv "$3".tmp "$3" } -download_it "FAQ" "$faq" "$srcdir"/docs/faq.html -download_it "Startup How-To" "$howto" "$srcdir"/docs/startup-HOWTO.html -download_it "Design" "$design" "$srcdir"/docs/design.html +download_it_nested() { + name=$1; shift + src=$1; shift + dest=$1; shift + download_it "$name" "$src" "$dest".nest + echo > "$dest" + eval $(perl -n -0777 -e 'print qq{download_it "\$name ($2)" "\${src}$1/" "\${dest}.$1"; +cat "\${dest}.$1" >> "\${dest}.tmp"; +rm "\${dest}.$1";\n} + while(m{(.*?)}g)' "$dest".nest) + rm "$dest".nest + perl -i -0777 -p -e 's{}{}g;s{\A}{\n}' "$dest".tmp + mv "$dest".tmp "$dest" +} + +download_it_nested "QNA" "$qna" "$srcdir"/docs/qna.html +download_it "New users guide" "$howto" "$srcdir"/docs/New-users.html +#download_it "Design" "$design" "$srcdir"/docs/design.html # .html -> .txt with lynx or elinks -echo "Documentation: html -> txt..." - -cat "$srcdir"/docs/faq.html \ - | LC_ALL=en_IE.utf8 $converter \ - | perl -pe ' - s/^ *//; - if ($_ eq "\n" && $state eq "Q") { $_ = ""; } - elsif (/^([QA]):/) { $state = $1 } - elsif ($_ ne "\n") { $_ = " $_"; }; -' > "$srcdir"/docs/faq.txt - -cat "$srcdir"/docs/startup-HOWTO.html \ - | perl -pe "s/\\bhref=([\"\'])#.*?\\1//" \ - | LC_ALL=en_IE.utf8 $converter > "$srcdir"/docs/startup-HOWTO.txt - -cat "$srcdir"/docs/design.html \ - | LC_ALL=en_IE.utf8 $converter > "$srcdir"/docs/design.txt +echo "Documentation: html -> txt... [converter: $converter]" + +cat "$srcdir"/docs/qna.html \ + | $addheadermark | $converter > "$srcdir"/docs/qna.txt + +cat "$srcdir"/docs/New-users.html \ + | $addheadermark | $converter > "$srcdir"/docs/New-users.txt + +#cat "$srcdir"/docs/design.html \ +# | $addheadermark | $converter > "$srcdir"/docs/design.txt From d30cdafcffeb5c14a4afc2028a93d93d825fd0db Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 27 Dec 2025 22:41:02 +0100 Subject: [PATCH 378/392] github actions: update package lists --- .github/workflows/abicheck.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/abicheck.yml b/.github/workflows/abicheck.yml index d1387b828..254c64f9b 100644 --- a/.github/workflows/abicheck.yml +++ b/.github/workflows/abicheck.yml @@ -17,7 +17,7 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: prepare required software run: | - sudo apt install $apt_build_deps + sudo apt update; sudo apt install $apt_build_deps eval "$get_pip_build_deps" - name: checkout base ref uses: actions/checkout@main @@ -52,7 +52,7 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: prepare required software run: | - sudo apt install $apt_build_deps + sudo apt update; sudo apt install $apt_build_deps eval "$get_pip_build_deps" - name: checkout merge ref uses: actions/checkout@main @@ -87,7 +87,7 @@ jobs: steps: - name: prepare required software run: | - sudo apt install abigail-tools + sudo apt update; sudo apt install abigail-tools - name: fetch base build uses: actions/download-artifact@v4 with: From 51f2a4f7fb51f57fe32ce5bccdbb5ed6cd9013c3 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 27 Jul 2025 20:06:10 +0200 Subject: [PATCH 379/392] use GIO resolver change: rename resolve_prefer_ipv6 -> irssiproxy_prefer_ipv6 --- docs/help/in/toggle.in | 1 - docs/manual.txt | 3 - meson.build | 35 ++++-- src/common.h | 3 +- src/core/chat-commands.c | 9 +- src/core/net-nonblock.c | 110 ++++++---------- src/core/net-nonblock.h | 18 +-- src/core/network.c | 186 ++++++++++----------------- src/core/network.h | 30 ++--- src/core/server-connect-rec.h | 4 +- src/core/server-rec.h | 4 +- src/core/servers-reconnect.c | 11 +- src/core/servers-setup.c | 14 ++- src/core/servers.c | 188 +++++++++++++++------------- src/core/servers.h | 1 + src/fe-common/core/fe-common-core.c | 23 +++- src/irc/proxy/listen.c | 11 +- src/irc/proxy/proxy.c | 1 + 18 files changed, 313 insertions(+), 339 deletions(-) diff --git a/docs/help/in/toggle.in b/docs/help/in/toggle.in index f87a6462b..9469ba5c0 100644 --- a/docs/help/in/toggle.in +++ b/docs/help/in/toggle.in @@ -15,7 +15,6 @@ %9Examples:%9 - /TOGGLE resolve_prefer_ipv6 /TOGGLE channels_rejoin_unavailable ON %9See also:%9 SET diff --git a/docs/manual.txt b/docs/manual.txt index d55e362e6..073abe185 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -373,9 +373,6 @@ After connected to server, Irssi can automatically change your user mode. You can set it with /SET usermode , default is +i. - /SET resolve_prefer_ipv6 - If ON, prefer IPv6 for hosts that - have both v4 and v6 addresses. - 5.5 Automatic reconnecting If you get disconnected from server, Irssi will try to reconnect diff --git a/meson.build b/meson.build index 9499a1268..4f78600e8 100644 --- a/meson.build +++ b/meson.build @@ -8,6 +8,7 @@ project('irssi', 'c', glib_internal_version = 'glib-2.74.3' # keep this in sync with subprojects/glib.wrap glib_pcre2_internal_version = 'pcre2-10.40' +glib_libffi_internal_version = 'libffi' cc = meson.get_compiler('c') rootinc = include_directories('.') dep = [] @@ -217,11 +218,6 @@ if not glib_dep.found() prov_lib = cc.find_library('iconv', dirs : '/usr/local/lib') glib_internal_usr_local = true endif - if cc.has_function('libiconv_open', dependencies : prov_lib) - glib_internal_configure_args += '-Diconv=gnu' - else - glib_internal_configure_args += '-Diconv=native' - endif glib_internal_dependencies += prov_lib endif @@ -254,7 +250,7 @@ if not glib_dep.found() glib_internal_configure_t = custom_target('glib-internal-configure', command : [ meson_cmd, 'setup', '--prefix=/irssi-glib-internal', '--buildtype=' + get_option('buildtype'), - '-Dlibmount=disabled', '-Dselinux=disabled', '-Ddefault_library=static', '-Dforce_fallback_for=pcre2', + '-Dlibmount=disabled', '-Dselinux=disabled', '-Ddefault_library=static', '-Dforce_fallback_for=pcre2,libffi', glib_internal_configure_args, (meson.current_build_dir() / 'build-subprojects' / 'glib'), (meson.current_source_dir() / 'subprojects' / glib_internal_version) ], @@ -263,9 +259,13 @@ if not glib_dep.found() depends : glib_internal_download_t,) glib_internal_build_t = custom_target('glib-internal-build', command : [ ninja, '-C', meson.current_build_dir() / 'build-subprojects' / 'glib', + 'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a', 'subprojects' / glib_pcre2_internal_version / 'libpcre2-8.a', 'glib' / 'libglib-2.0.a', - 'gmodule' / 'libgmodule-2.0.a'], + 'gmodule' / 'libgmodule-2.0.a', + 'gobject' / 'libgobject-2.0.a', + 'gio' / 'libgio-2.0.a', + ], console : true, output : ['glib-internal-build'], depends : glib_internal_configure_t,) @@ -295,11 +295,32 @@ if not glib_dep.found() ], link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gmodule' / 'libgmodule-2.0.a' ], ) + gobject_dep = declare_dependency(sources : glib_internal_build_t, + compile_args : [ + '-isystem' + (meson.current_build_dir() / 'build-subprojects' / 'glib'), + ], + link_args : [ + meson.current_build_dir() / 'build-subprojects' / 'glib' / 'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a', + meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gobject' / 'libgobject-2.0.a' + ], + ) + gio_dep = declare_dependency(sources : glib_internal_build_t, + dependencies : cc.find_library('z'), + compile_args : [ + '-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gio'), + '-isystem' + (meson.current_build_dir() / 'build-subprojects' / 'glib'), + ], + link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gio' / 'libgio-2.0.a' ], + ) else gmodule_dep = dependency('gmodule-2.0', static : want_static_dependency, include_type : 'system') + gobject_dep = dependency('gobject-2.0', static : want_static_dependency, include_type : 'system') + gio_dep = dependency('gio-2.0', static : want_static_dependency, include_type : 'system') endif dep += glib_dep dep += gmodule_dep +dep += gobject_dep +dep += gio_dep if glib_internal and want_static_dependency and want_fuzzer openssl_proj = subproject('openssl', default_options : ['default_library=static', 'asm=disabled']) diff --git a/src/common.h b/src/common.h index e514f2791..06b63a150 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 56 +#define IRSSI_ABI_VERSION 57 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 @@ -38,6 +38,7 @@ #include #include +#include typedef guint64 uoff_t; #define PRIuUOFF_T G_GUINT64_FORMAT diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index 10da0d2c0..9e2b80e80 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -101,10 +101,11 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, host = g_hash_table_lookup(optlist, "host"); if (host != NULL && *host != '\0') { - IPADDR ip4, ip6; - - if (net_gethostbyname(host, &ip4, &ip6) == 0) - server_connect_own_ip_save(conn, &ip4, &ip6); + IPADDR ip4 = { 0 }; + IPADDR ip6 = { 0 }; + if (net_gethostbyname_first_ips(host, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT, &ip4, + &ip6) == 0) + server_connect_own_ip_save(conn, &ip4, &ip6); } cmd_params_free(free_arg); diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index 643884ee8..494d9894f 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -22,86 +22,54 @@ #include -#include +#include #include -/* nonblocking gethostbyname(), ip (IPADDR) + error (int, 0 = not error) is - written to pipe when found PID of the resolver child is returned */ -int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_lookup) -{ - RESOLVED_IP_REC rec; - const char *errorstr; - int pid; - - (void) reverse_lookup; /* Kept for API backward compatibility */ - - g_return_val_if_fail(addr != NULL, FALSE); - - pid = fork(); - if (pid > 0) { - /* parent */ - pidwait_add(pid); - return pid; - } +typedef struct { + NetGethostbynameContinuationFunc cont; + void *cont_data; +} NET_GETHOSTBYNAME_CALLBACK_DATA; - if (pid != 0) { - /* failed! */ - g_warning("net_connect_thread(): fork() failed! " - "Using blocking resolving"); - } - - /* child */ - srand(time(NULL)); - - memset(&rec, 0, sizeof(rec)); - rec.error = net_gethostbyname(addr, &rec.ip4, &rec.ip6); - if (rec.error == 0) { - errorstr = NULL; +static void net_gethostbyname_callback(GResolver *resolver, GAsyncResult *result, + NET_GETHOSTBYNAME_CALLBACK_DATA *data) +{ + /* GList */ + GList *ailist; + GError *error; + RESOLVED_IP_REC *iprec; + + error = NULL; + ailist = g_resolver_lookup_by_name_with_flags_finish(resolver, result, &error); + iprec = g_new0(RESOLVED_IP_REC, 1); + if (error != NULL) { + iprec->error = error; } else { - errorstr = net_gethosterror(rec.error); - rec.errlen = errorstr == NULL ? 0 : strlen(errorstr)+1; + iprec->ailist = ailist; } + g_object_unref(resolver); + resolved_ip_ref(iprec); - i_io_channel_write_block(pipe, &rec, sizeof(rec)); - if (rec.errlen != 0) - i_io_channel_write_block(pipe, (void *) errorstr, rec.errlen); - - if (pid == 0) - _exit(99); - - /* we used blocking lookup */ - return 0; + data->cont(iprec, data->cont_data); + g_free(data); } -/* get the resolved IP address */ -int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec) +/* nonblocking gethostbyname() */ +GCancellable *net_gethostbyname_nonblock(const char *addr, GResolverNameLookupFlags flags, + NetGethostbynameContinuationFunc cont, void *cont_data) { - rec->error = -1; - rec->errorstr = NULL; - - fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK); - - /* get ip+error */ - if (i_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1) { - rec->errorstr = g_strdup_printf("Host name lookup: %s", - g_strerror(errno)); - return -1; - } - - if (rec->error) { - /* read error string, if we can't read everything for some - reason, just ignore it. */ - rec->errorstr = g_malloc0(rec->errlen+1); - i_io_channel_read_block(pipe, rec->errorstr, rec->errlen); - } - - return 0; -} + GResolver *resolver; + GCancellable *cancellable; + NET_GETHOSTBYNAME_CALLBACK_DATA *data; -/* Kill the resolver child */ -void net_disconnect_nonblock(int pid) -{ - g_return_if_fail(pid > 0); + g_return_val_if_fail(addr != NULL, FALSE); - kill(pid, SIGKILL); + resolver = g_resolver_get_default(); + cancellable = g_cancellable_new(); + data = g_new0(NET_GETHOSTBYNAME_CALLBACK_DATA, 1); + data->cont = cont; + data->cont_data = cont_data; + g_resolver_lookup_by_name_with_flags_async(resolver, addr, flags, cancellable, + (GAsyncReadyCallback) net_gethostbyname_callback, + data); + return cancellable; } diff --git a/src/core/net-nonblock.h b/src/core/net-nonblock.h index c93dd9e3b..c4cb7824a 100644 --- a/src/core/net-nonblock.h +++ b/src/core/net-nonblock.h @@ -3,20 +3,10 @@ #include -typedef struct { - IPADDR ip4, ip6; /* resolved ip addresses */ - int error; /* error, 0 = no error, -1 = error: */ - int errlen; /* error text length */ - char *errorstr; /* error string - dynamically allocated, you'll - need to free() it yourself unless it's NULL */ -} RESOLVED_IP_REC; +typedef void (*NetGethostbynameContinuationFunc)(RESOLVED_IP_REC *, void *); -/* nonblocking gethostbyname(), PID of the resolver child is returned. */ -int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_lookup); -/* get the resolved IP address. returns -1 if some error occurred with read() */ -int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec); - -/* Kill the resolver child */ -void net_disconnect_nonblock(int pid); +/* nonblocking gethostbyname(), Cancellable of the resolver child is returned. */ +GCancellable *net_gethostbyname_nonblock(const char *addr, GResolverNameLookupFlags flags, + NetGethostbynameContinuationFunc cont, void *cont_data); #endif diff --git a/src/core/network.c b/src/core/network.c index fa70d62ad..c763a7c69 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -81,27 +81,6 @@ int i_io_channel_read_block(GIOChannel *channel, void *data, int len) return received < len ? -1 : 0; } -IPADDR ip4_any = { - AF_INET, -#if defined(IN6ADDR_ANY_INIT) - IN6ADDR_ANY_INIT -#else - { INADDR_ANY } -#endif -}; - -int net_ip_compare(IPADDR *ip1, IPADDR *ip2) -{ - if (ip1->family != ip2->family) - return 0; - - if (ip1->family == AF_INET6) - return memcmp(&ip1->ip, &ip2->ip, sizeof(ip1->ip)) == 0; - - return memcmp(&ip1->ip, &ip2->ip, 4) == 0; -} - - static void sin_set_ip(union sockaddr_union *so, const IPADDR *ip) { if (ip == NULL) { @@ -392,95 +371,87 @@ int net_getsockname(GIOChannel *handle, IPADDR *addr, int *port) return 0; } -/* Get IP addresses for host, both IPv4 and IPv6 if possible. - If ip->family is 0, the address wasn't found. - Returns 0 = ok, others = error code for net_gethosterror() */ -int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) +void resolved_ip_ref(RESOLVED_IP_REC *iprec) { - union sockaddr_union *so; - struct addrinfo hints, *ai, *ailist; - int ret, count_v4, count_v6, use_v4, use_v6; - -#ifdef HAVE_CAPSICUM - if (capsicum_enabled()) - return (capsicum_net_gethostbyname(addr, ip4, ip6)); -#endif - - g_return_val_if_fail(addr != NULL, -1); + iprec->refcount++; +} - memset(ip4, 0, sizeof(IPADDR)); - memset(ip6, 0, sizeof(IPADDR)); - - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_ADDRCONFIG; - - /* save error to host_error for later use */ - ret = getaddrinfo(addr, NULL, &hints, &ailist); - if (ret != 0) - return ret; - - /* count IPs */ - count_v4 = count_v6 = 0; - for (ai = ailist; ai != NULL; ai = ai->ai_next) { - if (ai->ai_family == AF_INET) - count_v4++; - else if (ai->ai_family == AF_INET6) - count_v6++; +int resolved_ip_unref(RESOLVED_IP_REC *iprec) +{ + if (--iprec->refcount > 0) { + return TRUE; } - if (count_v4 == 0 && count_v6 == 0) - return EAI_NONAME; /* shouldn't happen? */ - - /* if there are multiple addresses, return random one */ - use_v4 = count_v4 <= 1 ? 0 : rand() % count_v4; - use_v6 = count_v6 <= 1 ? 0 : rand() % count_v6; - - count_v4 = count_v6 = 0; - for (ai = ailist; ai != NULL; ai = ai->ai_next) { - so = (union sockaddr_union *) ai->ai_addr; - - if (ai->ai_family == AF_INET) { - if (use_v4 == count_v4) - sin_get_ip(so, ip4); - count_v4++; - } else if (ai->ai_family == AF_INET6) { - if (use_v6 == count_v6) - sin_get_ip(so, ip6); - count_v6++; - } + g_resolver_free_addresses(iprec->ailist); + if (iprec->error != NULL) { + g_error_free(iprec->error); } - freeaddrinfo(ailist); - return 0; + g_free(iprec); + + return FALSE; } -/* Get name for host, *name should be g_free()'d unless it's NULL. - Return values are the same as with net_gethostbyname() */ -int net_gethostbyaddr(IPADDR *ip, char **name) +/* Get IP addresses for host, both IPv4 and IPv6 if possible. */ +static RESOLVED_IP_REC *net_gethostbyname(const char *addr, GResolverNameLookupFlags flags) { - union sockaddr_union so; - int host_error; - char hostname[NI_MAXHOST]; + /* GList */ + GList *ailist; + GError *error; + GResolver *resolver; + RESOLVED_IP_REC *iprec; - g_return_val_if_fail(ip != NULL, -1); - g_return_val_if_fail(name != NULL, -1); +#ifdef HAVE_CAPSICUM + if (capsicum_enabled()) + return (capsicum_net_gethostbyname(addr, flags)); +#endif - *name = NULL; + g_return_val_if_fail(addr != NULL, NULL); - memset(&so, 0, sizeof(so)); - sin_set_ip(&so, ip); + error = NULL; + resolver = g_resolver_get_default(); + ailist = g_resolver_lookup_by_name_with_flags(resolver, addr, flags, NULL, &error); + iprec = g_new0(RESOLVED_IP_REC, 1); + if (error != NULL) { + iprec->error = error; + } else { + iprec->ailist = ailist; + } + g_object_unref(resolver); + resolved_ip_ref(iprec); - /* save error to host_error for later use */ - host_error = getnameinfo((struct sockaddr *)&so, sizeof(so), - hostname, sizeof(hostname), - NULL, 0, - NI_NAMEREQD); - if (host_error != 0) - return host_error; + return iprec; +} - *name = g_strdup(hostname); +int net_gethostbyname_first_ips(const char *addr, GResolverNameLookupFlags flags, IPADDR *ip4, + IPADDR *ip6) +{ + RESOLVED_IP_REC *iprec; + + iprec = net_gethostbyname(addr, flags); + if (iprec->error == NULL) { + GList *curr; + + for (curr = iprec->ailist; curr->next; curr = curr->next) { + unsigned short family; + GInetAddress *addr; + + addr = curr->data; + family = g_inet_address_get_family(addr); + if (ip4->family == 0 && family == AF_INET) { + ip4->family = AF_INET; + memcpy(&ip4->ip, g_inet_address_to_bytes(addr), sizeof(ip4->ip)); + } else if (ip6->family == 0 && family == AF_INET6) { + ip6->family = AF_INET6; + memcpy(&ip6->ip, g_inet_address_to_bytes(addr), sizeof(ip6->ip)); + } + } - return 0; + resolved_ip_unref(iprec); + return 0; + } else { + resolved_ip_unref(iprec); + return -1; + } } int net_ip2host(IPADDR *ip, char *host) @@ -519,29 +490,6 @@ int net_geterror(GIOChannel *handle) return data; } -/* get error of net_gethostname() */ -const char *net_gethosterror(int error) -{ - g_return_val_if_fail(error != 0, NULL); - - if (error == EAI_SYSTEM) { - return strerror(errno); - } else { - return gai_strerror(error); - } -} - -/* return TRUE if host lookup failed because it didn't exist (ie. not - some error with name server) */ -int net_hosterror_notfound(int error) -{ -#ifdef EAI_NODATA /* NODATA is deprecated */ - return error != 1 && (error == EAI_NONAME || error == EAI_NODATA); -#else - return error != 1 && (error == EAI_NONAME); -#endif -} - /* Get name of TCP service */ char *net_getservbyport(int port) { diff --git a/src/core/network.h b/src/core/network.h index 5cd85ccca..647cd8c7a 100644 --- a/src/core/network.h +++ b/src/core/network.h @@ -6,6 +6,7 @@ #include #include #include +#include #ifndef AF_INET6 # ifdef PF_INET6 @@ -20,6 +21,13 @@ struct _IPADDR { struct in6_addr ip; }; +typedef struct { + int refcount; + /* GList */ + GList *ailist; /* needs to be freed */ + GError *error; /* needs to be freed */ +} RESOLVED_IP_REC; + /* maxmimum string length of IP address */ #define MAX_IP_LEN INET6_ADDRSTRLEN @@ -29,9 +37,7 @@ extern IPADDR ip4_any; GIOChannel *i_io_channel_new(int handle); -/* Returns 1 if IPADDRs are the same. */ -/* Deprecated since it is unused. It will be deleted in a later release. */ -int net_ip_compare(IPADDR *ip1, IPADDR *ip2) G_GNUC_DEPRECATED; +/* OTR */ int i_io_channel_write_block(GIOChannel *channel, void *data, int len); int i_io_channel_read_block(GIOChannel *channel, void *data, int len); @@ -60,18 +66,9 @@ int net_receive(GIOChannel *handle, char *buf, int len); /* Transmit data, return number of bytes sent, -1 = error */ int net_transmit(GIOChannel *handle, const char *data, int len); -/* Get IP addresses for host, both IPv4 and IPv6 if possible. - If ip->family is 0, the address wasn't found. - Returns 0 = ok, others = error code for net_gethosterror() */ -int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6); -/* Get name for host, *name should be g_free()'d unless it's NULL. - Return values are the same as with net_gethostbyname() */ -int net_gethostbyaddr(IPADDR *ip, char **name); -/* get error of net_gethostname() */ -const char *net_gethosterror(int error); -/* return TRUE if host lookup failed because it didn't exist (ie. not - some error with name server) */ -int net_hosterror_notfound(int error); +/* Get the first IP address for host, both IPv4 and IPv6 if possible. */ +int net_gethostbyname_first_ips(const char *addr, GResolverNameLookupFlags flags, IPADDR *ip4, + IPADDR *ip6); /* Get socket address/port */ int net_getsockname(GIOChannel *handle, IPADDR *addr, int *port); @@ -90,4 +87,7 @@ char *net_getservbyport(int port); int is_ipv4_address(const char *host); int is_ipv6_address(const char *host); +void resolved_ip_ref(RESOLVED_IP_REC *iprec); +int resolved_ip_unref(RESOLVED_IP_REC *iprec); + #endif diff --git a/src/core/server-connect-rec.h b/src/core/server-connect-rec.h index 16513109b..de1f06df1 100644 --- a/src/core/server-connect-rec.h +++ b/src/core/server-connect-rec.h @@ -45,6 +45,8 @@ unsigned int unix_socket:1; /* Connect using named unix socket */ unsigned int use_tls:1; /* this connection uses TLS */ unsigned int tls_verify:1; unsigned int no_connect:1; /* don't connect() at all, it's done by plugin */ -unsigned short last_failed_family; /* #641: if we failed to connect to ipv6, try ipv4 and vice versa */ +int last_connected; +int last_failed; +RESOLVED_IP_REC *resolved_host; char *channels; char *away_reason; diff --git a/src/core/server-rec.h b/src/core/server-rec.h index 6c7c63e35..e43245a70 100644 --- a/src/core/server-rec.h +++ b/src/core/server-rec.h @@ -21,10 +21,8 @@ unsigned int no_reconnect:1; /* Don't reconnect to server */ NET_SENDBUF_REC *handle; int readtag; /* input tag */ -/* for net_gethostbyname_return() */ -GIOChannel *connect_pipe[2]; +GCancellable *connect_cancellable; int connect_tag; -int connect_pid; RAWLOG_REC *rawlog; GHashTable *module_data; diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index a9d9422b7..64af62878 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -120,6 +120,10 @@ static int server_reconnect_timeout(void) if (server->connect_tag != -1) { g_source_remove(server->connect_tag); server->connect_tag = -1; + } else if (server->connect_cancellable != NULL) { + g_cancellable_cancel(server->connect_cancellable); + g_object_unref(server->connect_cancellable); + server->connect_cancellable = NULL; } server->connection_lost = TRUE; server_connect_failed(server, "Timeout"); @@ -168,7 +172,8 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info) server_connect_ref(dest); dest->type = module_get_uniq_id("SERVER CONNECT", 0); dest->reconnection = src->reconnection; - dest->last_failed_family = src->last_failed_family; + dest->last_connected = src->last_connected; + dest->last_failed = src->last_failed; dest->proxy = g_strdup(src->proxy); dest->proxy_port = src->proxy_port; dest->proxy_string = g_strdup(src->proxy_string); @@ -207,6 +212,10 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info) dest->own_ip6 = g_new(IPADDR, 1); memcpy(dest->own_ip6, src->own_ip6, sizeof(IPADDR)); } + dest->resolved_host = src->resolved_host; + if (dest->resolved_host != NULL) { + resolved_ip_ref(dest->resolved_host); + } dest->channels = g_strdup(src->channels); dest->away_reason = g_strdup(src->away_reason); diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index ff3d65848..972063285 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -58,7 +58,8 @@ static void save_ips(IPADDR *ip4, IPADDR *ip6, static void get_source_host_ip(void) { const char *hostname; - IPADDR ip4, ip6; + IPADDR ip4 = { 0 }; + IPADDR ip6 = { 0 }; if (source_host_ok) return; @@ -66,7 +67,8 @@ static void get_source_host_ip(void) /* FIXME: This will block! */ hostname = settings_get_str("hostname"); source_host_ok = *hostname != '\0' && - net_gethostbyname(hostname, &ip4, &ip6) == 0; + net_gethostbyname_first_ips(hostname, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT, + &ip4, &ip6) == 0; if (source_host_ok) save_ips(&ip4, &ip6, &source_host_ip4, &source_host_ip6); @@ -79,12 +81,14 @@ static void get_source_host_ip(void) static void conn_set_ip(SERVER_CONNECT_REC *conn, const char *own_host, IPADDR **own_ip4, IPADDR **own_ip6) { - IPADDR ip4, ip6; + IPADDR ip4 = { 0 }; + IPADDR ip6 = { 0 }; if (*own_ip4 == NULL && *own_ip6 == NULL) { /* resolve the IP */ - if (net_gethostbyname(own_host, &ip4, &ip6) == 0) - save_ips(&ip4, &ip6, own_ip4, own_ip6); + if (net_gethostbyname_first_ips(own_host, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT, + &ip4, &ip6) == 0) + save_ips(&ip4, &ip6, own_ip4, own_ip6); } server_connect_own_ip_save(conn, *own_ip4, *own_ip6); diff --git a/src/core/servers.c b/src/core/servers.c index 811081e8b..e62f09ec3 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -51,20 +51,16 @@ void server_connect_failed(SERVER_REC *server, const char *msg) g_source_remove(server->connect_tag); server->connect_tag = -1; } + if (server->connect_cancellable != NULL) { + g_cancellable_cancel(server->connect_cancellable); + g_object_unref(server->connect_cancellable); + server->connect_cancellable = NULL; + } if (server->handle != NULL) { net_sendbuffer_destroy(server->handle, TRUE); server->handle = NULL; } - if (server->connect_pipe[0] != NULL) { - g_io_channel_shutdown(server->connect_pipe[0], TRUE, NULL); - g_io_channel_unref(server->connect_pipe[0]); - g_io_channel_shutdown(server->connect_pipe[1], TRUE, NULL); - g_io_channel_unref(server->connect_pipe[1]); - server->connect_pipe[0] = NULL; - server->connect_pipe[1] = NULL; - } - server_unref(server); } @@ -156,7 +152,7 @@ static void server_connect_callback_init(SERVER_REC *server, GIOChannel *handle) error = net_geterror(handle); if (error != 0) { server->connection_lost = TRUE; - server->connrec->last_failed_family = server->connrec->chosen_family; + server->connrec->last_failed = server->connrec->last_connected; server_connect_failed(server, g_strerror(error)); return; } @@ -177,7 +173,7 @@ static void server_connect_callback_init_ssl(SERVER_REC *server, GIOChannel *han error = irssi_ssl_handshake(handle); if (error == -1) { server->connection_lost = TRUE; - server->connrec->last_failed_family = server->connrec->chosen_family; + server->connrec->last_failed = server->connrec->last_connected; server_connect_failed(server, NULL); return; } @@ -259,12 +255,12 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip, server->connection_lost = TRUE; if (ip != NULL) { - server->connrec->last_failed_family = ip->family; + server->connrec->last_failed = server->connrec->last_connected; } server_connect_failed(server, errmsg2 ? errmsg2 : errmsg); g_free(errmsg2); } else { - server->connrec->last_failed_family = 0; + server->connrec->last_failed = 0; if (!server->connrec->use_tls) server->handle = net_sendbuffer_create(handle, 0); if (server->connrec->use_tls) @@ -276,48 +272,47 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip, } } -static void server_connect_callback_readpipe(SERVER_REC *server) +static int server_start_connect_resolve(SERVER_REC *server); + +static void server_connect_use_resolved(SERVER_REC *server) { - RESOLVED_IP_REC iprec; - IPADDR *ip; + IPADDR *ip; const char *errormsg; + RESOLVED_IP_REC *iprec = server->connrec->resolved_host; - g_source_remove(server->connect_tag); - server->connect_tag = -1; - - net_gethostbyname_return(server->connect_pipe[0], &iprec); - - g_io_channel_shutdown(server->connect_pipe[0], TRUE, NULL); - g_io_channel_unref(server->connect_pipe[0]); - g_io_channel_shutdown(server->connect_pipe[1], TRUE, NULL); - g_io_channel_unref(server->connect_pipe[1]); - - server->connect_pipe[0] = NULL; - server->connect_pipe[1] = NULL; - - /* figure out if we should use IPv4 or v6 address */ - if (iprec.error != 0) { - /* error */ + if (iprec->error != NULL) { + /* error */ ip = NULL; - } else if (server->connrec->family == AF_INET) { - /* force IPv4 connection */ - ip = iprec.ip4.family == 0 ? NULL : &iprec.ip4; - } else if (server->connrec->family == AF_INET6) { - /* force IPv6 connection */ - ip = iprec.ip6.family == 0 ? NULL : &iprec.ip6; } else { - /* pick the one that was found. if both were found: - 1. disprefer the last one that failed - 2. prefer ipv4 over ipv6 unless resolve_prefer_ipv6 is set - */ - if (iprec.ip4.family == 0 || - (iprec.ip6.family != 0 && - (server->connrec->last_failed_family == AF_INET || - (settings_get_bool("resolve_prefer_ipv6") && - server->connrec->last_failed_family != AF_INET6)))) { - ip = &iprec.ip6; + GList *curr; + int i; + + curr = iprec->ailist; + i = 0; + while (i < server->connrec->last_failed) { + if (curr != NULL) { + curr = curr->next; + i++; + } + /* curr is different now */ + if (curr == NULL) { + resolved_ip_unref(server->connrec->resolved_host); + server->connrec->resolved_host = NULL; + server->connrec->last_failed = 0; + /* retry resolve */ + server_start_connect_resolve(server); + return; + } + } + if (curr != NULL) { + GInetAddress *addr; + addr = curr->data; + server->connrec->last_connected = i + 1; + ip = g_new0(IPADDR, 1); + ip->family = g_inet_address_get_family(addr); + memcpy(&ip->ip, g_inet_address_to_bytes(addr), sizeof(ip->ip)); } else { - ip = &iprec.ip4; + ip = NULL; } } @@ -326,28 +321,63 @@ static void server_connect_callback_readpipe(SERVER_REC *server) server_real_connect(server, ip, NULL); errormsg = NULL; } else { - if (iprec.error == 0 || net_hosterror_notfound(iprec.error)) { + if (iprec->error->code == G_RESOLVER_ERROR_NOT_FOUND) { /* IP wasn't found for the host, don't try to reconnect back to this server */ server->dns_error = TRUE; } - if (iprec.error == 0) { - /* forced IPv4 or IPv6 address but it wasn't found */ - errormsg = server->connrec->family == AF_INET ? - "IPv4 address not found for host" : - "IPv6 address not found for host"; - } else { - /* gethostbyname() failed */ - errormsg = iprec.errorstr != NULL ? iprec.errorstr : - "Host lookup failed"; - } + errormsg = iprec->error->message; + if (errormsg == NULL) + errormsg = "Host lookup failed"; server->connection_lost = TRUE; + /* clear the error in resolved_host */ + server->connrec->resolved_host = NULL; server_connect_failed(server, errormsg); + + resolved_ip_unref(iprec); + } +} + +static void server_connect_callback_resolved(RESOLVED_IP_REC *iprec, SERVER_REC *server) +{ + server->connect_cancellable = NULL; + + if (server->connrec->resolved_host != NULL) { + resolved_ip_unref(server->connrec->resolved_host); + } + server->connrec->resolved_host = iprec; + if (iprec->error == NULL && iprec->ailist == NULL) { + server->connection_lost = TRUE; + server->dns_error = TRUE; + server_connect_failed(server, "Host lookup failed"); + } else { + server_connect_use_resolved(server); } +} + +static int server_start_connect_resolve(SERVER_REC *server) +{ + const char *connect_address; + GResolverNameLookupFlags net_gethostbyname_flags; - g_free(iprec.errorstr); + connect_address = + server->connrec->proxy != NULL ? server->connrec->proxy : server->connrec->address; + net_gethostbyname_flags = G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT; + if (server->connrec->family == AF_INET) { + net_gethostbyname_flags = G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY; + } else if (server->connrec->family == AF_INET6) { + net_gethostbyname_flags = G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY; + } + if (server->connrec->resolved_host == NULL) { + server->connect_cancellable = net_gethostbyname_nonblock( + connect_address, net_gethostbyname_flags, + (NetGethostbynameContinuationFunc) server_connect_callback_resolved, server); + return FALSE; + } else { + return TRUE; + } } SERVER_REC *server_connect(SERVER_CONNECT_REC *conn) @@ -399,9 +429,6 @@ void server_connect_init(SERVER_REC *server) /* starts connecting to server */ int server_start_connect(SERVER_REC *server) { - const char *connect_address; - int fd[2]; - g_return_val_if_fail(server != NULL, FALSE); if (!server->connrec->unix_socket && server->connrec->port <= 0) return FALSE; @@ -419,30 +446,17 @@ int server_start_connect(SERVER_REC *server) /* connect with unix socket */ server_real_connect(server, NULL, server->connrec->address); } else { + int already_resolved; /* resolve host name */ - if (pipe(fd) != 0) { - g_warning("server_connect(): pipe() failed."); - g_free(server->tag); - g_free(server->nick); - return FALSE; - } - - server->connect_pipe[0] = i_io_channel_new(fd[0]); - server->connect_pipe[1] = i_io_channel_new(fd[1]); - - connect_address = server->connrec->proxy != NULL ? - server->connrec->proxy : server->connrec->address; - server->connect_pid = - net_gethostbyname_nonblock(connect_address, - server->connect_pipe[1], 0); - server->connect_tag = - i_input_add(server->connect_pipe[0], I_INPUT_READ, - (GInputFunction) server_connect_callback_readpipe, server); + already_resolved = server_start_connect_resolve(server); server->connect_time = time(NULL); lookup_servers = g_slist_append(lookup_servers, server); signal_emit("server looking", 1, server); + if (already_resolved) { + server_connect_use_resolved(server); + } } return TRUE; } @@ -481,8 +495,9 @@ void server_disconnect(SERVER_REC *server) if (server->connect_tag != -1) { /* still connecting to server.. */ - if (server->connect_pid != -1) - net_disconnect_nonblock(server->connect_pid); + server_connect_failed(server, NULL); + return; + } else if (server->connect_cancellable != NULL) { server_connect_failed(server, NULL); return; } @@ -649,6 +664,10 @@ void server_connect_unref(SERVER_CONNECT_REC *conn) g_free_not_null(conn->own_ip4); g_free_not_null(conn->own_ip6); + if (conn->resolved_host != NULL) { + resolved_ip_unref(conn->resolved_host); + } + g_free_not_null(conn->password); g_free_not_null(conn->nick); g_free_not_null(conn->username); @@ -769,7 +788,6 @@ static void sig_chat_protocol_deinit(CHAT_PROTOCOL_REC *proto) void servers_init(void) { - settings_add_bool("server", "resolve_prefer_ipv6", TRUE); lookup_servers = servers = NULL; signal_add("chat protocol deinit", (SIGNAL_FUNC) sig_chat_protocol_deinit); diff --git a/src/core/servers.h b/src/core/servers.h index d52603ebf..5e5a7fd29 100644 --- a/src/core/servers.h +++ b/src/core/servers.h @@ -2,6 +2,7 @@ #define IRSSI_CORE_SERVERS_H #include +#include /* Returns SERVER_REC if it's server, NULL if it isn't. */ #define SERVER(server) \ diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index 9724354f1..06240d5c7 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -166,7 +166,7 @@ void fe_common_core_init(void) settings_add_bool("lookandfeel", "use_msgs_window", FALSE); g_get_charset(&str); settings_add_str("lookandfeel", "term_charset", str); - settings_add_str("lookandfeel", "glib_log_domains", "all"); + settings_add_str("lookandfeel", "glib_log_domains", "all -glib-gio:debug"); themes_init(); theme_register(fecommon_core_formats); @@ -258,13 +258,19 @@ void fe_common_core_deinit(void) g_log_set_default_handler(logger_old, NULL); } -static gboolean glib_domain_wanted(const char *domain) +static gboolean glib_domain_wanted(const char *domain, const char *level) { const char *domains; char *c, *cur; int len = 0; int print_it = 0; /* -1 for exclude, 0 for undecided, 1 for include */ int incl; + char *domainlevel, *alllevel, *starlevel, *domainstar; + + domainlevel = g_strdup_printf("%s:%s", domain, level); + alllevel = g_strdup_printf("all:%s", level); + starlevel = g_strdup_printf("*:%s", level); + domainstar = g_strdup_printf("%s:*", domain); /* Go through each item in glib_log_domains setting to determine whether * or not we want to print message from this domain */ @@ -287,8 +293,10 @@ static gboolean glib_domain_wanted(const char *domain) } /* If we got a valid item, process it */ - if (len > 0 && (!strncmp(domain, c, len) || !strncasecmp("all", c, len) || - !strncmp("*", c, len))) + if (len > 0 && (!strncasecmp(domain, c, len) || !strncasecmp("all", c, len) || + !strncmp("*", c, len) || !strncasecmp(domainstar, c, len) || + !strncasecmp(domainlevel, c, len) || + !strncasecmp(alllevel, c, len) || !strncasecmp(starlevel, c, len))) print_it = incl; /* Go past any spaces towards the next item */ @@ -300,6 +308,11 @@ static gboolean glib_domain_wanted(const char *domain) len = 0; } while (*c != '\0' && print_it != -1); + g_free(domainlevel); + g_free(alllevel); + g_free(starlevel); + g_free(domainstar); + return (print_it == 1); } @@ -333,7 +346,7 @@ static void i_log_func(const char *log_domain, GLogLevelFlags log_level, const c domain = (log_domain ? log_domain : "default"); /* Only print the message if we decided to */ - if (!glib_domain_wanted(domain)) + if (!glib_domain_wanted(domain, reason)) return; if (windows == NULL) diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index 19aba87df..1fed639ef 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -711,16 +711,19 @@ static void add_listen(const char *ircnet, int port, const char *port_or_path) /* bind to specific host/ip? */ my_ip = NULL; if (*settings_get_str("irssiproxy_bind") != '\0') { - if (net_gethostbyname(settings_get_str("irssiproxy_bind"), - &ip4, &ip6) != 0) { + if (net_gethostbyname_first_ips(settings_get_str("irssiproxy_bind"), + G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT, &ip4, + &ip6) != 0) { printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Proxy: can not resolve '%s' - aborting", settings_get_str("irssiproxy_bind")); return; } - my_ip = ip6.family == 0 ? &ip4 : ip4.family == 0 || - settings_get_bool("resolve_prefer_ipv6") ? &ip6 : &ip4; + my_ip = ip6.family == 0 ? &ip4 : + ip4.family == 0 || settings_get_bool("irssiproxy_prefer_ipv6") ? + &ip6 : + &ip4; } handle = net_listen(my_ip, &port); } diff --git a/src/irc/proxy/proxy.c b/src/irc/proxy/proxy.c index d32b6009a..240df971a 100644 --- a/src/irc/proxy/proxy.c +++ b/src/irc/proxy/proxy.c @@ -74,6 +74,7 @@ static void irc_proxy_setup_changed(void) void irc_proxy_init(void) { + settings_add_bool("irssiproxy", "irssiproxy_prefer_ipv6", TRUE); settings_add_str("irssiproxy", "irssiproxy_ports", ""); settings_add_str("irssiproxy", "irssiproxy_password", ""); settings_add_str("irssiproxy", "irssiproxy_bind", ""); From e64ed836a5a62ab1e398bd0ca7b6e7070df82939 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 27 Jul 2025 21:16:06 +0200 Subject: [PATCH 380/392] up glib wrap --- meson.build | 2 +- subprojects/glib.wrap | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 4f78600e8..c7eed79d9 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project('irssi', 'c', ############################ ############################ -glib_internal_version = 'glib-2.74.3' # keep this in sync with subprojects/glib.wrap +glib_internal_version = 'glib-2.74.7' # keep this in sync with subprojects/glib.wrap glib_pcre2_internal_version = 'pcre2-10.40' glib_libffi_internal_version = 'libffi' cc = meson.get_compiler('c') diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap index 5e50e9a56..e6c649fc3 100644 --- a/subprojects/glib.wrap +++ b/subprojects/glib.wrap @@ -1,6 +1,6 @@ [wrap-file] # make sure to update the glib_internal_version in meson.build -directory = glib-2.74.3 -source_url = https://download.gnome.org/sources/glib/2.74/glib-2.74.3.tar.xz -source_filename = glib-2.74.3.tar.xz -source_hash = e9bc41ecd9690d9bc6a970cc7380119b828e5b6a4b16c393c638b3dc2b87cbcb +directory = glib-2.74.7 +source_url = https://download.gnome.org/sources/glib/2.74/glib-2.74.7.tar.xz +source_filename = glib-2.74.7.tar.xz +source_hash = 196ab86c27127a61b7a70c3ba6af7b97bdc01c07cd3b21abd5e778b955eccb1b From c6d15ee461569ef821ea8b7cff85ddc83da6e42d Mon Sep 17 00:00:00 2001 From: nikolas Date: Thu, 12 Jun 2025 20:53:18 -0400 Subject: [PATCH 381/392] Add a few more compile dependencies to INSTALL document --- INSTALL | 3 +++ 1 file changed, 3 insertions(+) diff --git a/INSTALL b/INSTALL index ed5a14a37..ac7c419fe 100644 --- a/INSTALL +++ b/INSTALL @@ -9,7 +9,10 @@ To compile Irssi you need: - glib-2.32 or greater - openssl (for ssl support) - perl-5.8 or greater (for building, and optionally Perl scripts) + (n.b a complete perl is needed, including ExtUtils::Embed and xsubpp) - terminfo or ncurses (for text frontend) +- utf8proc (optional, for additional char width calculation) +- libgcrypt (for OTR) For most people, this should work just fine: From 51322d6af121c0394becf96189244428302df7cd Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 13:53:23 +0100 Subject: [PATCH 382/392] restore ip4_any --- src/core/network.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/network.c b/src/core/network.c index c763a7c69..8dd5cf9d7 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -81,6 +81,14 @@ int i_io_channel_read_block(GIOChannel *channel, void *data, int len) return received < len ? -1 : 0; } +IPADDR ip4_any = { AF_INET, +#if defined(IN6ADDR_ANY_INIT) + IN6ADDR_ANY_INIT +#else + { INADDR_ANY } +#endif +}; + static void sin_set_ip(union sockaddr_union *so, const IPADDR *ip) { if (ip == NULL) { From 2012668beff7a275ad5ddb94d56adcf54b0d77be Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 13:54:57 +0100 Subject: [PATCH 383/392] make Irssi::Irc usable without dcc --- src/perl/irc/Dcc.xs | 102 +++++++++++++++++++++++++++++++++++++++ src/perl/irc/Irc.pm | 6 +++ src/perl/irc/Irc.xs | 83 ++----------------------------- src/perl/irc/Irc/Dcc.pm | 26 ++++++++++ src/perl/irc/meson.build | 34 ++++++++++++- 5 files changed, 169 insertions(+), 82 deletions(-) create mode 100644 src/perl/irc/Irc/Dcc.pm diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs index c078a1b5c..f96f4d33c 100644 --- a/src/perl/irc/Dcc.xs +++ b/src/perl/irc/Dcc.xs @@ -1,7 +1,74 @@ #define PERL_NO_GET_CONTEXT #include "module.h" +static int initialized = FALSE; + +static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) +{ + (void) hv_store(hv, "type", 4, new_pv(dcc_type2str(dcc->type)), 0); + (void) hv_store(hv, "orig_type", 9, new_pv(dcc_type2str(dcc->orig_type)), 0); + (void) hv_store(hv, "created", 7, newSViv(dcc->created), 0); + + (void) hv_store(hv, "server", 6, iobject_bless(dcc->server), 0); + (void) hv_store(hv, "servertag", 9, new_pv(dcc->servertag), 0); + (void) hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0); + (void) hv_store(hv, "nick", 4, new_pv(dcc->nick), 0); + + (void) hv_store(hv, "chat", 4, simple_iobject_bless(dcc->chat), 0); + (void) hv_store(hv, "target", 6, new_pv(dcc->target), 0); + (void) hv_store(hv, "arg", 3, new_pv(dcc->arg), 0); + + (void) hv_store(hv, "addr", 4, new_pv(dcc->addrstr), 0); + (void) hv_store(hv, "port", 4, newSViv(dcc->port), 0); + + (void) hv_store(hv, "starttime", 9, newSViv(dcc->starttime), 0); + (void) hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0); +} + +static void perl_dcc_chat_fill_hash(HV *hv, CHAT_DCC_REC *dcc) +{ + perl_dcc_fill_hash(hv, (DCC_REC *) dcc); + + (void) hv_store(hv, "id", 2, new_pv(dcc->id), 0); + (void) hv_store(hv, "mirc_ctcp", 9, newSViv(dcc->mirc_ctcp), 0); + (void) hv_store(hv, "connection_lost", 15, newSViv(dcc->connection_lost), 0); +} + +static void perl_dcc_file_fill_hash(HV *hv, FILE_DCC_REC *dcc) +{ + perl_dcc_fill_hash(hv, (DCC_REC *) dcc); + + (void) hv_store(hv, "size", 4, newSViv(dcc->size), 0); + (void) hv_store(hv, "skipped", 7, newSViv(dcc->skipped), 0); +} + +static void perl_dcc_get_fill_hash(HV *hv, GET_DCC_REC *dcc) +{ + perl_dcc_file_fill_hash(hv, (FILE_DCC_REC *) dcc); + + (void) hv_store(hv, "get_type", 8, newSViv(dcc->get_type), 0); + (void) hv_store(hv, "file", 4, new_pv(dcc->file), 0); + (void) hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); +} + +static void perl_dcc_send_fill_hash(HV *hv, SEND_DCC_REC *dcc) +{ + perl_dcc_file_fill_hash(hv, (FILE_DCC_REC *) dcc); + + (void) hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); + (void) hv_store(hv, "waitforend", 10, newSViv(dcc->waitforend), 0); + (void) hv_store(hv, "gotalldata", 10, newSViv(dcc->gotalldata), 0); +} + +static PLAIN_OBJECT_INIT_REC irc_dcc_plains[] = { { "Irssi::Irc::Dcc", + (PERL_OBJECT_FUNC) perl_dcc_fill_hash }, + + { NULL, NULL } }; + +/********************************/ + MODULE = Irssi::Irc::Dcc PACKAGE = Irssi::Irc + PROTOTYPES: ENABLE void @@ -101,3 +168,38 @@ MODULE = Irssi::Irc::Dcc PACKAGE = Irssi::Windowitem PREFIX = item_ Irssi::Irc::Dcc::Chat item_get_dcc(item) Irssi::Windowitem item + +#******************************* +MODULE = Irssi::Irc::Dcc PACKAGE = Irssi::Irc::Dcc +#******************************* + +void +init() +CODE: + if (initialized) + return; + perl_api_version_check("Irssi::Irc::Dcc"); + initialized = TRUE; + + irssi_add_object(module_get_uniq_id_str("DCC", "CHAT"), 0, "Irssi::Irc::Dcc::Chat", + (PERL_OBJECT_FUNC) perl_dcc_chat_fill_hash); + irssi_add_object(module_get_uniq_id_str("DCC", "GET"), 0, "Irssi::Irc::Dcc::Get", + (PERL_OBJECT_FUNC) perl_dcc_get_fill_hash); + irssi_add_object(module_get_uniq_id_str("DCC", "SEND"), 0, "Irssi::Irc::Dcc::Send", + (PERL_OBJECT_FUNC) perl_dcc_send_fill_hash); + irssi_add_object(module_get_uniq_id_str("DCC", "SERVER"), 0, "Irssi::Irc::Dcc::Server", + (PERL_OBJECT_FUNC) perl_dcc_send_fill_hash); + irssi_add_plains(irc_dcc_plains); + perl_eval_pv("@Irssi::Irc::Dcc::Chat::ISA = qw(Irssi::Irc::Dcc);\n" + "@Irssi::Irc::Dcc::Get::ISA = qw(Irssi::Irc::Dcc);\n" + "@Irssi::Irc::Dcc::Send::ISA = qw(Irssi::Irc::Dcc);\n" + "@Irssi::Irc::Dcc::Server::ISA = qw(Irssi::Irc::Dcc);\n", + TRUE); + +void +deinit() +CODE: + initialized = FALSE; + +BOOT: + /* nothing * / diff --git a/src/perl/irc/Irc.pm b/src/perl/irc/Irc.pm index 1d95462d0..b5ace2679 100644 --- a/src/perl/irc/Irc.pm +++ b/src/perl/irc/Irc.pm @@ -22,5 +22,11 @@ Irssi::Irc::init(); Irssi::EXPORT_ALL(); +eval { + local $@; + require Irssi::Irc::Dcc; + 1; +}; + 1; diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index 33be93d56..80033fbae 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -69,63 +69,6 @@ static void perl_ban_fill_hash(HV *hv, BAN_REC *ban) (void) hv_store(hv, "time", 4, newSViv(ban->time), 0); } -static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) -{ - (void) hv_store(hv, "type", 4, new_pv(dcc_type2str(dcc->type)), 0); - (void) hv_store(hv, "orig_type", 9, new_pv(dcc_type2str(dcc->orig_type)), 0); - (void) hv_store(hv, "created", 7, newSViv(dcc->created), 0); - - (void) hv_store(hv, "server", 6, iobject_bless(dcc->server), 0); - (void) hv_store(hv, "servertag", 9, new_pv(dcc->servertag), 0); - (void) hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0); - (void) hv_store(hv, "nick", 4, new_pv(dcc->nick), 0); - - (void) hv_store(hv, "chat", 4, simple_iobject_bless(dcc->chat), 0); - (void) hv_store(hv, "target", 6, new_pv(dcc->target), 0); - (void) hv_store(hv, "arg", 3, new_pv(dcc->arg), 0); - - (void) hv_store(hv, "addr", 4, new_pv(dcc->addrstr), 0); - (void) hv_store(hv, "port", 4, newSViv(dcc->port), 0); - - (void) hv_store(hv, "starttime", 9, newSViv(dcc->starttime), 0); - (void) hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0); -} - -static void perl_dcc_chat_fill_hash(HV *hv, CHAT_DCC_REC *dcc) -{ - perl_dcc_fill_hash(hv, (DCC_REC *) dcc); - - (void) hv_store(hv, "id", 2, new_pv(dcc->id), 0); - (void) hv_store(hv, "mirc_ctcp", 9, newSViv(dcc->mirc_ctcp), 0); - (void) hv_store(hv, "connection_lost", 15, newSViv(dcc->connection_lost), 0); -} - -static void perl_dcc_file_fill_hash(HV *hv, FILE_DCC_REC *dcc) -{ - perl_dcc_fill_hash(hv, (DCC_REC *) dcc); - - (void) hv_store(hv, "size", 4, newSViv(dcc->size), 0); - (void) hv_store(hv, "skipped", 7, newSViv(dcc->skipped), 0); -} - -static void perl_dcc_get_fill_hash(HV *hv, GET_DCC_REC *dcc) -{ - perl_dcc_file_fill_hash(hv, (FILE_DCC_REC *) dcc); - - (void) hv_store(hv, "get_type", 8, newSViv(dcc->get_type), 0); - (void) hv_store(hv, "file", 4, new_pv(dcc->file), 0); - (void) hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); -} - -static void perl_dcc_send_fill_hash(HV *hv, SEND_DCC_REC *dcc) -{ - perl_dcc_file_fill_hash(hv, (FILE_DCC_REC *) dcc); - - (void) hv_store(hv, "file_quoted", 11, newSViv(dcc->file_quoted), 0); - (void) hv_store(hv, "waitforend", 10, newSViv(dcc->waitforend), 0); - (void) hv_store(hv, "gotalldata", 10, newSViv(dcc->gotalldata), 0); -} - static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit) { AV *av; @@ -195,7 +138,6 @@ static void perl_client_fill_hash(HV *hv, CLIENT_REC *client) static PLAIN_OBJECT_INIT_REC irc_plains[] = { { "Irssi::Irc::Ban", (PERL_OBJECT_FUNC) perl_ban_fill_hash }, - { "Irssi::Irc::Dcc", (PERL_OBJECT_FUNC) perl_dcc_fill_hash }, { "Irssi::Irc::Netsplit", (PERL_OBJECT_FUNC) perl_netsplit_fill_hash }, { "Irssi::Irc::Netsplitserver", (PERL_OBJECT_FUNC) perl_netsplit_server_fill_hash }, { "Irssi::Irc::Netsplitchannel", (PERL_OBJECT_FUNC) perl_netsplit_channel_fill_hash }, @@ -244,27 +186,9 @@ CODE: irssi_add_object(module_get_uniq_id("SERVER CONNECT", 0), chat_type, "Irssi::Irc::Connect", (PERL_OBJECT_FUNC) perl_irc_connect_fill_hash); - irssi_add_object(module_get_uniq_id("SERVER", 0), - chat_type, "Irssi::Irc::Server", - (PERL_OBJECT_FUNC) perl_irc_server_fill_hash); - irssi_add_object(module_get_uniq_id_str("DCC", "CHAT"), - 0, "Irssi::Irc::Dcc::Chat", - (PERL_OBJECT_FUNC) perl_dcc_chat_fill_hash); - irssi_add_object(module_get_uniq_id_str("DCC", "GET"), - 0, "Irssi::Irc::Dcc::Get", - (PERL_OBJECT_FUNC) perl_dcc_get_fill_hash); - irssi_add_object(module_get_uniq_id_str("DCC", "SEND"), - 0, "Irssi::Irc::Dcc::Send", - (PERL_OBJECT_FUNC) perl_dcc_send_fill_hash); - irssi_add_object(module_get_uniq_id_str("DCC", "SERVER"), - 0, "Irssi::Irc::Dcc::Server", - (PERL_OBJECT_FUNC) perl_dcc_send_fill_hash); - irssi_add_plains(irc_plains); - perl_eval_pv("@Irssi::Irc::Dcc::Chat::ISA = qw(Irssi::Irc::Dcc);\n" - "@Irssi::Irc::Dcc::Get::ISA = qw(Irssi::Irc::Dcc);\n" - "@Irssi::Irc::Dcc::Send::ISA = qw(Irssi::Irc::Dcc);\n" - "@Irssi::Irc::Dcc::Server::ISA = qw(Irssi::Irc::Dcc);\n", - TRUE); + irssi_add_object(module_get_uniq_id("SERVER", 0), chat_type, "Irssi::Irc::Server", + (PERL_OBJECT_FUNC) perl_irc_server_fill_hash); + irssi_add_plains(irc_plains); void deinit() @@ -274,7 +198,6 @@ CODE: BOOT: irssi_boot(Irc__Channel); irssi_boot(Irc__Ctcp); - irssi_boot(Irc__Dcc); irssi_boot(Irc__Modes); irssi_boot(Irc__Netsplit); irssi_boot(Irc__Notifylist); diff --git a/src/perl/irc/Irc/Dcc.pm b/src/perl/irc/Irc/Dcc.pm new file mode 100644 index 000000000..65a30c44a --- /dev/null +++ b/src/perl/irc/Irc/Dcc.pm @@ -0,0 +1,26 @@ +# +# Perl interface to irssi functions. +# + +package Irssi::Irc::Dcc; + +use strict; +use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); + +$VERSION = "0.9"; + +require Exporter; +require DynaLoader; + +@ISA = qw(Exporter DynaLoader); +@EXPORT = qw(); +@EXPORT_OK = qw(); + +bootstrap Irssi::Irc::Dcc $VERSION if (!Irssi::Core::is_static()); + +Irssi::Irc::Dcc::init(); + +Irssi::EXPORT_ALL(); + +1; + diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build index e033c2604..af68ce7f3 100644 --- a/src/perl/irc/meson.build +++ b/src/perl/irc/meson.build @@ -4,7 +4,6 @@ shared_library('Irc', 'Channel.xs', 'Client.xs', 'Ctcp.xs', - 'Dcc.xs', 'Irc.xs', 'Modes.xs', 'Netsplit.xs', @@ -27,7 +26,7 @@ shared_library('Irc', include_directories : rootinc, implicit_include_directories : true, dependencies : dep + [ perl_dep ], - link_with : dl_cross_perl_core + dl_cross_irc_dcc + dl_cross_irc_notifylist + dl_cross_irc_core + dl_cross_irssi_main, + link_with : dl_cross_perl_core + dl_cross_irc_notifylist + dl_cross_irc_core + dl_cross_irssi_main, override_options : ['b_lundef=false'], ) @@ -37,6 +36,37 @@ install_headers( ), install_dir : perlmoddir / 'Irssi', ) + +shared_library('Dcc', + [ xsubpp.process( + files( + 'Dcc.xs', + ), + extra_args : [ + '-typemap', + '../common/typemap', + ], + ) ] + + files( + 'module.h', + ), + name_prefix : '', + name_suffix : perl_module_suffix, + install : true, + install_dir : perlmoddir / 'auto' / 'Irssi' / 'Irc' / 'Dcc', + include_directories : rootinc, + implicit_include_directories : true, + dependencies : dep + [ perl_dep ], + link_with : dl_cross_perl_core + dl_cross_irc_dcc + dl_cross_irc_core + dl_cross_irssi_main, + override_options : ['b_lundef=false'], +) + +install_headers( + files( + 'Irc/Dcc.pm', + ), + install_dir : perlmoddir / 'Irssi' / 'Irc', +) # 'Makefile.PL.in', # 'typemap', From a54677ce99413e4c5f7ac7e5061ac83f5a4af85d Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 14:08:28 +0100 Subject: [PATCH 384/392] up perl api --- src/perl/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/perl/module.h b/src/perl/module.h index 0a4d78f6a..398eb1c76 100644 --- a/src/perl/module.h +++ b/src/perl/module.h @@ -17,4 +17,4 @@ extern PerlInterpreter *my_perl; /* must be called my_perl or some perl implemen /* Change this every time when some API changes between irssi's perl module (or irssi itself) and irssi's perl libraries. */ -#define IRSSI_PERL_API_VERSION (20011214 + IRSSI_ABI_VERSION) +#define IRSSI_PERL_API_VERSION (20160124 + IRSSI_ABI_VERSION) From 45d3013f9e490626f0cf8ba11b1db7569239e0e3 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 14:11:42 +0100 Subject: [PATCH 385/392] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 06b63a150..4e9b5c799 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 57 +#define IRSSI_ABI_VERSION 58 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From e9281b2f1147eb25dd811f4cd2a870eae3c22a62 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 18:05:05 +0100 Subject: [PATCH 386/392] add compatibility code for older GResolver --- src/core/net-nonblock.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/core/network.h | 13 +++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index 494d9894f..1a06a662c 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -26,6 +26,7 @@ #include typedef struct { + GResolverNameLookupFlags flags; NetGethostbynameContinuationFunc cont; void *cont_data; } NET_GETHOSTBYNAME_CALLBACK_DATA; @@ -39,7 +40,39 @@ static void net_gethostbyname_callback(GResolver *resolver, GAsyncResult *result RESOLVED_IP_REC *iprec; error = NULL; +#if GLIB_CHECK_VERSION(2, 59, 0) ailist = g_resolver_lookup_by_name_with_flags_finish(resolver, result, &error); +#else + /* compatibility code for old GLib */ + ailist = g_resolver_lookup_by_name_finish(resolver, result, &error); + if (error == NULL && data->flags) { + GList *ll, *lll; + + for (ll = ailist; ll != NULL; ll = lll) { + GInetAddress *address; + GSocketFamily family; + + address = G_INET_ADDRESS(ll->data); + family = g_inet_address_get_family(address); + lll = ll->next; + + if ((data->flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY && + family == G_SOCKET_FAMILY_IPV6) || + (data->flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY && + family == G_SOCKET_FAMILY_IPV4)) { + g_object_unref(address); + ailist = g_list_delete_link(ailist, ll); + } + } + + if (ailist == NULL) { + g_set_error(&error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, + data->flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY ? + "IPv4 address not found for host" : + "IPv6 address not found for host"); + } + } +#endif iprec = g_new0(RESOLVED_IP_REC, 1); if (error != NULL) { iprec->error = error; @@ -66,10 +99,17 @@ GCancellable *net_gethostbyname_nonblock(const char *addr, GResolverNameLookupFl resolver = g_resolver_get_default(); cancellable = g_cancellable_new(); data = g_new0(NET_GETHOSTBYNAME_CALLBACK_DATA, 1); + data->flags = flags; data->cont = cont; data->cont_data = cont_data; +#if GLIB_CHECK_VERSION(2, 59, 0) g_resolver_lookup_by_name_with_flags_async(resolver, addr, flags, cancellable, (GAsyncReadyCallback) net_gethostbyname_callback, data); +#else + /* compatibility code for old GLib */ + g_resolver_lookup_by_name_async(resolver, addr, cancellable, + (GAsyncReadyCallback) net_gethostbyname_callback, data); +#endif return cancellable; } diff --git a/src/core/network.h b/src/core/network.h index 647cd8c7a..780923756 100644 --- a/src/core/network.h +++ b/src/core/network.h @@ -16,6 +16,19 @@ # endif #endif +#if GLIB_CHECK_VERSION(2, 59, 0) +/* nothing */ +#else +/* compatibility code for old GLib */ + +typedef enum { + G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT = 0, + G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY = 1 << 0, + G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY = 1 << 1, +} GResolverNameLookupFlags; + +#endif + struct _IPADDR { unsigned short family; struct in6_addr ip; From 00146211d08ddc0ba0e1907f25fd08a0624f0eea Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 18:06:21 +0100 Subject: [PATCH 387/392] fix space in end comment --- src/perl/irc/Dcc.xs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs index f96f4d33c..a6d2c473e 100644 --- a/src/perl/irc/Dcc.xs +++ b/src/perl/irc/Dcc.xs @@ -202,4 +202,4 @@ CODE: initialized = FALSE; BOOT: - /* nothing * / + /* nothing */ From 0157a4424bce0715b09799af64a86f8e956e6a64 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 24 Jan 2026 20:53:29 +0100 Subject: [PATCH 388/392] fix clang-format-xs boot code --- utils/clang-format-xs/clang-format-xs | 29 ++++++++++++++++++++++++--- utils/clang-format-xs/format-xs-1.pl | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/utils/clang-format-xs/clang-format-xs b/utils/clang-format-xs/clang-format-xs index 3216210b3..39493c53d 100755 --- a/utils/clang-format-xs/clang-format-xs +++ b/utils/clang-format-xs/clang-format-xs @@ -6,14 +6,22 @@ srcdir=$(dirname "$(readlink -f "$0")") test -z "$srcdir" && srcdir=. CLANG_FORMAT=${CLANG_FORMAT:-clang-format} +if [[ "$CLANG_FORMAT" = *-xs\ * ]]; then + CLANG_FORMAT=${CLANG_FORMAT/-xs / } +elif [[ "$CLANG_FORMAT" = *-xs ]]; then + CLANG_FORMAT=${CLANG_FORMAT%-xs} +fi + +clang_format_version=$($CLANG_FORMAT --version 2>/dev/null | perl -ne '/(\d+)/ && print $1 or print 0') + options=() files=() lines=() -inplace=0;xml=0; +inplace=0;xml=0;list_ignored=0; filename=tmp.1.c offsets= off_opts=() -opts=$(getopt -n clang-format-xs -s bash -a -o in -l Werror,assume-filename:,cursor:,dry-run,dump-config,fallback-style:,ferror-limit:,help,length:,lines:,offset:,output-replacement-xmls,sort-includes,style:,verbose,version -- "$@") +opts=$(getopt -n clang-format-xs -s bash -a -o in -l Werror,assume-filename:,cursor:,dry-run,dump-config,fallback-style:,ferror-limit:,help,length:,lines:,offset:,output-replacement-xmls,sort-includes,list-ignored,style:,verbose,version -- "$@") if [ $? -ne 0 ]; then exit 1; fi eval set -- "$opts"; unset opts while :; do @@ -47,6 +55,11 @@ while :; do shift continue ;; + --list-ignored) + list_ignored=1 + shift + continue + ;; -i) inplace=1 shift @@ -75,6 +88,10 @@ fi if [[ $xml = 1 ]]; then options_o=("-output-replacements-xml" "${options[@]}") fi +if [[ $list_ignored = 1 ]]; then + options_o=("-list-ignored" "${options[@]}") +fi + options_o+=("${off_opts[@]}") do_xs() { @@ -92,7 +109,13 @@ do_xs() { rm "$1".1.c } -if [[ ${#files[@]} -eq 0 ]]; then +if [[ $list_ignored = 1 ]]; then + if [[ $clang_format_version -lt 19 ]]; then + : # true + else + $CLANG_FORMAT "${options_o[@]}" -- "${files[@]}" + fi +elif [[ ${#files[@]} -eq 0 ]]; then case "$filename" in *.xs) cat > "$filename".1.xs diff --git a/utils/clang-format-xs/format-xs-1.pl b/utils/clang-format-xs/format-xs-1.pl index 1d15316e1..fab1e90a1 100644 --- a/utils/clang-format-xs/format-xs-1.pl +++ b/utils/clang-format-xs/format-xs-1.pl @@ -30,7 +30,7 @@ sub in_lines { $prot = 2; $in_code = 0; } - elsif (/^((PP)?CODE|PREINIT):/) { + elsif (/^((PP)?CODE|PREINIT|BOOT):/) { $prot = 1; $in_code = 3; } From 88afc78aacc3e89b49745cac6c61be662fe9cefa Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 25 Jan 2026 00:25:14 +0100 Subject: [PATCH 389/392] GResolver fixes fix issues brought up by @horgh in #1580 --- src/core/network.c | 44 ++++++++++++++++++++++++++++++++++------ src/core/servers-setup.c | 8 ++++---- src/core/servers.c | 8 +++++++- 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/core/network.c b/src/core/network.c index 8dd5cf9d7..c641b203b 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -408,16 +408,43 @@ static RESOLVED_IP_REC *net_gethostbyname(const char *addr, GResolverNameLookupF GResolver *resolver; RESOLVED_IP_REC *iprec; -#ifdef HAVE_CAPSICUM - if (capsicum_enabled()) - return (capsicum_net_gethostbyname(addr, flags)); -#endif - g_return_val_if_fail(addr != NULL, NULL); error = NULL; resolver = g_resolver_get_default(); +#if GLIB_CHECK_VERSION(2, 59, 0) ailist = g_resolver_lookup_by_name_with_flags(resolver, addr, flags, NULL, &error); +#else + /* compatibility code for old GLib */ + ailist = g_resolver_lookup_by_name(resolver, addr, NULL, &error); + if (error == NULL && flags) { + GList *ll, *lll; + + for (ll = ailist; ll != NULL; ll = lll) { + GInetAddress *address; + GSocketFamily family; + + address = G_INET_ADDRESS(ll->data); + family = g_inet_address_get_family(address); + lll = ll->next; + + if ((flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY && + family == G_SOCKET_FAMILY_IPV6) || + (flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY && + family == G_SOCKET_FAMILY_IPV4)) { + g_object_unref(address); + ailist = g_list_delete_link(ailist, ll); + } + } + + if (ailist == NULL) { + g_set_error(&error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, + flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY ? + "IPv4 address not found for host" : + "IPv6 address not found for host"); + } + } +#endif iprec = g_new0(RESOLVED_IP_REC, 1); if (error != NULL) { iprec->error = error; @@ -435,11 +462,16 @@ int net_gethostbyname_first_ips(const char *addr, GResolverNameLookupFlags flags { RESOLVED_IP_REC *iprec; +#ifdef HAVE_CAPSICUM + if (capsicum_enabled()) + return (capsicum_net_gethostbyname(addr, ip4, ip6)); +#endif + iprec = net_gethostbyname(addr, flags); if (iprec->error == NULL) { GList *curr; - for (curr = iprec->ailist; curr->next; curr = curr->next) { + for (curr = iprec->ailist; curr; curr = curr->next) { unsigned short family; GInetAddress *addr; diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 972063285..8747eea39 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -70,11 +70,11 @@ static void get_source_host_ip(void) net_gethostbyname_first_ips(hostname, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT, &ip4, &ip6) == 0; - if (source_host_ok) + if (source_host_ok) { save_ips(&ip4, &ip6, &source_host_ip4, &source_host_ip6); - else { - g_free_and_null(source_host_ip4); - g_free_and_null(source_host_ip6); + } else { + g_free_and_null(source_host_ip4); + g_free_and_null(source_host_ip6); } } diff --git a/src/core/servers.c b/src/core/servers.c index e62f09ec3..04852104d 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -338,16 +338,22 @@ static void server_connect_use_resolved(SERVER_REC *server) resolved_ip_unref(iprec); } + + g_free(ip); } static void server_connect_callback_resolved(RESOLVED_IP_REC *iprec, SERVER_REC *server) { - server->connect_cancellable = NULL; + if (server->connect_cancellable != NULL) { + g_object_unref(server->connect_cancellable); + server->connect_cancellable = NULL; + } if (server->connrec->resolved_host != NULL) { resolved_ip_unref(server->connrec->resolved_host); } server->connrec->resolved_host = iprec; + if (iprec->error == NULL && iprec->ailist == NULL) { server->connection_lost = TRUE; server->dns_error = TRUE; From 221d520c370d5dedfe2f7ab97d76459fc20c7dc1 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 25 Jan 2026 22:07:44 +0100 Subject: [PATCH 390/392] run meson formatter --- .muon_fmt.ini | 14 + docs/help/meson.build | 3 +- docs/meson.build | 3 +- meson.build | 494 +++++++++++++++++------ scripts/meson.build | 3 +- src/core/meson.build | 11 +- src/fe-common/core/meson.build | 19 +- src/fe-common/irc/dcc/meson.build | 15 +- src/fe-common/irc/meson.build | 15 +- src/fe-common/irc/notifylist/meson.build | 15 +- src/fe-fuzz/fe-common/core/meson.build | 7 +- src/fe-fuzz/irc/core/meson.build | 7 +- src/fe-fuzz/meson.build | 14 +- src/fe-none/meson.build | 5 +- src/fe-text/meson.build | 11 +- src/irc/core/meson.build | 17 +- src/irc/dcc/meson.build | 11 +- src/irc/flood/meson.build | 15 +- src/irc/notifylist/meson.build | 11 +- src/irc/proxy/meson.build | 5 +- src/lib-config/meson.build | 9 +- src/meson.build | 7 +- src/otr/meson.build | 5 +- src/perl/common/meson.build | 40 +- src/perl/irc/meson.build | 62 +-- src/perl/meson.build | 29 +- src/perl/textui/meson.build | 33 +- src/perl/ui/meson.build | 30 +- tests/fe-common/core/meson.build | 14 +- tests/fe-text/meson.build | 13 +- tests/irc/core/meson.build | 24 +- tests/irc/flood/meson.build | 12 +- themes/meson.build | 3 +- 33 files changed, 661 insertions(+), 315 deletions(-) create mode 100644 .muon_fmt.ini diff --git a/.muon_fmt.ini b/.muon_fmt.ini new file mode 100644 index 000000000..47fce5d28 --- /dev/null +++ b/.muon_fmt.ini @@ -0,0 +1,14 @@ +# Irssi configuration for muon fmt +max_line_len = 108 +indent_style = space +indent_size = 2 +#indent_by = ' ' +space_array = true +kwargs_force_multiline = true +wide_colon = true +no_single_comma_function = true +insert_final_newline = true +sort_files = false +group_arg_value = true +sticky_parens = true +continuation_indent = true diff --git a/docs/help/meson.build b/docs/help/meson.build index 7fe95d435..6eaa30256 100644 --- a/docs/help/meson.build +++ b/docs/help/meson.build @@ -116,6 +116,7 @@ install_data( 'whowas', 'window', ), - install_dir : helpdir) + install_dir : helpdir, +) # subdir('in') diff --git a/docs/meson.build b/docs/meson.build index a58faed34..f67612006 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -13,6 +13,7 @@ install_data( 'startup-HOWTO.html', 'startup-HOWTO.txt', ), - install_dir : docdir) + install_dir : docdir, +) subdir('help') diff --git a/meson.build b/meson.build index c7eed79d9..d6c582b50 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,10 @@ -project('irssi', 'c', +project( + 'irssi', + 'c', version : '1.5-head', meson_version : '>=0.53', - default_options : ['warning_level=1']) + default_options : [ 'warning_level=1' ], +) ############################ ############################ @@ -11,11 +14,11 @@ glib_pcre2_internal_version = 'pcre2-10.40' glib_libffi_internal_version = 'libffi' cc = meson.get_compiler('c') rootinc = include_directories('.') -dep = [] -textui_dep = [] +dep = [ ] +textui_dep = [ ] need_dl_cross_link = false need_dl_cross_link_main = false -dl_cross_irssi_main = [] +dl_cross_irssi_main = [ ] # The Android environment requires that all modules are linked to each other. # See https://github.com/android/ndk/issues/201 if host_machine.system() == 'android' @@ -66,14 +69,33 @@ if fs.exists('config.status') or fs.exists('irssi-version.h') or fs.exists('defa endif UNSET = '=INVALID=' -UNSET_ARR = [UNSET] +UNSET_ARR = [ UNSET ] -chat_modules = ['irc'] +chat_modules = [ 'irc' ] -run_command('mkdir', meson.current_build_dir() / incdir, check : false) -run_command('ln', '-s', meson.current_source_dir() / 'src', meson.current_build_dir() / incdir, check : false) -run_command('ln', '-s', meson.current_build_dir() / 'irssi-config.h', meson.current_build_dir() / incdir, check : false) -run_command('ln', '-s', meson.current_build_dir() / 'irssi-version.h', meson.current_build_dir() / incdir, check : false) +run_command( + 'mkdir', + meson.current_build_dir() / incdir, + check : false, +) +run_command( + 'ln', + '-s', meson.current_source_dir() / 'src', + meson.current_build_dir() / incdir, + check : false, +) +run_command( + 'ln', + '-s', meson.current_build_dir() / 'irssi-config.h', + meson.current_build_dir() / incdir, + check : false, +) +run_command( + 'ln', + '-s', meson.current_build_dir() / 'irssi-version.h', + meson.current_build_dir() / incdir, + check : false, +) def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"' def_sysconfdir = '-D' + 'SYSCONFDIR' + '="' + (get_option('prefix') / get_option('sysconfdir')) + '"' @@ -83,12 +105,11 @@ def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK' - -module_suffix = [] -perl_module_suffix = [] +module_suffix = [ ] +perl_module_suffix = [ ] # Meson uses the wrong module extensions on Mac. # https://gitlab.gnome.org/GNOME/glib/issues/520 -if ['darwin', 'ios'].contains(host_machine.system()) +if [ 'darwin', 'ios' ].contains(host_machine.system()) module_suffix = 'so' perl_module_suffix = 'bundle' endif @@ -97,13 +118,20 @@ endif # Help files # ############## -build_perl = find_program('perl', native : true) +build_perl = find_program( + 'perl', + native : true, +) if meson.is_cross_build() cross_perl = find_program('perl') else cross_perl = build_perl endif -run_command(build_perl, files('utils/syntax.pl'), check : true) +run_command( + build_perl, + files('utils/syntax.pl'), + check : true, +) ################### # irssi-version.h # @@ -111,12 +139,12 @@ run_command(build_perl, files('utils/syntax.pl'), check : true) env = find_program('env') irssi_version_sh = find_program('utils/irssi-version.sh') -irssi_version_h = custom_target('irssi-version.h', +irssi_version_h = custom_target( + 'irssi-version.h', build_by_default : true, build_always_stale : true, capture : true, - command : [env, 'VERSION=' + meson.project_version(), - irssi_version_sh, meson.current_source_dir()], + command : [ env, 'VERSION=' + meson.project_version(), irssi_version_sh, meson.current_source_dir() ], output : 'irssi-version.h', install : true, install_dir : includedir / incdir, @@ -127,22 +155,24 @@ irssi_version_h = custom_target('irssi-version.h', #################### file2header = find_program('utils/file2header.sh') -default_config_h = custom_target('default-config.h', +default_config_h = custom_target( + 'default-config.h', input : files('irssi.conf'), output : 'default-config.h', capture : true, - command : [file2header, '@INPUT@', 'default_config'], + command : [ file2header, '@INPUT@', 'default_config' ], ) ################### # default-theme.h # ################### -default_theme_h = custom_target('default-theme.h', +default_theme_h = custom_target( + 'default-theme.h', input : files('themes/default.theme'), output : 'default-theme.h', capture : true, - command : [file2header, '@INPUT@', 'default_theme'], + command : [ file2header, '@INPUT@', 'default_theme' ], ) ################ @@ -151,12 +181,18 @@ default_theme_h = custom_target('default-theme.h', #### inet_addr #### inet_addr_found = false -foreach inet_addr_provider : ['', 'nsl'] - prov_lib = [] +foreach inet_addr_provider : [ '', 'nsl' ] + prov_lib = [ ] if inet_addr_provider != '' - prov_lib += cc.find_library(inet_addr_provider, required : false) + prov_lib += cc.find_library( + inet_addr_provider, + required : false, + ) endif - if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function('inet_addr', dependencies : prov_lib) + if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function( + 'inet_addr', + dependencies : prov_lib, + ) dep += prov_lib inet_addr_found = true break @@ -168,12 +204,18 @@ endif #### socket #### socket_found = false -foreach socket_provider : ['', 'socket', 'network'] - prov_lib = [] +foreach socket_provider : [ '', 'socket', 'network' ] + prov_lib = [ ] if socket_provider != '' - prov_lib += cc.find_library(socket_provider, required : false) + prov_lib += cc.find_library( + socket_provider, + required : false, + ) endif - if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function('socket', dependencies : prov_lib) + if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function( + 'socket', + dependencies : prov_lib, + ) dep += prov_lib socket_found = true break @@ -183,7 +225,7 @@ if not socket_found error('socket not found') endif -built_src = [] +built_src = [ ] glib_internal = false message('*** If you don\'t have GLib, you can run meson ... -Dinstall-glib=yes') message('*** to download and build it automatically') @@ -191,54 +233,82 @@ message('*** Or alternatively install your distribution\'s package') message('*** On Debian: sudo apt-get install libglib2.0-dev') message('*** On Redhat: dnf install glib2-devel') if not require_glib_internal - glib_dep = dependency('glib-2.0', version : '>=2.32', required : not want_glib_internal, static : want_static_dependency, include_type : 'system') + glib_dep = dependency( + 'glib-2.0', + version : '>=2.32', + required : not want_glib_internal, + static : want_static_dependency, + include_type : 'system', + ) else - glib_dep = dependency('', required : false) + glib_dep = dependency( + '', + required : false, + ) endif if not glib_dep.found() glib_internal = true meson_cmd = find_program('meson') ninja = find_program('ninja') - glib_internal_download_t = custom_target('glib-internal-download', + glib_internal_download_t = custom_target( + 'glib-internal-download', command : [ meson_cmd, 'subprojects', 'download', 'glib', '--sourcedir', meson.current_source_dir() ], console : true, - output : ['glib-internal-download'], + output : [ 'glib-internal-download' ], ) glib_internal_dependencies = [ dependency('threads'), ] - glib_internal_configure_args = [] + glib_internal_configure_args = [ ] glib_internal_usr_local = false if not cc.has_function('iconv_open') - prov_lib = cc.find_library('iconv', required : false) + prov_lib = cc.find_library( + 'iconv', + required : false, + ) if not prov_lib.found() - prov_lib = cc.find_library('iconv', dirs : '/usr/local/lib') + prov_lib = cc.find_library( + 'iconv', + dirs : '/usr/local/lib', + ) glib_internal_usr_local = true endif glib_internal_dependencies += prov_lib endif if not cc.has_function('ngettext') - prov_lib = cc.find_library('intl', required : false) + prov_lib = cc.find_library( + 'intl', + required : false, + ) if not prov_lib.found() - prov_lib = cc.find_library('intl', dirs : '/usr/local/lib') + prov_lib = cc.find_library( + 'intl', + dirs : '/usr/local/lib', + ) glib_internal_usr_local = true endif glib_internal_dependencies += prov_lib endif if glib_internal_usr_local - glib_internal_configure_args += ['-Dc_args=-I/usr/local/include', '-Dc_link_args=-L/usr/local/lib'] + glib_internal_configure_args += [ '-Dc_args=-I/usr/local/include', '-Dc_link_args=-L/usr/local/lib' ] endif if not cc.has_function('getxattr') or not cc.has_header('sys/xattr.h') if cc.has_header_symbol('attr/xattr.h', 'getxattr') - prov_lib = cc.find_library('xattr', required : false) + prov_lib = cc.find_library( + 'xattr', + required : false, + ) else - prov_lib = dependency('', required : false) + prov_lib = dependency( + '', + required : false, + ) endif if prov_lib.found() glib_internal_dependencies += prov_lib @@ -247,28 +317,41 @@ if not glib_dep.found() endif endif - glib_internal_configure_t = custom_target('glib-internal-configure', - command : [ meson_cmd, 'setup', '--prefix=/irssi-glib-internal', + glib_internal_configure_t = custom_target( + 'glib-internal-configure', + command : [ + meson_cmd, + 'setup', + '--prefix=/irssi-glib-internal', '--buildtype=' + get_option('buildtype'), - '-Dlibmount=disabled', '-Dselinux=disabled', '-Ddefault_library=static', '-Dforce_fallback_for=pcre2,libffi', + '-Dlibmount=disabled', + '-Dselinux=disabled', + '-Ddefault_library=static', + '-Dforce_fallback_for=pcre2,libffi', glib_internal_configure_args, (meson.current_build_dir() / 'build-subprojects' / 'glib'), - (meson.current_source_dir() / 'subprojects' / glib_internal_version) ], + (meson.current_source_dir() / 'subprojects' / glib_internal_version), + ], console : true, - output : ['glib-internal-configure'], - depends : glib_internal_download_t,) - glib_internal_build_t = custom_target('glib-internal-build', - command : [ ninja, '-C', meson.current_build_dir() / 'build-subprojects' / 'glib', + output : [ 'glib-internal-configure' ], + depends : glib_internal_download_t, + ) + glib_internal_build_t = custom_target( + 'glib-internal-build', + command : [ + ninja, + '-C', meson.current_build_dir() / 'build-subprojects' / 'glib', 'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a', 'subprojects' / glib_pcre2_internal_version / 'libpcre2-8.a', 'glib' / 'libglib-2.0.a', 'gmodule' / 'libgmodule-2.0.a', 'gobject' / 'libgobject-2.0.a', 'gio' / 'libgio-2.0.a', - ], + ], console : true, - output : ['glib-internal-build'], - depends : glib_internal_configure_t,) + output : [ 'glib-internal-build' ], + depends : glib_internal_configure_t, + ) glib_dep = declare_dependency( dependencies : glib_internal_dependencies, sources : glib_internal_build_t, @@ -283,28 +366,37 @@ if not glib_dep.found() ], ) built_src += glib_internal_build_t - libdl_dep = [] - prov_lib = cc.find_library('dl', required : false) - if prov_lib.found() and cc.has_function('dlopen', dependencies : prov_lib) + libdl_dep = [ ] + prov_lib = cc.find_library( + 'dl', + required : false, + ) + if prov_lib.found() and cc.has_function( + 'dlopen', + dependencies : prov_lib, + ) libdl_dep += prov_lib endif - gmodule_dep = declare_dependency(sources : glib_internal_build_t, + gmodule_dep = declare_dependency( + sources : glib_internal_build_t, dependencies : libdl_dep, compile_args : [ '-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gmodule'), ], link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gmodule' / 'libgmodule-2.0.a' ], ) - gobject_dep = declare_dependency(sources : glib_internal_build_t, + gobject_dep = declare_dependency( + sources : glib_internal_build_t, compile_args : [ '-isystem' + (meson.current_build_dir() / 'build-subprojects' / 'glib'), ], link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a', - meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gobject' / 'libgobject-2.0.a' + meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gobject' / 'libgobject-2.0.a', ], ) - gio_dep = declare_dependency(sources : glib_internal_build_t, + gio_dep = declare_dependency( + sources : glib_internal_build_t, dependencies : cc.find_library('z'), compile_args : [ '-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gio'), @@ -313,9 +405,21 @@ if not glib_dep.found() link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gio' / 'libgio-2.0.a' ], ) else - gmodule_dep = dependency('gmodule-2.0', static : want_static_dependency, include_type : 'system') - gobject_dep = dependency('gobject-2.0', static : want_static_dependency, include_type : 'system') - gio_dep = dependency('gio-2.0', static : want_static_dependency, include_type : 'system') + gmodule_dep = dependency( + 'gmodule-2.0', + static : want_static_dependency, + include_type : 'system', + ) + gobject_dep = dependency( + 'gobject-2.0', + static : want_static_dependency, + include_type : 'system', + ) + gio_dep = dependency( + 'gio-2.0', + static : want_static_dependency, + include_type : 'system', + ) endif dep += glib_dep dep += gmodule_dep @@ -323,10 +427,17 @@ dep += gobject_dep dep += gio_dep if glib_internal and want_static_dependency and want_fuzzer - openssl_proj = subproject('openssl', default_options : ['default_library=static', 'asm=disabled']) + openssl_proj = subproject( + 'openssl', + default_options : [ 'default_library=static', 'asm=disabled' ], + ) openssl_dep = openssl_proj.get_variable('openssl_dep') else - openssl_dep = dependency('openssl', static : want_static_dependency, include_type : 'system') + openssl_dep = dependency( + 'openssl', + static : want_static_dependency, + include_type : 'system', + ) endif dep += openssl_dep @@ -335,10 +446,16 @@ dep += openssl_dep ############ have_libutf8proc = false -libutf8proc = [] +libutf8proc = [ ] if want_libutf8proc - libutf8proc = cc.find_library('utf8proc', required : require_libutf8proc) - have_libutf8proc = cc.has_function('utf8proc_version', dependencies : libutf8proc) + libutf8proc = cc.find_library( + 'utf8proc', + required : require_libutf8proc, + ) + have_libutf8proc = cc.has_function( + 'utf8proc_version', + dependencies : libutf8proc, + ) if have_libutf8proc dep += libutf8proc endif @@ -353,9 +470,15 @@ endif if want_textui setupterm_found = false - foreach setupterm_provider : ['tinfo', 'ncursesw', 'ncurses', 'terminfo'] - prov_lib = cc.find_library(setupterm_provider, required : false) - if prov_lib.found() and cc.has_function('setupterm', dependencies : prov_lib) + foreach setupterm_provider : [ 'tinfo', 'ncursesw', 'ncurses', 'terminfo' ] + prov_lib = cc.find_library( + setupterm_provider, + required : false, + ) + if prov_lib.found() and cc.has_function( + 'setupterm', + dependencies : prov_lib, + ) textui_dep += prov_lib setupterm_found = true break @@ -372,15 +495,20 @@ endif have_perl = false if want_perl - perl_cflags = [] - perl_ldflags = [] - perl_rpath_flags = [] + perl_cflags = [ ] + perl_ldflags = [ ] + perl_rpath_flags = [ ] perl_rpath = '' #### ccopts #### perl_ccopts = meson.get_cross_property('perl_ccopts', UNSET_ARR) if perl_ccopts == UNSET_ARR - res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ccopts', check : true) + res = run_command( + cross_perl, + '-MExtUtils::Embed', + '-e', 'ccopts', + check : true, + ) perl_ccopts = res.stdout().strip().split() endif foreach fl : perl_ccopts @@ -397,10 +525,15 @@ if want_perl #### ldopts #### perl_ldopts = meson.get_cross_property('perl_ldopts', UNSET_ARR) if perl_ldopts == UNSET_ARR - res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ldopts', check : true) + res = run_command( + cross_perl, + '-MExtUtils::Embed', + '-e', 'ldopts', + check : true, + ) perl_ldopts = res.stdout().strip().split() endif - skip_libs = ['-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic'] + skip_libs = [ '-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic' ] foreach fl : perl_ldopts if not fl.startswith('-A') and not skip_libs.contains(fl) if fl.startswith('-Wl,-rpath,') @@ -414,18 +547,26 @@ if want_perl perl_version = meson.get_cross_property('perl_version', UNSET) if perl_version == UNSET - perl_version = run_command(cross_perl, '-V::version:', check : true).stdout().split('\'')[1] + perl_version = run_command( + cross_perl, + '-V::version:', + check : true, + ).stdout().split('\'')[1] endif # disable clang warning if perl_version.version_compare('<5.35.2') perl_cflags += cc.get_supported_arguments('-Wno-compound-token-split-by-macro') endif - perl_dep = declare_dependency(compile_args : perl_cflags, link_args : perl_ldflags, - version : perl_version) + perl_dep = declare_dependency( + compile_args : perl_cflags, + link_args : perl_ldflags, + version : perl_version, + ) #### - if not cc.links(''' + if not cc.links( + ''' #include #include int main() @@ -433,8 +574,10 @@ int main() perl_alloc(); return 0; } -''', args : perl_cflags + perl_ldflags + perl_rpath_flags, - name : 'working Perl support') +''', + args : perl_cflags + perl_ldflags + perl_rpath_flags, + name : 'working Perl support', + ) if require_perl error('error linking with perl libraries') else @@ -443,9 +586,15 @@ int main() else xsubpp_file_c = meson.get_cross_property('perl_xsubpp', UNSET) if xsubpp_file_c == UNSET - xsubpp_file_c = run_command(build_perl, '-MExtUtils::ParseXS', '-e($r = $INC{"ExtUtils/ParseXS.pm"}) =~ s{ParseXS\\.pm$}{xsubpp}; print $r', check : true).stdout() + xsubpp_file_c = run_command( + build_perl, + '-MExtUtils::ParseXS', + '-e($r = $INC{"ExtUtils/ParseXS.pm"}) =~ s{ParseXS\\.pm$}{xsubpp}; print $r', + check : true, + ).stdout() endif - xsubpp = generator(build_perl, + xsubpp = generator( + build_perl, output : '@BASENAME@.c', capture : true, arguments : [ xsubpp_file_c, '@EXTRA_ARGS@', '@INPUT@' ], @@ -453,31 +602,44 @@ int main() xsubpp_file = files(xsubpp_file_c) if with_perl_lib == 'module' - perl_install_base = run_command(build_perl, '-MText::ParseWords=shellwords', '-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}', check : true).stdout() + perl_install_base = run_command( + build_perl, + '-MText::ParseWords=shellwords', + '-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}', + check : true, + ).stdout() if perl_install_base == '' with_perl_lib = '' endif endif if with_perl_lib == '' - if get_option('prefix') in ['/usr/local', 'C:/'] + if get_option('prefix') in [ '/usr/local', 'C:/' ] with_perl_lib = 'site' - elif get_option('prefix') in ['/usr'] + elif get_option('prefix') in [ '/usr' ] with_perl_lib = 'vendor' endif endif perlmoddir = '' - if with_perl_lib in ['site', 'vendor', 'module'] + if with_perl_lib in [ 'site', 'vendor', 'module' ] set_perl_use_lib = false perl_library_dir = with_perl_lib + ' default' - if with_perl_lib in ['site', 'vendor'] + if with_perl_lib in [ 'site', 'vendor' ] perlmoddir = meson.get_cross_property('perl_install' + with_perl_lib + 'arch', UNSET) if perlmoddir == UNSET - perlmoddir = run_command(cross_perl, '-V::install' + with_perl_lib + 'arch:', check : true).stdout().split('\'')[1] + perlmoddir = run_command( + cross_perl, + '-V::install' + with_perl_lib + 'arch:', + check : true, + ).stdout().split('\'')[1] endif elif with_perl_lib == 'module' perl_archname = meson.get_cross_property('perl_archname', UNSET) if perl_archname == UNSET - perl_archname = run_command(cross_perl, '-V::archname:', check : true).stdout().split('\'')[1] + perl_archname = run_command( + cross_perl, + '-V::archname:', + check : true, + ).stdout().split('\'')[1] endif perlmoddir = perl_install_base / 'lib' / 'perl5' / perl_archname endif @@ -498,7 +660,12 @@ int main() if set_perl_use_lib perl_inc = meson.get_cross_property('perl_inc', UNSET_ARR) if perl_inc == UNSET_ARR - set_perl_use_lib = run_command(cross_perl, '-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC', perl_use_lib, check : false).returncode() != 0 + set_perl_use_lib = run_command( + cross_perl, + '-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC', + perl_use_lib, + check : false, + ).returncode() != 0 else set_perl_use_lib = not perl_inc.contains(perl_use_lib) endif @@ -524,8 +691,20 @@ endif have_otr = false if want_otr - libgcrypt = dependency('libgcrypt', version : '>=1.2.0', required : require_otr, static : want_static_dependency, include_type : 'system') - libotr = dependency('libotr', version : '>=4.1.0', required : require_otr, static : want_static_dependency, include_type : 'system') + libgcrypt = dependency( + 'libgcrypt', + version : '>=1.2.0', + required : require_otr, + static : want_static_dependency, + include_type : 'system', + ) + libotr = dependency( + 'libotr', + version : '>=4.1.0', + required : require_otr, + static : want_static_dependency, + include_type : 'system', + ) if libgcrypt.found() and libotr.found() dep += libgcrypt dep += libotr @@ -539,9 +718,19 @@ endif have_capsicum = false if want_capsicum - if cc.has_function('cap_enter', dependencies : cc.find_library('c')) - libnv = cc.find_library('nv', required : require_capsicum) - nvlist_create_found = libnv.found() and cc.has_function('nvlist_create', dependencies : libnv, prefix : '#include ') + if cc.has_function( + 'cap_enter', + dependencies : cc.find_library('c'), + ) + libnv = cc.find_library( + 'nv', + required : require_capsicum, + ) + nvlist_create_found = libnv.found() and cc.has_function( + 'nvlist_create', + dependencies : libnv, + prefix : '#include ', + ) if nvlist_create_found dep += libnv have_capsicum = true @@ -558,11 +747,14 @@ if want_capsicum endif # dependency helper sets -dep_cflagsonly = [] +dep_cflagsonly = [ ] foreach d : dep - dep_cflagsonly += d.partial_dependency(includes : true, compile_args : true) + dep_cflagsonly += d.partial_dependency( + includes : true, + compile_args : true, + ) endforeach -dl_cross_dep = [] +dl_cross_dep = [ ] if need_dl_cross_link dl_cross_dep = dep endif @@ -573,11 +765,19 @@ endif conf = configuration_data() -conf.set('HAVE_CAPSICUM', have_capsicum, description : 'Build with Capsicum support') +conf.set( + 'HAVE_CAPSICUM', + have_capsicum, + description : 'Build with Capsicum support', +) conf.set('HAVE_GMODULE', true) conf.set('TERM_TRUECOLOR', true) conf.set('USE_GREGEX', true) -conf.set10('_DARWIN_USE_64_BIT_INODE', true, description : 'Enable large inode numbers on Mac OS X 10.5.') +conf.set10( + '_DARWIN_USE_64_BIT_INODE', + true, + description : 'Enable large inode numbers on Mac OS X 10.5.', +) conf.set_quoted('FHS_PREFIX', get_option('fhs-prefix')) headers = [ @@ -591,31 +791,50 @@ headers = [ ] foreach h : headers if cc.has_header(h) - conf.set('HAVE_' + h.underscorify().to_upper(), 1, description : 'Define to 1 if you have the <' + h + '> header file.') + conf.set( + 'HAVE_' + h.underscorify().to_upper(), + 1, + description : 'Define to 1 if you have the <' + h + '> header file.', + ) endif endforeach if want_textui and conf.get('HAVE_TERM_H', 0) == 1 - if cc.links(''' + if cc.links( + ''' #include #include int main (void) { return tputs("x", 1, putchar); } -''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working') +''', + args : '-pedantic-errors', + dependencies : textui_dep, + name : 'Curses working', + ) # ok else has_curses_h = cc.has_header('curses.h') - if has_curses_h and cc.links(''' + if has_curses_h and cc.links( + ''' #include #include int main (void) { return tputs("x", 1, putchar); } -''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working with curses.h') - conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h') +''', + args : '-pedantic-errors', + dependencies : textui_dep, + name : 'Curses working with curses.h', + ) + conf.set( + 'NEED_CURSES_H', + 1, + description : 'tputs needs curses.h', + ) else - if has_curses_h and cc.links(''' + if has_curses_h and cc.links( + ''' #include #include int char_putchar (char c) { @@ -624,9 +843,21 @@ int char_putchar (char c) { int main (void) { return tputs("x", 1, char_putchar); } -''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses with tputs third argument arg char') - conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h') - conf.set('TPUTS_SVR4', 1, description : 'third argument of tputs has the type int (*)(char)') +''', + args : '-pedantic-errors', + dependencies : textui_dep, + name : 'Curses with tputs third argument arg char', + ) + conf.set( + 'NEED_CURSES_H', + 1, + description : 'tputs needs curses.h', + ) + conf.set( + 'TPUTS_SVR4', + 1, + description : 'third argument of tputs has the type int (*)(char)', + ) else error('could not link terminfo') endif @@ -638,21 +869,32 @@ conf.set('HAVE_LIBUTF8PROC', have_libutf8proc) conf.set_quoted('PACKAGE_VERSION', package_version) conf.set_quoted('PACKAGE_TARNAME', meson.project_name()) -configure_file(output : 'irssi-config.h', +configure_file( + output : 'irssi-config.h', configuration : conf, - install_dir : includedir / incdir) + install_dir : includedir / incdir, +) ########## # CFLAGS # ########## #### warnings #### -add_project_arguments(cc.get_supported_arguments('-Werror=declaration-after-statement'), language : 'c') +add_project_arguments( + cc.get_supported_arguments('-Werror=declaration-after-statement'), + language : 'c', +) #### personality #### -add_project_arguments(cc.get_supported_arguments('-fno-strict-aliasing'), language : 'c') +add_project_arguments( + cc.get_supported_arguments('-fno-strict-aliasing'), + language : 'c', +) if get_option('buildtype').contains('debug') - add_project_arguments(cc.get_supported_arguments('-fno-omit-frame-pointer'), language : 'c') + add_project_arguments( + cc.get_supported_arguments('-fno-omit-frame-pointer'), + language : 'c', + ) endif if want_fuzzer @@ -660,7 +902,10 @@ if want_fuzzer if not cc.has_argument('-fsanitize=fuzzer-no-link') error('compiler does not support -fsanitize=fuzzer-no-link, try clang?') endif - add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c') + add_project_arguments( + '-fsanitize=fuzzer-no-link', + language : 'c', + ) endif if fuzzer_link_language != 'c' add_languages(fuzzer_link_language) @@ -672,7 +917,7 @@ endif ############## pc = import('pkgconfig') -pc_requires = [] +pc_requires = [ ] if not glib_internal pc_requires += glib_dep endif @@ -687,7 +932,8 @@ if signalsfile.startswith('/') else signalsfile = '${prefix}' / signalsfile endif -pc.generate(filebase : 'irssi-1', +pc.generate( + filebase : 'irssi-1', name : 'Irssi', description : 'Irssi chat client', version : package_version, diff --git a/scripts/meson.build b/scripts/meson.build index 072ac3ea5..10fdc34bc 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -11,4 +11,5 @@ install_data( 'scriptassist.pl', 'usercount.pl', ), - install_dir : scriptdir) + install_dir : scriptdir, +) diff --git a/src/core/meson.build b/src/core/meson.build index 56b6ec77b..521015d42 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -3,10 +3,11 @@ if have_capsicum core_capsicum_source = files('capsicum.c') else - core_capsicum_source = [] + core_capsicum_source = [ ] endif -libcore_a = static_library('core', +libcore_a = static_library( + 'core', files( 'args.c', 'channels-setup.c', @@ -63,7 +64,8 @@ libcore_a = static_library('core', def_moduledir, def_sysconfdir, ], - dependencies : dep) + dependencies : dep, +) install_headers( files( @@ -122,4 +124,5 @@ install_headers( 'window-item-def.h', 'write-buffer.h', ), - subdir : incdir / 'src' / 'core') + subdir : incdir / 'src' / 'core', +) diff --git a/src/fe-common/core/meson.build b/src/fe-common/core/meson.build index 73cb156a6..a84f12ebc 100644 --- a/src/fe-common/core/meson.build +++ b/src/fe-common/core/meson.build @@ -3,7 +3,7 @@ if have_capsicum fe_common_core_capsicum_source = files('fe-capsicum.c') else - fe_common_core_capsicum_source = [] + fe_common_core_capsicum_source = [ ] endif fe_common_core_sources = [ @@ -43,10 +43,11 @@ fe_common_core_sources = [ + [ default_theme_h, irssi_version_h, - ] + ], ] -libfe_common_core_a = static_library('fe_common_core', +libfe_common_core_a = static_library( + 'fe_common_core', fe_common_core_sources, include_directories : rootinc, implicit_include_directories : false, @@ -54,10 +55,12 @@ libfe_common_core_a = static_library('fe_common_core', def_helpdir, def_themesdir, ], - dependencies : dep) + dependencies : dep, +) if want_fuzzer - libfuzzer_fe_common_core_a = static_library('fuzzer_fe_common_core', + libfuzzer_fe_common_core_a = static_library( + 'fuzzer_fe_common_core', fe_common_core_sources, include_directories : rootinc, implicit_include_directories : false, @@ -66,7 +69,8 @@ if want_fuzzer def_themesdir, def_suppress_printf_fallback, ], - dependencies : dep) + dependencies : dep, + ) endif install_headers( @@ -96,4 +100,5 @@ install_headers( 'window-items.h', 'windows-layout.h', ), - subdir : incdir / 'src' / 'fe-common' / 'core') + subdir : incdir / 'src' / 'fe-common' / 'core', +) diff --git a/src/fe-common/irc/dcc/meson.build b/src/fe-common/irc/dcc/meson.build index 5edf2477c..b347cd004 100644 --- a/src/fe-common/irc/dcc/meson.build +++ b/src/fe-common/irc/dcc/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libfe_irc_dcc_a = static_library('fe_irc_dcc', +libfe_irc_dcc_a = static_library( + 'fe_irc_dcc', files( 'fe-dcc-chat-messages.c', 'fe-dcc-chat.c', @@ -16,14 +17,17 @@ libfe_irc_dcc_a = static_library('fe_irc_dcc', def_helpdir, def_sysconfdir, ], - dependencies : dep) -shared_library('fe_irc_dcc', + dependencies : dep, +) +shared_library( + 'fe_irc_dcc', name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_dcc + dl_cross_irc_core + dl_cross_irssi_main, link_whole : libfe_irc_dcc_a, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) install_headers( files( @@ -31,4 +35,5 @@ install_headers( 'module-formats.h', 'module.h', ), - subdir : incdir / 'src' / 'fe-common' / 'irc' / 'dcc') + subdir : incdir / 'src' / 'fe-common' / 'irc' / 'dcc', +) diff --git a/src/fe-common/irc/meson.build b/src/fe-common/irc/meson.build index 518dfbfa2..b4d780320 100644 --- a/src/fe-common/irc/meson.build +++ b/src/fe-common/irc/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libfe_common_irc_a = static_library('fe_common_irc', +libfe_common_irc_a = static_library( + 'fe_common_irc', files( 'fe-cap.c', 'fe-common-irc.c', @@ -27,14 +28,17 @@ libfe_common_irc_a = static_library('fe_common_irc', def_helpdir, def_themesdir, ], - dependencies : dep) -shared_library('fe_common_irc', + dependencies : dep, +) +shared_library( + 'fe_common_irc', name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_core + dl_cross_irssi_main, link_whole : libfe_common_irc_a, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) install_headers( files( @@ -43,7 +47,8 @@ install_headers( 'module-formats.h', 'module.h', ), - subdir : incdir / 'src' / 'fe-common' / 'irc') + subdir : incdir / 'src' / 'fe-common' / 'irc', +) subdir('dcc') subdir('notifylist') diff --git a/src/fe-common/irc/notifylist/meson.build b/src/fe-common/irc/notifylist/meson.build index cdb5168b3..894c1d897 100644 --- a/src/fe-common/irc/notifylist/meson.build +++ b/src/fe-common/irc/notifylist/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libfe_irc_notifylist_a = static_library('fe_irc_notifylist', +libfe_irc_notifylist_a = static_library( + 'fe_irc_notifylist', files( 'fe-notifylist.c', 'module-formats.c', @@ -11,18 +12,22 @@ libfe_irc_notifylist_a = static_library('fe_irc_notifylist', def_helpdir, def_sysconfdir, ], - dependencies : dep) -shared_library('fe_irc_notifylist', + dependencies : dep, +) +shared_library( + 'fe_irc_notifylist', name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_notifylist + dl_cross_irssi_main, link_whole : libfe_irc_notifylist_a, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) install_headers( files( 'module-formats.h', 'module.h', ), - subdir : incdir / 'src' / 'fe-common' / 'irc' / 'notifylist') + subdir : incdir / 'src' / 'fe-common' / 'irc' / 'notifylist', +) diff --git a/src/fe-fuzz/fe-common/core/meson.build b/src/fe-fuzz/fe-common/core/meson.build index 893f5937d..af9dea6e0 100644 --- a/src/fe-fuzz/fe-common/core/meson.build +++ b/src/fe-fuzz/fe-common/core/meson.build @@ -1,5 +1,6 @@ # this file is part of irssi -executable('theme-load-fuzz', +executable( + 'theme-load-fuzz', files( '../../null-logger.c', 'theme-load.c', @@ -10,12 +11,12 @@ executable('theme-load-fuzz', libcore_a, libfuzzer_fe_common_core_a, ], - link_args : [fuzzer_lib], + link_args : [ fuzzer_lib ], link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, - dependencies : dep + dependencies : dep, ) # noinst_headers = files( diff --git a/src/fe-fuzz/irc/core/meson.build b/src/fe-fuzz/irc/core/meson.build index 730c92406..65d316d3f 100644 --- a/src/fe-fuzz/irc/core/meson.build +++ b/src/fe-fuzz/irc/core/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -executable('event-get-params-fuzz', +executable( + 'event-get-params-fuzz', files( '../../null-logger.c', 'event-get-params.c', @@ -12,12 +13,12 @@ executable('event-get-params-fuzz', libirc_core_a, libfuzzer_fe_common_core_a, ], - link_args : [fuzzer_lib], + link_args : [ fuzzer_lib ], link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, - dependencies : dep + dependencies : dep, ) # noinst_headers = files( diff --git a/src/fe-fuzz/meson.build b/src/fe-fuzz/meson.build index 5ab196518..55071a30d 100644 --- a/src/fe-fuzz/meson.build +++ b/src/fe-fuzz/meson.build @@ -3,7 +3,8 @@ subdir('irc') subdir('fe-common') -executable('irssi-fuzz', +executable( + 'irssi-fuzz', files( 'null-logger.c', 'irssi.c', @@ -14,15 +15,16 @@ executable('irssi-fuzz', libcore_a, libfuzzer_fe_common_core_a, ], - link_args : [fuzzer_lib], + link_args : [ fuzzer_lib ], link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, - dependencies : dep + dependencies : dep, ) -executable('server-fuzz', +executable( + 'server-fuzz', files( 'null-logger.c', 'server.c', @@ -37,12 +39,12 @@ executable('server-fuzz', libfe_irc_dcc_a, libfe_irc_notifylist_a, ], - link_args : [fuzzer_lib], + link_args : [ fuzzer_lib ], link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, - dependencies : dep + dependencies : dep, ) # noinst_headers = files( diff --git a/src/fe-none/meson.build b/src/fe-none/meson.build index 49cfe5171..b6b91b57c 100644 --- a/src/fe-none/meson.build +++ b/src/fe-none/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -fe_none_irssi = executable('botti', +fe_none_irssi = executable( + 'botti', files( 'irssi.c', ), @@ -13,7 +14,7 @@ fe_none_irssi = executable('botti', libcore_a, ], install : true, - dependencies : dep + dependencies : dep, ) if need_dl_cross_link_main dl_cross_irssi_main = [ fe_none_irssi ] diff --git a/src/fe-text/meson.build b/src/fe-text/meson.build index 1c885b896..6165b4619 100644 --- a/src/fe-text/meson.build +++ b/src/fe-text/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -fe_text_irssi = executable('irssi', +fe_text_irssi = executable( + 'irssi', files( #### terminfo_sources #### 'term-terminfo.c', @@ -40,10 +41,9 @@ fe_text_irssi = executable('irssi', libconfig_a, libcore_a, libfe_common_core_a, - ], + ], install : true, - dependencies : dep - + textui_dep + dependencies : dep + textui_dep, ) if need_dl_cross_link_main dl_cross_irssi_main = [ fe_text_irssi ] @@ -61,7 +61,8 @@ install_headers( 'textbuffer-view.h', 'textbuffer.h', ), - subdir : incdir / 'src' / 'fe-text') + subdir : incdir / 'src' / 'fe-text', +) # noinst_headers = files( # 'gui-entry.h', diff --git a/src/irc/core/meson.build b/src/irc/core/meson.build index 94ed20a28..d1b7db780 100644 --- a/src/irc/core/meson.build +++ b/src/irc/core/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libirc_core_a = static_library('irc_core', +libirc_core_a = static_library( + 'irc_core', files( 'bans.c', 'channel-events.c', @@ -38,16 +39,19 @@ libirc_core_a = static_library('irc_core', def_moduledir, def_sysconfdir, ], - dependencies : dep) -libirc_core_sm = shared_library('irc_core', + dependencies : dep, +) +libirc_core_sm = shared_library( + 'irc_core', name_suffix : module_suffix, install : true, install_dir : moduledir, link_whole : libirc_core_a, link_with : dl_cross_irssi_main, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) -dl_cross_irc_core = [] +dl_cross_irc_core = [ ] if need_dl_cross_link dl_cross_irc_core += libirc_core_sm endif @@ -77,4 +81,5 @@ install_headers( 'servers-idle.h', 'servers-redirect.h', ), - subdir : incdir / 'src' / 'irc' / 'core') + subdir : incdir / 'src' / 'irc' / 'core', +) diff --git a/src/irc/dcc/meson.build b/src/irc/dcc/meson.build index 3ab1bace7..c09f07b2e 100644 --- a/src/irc/dcc/meson.build +++ b/src/irc/dcc/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libirc_dcc_sm = shared_library('irc_dcc', +libirc_dcc_sm = shared_library( + 'irc_dcc', files( 'dcc-autoget.c', 'dcc-chat.c', @@ -18,9 +19,10 @@ libirc_dcc_sm = shared_library('irc_dcc', install_dir : moduledir, link_with : dl_cross_irc_core + dl_cross_irssi_main, dependencies : dep, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) -dl_cross_irc_dcc = [] +dl_cross_irc_dcc = [ ] if need_dl_cross_link dl_cross_irc_dcc += libirc_dcc_sm endif @@ -38,4 +40,5 @@ install_headers( 'dcc.h', 'module.h', ), - subdir : incdir / 'src' / 'irc' / 'dcc') + subdir : incdir / 'src' / 'irc' / 'dcc', +) diff --git a/src/irc/flood/meson.build b/src/irc/flood/meson.build index 257e5c114..9df0ef84d 100644 --- a/src/irc/flood/meson.build +++ b/src/irc/flood/meson.build @@ -1,21 +1,26 @@ # this file is part of irssi -libirc_flood_a = static_library('irc_flood', +libirc_flood_a = static_library( + 'irc_flood', files( 'autoignore.c', 'flood.c', ), include_directories : rootinc, implicit_include_directories : false, - dependencies : dep) -shared_library('irc_flood', + dependencies : dep, +) +shared_library( + 'irc_flood', name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_core + dl_cross_irssi_main, link_whole : libirc_flood_a, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) install_headers( files('module.h'), - subdir : incdir / 'src' / 'irc' / 'flood') + subdir : incdir / 'src' / 'irc' / 'flood', +) diff --git a/src/irc/notifylist/meson.build b/src/irc/notifylist/meson.build index 34517b341..75f928105 100644 --- a/src/irc/notifylist/meson.build +++ b/src/irc/notifylist/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libirc_notifylist_sm = shared_library('irc_notifylist', +libirc_notifylist_sm = shared_library( + 'irc_notifylist', files( 'notify-commands.c', 'notify-ison.c', @@ -15,9 +16,10 @@ libirc_notifylist_sm = shared_library('irc_notifylist', install_dir : moduledir, link_with : dl_cross_irc_core + dl_cross_irssi_main, dependencies : dep, - override_options : ['b_lundef=false']) + override_options : [ 'b_lundef=false' ], +) -dl_cross_irc_notifylist = [] +dl_cross_irc_notifylist = [ ] if need_dl_cross_link dl_cross_irc_notifylist += libirc_notifylist_sm endif @@ -28,4 +30,5 @@ install_headers( 'notify-setup.h', 'notifylist.h', ), - subdir : incdir / 'src' / 'irc' / 'notifylist') + subdir : incdir / 'src' / 'irc' / 'notifylist', +) diff --git a/src/irc/proxy/meson.build b/src/irc/proxy/meson.build index 4cc2b6580..4d5ed5540 100644 --- a/src/irc/proxy/meson.build +++ b/src/irc/proxy/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -shared_library('irc_proxy', +shared_library( + 'irc_proxy', files( 'dump.c', 'listen.c', @@ -13,7 +14,7 @@ shared_library('irc_proxy', install : true, install_dir : moduledir, dependencies : dep, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) # noinst_headers = files( diff --git a/src/lib-config/meson.build b/src/lib-config/meson.build index 2bc094ddb..c4818dcd6 100644 --- a/src/lib-config/meson.build +++ b/src/lib-config/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -libconfig_a = static_library('irssi_config', +libconfig_a = static_library( + 'irssi_config', files( 'get.c', 'parse.c', @@ -9,11 +10,13 @@ libconfig_a = static_library('irssi_config', ), include_directories : rootinc, implicit_include_directories : false, - dependencies : dep) + dependencies : dep, +) install_headers( files( 'iconfig.h', 'module.h', ), - subdir : incdir / 'src' / 'lib-config') + subdir : incdir / 'src' / 'lib-config', +) diff --git a/src/meson.build b/src/meson.build index cc30da1ba..b1663d18b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -24,7 +24,6 @@ if want_fuzzer endif install_headers( - files( - 'common.h' - ), - subdir : incdir / 'src') + files('common.h'), + subdir : incdir / 'src', +) diff --git a/src/otr/meson.build b/src/otr/meson.build index 13b564ea1..9611b4280 100644 --- a/src/otr/meson.build +++ b/src/otr/meson.build @@ -1,6 +1,7 @@ # this file is part of irssi -shared_library('otr_core', +shared_library( + 'otr_core', files( 'key.c', 'otr-fe.c', @@ -15,7 +16,7 @@ shared_library('otr_core', install : true, install_dir : moduledir, dependencies : dep, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) # noinst_headers = files( diff --git a/src/perl/common/meson.build b/src/perl/common/meson.build index 0f3f3bb57..1d0ba9539 100644 --- a/src/perl/common/meson.build +++ b/src/perl/common/meson.build @@ -1,20 +1,22 @@ - -shared_library('Irssi', - [ xsubpp.process( - files( - 'Channel.xs', - 'Core.xs', - 'Expando.xs', - 'Ignore.xs', - 'Irssi.xs', - 'Log.xs', - 'Masks.xs', - 'Query.xs', - 'Rawlog.xs', - 'Server.xs', - 'Settings.xs', - ) - ) ] +shared_library( + 'Irssi', + [ + xsubpp.process( + files( + 'Channel.xs', + 'Core.xs', + 'Expando.xs', + 'Ignore.xs', + 'Irssi.xs', + 'Log.xs', + 'Masks.xs', + 'Query.xs', + 'Rawlog.xs', + 'Server.xs', + 'Settings.xs', + ) + ), + ] + files( 'module.h', ) @@ -27,7 +29,7 @@ shared_library('Irssi', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irssi_main, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) install_headers( @@ -36,6 +38,6 @@ install_headers( ), install_dir : perlmoddir, ) - + # 'Makefile.PL.in', # 'typemap', diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build index af68ce7f3..4dd0f5e1c 100644 --- a/src/perl/irc/meson.build +++ b/src/perl/irc/meson.build @@ -1,21 +1,23 @@ -shared_library('Irc', - [ xsubpp.process( - files( - 'Channel.xs', - 'Client.xs', - 'Ctcp.xs', - 'Irc.xs', - 'Modes.xs', - 'Netsplit.xs', - 'Notifylist.xs', - 'Query.xs', - 'Server.xs', +shared_library( + 'Irc', + [ + xsubpp.process( + files( + 'Channel.xs', + 'Client.xs', + 'Ctcp.xs', + 'Irc.xs', + 'Modes.xs', + 'Netsplit.xs', + 'Notifylist.xs', + 'Query.xs', + 'Server.xs', + ), + extra_args : [ + '-typemap', '../common/typemap', + ], ), - extra_args : [ - '-typemap', - '../common/typemap', - ], - ) ] + ] + files( 'module.h', ), @@ -27,7 +29,7 @@ shared_library('Irc', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irc_notifylist + dl_cross_irc_core + dl_cross_irssi_main, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) install_headers( @@ -37,16 +39,18 @@ install_headers( install_dir : perlmoddir / 'Irssi', ) -shared_library('Dcc', - [ xsubpp.process( - files( - 'Dcc.xs', +shared_library( + 'Dcc', + [ + xsubpp.process( + files( + 'Dcc.xs', + ), + extra_args : [ + '-typemap', '../common/typemap', + ], ), - extra_args : [ - '-typemap', - '../common/typemap', - ], - ) ] + ] + files( 'module.h', ), @@ -58,7 +62,7 @@ shared_library('Dcc', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irc_dcc + dl_cross_irc_core + dl_cross_irssi_main, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) install_headers( @@ -67,6 +71,6 @@ install_headers( ), install_dir : perlmoddir / 'Irssi' / 'Irc', ) - + # 'Makefile.PL.in', # 'typemap', diff --git a/src/perl/meson.build b/src/perl/meson.build index 1c6e2fbc0..9e85ca064 100644 --- a/src/perl/meson.build +++ b/src/perl/meson.build @@ -1,32 +1,36 @@ - -perl_signals_list_h = custom_target('perl-signals-list.h', +perl_signals_list_h = custom_target( + 'perl-signals-list.h', input : files('../../docs/signals.txt'), output : 'perl-signals-list.h', capture : true, depend_files : files('get-signals.pl'), - command : [build_perl, files('get-signals.pl'), '@INPUT@'], + command : [ build_perl, files('get-signals.pl'), '@INPUT@' ], ) -irssi_core_pl_h = custom_target('irssi-core.pl.h', +irssi_core_pl_h = custom_target( + 'irssi-core.pl.h', input : files('irssi-core.pl'), output : 'irssi-core.pl.h', capture : true, - command : [file2header, '@INPUT@', 'irssi_core_code'], + command : [ file2header, '@INPUT@', 'irssi_core_code' ], ) # required as of Meson 0.58.0 generated_files_inc = include_directories('.') -libperl_core_sm = shared_library('perl_core', +libperl_core_sm = shared_library( + 'perl_core', files( 'perl-common.c', 'perl-core.c', 'perl-signals.c', 'perl-sources.c', - ) + [ + ) + + [ irssi_core_pl_h, perl_signals_list_h, - ] + built_src, + ] + + built_src, c_args : [ def_scriptdir, def_perl_use_lib, @@ -39,16 +43,17 @@ libperl_core_sm = shared_library('perl_core', install_rpath : perl_rpath, build_rpath : perl_rpath, dependencies : dep_cflagsonly + [ perl_dep ] + dl_cross_dep, - override_options : ['b_asneeded=false', 'b_lundef=false'], + override_options : [ 'b_asneeded=false', 'b_lundef=false' ], link_with : dl_cross_irssi_main, ) -dl_cross_perl_core = [] +dl_cross_perl_core = [ ] if need_dl_cross_link dl_cross_perl_core += libperl_core_sm endif -shared_library('fe_perl', +shared_library( + 'fe_perl', files( 'module-formats.c', 'perl-fe.c', @@ -63,7 +68,7 @@ shared_library('fe_perl', install_dir : moduledir, dependencies : dep, link_with : dl_cross_perl_core + dl_cross_irssi_main, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) subdir('common') diff --git a/src/perl/textui/meson.build b/src/perl/textui/meson.build index b7d769c50..9a5b08cf4 100644 --- a/src/perl/textui/meson.build +++ b/src/perl/textui/meson.build @@ -1,18 +1,19 @@ -shared_library('TextUI', - [ xsubpp.process( - files( - 'Statusbar.xs', - 'TextBufferView.xs', - 'TextBuffer.xs', - 'TextUI.xs', +shared_library( + 'TextUI', + [ + xsubpp.process( + files( + 'Statusbar.xs', + 'TextBufferView.xs', + 'TextBuffer.xs', + 'TextUI.xs', + ), + extra_args : [ + '-typemap', '../common/typemap', + '-typemap', '../ui/typemap', + ], ), - extra_args : [ - '-typemap', - '../common/typemap', - '-typemap', - '../ui/typemap', - ], - ) ] + ] + files( 'module.h', ), @@ -24,7 +25,7 @@ shared_library('TextUI', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irssi_main, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) install_headers( @@ -33,6 +34,6 @@ install_headers( ), install_dir : perlmoddir / 'Irssi', ) - + # 'Makefile.PL.in', # 'typemap', diff --git a/src/perl/ui/meson.build b/src/perl/ui/meson.build index a6e5c93c5..5a24d5d6b 100644 --- a/src/perl/ui/meson.build +++ b/src/perl/ui/meson.build @@ -1,16 +1,18 @@ -shared_library('UI', - [ xsubpp.process( - files( - 'Formats.xs', - 'Themes.xs', - 'UI.xs', - 'Window.xs', +shared_library( + 'UI', + [ + xsubpp.process( + files( + 'Formats.xs', + 'Themes.xs', + 'UI.xs', + 'Window.xs', + ), + extra_args : [ + '-typemap', '../common/typemap', + ], ), - extra_args : [ - '-typemap', - '../common/typemap', - ], - ) ] + ] + files( 'module.h', ), @@ -22,7 +24,7 @@ shared_library('UI', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irssi_main, - override_options : ['b_lundef=false'], + override_options : [ 'b_lundef=false' ], ) install_headers( @@ -31,6 +33,6 @@ install_headers( ), install_dir : perlmoddir / 'Irssi', ) - + # 'Makefile.PL.in', # 'typemap', diff --git a/tests/fe-common/core/meson.build b/tests/fe-common/core/meson.build index 44b11222d..a3181f7bd 100644 --- a/tests/fe-common/core/meson.build +++ b/tests/fe-common/core/meson.build @@ -1,4 +1,5 @@ -test_test_formats = executable('test-formats', +test_test_formats = executable( + 'test-formats', files( 'test-formats.c', ), @@ -12,8 +13,11 @@ test_test_formats = executable('test-formats', ], include_directories : rootinc, implicit_include_directories : false, - dependencies : dep + dependencies : dep, +) +test( + 'test-formats test', + test_test_formats, + args : [ '--tap' ], + protocol : 'tap', ) -test('test-formats test', test_test_formats, - args : ['--tap'], - protocol : 'tap') diff --git a/tests/fe-text/meson.build b/tests/fe-text/meson.build index 397bd39f2..68def5f86 100644 --- a/tests/fe-text/meson.build +++ b/tests/fe-text/meson.build @@ -1,4 +1,5 @@ -test_test_paste_join_multiline = executable('test-paste-join-multiline', +test_test_paste_join_multiline = executable( + 'test-paste-join-multiline', files( '../../src/fe-text/gui-entry.c', '../../src/fe-text/gui-printtext.c', @@ -25,7 +26,9 @@ test_test_paste_join_multiline = executable('test-paste-join-multiline', implicit_include_directories : false, dependencies : dep + textui_dep, ) -test('test-paste-join-multiline test', test_test_paste_join_multiline, - args : ['--tap'], - protocol : 'tap') - +test( + 'test-paste-join-multiline test', + test_test_paste_join_multiline, + args : [ '--tap' ], + protocol : 'tap', +) diff --git a/tests/irc/core/meson.build b/tests/irc/core/meson.build index f63f4fa8f..d59b645d1 100644 --- a/tests/irc/core/meson.build +++ b/tests/irc/core/meson.build @@ -1,4 +1,5 @@ -test_test_irc = executable('test-irc', +test_test_irc = executable( + 'test-irc', files( 'test-irc.c', ), @@ -13,15 +14,19 @@ test_test_irc = executable('test-irc', ], include_directories : rootinc, implicit_include_directories : false, - dependencies : dep + dependencies : dep, ) -test('test-irc test', test_test_irc, +test( + 'test-irc test', + test_test_irc, args : [ '--tap', ], - protocol : 'tap') + protocol : 'tap', +) -test_test_channel_events = executable('test-channel-events', +test_test_channel_events = executable( + 'test-channel-events', files( 'test-channel-events.c', ), @@ -36,10 +41,13 @@ test_test_channel_events = executable('test-channel-events', ], include_directories : rootinc, implicit_include_directories : false, - dependencies : dep + dependencies : dep, ) -test('test-channel-events test', test_test_channel_events, +test( + 'test-channel-events test', + test_test_channel_events, args : [ '--tap', ], - protocol : 'tap') + protocol : 'tap', +) diff --git a/tests/irc/flood/meson.build b/tests/irc/flood/meson.build index 785563314..9da3dda50 100644 --- a/tests/irc/flood/meson.build +++ b/tests/irc/flood/meson.build @@ -1,4 +1,5 @@ -test_test_796 = executable('test-796', +test_test_796 = executable( + 'test-796', files( 'test-796.c', ), @@ -17,10 +18,13 @@ test_test_796 = executable('test-796', ], include_directories : rootinc, implicit_include_directories : false, - dependencies : dep + dependencies : dep, ) -test('test-796 test', test_test_796, +test( + 'test-796 test', + test_test_796, args : [ '--tap', ], - protocol : 'tap') + protocol : 'tap', +) diff --git a/themes/meson.build b/themes/meson.build index d58dddf43..bdf2519ec 100644 --- a/themes/meson.build +++ b/themes/meson.build @@ -3,4 +3,5 @@ install_data( 'default.theme', 'colorless.theme', ), - install_dir : themedir) + install_dir : themedir, +) From 7ca9fd5aee415ca50f0262a7382cb113732d5bfd Mon Sep 17 00:00:00 2001 From: William Storey Date: Mon, 26 Jan 2026 20:58:37 -0800 Subject: [PATCH 391/392] Format root meson.build --- meson.build | 60 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/meson.build b/meson.build index d6c582b50..bb6d28291 100644 --- a/meson.build +++ b/meson.build @@ -28,40 +28,40 @@ elif host_machine.system() == 'cygwin' need_dl_cross_link_main = true endif -includedir = get_option('includedir') -incdir = 'irssi' -moduledir = get_option('libdir') / incdir / 'modules' -helpdir = get_option('datadir') / incdir / 'help' -themedir = get_option('datadir') / incdir / 'themes' -scriptdir = get_option('datadir') / incdir / 'scripts' -docdir = get_option('docdir') != '' ? get_option('docdir') : (get_option('datadir') / 'doc' / incdir) - -want_textui = get_option('without-textui') != 'yes' -want_bot = get_option('with-bot') == 'yes' -want_fuzzer = get_option('with-fuzzer') == 'yes' -fuzzer_lib = get_option('with-fuzzer-lib') +includedir = get_option('includedir') +incdir = 'irssi' +moduledir = get_option('libdir') / incdir / 'modules' +helpdir = get_option('datadir') / incdir / 'help' +themedir = get_option('datadir') / incdir / 'themes' +scriptdir = get_option('datadir') / incdir / 'scripts' +docdir = get_option('docdir') != '' ? get_option('docdir') : (get_option('datadir') / 'doc' / incdir) + +want_textui = get_option('without-textui') != 'yes' +want_bot = get_option('with-bot') == 'yes' +want_fuzzer = get_option('with-fuzzer') == 'yes' +fuzzer_lib = get_option('with-fuzzer-lib') fuzzer_link_language = get_option('fuzzer-link-language') -want_proxy = get_option('with-proxy') == 'yes' +want_proxy = get_option('with-proxy') == 'yes' -require_capsicum = get_option('with-capsicum') == 'yes' -want_capsicum = get_option('with-capsicum') != 'no' +require_capsicum = get_option('with-capsicum') == 'yes' +want_capsicum = get_option('with-capsicum') != 'no' require_libutf8proc = get_option('disable-utf8proc') == 'no' -want_libutf8proc = get_option('disable-utf8proc') != 'yes' +want_libutf8proc = get_option('disable-utf8proc') != 'yes' -require_perl = get_option('with-perl') == 'yes' -want_perl = get_option('with-perl') != 'no' -with_perl_lib = get_option('with-perl-lib') +require_perl = get_option('with-perl') == 'yes' +want_perl = get_option('with-perl') != 'no' +with_perl_lib = get_option('with-perl-lib') -require_otr = get_option('with-otr') == 'yes' -want_otr = get_option('with-otr') != 'no' +require_otr = get_option('with-otr') == 'yes' +want_otr = get_option('with-otr') != 'no' -want_glib_internal = get_option('install-glib') != 'no' +want_glib_internal = get_option('install-glib') != 'no' require_glib_internal = get_option('install-glib') == 'force' want_static_dependency = get_option('static-dependency') == 'yes' -package_version = get_option('PACKAGE_VERSION') != '' ? get_option('PACKAGE_VERSION') : meson.project_version() +package_version = get_option('PACKAGE_VERSION') != '' ? get_option('PACKAGE_VERSION') : meson.project_version() fs = import('fs') if fs.exists('config.status') or fs.exists('irssi-version.h') or fs.exists('default-config.h') or fs.exists('default-theme.h') or fs.exists('src/perl/irssi-core.pl.h') or fs.exists('src/perl/perl-signals-list.h') or fs.exists('irssi-config.h') @@ -97,11 +97,11 @@ run_command( check : false, ) -def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"' +def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"' def_sysconfdir = '-D' + 'SYSCONFDIR' + '="' + (get_option('prefix') / get_option('sysconfdir')) + '"' -def_helpdir = '-D' + 'HELPDIR' + '="' + (get_option('prefix') / helpdir) + '"' -def_themesdir = '-D' + 'THEMESDIR' + '="' + (get_option('prefix') / themedir) + '"' -def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) + '"' +def_helpdir = '-D' + 'HELPDIR' + '="' + (get_option('prefix') / helpdir) + '"' +def_themesdir = '-D' + 'THEMESDIR' + '="' + (get_option('prefix') / themedir) + '"' +def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) + '"' def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK' @@ -938,10 +938,8 @@ pc.generate( description : 'Irssi chat client', version : package_version, requires : pc_requires, - variables : [ - 'irssimoduledir=${libdir}' / incdir / 'modules', - 'signalsfile=' + signalsfile - ]) + variables : [ 'irssimoduledir=${libdir}' / incdir / 'modules', 'signalsfile=' + signalsfile ], +) ########### # irssi.1 # From 54bb34e14fa996ca2db543a7a62e1225ffe6c0f2 Mon Sep 17 00:00:00 2001 From: William Storey Date: Mon, 26 Jan 2026 20:42:05 -0800 Subject: [PATCH 392/392] Add muon fmt GitHub Actions workflow --- .github/workflows/muon-fmt.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/muon-fmt.yml diff --git a/.github/workflows/muon-fmt.yml b/.github/workflows/muon-fmt.yml new file mode 100644 index 000000000..6fa06d381 --- /dev/null +++ b/.github/workflows/muon-fmt.yml @@ -0,0 +1,32 @@ +name: Format meson files + +on: + push: + pull_request: + +permissions: {} + +jobs: + muon-meson-fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + with: + persist-credentials: false + + # Build from source because Ubuntu 24.04 apt only has muon 0.2.0. + # Newer muons seem to format differently. + - name: Build muon from source + run: | + git clone --depth 1 --branch 0.5.0 https://github.com/muon-build/muon /tmp/muon + cd /tmp/muon + ./bootstrap.sh build + build/muon-bootstrap setup build + build/muon-bootstrap -C build samu + sudo build/muon -C build install + + - name: Run muon fmt + run: | + find . -name meson.build -print0 | xargs -0 muon fmt -c .muon_fmt.ini -i + git diff --exit-code