From 2db9dfbb4604fc528295021fb7cf85cfcdcb9201 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Sun, 26 Mar 2023 16:34:24 -0500 Subject: [PATCH 001/117] properly format listmodes and their timestamps --- src/fe-common/irc/fe-events-numeric.c | 52 ++++++++++++++++++--------- src/fe-common/irc/module-formats.c | 8 +++-- src/fe-common/irc/module-formats.h | 2 ++ 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 34ba3fe7..0051d3bf 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -143,15 +143,13 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data) IRC_CHANNEL_REC *chanrec; BAN_REC *banrec; const char *channel; - char *params, *ban, *setby, *tims; - long secs; + char *params, *ban, *setby, *tims, *timestr; g_return_if_fail(data != NULL); params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims); - secs = *tims == '\0' ? 0 : - (long) (time(NULL) - atol(tims)); + timestr = my_asctime((time_t) atol(tims)); chanrec = irc_channel_find(server, channel); banrec = chanrec == NULL ? NULL : banlist_find(chanrec->banlist, ban); @@ -160,29 +158,49 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data) printformat(server, channel, MSGLEVEL_CRAP, *setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG, banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec)+1, - channel, ban, setby, secs); + channel, ban, setby, timestr); + g_free(timestr); g_free(params); } static void event_eban_list(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *ban, *setby, *tims; - long secs; + char *params, *ban, *setby, *tims, *timestr; g_return_if_fail(data != NULL); params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims); - secs = *tims == '\0' ? 0 : - (long) (time(NULL) - atol(tims)); + timestr = my_asctime((time_t) atol(tims)); channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, *setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG, - channel, ban, setby, secs); + channel, ban, setby, timestr); + g_free(timestr); + g_free(params); +} + +static void event_quiet_list(IRC_SERVER_REC *server, const char *data) +{ + const char *channel; + char *params, *ban, *setby, *tims, *timestr; + + g_return_if_fail(data != NULL); + + params = event_get_params(data, 6, NULL, &channel, + NULL, &ban, &setby, &tims); + timestr = my_asctime((time_t) atol(tims)); + + channel = get_visible_target(server, channel); + printformat(server, channel, MSGLEVEL_CRAP, + *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, + channel, ban, setby, timestr); + + g_free(timestr); g_free(params); } @@ -214,20 +232,20 @@ static void event_accept_list(IRC_SERVER_REC *server, const char *data) static void event_invite_list(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *invite, *setby, *tims; - long secs; + char *params, *invite, *setby, *tims, *timestr; g_return_if_fail(data != NULL); params = event_get_params(data, 5, NULL, &channel, &invite, &setby, &tims); - secs = *tims == '\0' ? 0 : - (long) (time(NULL) - atol(tims)); + timestr = my_asctime((time_t) atol(tims)); channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, *setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG, - channel, invite, setby, secs); + channel, invite, setby, timestr); + + g_free(timestr); g_free(params); } @@ -727,6 +745,7 @@ void fe_events_numeric_init(void) signal_add("event 281", (SIGNAL_FUNC) event_accept_list); signal_add("event 367", (SIGNAL_FUNC) event_ban_list); signal_add("event 348", (SIGNAL_FUNC) event_eban_list); + signal_add("event 728", (SIGNAL_FUNC) event_quiet_list); signal_add("event 346", (SIGNAL_FUNC) event_invite_list); signal_add("event 433", (SIGNAL_FUNC) event_nick_in_use); signal_add("event 332", (SIGNAL_FUNC) event_topic_get); @@ -804,7 +823,6 @@ void fe_events_numeric_init(void) signal_add("event 506", (SIGNAL_FUNC) event_target_received); /* cannot send (+R) */ signal_add("event 716", (SIGNAL_FUNC) event_target_received); /* cannot /msg (+g) */ signal_add("event 717", (SIGNAL_FUNC) event_target_received); /* +g notified */ - signal_add("event 728", (SIGNAL_FUNC) event_target_received); /* quiet (or other) list */ signal_add("event 729", (SIGNAL_FUNC) event_target_received); /* end of quiet (or other) list */ /* clang-format on */ } @@ -825,6 +843,7 @@ void fe_events_numeric_deinit(void) signal_remove("event 281", (SIGNAL_FUNC) event_accept_list); signal_remove("event 367", (SIGNAL_FUNC) event_ban_list); signal_remove("event 348", (SIGNAL_FUNC) event_eban_list); + signal_remove("event 728", (SIGNAL_FUNC) event_quiet_list); signal_remove("event 346", (SIGNAL_FUNC) event_invite_list); signal_remove("event 433", (SIGNAL_FUNC) event_nick_in_use); signal_remove("event 332", (SIGNAL_FUNC) event_topic_get); @@ -898,6 +917,5 @@ void fe_events_numeric_deinit(void) signal_remove("event 506", (SIGNAL_FUNC) event_target_received); signal_remove("event 716", (SIGNAL_FUNC) event_target_received); signal_remove("event 717", (SIGNAL_FUNC) event_target_received); - signal_remove("event 728", (SIGNAL_FUNC) event_target_received); signal_remove("event 729", (SIGNAL_FUNC) event_target_received); } diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index 9432c5f9..2cd87e04 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -81,12 +81,14 @@ FORMAT_REC fecommon_irc_formats[] = { { "bantype", "Ban type changed to {channel $0}", 1, { 0 } }, { "no_bans", "No bans in channel {channel $0}", 1, { 0 } }, { "banlist", "$0 - {channel $1}: ban {ban $2}", 3, { 1, 0, 0 } }, - { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, $4 secs ago}", 5, { 1, 0, 0, 0, 1 } }, + { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $4}", 5, { 1, 0, 0, 0, 0 } }, + { "quietlist", "{channel $0}: quiet {ban $1}", 2, { 0, 0 } }, + { "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } }, { "ebanlist", "{channel $0}: ban exception {ban $1}", 2, { 0, 0 } }, - { "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } }, + { "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } }, { "no_invitelist", "Invite list is empty in channel {channel $0}", 1, { 0 } }, { "invitelist", "{channel $0}: invite {ban $1}", 2, { 0, 0 } }, - { "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } }, + { "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } }, { "no_such_channel", "{channel $0}: No such channel", 1, { 0 } }, { "channel_synced", "Join to {channel $0} was synced in {hilight $1} secs", 2, { 0, 2 } }, { "server_help_start", "$1", 2, { 0, 0 } }, diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h index a9d29cb0..722f8d40 100644 --- a/src/fe-common/irc/module-formats.h +++ b/src/fe-common/irc/module-formats.h @@ -59,6 +59,8 @@ enum { IRCTXT_NO_BANS, IRCTXT_BANLIST, IRCTXT_BANLIST_LONG, + IRCTXT_QUIETLIST, + IRCTXT_QUIETLIST_LONG, IRCTXT_EBANLIST, IRCTXT_EBANLIST_LONG, IRCTXT_NO_INVITELIST, From 556f580f672bd9587475cef737209699189120c7 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Sun, 26 Mar 2023 19:27:48 -0500 Subject: [PATCH 002/117] add support for ircd-hybrid quiet lists --- src/fe-common/irc/fe-events-numeric.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 0051d3bf..be01d8c3 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -204,6 +204,26 @@ static void event_quiet_list(IRC_SERVER_REC *server, const char *data) g_free(params); } +static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data) +{ + const char *channel; + char *params, *ban, *setby, *tims, *timestr; + + g_return_if_fail(data != NULL); + + params = event_get_params(data, 5, NULL, &channel, + &ban, &setby, &tims); + timestr = my_asctime((time_t) atol(tims)); + + channel = get_visible_target(server, channel); + printformat(server, channel, MSGLEVEL_CRAP, + *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, + channel, ban, setby, timestr); + + g_free(timestr); + g_free(params); +} + static void event_silence_list(IRC_SERVER_REC *server, const char *data) { char *params, *nick, *mask; @@ -746,6 +766,7 @@ void fe_events_numeric_init(void) signal_add("event 367", (SIGNAL_FUNC) event_ban_list); signal_add("event 348", (SIGNAL_FUNC) event_eban_list); signal_add("event 728", (SIGNAL_FUNC) event_quiet_list); + signal_add("event 344", (SIGNAL_FUNC) event_hybrid_quiet_list); /* used by ircd-hybrid */ signal_add("event 346", (SIGNAL_FUNC) event_invite_list); signal_add("event 433", (SIGNAL_FUNC) event_nick_in_use); signal_add("event 332", (SIGNAL_FUNC) event_topic_get); @@ -804,8 +825,7 @@ void fe_events_numeric_init(void) signal_add("event 470", (SIGNAL_FUNC) event_received); signal_add("event 479", (SIGNAL_FUNC) event_received); - signal_add("event 344", (SIGNAL_FUNC) event_target_received); /* reop list */ - signal_add("event 345", (SIGNAL_FUNC) event_target_received); /* end of reop list */ + signal_add("event 345", (SIGNAL_FUNC) event_target_received); /* end of reop list/hybrid quiet list */ signal_add("event 347", (SIGNAL_FUNC) event_target_received); /* end of invite exception list */ signal_add("event 349", (SIGNAL_FUNC) event_target_received); /* end of ban exception list */ signal_add("event 368", (SIGNAL_FUNC) event_target_received); /* end of ban list */ @@ -844,6 +864,7 @@ void fe_events_numeric_deinit(void) signal_remove("event 367", (SIGNAL_FUNC) event_ban_list); signal_remove("event 348", (SIGNAL_FUNC) event_eban_list); signal_remove("event 728", (SIGNAL_FUNC) event_quiet_list); + signal_remove("event 344", (SIGNAL_FUNC) event_hybrid_quiet_list); signal_remove("event 346", (SIGNAL_FUNC) event_invite_list); signal_remove("event 433", (SIGNAL_FUNC) event_nick_in_use); signal_remove("event 332", (SIGNAL_FUNC) event_topic_get); @@ -898,7 +919,6 @@ void fe_events_numeric_deinit(void) signal_remove("event 470", (SIGNAL_FUNC) event_received); signal_remove("event 479", (SIGNAL_FUNC) event_received); - signal_remove("event 344", (SIGNAL_FUNC) event_target_received); signal_remove("event 345", (SIGNAL_FUNC) event_target_received); signal_remove("event 347", (SIGNAL_FUNC) event_target_received); signal_remove("event 349", (SIGNAL_FUNC) event_target_received); From 9324ff9f68ab9a3a9c4dd97a1d5c8fa3b4342d4f Mon Sep 17 00:00:00 2001 From: David Schultz Date: Mon, 27 Mar 2023 11:04:53 -0500 Subject: [PATCH 003/117] this should work for everyone --- src/fe-common/irc/fe-events-numeric.c | 47 +++++++++++++++------------ 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index be01d8c3..6b4540ab 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -204,26 +204,6 @@ static void event_quiet_list(IRC_SERVER_REC *server, const char *data) g_free(params); } -static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data) -{ - const char *channel; - char *params, *ban, *setby, *tims, *timestr; - - g_return_if_fail(data != NULL); - - params = event_get_params(data, 5, NULL, &channel, - &ban, &setby, &tims); - timestr = my_asctime((time_t) atol(tims)); - - channel = get_visible_target(server, channel); - printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, - channel, ban, setby, timestr); - - g_free(timestr); - g_free(params); -} - static void event_silence_list(IRC_SERVER_REC *server, const char *data) { char *params, *nick, *mask; @@ -733,6 +713,33 @@ static void event_target_received(IRC_SERVER_REC *server, const char *data, print_event_received(server, data, nick, TRUE); } +static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data) +{ + const char *channel; + char *params, *ban, *setby, *tims, *timestr; + + g_return_if_fail(data != NULL); + + params = event_get_params(data, 5, NULL, &channel, + &ban, &setby, &tims); + + if (*tims == '\0') { + /* probably not a quiet list */ + event_target_received(server, data, NULL); + return; + } + channel = get_visible_target(server, channel); + + timestr = my_asctime((time_t) atol(tims)); + + printformat(server, channel, MSGLEVEL_CRAP, + *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, + channel, ban, setby, timestr); + + g_free(timestr); + g_free(params); +} + static void event_motd(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { From 201296a0dae2a9b7d4e8d4f4d52fac451a9d1027 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Mon, 27 Mar 2023 18:21:36 -0500 Subject: [PATCH 004/117] add `time_ago()` in addition to timestamps; deduplicate qlist logic --- src/fe-common/irc/fe-events-numeric.c | 91 +++++++++++++++++++-------- src/fe-common/irc/module-formats.c | 8 +-- 2 files changed, 70 insertions(+), 29 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 6b4540ab..1126c2d2 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -138,18 +138,55 @@ static void event_end_of_who(IRC_SERVER_REC *server, const char *data) g_free(params); } +/* Get time elapsed since an event */ +static char *time_ago(time_t seconds) +{ + static char ret[128]; + long unsigned years, weeks, days, hours, minutes; + + seconds = time(NULL) - seconds; + + years = seconds/(86400*365); + seconds %= (86400*365); + weeks = seconds/604800; + seconds %= 604800; + days = seconds/86400; + seconds %= 86400; + hours = seconds/3600; + hours %= 3600; + minutes = seconds/60; + minutes %= 60; + seconds %= 60; + + if (years) + snprintf(ret, sizeof(ret), "%luy %luw %lud", years, weeks, days); + else if (weeks) + snprintf(ret, sizeof(ret), "%luw %lud %luh", weeks, days, hours); + else if (days) + snprintf(ret, sizeof(ret), "%lud %luh %lum", days, hours, minutes); + else if (hours) + snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes); + else if (minutes) + snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned)seconds); + else + snprintf(ret, sizeof(ret), "%lus", (long unsigned)seconds); + + return ret; +} + static void event_ban_list(IRC_SERVER_REC *server, const char *data) { IRC_CHANNEL_REC *chanrec; BAN_REC *banrec; const char *channel; - char *params, *ban, *setby, *tims, *timestr; + char *params, *ban, *setby, *tims, *timestr, *ago; g_return_if_fail(data != NULL); params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims); - timestr = my_asctime((time_t) atol(tims)); + timestr = my_asctime((time_t) atoll(tims)); + ago = time_ago((time_t) atoll(tims)); chanrec = irc_channel_find(server, channel); banrec = chanrec == NULL ? NULL : banlist_find(chanrec->banlist, ban); @@ -158,7 +195,7 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data) printformat(server, channel, MSGLEVEL_CRAP, *setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG, banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec)+1, - channel, ban, setby, timestr); + channel, ban, setby, timestr, ago); g_free(timestr); g_free(params); @@ -167,40 +204,49 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data) static void event_eban_list(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *ban, *setby, *tims, *timestr; + char *params, *ban, *setby, *tims, *timestr, *ago; g_return_if_fail(data != NULL); params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims); - timestr = my_asctime((time_t) atol(tims)); + timestr = my_asctime((time_t) atoll(tims)); + ago = time_ago((time_t) atoll(tims)); channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, *setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG, - channel, ban, setby, timestr); + channel, ban, setby, timestr, ago); g_free(timestr); g_free(params); } +static void do_quiet_list(IRC_SERVER_REC *server, const char *channel, char *ban, char *setby, char *tims) { + char *timestr, *ago; + + timestr = my_asctime((time_t) atoll(tims)); + ago = time_ago((time_t) atoll(tims)); + + channel = get_visible_target(server, channel); + printformat(server, channel, MSGLEVEL_CRAP, + *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, + channel, ban, setby, timestr, ago); + + g_free(timestr); +} + static void event_quiet_list(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *ban, *setby, *tims, *timestr; + char *params, *ban, *setby, *tims; g_return_if_fail(data != NULL); params = event_get_params(data, 6, NULL, &channel, NULL, &ban, &setby, &tims); - timestr = my_asctime((time_t) atol(tims)); + do_quiet_list(server, channel, ban, setby, tims); - channel = get_visible_target(server, channel); - printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, - channel, ban, setby, timestr); - - g_free(timestr); g_free(params); } @@ -232,18 +278,19 @@ static void event_accept_list(IRC_SERVER_REC *server, const char *data) static void event_invite_list(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *invite, *setby, *tims, *timestr; + char *params, *invite, *setby, *tims, *timestr, *ago; g_return_if_fail(data != NULL); params = event_get_params(data, 5, NULL, &channel, &invite, &setby, &tims); - timestr = my_asctime((time_t) atol(tims)); + timestr = my_asctime((time_t) atoll(tims)); + ago = time_ago((time_t) atoll(tims)); channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, *setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG, - channel, invite, setby, timestr); + channel, invite, setby, timestr, ago); g_free(timestr); g_free(params); @@ -716,7 +763,7 @@ static void event_target_received(IRC_SERVER_REC *server, const char *data, static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *ban, *setby, *tims, *timestr; + char *params, *ban, *setby, *tims; g_return_if_fail(data != NULL); @@ -728,15 +775,9 @@ static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data) event_target_received(server, data, NULL); return; } - channel = get_visible_target(server, channel); - timestr = my_asctime((time_t) atol(tims)); + do_quiet_list(server, channel, ban, setby, tims); - printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, - channel, ban, setby, timestr); - - g_free(timestr); g_free(params); } diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index 2cd87e04..3ccf17f9 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -81,14 +81,14 @@ FORMAT_REC fecommon_irc_formats[] = { { "bantype", "Ban type changed to {channel $0}", 1, { 0 } }, { "no_bans", "No bans in channel {channel $0}", 1, { 0 } }, { "banlist", "$0 - {channel $1}: ban {ban $2}", 3, { 1, 0, 0 } }, - { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $4}", 5, { 1, 0, 0, 0, 0 } }, + { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $4 ($5 ago)}", 6, { 1, 0, 0, 0, 0, 0 } }, { "quietlist", "{channel $0}: quiet {ban $1}", 2, { 0, 0 } }, - { "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } }, + { "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } }, { "ebanlist", "{channel $0}: ban exception {ban $1}", 2, { 0, 0 } }, - { "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } }, + { "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } }, { "no_invitelist", "Invite list is empty in channel {channel $0}", 1, { 0 } }, { "invitelist", "{channel $0}: invite {ban $1}", 2, { 0, 0 } }, - { "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } }, + { "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } }, { "no_such_channel", "{channel $0}: No such channel", 1, { 0 } }, { "channel_synced", "Join to {channel $0} was synced in {hilight $1} secs", 2, { 0, 2 } }, { "server_help_start", "$1", 2, { 0, 0 } }, From ee1213481224275afb088518ad763d9f965697dc Mon Sep 17 00:00:00 2001 From: David Schultz Date: Mon, 27 Mar 2023 19:37:48 -0500 Subject: [PATCH 005/117] clean up `time_ago()` Co-authored-by: Doug Freed --- src/fe-common/irc/fe-events-numeric.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 1126c2d2..81ae34e5 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -146,16 +146,12 @@ static char *time_ago(time_t seconds) seconds = time(NULL) - seconds; - years = seconds/(86400*365); - seconds %= (86400*365); - weeks = seconds/604800; - seconds %= 604800; - days = seconds/86400; - seconds %= 86400; - hours = seconds/3600; - hours %= 3600; - minutes = seconds/60; - minutes %= 60; + years = seconds / (86400 * 365); + seconds %= (86400 * 365); + weeks = seconds / 604800; + days = (seconds / 86400) % 7; + hours = (seconds / 3600) % 24; + minutes = (seconds / 60) % 60; seconds %= 60; if (years) From ca148a01224f63e6ad4281c6dcde3c9d08bd7cb0 Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Tue, 4 Apr 2023 11:14:19 +0200 Subject: [PATCH 006/117] expand ~ to $HOME in /upgrade Fixes #1460. --- src/core/session.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/session.c b/src/core/session.c index 5fe481fb..3a63a785 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -59,13 +60,19 @@ void session_upgrade(void) static void cmd_upgrade(const char *data) { CONFIG_REC *session; - char *session_file, *str; + char *session_file, *str, *name; char *binary; if (*data == '\0') - data = irssi_binary; + name = irssi_binary; + else + name = convert_home(data); - if ((binary = g_find_program_in_path(data)) == NULL) + binary = g_find_program_in_path(name); + if (name != irssi_binary) + g_free(name); + + if (binary == NULL) cmd_return_error(CMDERR_PROGRAM_NOT_FOUND); /* save the session */ From a93c51796d0874c5d9968c88ecad443df4412e78 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 4 Apr 2023 15:18:54 +0200 Subject: [PATCH 007/117] update github workflows ubuntu --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 33582968..192e3204 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -34,12 +34,12 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04, ubuntu-latest] + os: [ubuntu-20.04, ubuntu-latest] builder: [meson] compiler: [clang, gcc] flags: [regular] include: - - os: ubuntu-18.04 + - os: ubuntu-20.04 builder: meson meson_ver: ==0.53.2 setuptools_ver: <51 From c5df1c01ccb0f747af95c3b5993dfa7303b80c47 Mon Sep 17 00:00:00 2001 From: Score_Under Date: Sat, 15 Apr 2023 00:39:38 +0100 Subject: [PATCH 008/117] Print perl import warning to STDERR Printing to STDOUT can interfere with programs which intend to produce machine-readable output and yet for whatever reason import Irssi.pm from outside of irssi. Closes https://github.com/irssi/irssi/issues/1465 --- src/perl/common/Irssi.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/perl/common/Irssi.pm b/src/perl/common/Irssi.pm index 786d0e52..bca0084b 100644 --- a/src/perl/common/Irssi.pm +++ b/src/perl/common/Irssi.pm @@ -153,7 +153,7 @@ eval { $in_irssi = $@ ? 0 : 1; if (!in_irssi()) { - print "Warning: This script should be run inside irssi\n"; + print STDERR "Warning: This script should be run inside irssi\n"; } else { bootstrap Irssi $VERSION if (!$static); From 9e9858638d8ef9d5a642c3d4c0ce5107f9754472 Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Thu, 4 May 2023 23:04:28 +0200 Subject: [PATCH 009/117] Fix logic in how own actions are printed for other protocols When working with channels belonging to other, non-IRC protocols, calling irc_channel_find() returns NULL, which makes irssi use IRCTXT_OWN_ACTION_TARGET format, instead of the correct IRCTXT_OWN_ACTION. Using generic channel_find() instead fixes the issue. --- src/fe-common/irc/fe-irc-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index 201e7ffa..89346648 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -173,7 +173,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg, oldtarget = target; target = fe_channel_skip_prefix(IRC_SERVER(server), target); if (server_ischannel(SERVER(server), target)) - item = irc_channel_find(server, target); + item = channel_find(SERVER(server), target); else item = irc_query_find(server, target); From 0bcff291e9c1a9120ffbd6a84a20b7948e690ac1 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 25 May 2023 11:36:25 +0200 Subject: [PATCH 010/117] order --- src/fe-common/irc/fe-events-numeric.c | 10 +++++----- src/fe-common/irc/module-formats.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 81ae34e5..667049cb 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -189,9 +189,9 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data) channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG, - banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec)+1, - channel, ban, setby, timestr, ago); + *setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG, + banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec) + 1, channel, ban, + setby, ago, timestr); g_free(timestr); g_free(params); @@ -226,8 +226,8 @@ static void do_quiet_list(IRC_SERVER_REC *server, const char *channel, char *ban channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, - channel, ban, setby, timestr, ago); + *setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, channel, ban, setby, + ago, timestr); g_free(timestr); } diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index 3ccf17f9..86310157 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -81,11 +81,11 @@ FORMAT_REC fecommon_irc_formats[] = { { "bantype", "Ban type changed to {channel $0}", 1, { 0 } }, { "no_bans", "No bans in channel {channel $0}", 1, { 0 } }, { "banlist", "$0 - {channel $1}: ban {ban $2}", 3, { 1, 0, 0 } }, - { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $4 ($5 ago)}", 6, { 1, 0, 0, 0, 0, 0 } }, + { "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $5 ($4 ago)}", 6, { 1, 0, 0, 0, 0, 0 } }, { "quietlist", "{channel $0}: quiet {ban $1}", 2, { 0, 0 } }, - { "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } }, + { "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $4 ($3 ago)}", 5, { 0, 0, 0, 0, 0 } }, { "ebanlist", "{channel $0}: ban exception {ban $1}", 2, { 0, 0 } }, - { "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } }, + { "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $4 ($3 ago)}", 5, { 0, 0, 0, 0, 0 } }, { "no_invitelist", "Invite list is empty in channel {channel $0}", 1, { 0 } }, { "invitelist", "{channel $0}: invite {ban $1}", 2, { 0, 0 } }, { "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } }, From 0355ed0bea5a993b49804b6d7a32588ade1a9b48 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 25 May 2023 11:42:15 +0200 Subject: [PATCH 011/117] format --- src/fe-common/irc/fe-events-numeric.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 667049cb..951bd31f 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -163,9 +163,9 @@ static char *time_ago(time_t seconds) else if (hours) snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes); else if (minutes) - snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned)seconds); + snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned) seconds); else - snprintf(ret, sizeof(ret), "%lus", (long unsigned)seconds); + snprintf(ret, sizeof(ret), "%lus", (long unsigned) seconds); return ret; } @@ -211,14 +211,16 @@ static void event_eban_list(IRC_SERVER_REC *server, const char *data) channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG, - channel, ban, setby, timestr, ago); + *setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG, channel, ban, setby, + timestr, ago); g_free(timestr); g_free(params); } -static void do_quiet_list(IRC_SERVER_REC *server, const char *channel, char *ban, char *setby, char *tims) { +static void do_quiet_list(IRC_SERVER_REC *server, const char *channel, char *ban, char *setby, + char *tims) +{ char *timestr, *ago; timestr = my_asctime((time_t) atoll(tims)); @@ -239,8 +241,7 @@ static void event_quiet_list(IRC_SERVER_REC *server, const char *data) g_return_if_fail(data != NULL); - params = event_get_params(data, 6, NULL, &channel, - NULL, &ban, &setby, &tims); + params = event_get_params(data, 6, NULL, &channel, NULL, &ban, &setby, &tims); do_quiet_list(server, channel, ban, setby, tims); g_free(params); @@ -285,8 +286,8 @@ static void event_invite_list(IRC_SERVER_REC *server, const char *data) channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, - *setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG, - channel, invite, setby, timestr, ago); + *setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG, channel, invite, + setby, timestr, ago); g_free(timestr); g_free(params); @@ -763,8 +764,7 @@ static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data) g_return_if_fail(data != NULL); - params = event_get_params(data, 5, NULL, &channel, - &ban, &setby, &tims); + params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims); if (*tims == '\0') { /* probably not a quiet list */ From 685816e9459a4c4c93f314222d5123467438e88a Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 25 May 2023 11:48:31 +0200 Subject: [PATCH 012/117] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 96886f6b..59566dc8 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 51 +#define IRSSI_ABI_VERSION 52 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 3ec05851a06eac761a9382175765923e45f30e6c Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 4 Jul 2023 10:27:09 +0200 Subject: [PATCH 013/117] fix usage of $type in ExtUtils::ParseXS 3.50 --- src/perl/common/typemap | 2 +- src/perl/irc/typemap | 2 +- src/perl/textui/typemap | 2 +- src/perl/ui/typemap | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/perl/common/typemap b/src/perl/common/typemap index 5b7e0c32..9b6c6668 100644 --- a/src/perl/common/typemap +++ b/src/perl/common/typemap @@ -28,5 +28,5 @@ T_IrssiObj $arg = iobject_bless((SERVER_REC *)$var); T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); diff --git a/src/perl/irc/typemap b/src/perl/irc/typemap index 9bf87647..c8a9b678 100644 --- a/src/perl/irc/typemap +++ b/src/perl/irc/typemap @@ -36,5 +36,5 @@ T_DccObj $arg = simple_iobject_bless((DCC_REC *)$var); T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); diff --git a/src/perl/textui/typemap b/src/perl/textui/typemap index 7710c2d2..e597c586 100644 --- a/src/perl/textui/typemap +++ b/src/perl/textui/typemap @@ -18,7 +18,7 @@ T_BufferLineWrapper OUTPUT T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); T_BufferLineWrapper $arg = perl_buffer_line_bless($var); diff --git a/src/perl/ui/typemap b/src/perl/ui/typemap index 4afb273d..98355191 100644 --- a/src/perl/ui/typemap +++ b/src/perl/ui/typemap @@ -13,5 +13,5 @@ T_PlainObj OUTPUT T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); From c93c61bf997ae98580fe3fecaaaf57186ba982ac Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 19 Jul 2023 20:04:25 +0200 Subject: [PATCH 014/117] update perl requirement in install file --- INSTALL | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index c2e05416..69bd6aa8 100644 --- a/INSTALL +++ b/INSTALL @@ -7,7 +7,7 @@ To compile Irssi you need: - meson-0.53 build system with ninja-1.8 or greater - glib-2.32 or greater - openssl (for ssl support) -- perl-5.6 or greater (for Perl support) +- perl-5.8 or greater (for building, and optionally Perl scripts) - terminfo or ncurses (for text frontend) For most people, this should work just fine: diff --git a/meson.build b/meson.build index c1698466..264718f2 100644 --- a/meson.build +++ b/meson.build @@ -402,7 +402,7 @@ 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', '-Eprint $INC{"ExtUtils/ParseXS.pm"} =~ s{ParseXS\\.pm$}{xsubpp}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, output : '@BASENAME@.c', From 1131a881cffd2b83e9e42b424397cdd1aca53625 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 8 Aug 2023 07:59:31 +0200 Subject: [PATCH 015/117] change realpath to use syntax based on _POSIX_VERSION --- src/lib-config/write.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib-config/write.c b/src/lib-config/write.c index 5dbbd1ed..b7c6edb5 100644 --- a/src/lib-config/write.c +++ b/src/lib-config/write.c @@ -305,6 +305,9 @@ int config_write(CONFIG_REC *rec, const char *fname, int create_mode) const char *base_name; char *tmp_name = NULL; char *dest_name = NULL; +#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L + char resolved_path[PATH_MAX] = { 0 }; +#endif g_return_val_if_fail(rec != NULL, -1); g_return_val_if_fail(fname != NULL || rec->fname != NULL, -1); @@ -313,16 +316,15 @@ int config_write(CONFIG_REC *rec, const char *fname, int create_mode) base_name = fname != NULL ? fname : rec->fname; /* expand all symlinks; else we may replace a symlink with a regular file */ - dest_name = realpath(base_name, NULL); - - if (errno == EINVAL) { - /* variable path length not supported by glibc < 2.3, Solaris < 11 */ - char resolved_path[PATH_MAX] = { 0 }; - errno = 0; - if ((dest_name = realpath(base_name, resolved_path)) != NULL) { - dest_name = g_strdup(dest_name); - } +#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L + /* variable path length not supported by glibc < 2.3, Solaris < 11 */ + errno = 0; + if ((dest_name = realpath(base_name, resolved_path)) != NULL) { + dest_name = g_strdup(dest_name); } +#else + dest_name = realpath(base_name, NULL); +#endif if (dest_name == NULL) { if (errno == ENOENT) { From c0db0b8cb81f696d3e40be59605319a77283ed58 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 10 Aug 2023 10:19:01 +0200 Subject: [PATCH 016/117] add explicit name_suffix to shared modules --- meson.build | 10 ++++++++++ src/fe-common/irc/dcc/meson.build | 1 + src/fe-common/irc/meson.build | 1 + src/fe-common/irc/notifylist/meson.build | 1 + src/irc/core/meson.build | 1 + src/irc/dcc/meson.build | 1 + src/irc/flood/meson.build | 1 + src/irc/notifylist/meson.build | 1 + src/irc/proxy/meson.build | 1 + src/otr/meson.build | 1 + src/perl/common/meson.build | 1 + src/perl/irc/meson.build | 1 + src/perl/meson.build | 2 ++ src/perl/textui/meson.build | 1 + src/perl/ui/meson.build | 1 + 15 files changed, 25 insertions(+) diff --git a/meson.build b/meson.build index 264718f2..07949e30 100644 --- a/meson.build +++ b/meson.build @@ -77,6 +77,16 @@ def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK' + +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()) + module_suffix = 'so' + perl_module_suffix = 'bundle' +endif + ############## # Help files # ############## diff --git a/src/fe-common/irc/dcc/meson.build b/src/fe-common/irc/dcc/meson.build index 50806e81..487d1aea 100644 --- a/src/fe-common/irc/dcc/meson.build +++ b/src/fe-common/irc/dcc/meson.build @@ -18,6 +18,7 @@ libfe_irc_dcc_a = static_library('fe_irc_dcc', ], dependencies : dep) shared_module('fe_irc_dcc', + name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_dcc, diff --git a/src/fe-common/irc/meson.build b/src/fe-common/irc/meson.build index 5af5528a..9b198e24 100644 --- a/src/fe-common/irc/meson.build +++ b/src/fe-common/irc/meson.build @@ -29,6 +29,7 @@ libfe_common_irc_a = static_library('fe_common_irc', ], dependencies : dep) shared_module('fe_common_irc', + name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_core, diff --git a/src/fe-common/irc/notifylist/meson.build b/src/fe-common/irc/notifylist/meson.build index 1d42e147..0f9c4d68 100644 --- a/src/fe-common/irc/notifylist/meson.build +++ b/src/fe-common/irc/notifylist/meson.build @@ -13,6 +13,7 @@ libfe_irc_notifylist_a = static_library('fe_irc_notifylist', ], dependencies : dep) shared_module('fe_irc_notifylist', + name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_notifylist, diff --git a/src/irc/core/meson.build b/src/irc/core/meson.build index b8c1bad9..81559f3e 100644 --- a/src/irc/core/meson.build +++ b/src/irc/core/meson.build @@ -39,6 +39,7 @@ libirc_core_a = static_library('irc_core', ], dependencies : dep) libirc_core_sm = shared_module('irc_core', + name_suffix : module_suffix, install : true, install_dir : moduledir, link_whole : libirc_core_a) diff --git a/src/irc/dcc/meson.build b/src/irc/dcc/meson.build index 9c7e33d5..e5e2b0c6 100644 --- a/src/irc/dcc/meson.build +++ b/src/irc/dcc/meson.build @@ -13,6 +13,7 @@ libirc_dcc_sm = shared_module('irc_dcc', ), include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_core, diff --git a/src/irc/flood/meson.build b/src/irc/flood/meson.build index 3c763beb..0ba94282 100644 --- a/src/irc/flood/meson.build +++ b/src/irc/flood/meson.build @@ -9,6 +9,7 @@ libirc_flood_a = static_library('irc_flood', implicit_include_directories : false, dependencies : dep) shared_module('irc_flood', + name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_core, diff --git a/src/irc/notifylist/meson.build b/src/irc/notifylist/meson.build index ab664d16..212d68e5 100644 --- a/src/irc/notifylist/meson.build +++ b/src/irc/notifylist/meson.build @@ -10,6 +10,7 @@ libirc_notifylist_sm = shared_module('irc_notifylist', ), include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, link_with : dl_cross_irc_core, diff --git a/src/irc/proxy/meson.build b/src/irc/proxy/meson.build index be91c7d5..30ac90a4 100644 --- a/src/irc/proxy/meson.build +++ b/src/irc/proxy/meson.build @@ -9,6 +9,7 @@ shared_module('irc_proxy', + [ irssi_version_h ], include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, dependencies : dep, diff --git a/src/otr/meson.build b/src/otr/meson.build index 10b9fa55..5b7d256f 100644 --- a/src/otr/meson.build +++ b/src/otr/meson.build @@ -11,6 +11,7 @@ shared_module('otr_core', ), include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, dependencies : dep, diff --git a/src/perl/common/meson.build b/src/perl/common/meson.build index d3c98a88..5b174399 100644 --- a/src/perl/common/meson.build +++ b/src/perl/common/meson.build @@ -20,6 +20,7 @@ shared_module('Irssi', ) + [ irssi_version_h ], name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi', include_directories : rootinc, diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build index b65856ff..a95fd778 100644 --- a/src/perl/irc/meson.build +++ b/src/perl/irc/meson.build @@ -21,6 +21,7 @@ shared_module('Irc', 'module.h', ), name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi' / 'Irc', include_directories : rootinc, diff --git a/src/perl/meson.build b/src/perl/meson.build index ad996acf..f859c7c4 100644 --- a/src/perl/meson.build +++ b/src/perl/meson.build @@ -33,6 +33,7 @@ libperl_core_sm = shared_module('perl_core', ], include_directories : [ rootinc ] + [ generated_files_inc ], implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, install_rpath : perl_rpath, @@ -56,6 +57,7 @@ shared_module('fe_perl', ], include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, dependencies : dep, diff --git a/src/perl/textui/meson.build b/src/perl/textui/meson.build index e0b83dd3..23c8d458 100644 --- a/src/perl/textui/meson.build +++ b/src/perl/textui/meson.build @@ -17,6 +17,7 @@ shared_module('TextUI', 'module.h', ), name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi' / 'TextUI', include_directories : rootinc, diff --git a/src/perl/ui/meson.build b/src/perl/ui/meson.build index f9b8b41c..1577dcf6 100644 --- a/src/perl/ui/meson.build +++ b/src/perl/ui/meson.build @@ -15,6 +15,7 @@ shared_module('UI', 'module.h', ), name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi' / 'UI', include_directories : rootinc, From 96dbcef1666355d5b7cf0f2589e91dfaaa63e2f6 Mon Sep 17 00:00:00 2001 From: vague666 Date: Mon, 14 Aug 2023 11:35:06 +0200 Subject: [PATCH 017/117] patch by petteri_ to enable bash-like editing of window history --- src/fe-common/core/command-history.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/command-history.c b/src/fe-common/core/command-history.c index 43d86354..ccb8bfd9 100644 --- a/src/fe-common/core/command-history.c +++ b/src/fe-common/core/command-history.c @@ -261,7 +261,12 @@ static const char *command_history_prev_int(WINDOW_REC *window, const char *text if (*text != '\0' && (pos == NULL || g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) != 0)) { /* save the old entry to history */ - command_history_add(history, text); + if (pos != NULL && settings_get_bool("command_history_editable")) { + history_entry_destroy(pos->data); + pos->data = history_entry_new(history, text); + } else { + command_history_add(history, text); + } } return history->pos == NULL ? text : ((HISTORY_ENTRY_REC *)history->pos->data)->text; @@ -292,7 +297,12 @@ static const char *command_history_next_int(WINDOW_REC *window, const char *text if (*text != '\0' && (pos == NULL || g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) != 0)) { /* save the old entry to history */ - command_history_add(history, text); + if (pos != NULL && settings_get_bool("command_history_editable")) { + history_entry_destroy(pos->data); + pos->data = history_entry_new(history, text); + } else { + command_history_add(history, text); + } } return history->pos == NULL ? "" : ((HISTORY_ENTRY_REC *)history->pos->data)->text; } @@ -467,6 +477,7 @@ void command_history_init(void) { settings_add_int("history", "max_command_history", 100); settings_add_bool("history", "window_history", FALSE); + settings_add_bool("history", "command_history_editable", FALSE); special_history_func_set(special_history_func); From 3aa9734c1ca0a4b8fe498a04b3f9e9b418263a80 Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Mon, 14 Aug 2023 12:01:31 +0200 Subject: [PATCH 018/117] core: remove unused len variable This commit removes the unused `len` variable, which gets set quite a few times, but whose value is totally unused. This also fixes a compiler warning I get on my Darwin. --- src/irc/core/netsplit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index 38b63fe5..308a20d9 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -222,7 +222,7 @@ NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server, int quitmsg_is_split(const char *msg) { const char *host2, *p; - int prev, len, host1_dot, host2_dot; + int prev, host1_dot, host2_dot; g_return_val_if_fail(msg != NULL, FALSE); @@ -242,7 +242,7 @@ int quitmsg_is_split(const char *msg) - can't contain ':' or '/' chars (some servers allow URLs) */ host2 = NULL; - prev = '\0'; len = 0; host1_dot = host2_dot = 0; + prev = '\0'; host1_dot = host2_dot = 0; while (*msg != '\0') { if (*msg == ' ') { if (prev == '.' || prev == '\0') { @@ -254,7 +254,7 @@ int quitmsg_is_split(const char *msg) return FALSE; /* only one space allowed */ if (!host1_dot) return FALSE; /* host1 didn't have domain */ - host2 = msg+1; len = -1; + host2 = msg+1; } else if (*msg == '.') { if (prev == '\0' || prev == ' ' || prev == '.') { /* domains can't start with '.' @@ -270,7 +270,7 @@ int quitmsg_is_split(const char *msg) return FALSE; prev = *msg; - msg++; len++; + msg++; } if (!host2_dot || prev == '.') From a037f68f02777db5194bbd6042db535b921e28e9 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 22 Aug 2023 22:28:36 +0200 Subject: [PATCH 019/117] stop crash on server add reported by nsprra --- src/fe-common/core/fe-server.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index ab76c363..56acf020 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -101,8 +101,14 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist) } } - server = rec->create_server_setup(); - server->chat_type = rec->id; + if (rec == NULL) { + /* no protocols loaded, bail out */ + signal_emit("chat protocol unknown", 1, "(none)"); + return NULL; + } + + server = rec->create_server_setup(); + server->chat_type = rec->id; server->tls_verify = TRUE; return server; } From 523a42e6f09c9a73219efa90960e1c90f5519619 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 4 Sep 2023 21:42:18 +0200 Subject: [PATCH 020/117] document meson apple workaround workaround for https://github.com/mesonbuild/meson/issues/11165 --- INSTALL | 8 ++++++++ docs/meson-macos-ar.txt | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 docs/meson-macos-ar.txt diff --git a/INSTALL b/INSTALL index 69bd6aa8..9c88325d 100644 --- a/INSTALL +++ b/INSTALL @@ -108,3 +108,11 @@ would call: Getting perl scripting to work needs a few things: - TODO + + + Apple MacOS / Darwin + +At the time of writing, meson has an open issue with correctly linking +libraries on macos. + +See docs/meson-macos-ar.txt for a workaround. diff --git a/docs/meson-macos-ar.txt b/docs/meson-macos-ar.txt new file mode 100644 index 00000000..77e5cb8e --- /dev/null +++ b/docs/meson-macos-ar.txt @@ -0,0 +1,6 @@ +;; manual workaround for meson bug https://github.com/mesonbuild/meson/issues/11165 +;; fixes compilation with meson on apple macos +;; usage: meson --native-file ./docs/meson-macos-ar.txt ... + +[binaries] +ar = ['/bin/sh', '-c', 'ar=${AR:-ar}; ranlib=${RANLIB:-ranlib -c -}; case "x$1" in xcsr*) $ar "$@" && $ranlib "$2" || exit $?; ;; *) exec $ar "$@"; ;; esac;', 'ar'] From 9ab78d0160254fdf41588aca748a30022fb7c865 Mon Sep 17 00:00:00 2001 From: KindOne <20209685+RealKindOne@users.noreply.github.com> Date: Sat, 9 Sep 2023 05:25:30 -0400 Subject: [PATCH 021/117] Add -notls and -notls_verify into help file and src/core/chat-commands.c --- docs/help/in/server.in | 4 +++- src/core/chat-commands.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/help/in/server.in b/docs/help/in/server.in index 47b2d524..84b5ad78 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -16,11 +16,13 @@ -4: Connects using IPv4. -6: Connects using IPv6. -tls: Connects using TLS encryption. + -notls: Connect without TLS encrption. -tls_cert: The TLS client certificate file. -tls_pkey: The TLS client private key, if not included in the certificate file. -tls_pass: The password for the TLS client private key or certificate. - -tls_verify: Verifies the TLS certificate of the server. + -tls_verify: Verifies the TLS certificate of the server. + -notls_verify: Doesn't verify the TLS certificate of the server. -tls_cafile: The file with the list of CA certificates. -tls_capath: The directory which contains the CA certificates. -tls_ciphers: TLS cipher suite preference lists. diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index a88a27ab..faeec451 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -211,8 +211,8 @@ static void cmd_server(const char *data, SERVER_REC *server, WI_ITEM_REC *item) command_runsub("server", data, server, item); } -/* SYNTAX: SERVER CONNECT [-4 | -6] [-tls] [-tls_cert ] [-tls_pkey ] - [-tls_pass ] [-tls_verify] [-tls_cafile ] +/* SYNTAX: SERVER CONNECT [-4 | -6] [-tls | -notls] [-tls_cert ] [-tls_pkey ] + [-tls_pass ] [-tls_verify | -notls_verify] [-tls_cafile ] [-tls_capath ] [-tls_ciphers ] [-tls_pinned_cert ] [-tls_pinned_pubkey ] [-!] [-noautosendcmd] [-nocap] From fe6013be42b9af94de3bb0e497a3ab135af2fb8e Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 12 Sep 2023 13:51:36 +0200 Subject: [PATCH 022/117] improve code formatting --- src/irc/core/netsplit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index 308a20d9..4a902c9e 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -222,7 +222,7 @@ NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server, int quitmsg_is_split(const char *msg) { const char *host2, *p; - int prev, host1_dot, host2_dot; + int prev, host1_dot, host2_dot; g_return_val_if_fail(msg != NULL, FALSE); @@ -242,7 +242,8 @@ int quitmsg_is_split(const char *msg) - can't contain ':' or '/' chars (some servers allow URLs) */ host2 = NULL; - prev = '\0'; host1_dot = host2_dot = 0; + prev = '\0'; + host1_dot = host2_dot = 0; while (*msg != '\0') { if (*msg == ' ') { if (prev == '.' || prev == '\0') { @@ -254,7 +255,7 @@ int quitmsg_is_split(const char *msg) return FALSE; /* only one space allowed */ if (!host1_dot) return FALSE; /* host1 didn't have domain */ - host2 = msg+1; + host2 = msg + 1; } else if (*msg == '.') { if (prev == '\0' || prev == ' ' || prev == '.') { /* domains can't start with '.' @@ -270,7 +271,7 @@ int quitmsg_is_split(const char *msg) return FALSE; prev = *msg; - msg++; + msg++; } if (!host2_dot || prev == '.') From 4ceafbeea4e001af8cb752c1eeddd64551063ad2 Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Mon, 14 Aug 2023 11:56:39 +0200 Subject: [PATCH 023/117] fe-text: include the real tputs(3) from term.h This commit includes the real `tpus(3)` function from the appropriate `term.h` header file, if found. This commit is necessary to fix a compiler warning on Darwin. --- src/fe-text/term-terminfo.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 5e9ead8a..06310cc9 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -30,6 +30,13 @@ #include #include +#ifdef HAVE_TERM_H +#include +#else +/* TODO: This needs arguments, starting with C2X. */ +int tputs(); +#endif + /* returns number of characters in the beginning of the buffer being a a single character, or -1 if more input is needed. The character will be saved in result */ @@ -314,9 +321,6 @@ inline static int term_putchar(int c) return fputc(c, current_term->out); } -/* copied from terminfo-core.c */ -int tputs(); - static int termctl_set_color_24bit(int bg, unsigned int lc) { static char buf[20]; From 8c2fa0687ea5761d51e2783d903b103a42cce076 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 13 Sep 2023 21:31:11 +0200 Subject: [PATCH 024/117] silence clang perl warning on affected version --- .github/workflows/check.yml | 3 +++ meson.build | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 192e3204..f92e11e4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -65,6 +65,9 @@ jobs: 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 run: tar xaf artifact/irssi-*.tar.gz + - name: Setup local annotations + if: ${{ github.event_name == 'pull_request' }} + uses: irssi-import/actions-irssi/problem-matchers@master - name: build and install with meson run: | # ninja install diff --git a/meson.build b/meson.build index 07949e30..0d06c466 100644 --- a/meson.build +++ b/meson.build @@ -390,6 +390,11 @@ if want_perl if perl_version == UNSET 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) From 4bc354d5e434300ca6c9362187627dd806b45273 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 13 Sep 2023 22:54:46 +0200 Subject: [PATCH 025/117] load all modules in the right order during check --- .github/workflows/check.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f92e11e4..276e513e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -96,9 +96,14 @@ jobs: ^set -clear log_day_changed ^set -clear log_open_string ^set log_timestamp * - ^window log on' > irssi-test/startup - echo load perl >> irssi-test/startup - echo load proxy >> irssi-test/startup - echo ^quit >> irssi-test/startup + ^window log on + load irc + load dcc + load flood + load notifylist + load perl + load otr + load proxy + ^quit' > irssi-test/startup irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl cat irc.log.* From 7c5b2db26974c671e65055b9b6749bc538186afd Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 14 Sep 2023 15:21:55 +0200 Subject: [PATCH 026/117] add separate annotation-warnings step see https://github.com/actions/runner/blob/2908d82845c018193655e68f3c20a5ad03bc0efd/src/Runner.Worker/Handlers/OutputManager.cs#L320 see https://github.com/actions/runner/issues/763#issuecomment-1435735340 --- .github/workflows/check.yml | 55 +++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 276e513e..65f56b17 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -65,9 +65,6 @@ jobs: 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 run: tar xaf artifact/irssi-*.tar.gz - - name: Setup local annotations - if: ${{ github.event_name == 'pull_request' }} - uses: irssi-import/actions-irssi/problem-matchers@master - name: build and install with meson run: | # ninja install @@ -107,3 +104,55 @@ jobs: ^quit' > irssi-test/startup irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl cat irc.log.* + annotation-warnings: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + env: + CC: clang + steps: + - name: prepare required software + run: | + sudo apt update && sudo apt install $apt_build_deps + - uses: actions/checkout@main + - name: Setup local annotations + uses: irssi-import/actions-irssi/problem-matchers@master + - name: set PATH + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: prepare required software + env: + meson_ver: ${{ matrix.meson_ver }} + setuptools_ver: ${{ matrix.setuptools_ver }} + run: | + sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_meson + eval "$get_pip_build_deps_meson" + curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl + - name: build and install with meson + run: | + meson Build $build_options_meson --prefix=${prefix/\~/~} + ninja -C Build + ninja -C Build install >/dev/null + - name: run launch test + env: + TERM: xterm + run: | + # automated irssi launch test + cd + mkdir irssi-test + echo 'echo automated irssi launch test + ^set settings_autosave off + ^set -clear log_close_string + ^set -clear log_day_changed + ^set -clear log_open_string + ^set log_timestamp * + ^window log on + load irc + load dcc + load flood + load notifylist + load perl + load otr + load proxy + ^quit' > irssi-test/startup + irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl + cat irc.log.* From dfca0a9f84b0191f891496c7bb0eacbd878a0416 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 22 Sep 2023 12:53:57 +0200 Subject: [PATCH 027/117] Restore locale after loading Perl --- src/perl/irssi-core.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/perl/irssi-core.pl b/src/perl/irssi-core.pl index cf987b31..880bd6a3 100644 --- a/src/perl/irssi-core.pl +++ b/src/perl/irssi-core.pl @@ -50,3 +50,10 @@ sub eval_file { die "cap_sasl has been unloaded from Irssi ".Irssi::version()." because it conflicts with the built-in SASL support. See /help network for configuring SASL or read the ChangeLog for more information."; } } + +if ( $] >= 5.037005 && $] <= 5.038000 ) { + # https://github.com/Perl/perl5/issues/21366 + print STDERR "\e7 \e[A Irssi: applying locale workaround for Perl 5.38.0 \e8"; + require POSIX; + POSIX::setlocale(&POSIX::LC_ALL, ""); +} From 160c2401a5ad424662d58181da133be60d153489 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Fri, 31 Mar 2023 12:43:36 +0000 Subject: [PATCH 028/117] Merge pull request #1458 from ailin-nemui/help-toglev update level toggle help (cherry picked from commit c6ad171fe93573d73bb0ffad0e66de935c54ec15) --- docs/help/in/window.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/help/in/window.in b/docs/help/in/window.in index 23316911..2566668b 100644 --- a/docs/help/in/window.in +++ b/docs/help/in/window.in @@ -53,7 +53,7 @@ %|Add the required arguments for the given command. Without arguments, the details (size, immortality, levels, server, name and sticky group) of the currently active window are displayed. If used with a number as argument, same as WINDOW REFNUM. - %|LEVEL and HIDELEVEL modify the currently set level. Without arguments, the current level is displayed. Levels listed starting with `+' are added to the current levels. Levels listed starting with `-' are removed from the current levels. To clear the levels, start the new level setting with `NONE'. Levels listed starting with `^' are either removed or added from the current setting, depending on whether they were previously set or not (since Irssi 1.5). Levels listed as is are also added to the current levels. Afterwards, the new level setting is displayed. + %|LEVEL and HIDELEVEL modify the currently set level. Without arguments, the current level is displayed. Levels listed starting with `+' are added to the current levels. Levels listed starting with `-' are removed from the current levels. To clear the levels, start the new level setting with `NONE'. Levels listed starting with `^' are either removed or added from the current setting, depending on whether they were previously set or not (since Irssi 1.4.4). Levels listed as is are also added to the current levels. Afterwards, the new level setting is displayed. %9Description:%9 From 6b65492b65382215fc4eae047b024077a53ce0cc Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 4 Apr 2023 13:12:50 +0000 Subject: [PATCH 029/117] Merge pull request #1462 from mauke/upgrade-tilde-expand expand ~ to $HOME in /upgrade (cherry picked from commit 5c42345ea23a96bd0fbc28036af36e5db45d6059) --- src/core/session.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/session.c b/src/core/session.c index 5fe481fb..3a63a785 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -59,13 +60,19 @@ void session_upgrade(void) static void cmd_upgrade(const char *data) { CONFIG_REC *session; - char *session_file, *str; + char *session_file, *str, *name; char *binary; if (*data == '\0') - data = irssi_binary; + name = irssi_binary; + else + name = convert_home(data); - if ((binary = g_find_program_in_path(data)) == NULL) + binary = g_find_program_in_path(name); + if (name != irssi_binary) + g_free(name); + + if (binary == NULL) cmd_return_error(CMDERR_PROGRAM_NOT_FOUND); /* save the session */ From 8afbd6511c095319406a37df16345ebb3d2f1449 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sat, 15 Apr 2023 14:08:31 +0000 Subject: [PATCH 030/117] Merge pull request #1467 from ScoreUnder/perl_warning_to_stderr Print perl import warning to STDERR (cherry picked from commit e732b601f7edd24b268051a8b6d62b8c7f1d9c82) --- src/perl/common/Irssi.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/perl/common/Irssi.pm b/src/perl/common/Irssi.pm index 786d0e52..bca0084b 100644 --- a/src/perl/common/Irssi.pm +++ b/src/perl/common/Irssi.pm @@ -153,7 +153,7 @@ eval { $in_irssi = $@ ? 0 : 1; if (!in_irssi()) { - print "Warning: This script should be run inside irssi\n"; + print STDERR "Warning: This script should be run inside irssi\n"; } else { bootstrap Irssi $VERSION if (!$static); From 7f67b5deb0ea59e866df4f3ec57b4fda62512aca Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Thu, 25 May 2023 11:00:40 +0000 Subject: [PATCH 031/117] Merge pull request #1471 from irssi/from-codeberg Sync (cherry picked from commit 274977a5879ca71d1a9b7ea7ce2f980325511a18) --- src/fe-common/irc/fe-irc-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index 1419f934..5d820bbf 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -173,7 +173,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg, oldtarget = target; target = fe_channel_skip_prefix(IRC_SERVER(server), target); if (server_ischannel(SERVER(server), target)) - item = irc_channel_find(server, target); + item = channel_find(SERVER(server), target); else item = irc_query_find(server, target); From 7f32ed012cc05b765b07f552b8cf2bcf3bd2730d Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 18 Jul 2023 22:05:28 +0000 Subject: [PATCH 032/117] Merge pull request #1474 from ailin-nemui/perl5380 fix usage of $type in ExtUtils::ParseXS 3.50 (cherry picked from commit da49ec62e6cc949d3e5359b88abbd0b038d3e23a) --- src/perl/common/typemap | 2 +- src/perl/irc/typemap | 2 +- src/perl/textui/typemap | 2 +- src/perl/ui/typemap | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/perl/common/typemap b/src/perl/common/typemap index 5b7e0c32..9b6c6668 100644 --- a/src/perl/common/typemap +++ b/src/perl/common/typemap @@ -28,5 +28,5 @@ T_IrssiObj $arg = iobject_bless((SERVER_REC *)$var); T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); diff --git a/src/perl/irc/typemap b/src/perl/irc/typemap index 9bf87647..c8a9b678 100644 --- a/src/perl/irc/typemap +++ b/src/perl/irc/typemap @@ -36,5 +36,5 @@ T_DccObj $arg = simple_iobject_bless((DCC_REC *)$var); T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); diff --git a/src/perl/textui/typemap b/src/perl/textui/typemap index 7710c2d2..e597c586 100644 --- a/src/perl/textui/typemap +++ b/src/perl/textui/typemap @@ -18,7 +18,7 @@ T_BufferLineWrapper OUTPUT T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); T_BufferLineWrapper $arg = perl_buffer_line_bless($var); diff --git a/src/perl/ui/typemap b/src/perl/ui/typemap index 4afb273d..98355191 100644 --- a/src/perl/ui/typemap +++ b/src/perl/ui/typemap @@ -13,5 +13,5 @@ T_PlainObj OUTPUT T_PlainObj - $arg = plain_bless($var, \"$type\"); + $arg = plain_bless($var, \"$ntype\"); From edfbc1f2f67eeb881673b0d83bd42e8afe89c4bf Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 19 Jul 2023 18:26:45 +0000 Subject: [PATCH 033/117] Merge pull request #1478 from ailin-nemui/buildperl update perl requirement in install file (cherry picked from commit 3f203dc3822b5f357fb3f64ce9020cf4ca367f46) --- INSTALL | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 3dbe2ebd..376960d1 100644 --- a/INSTALL +++ b/INSTALL @@ -7,7 +7,7 @@ To compile Irssi you need: - meson-0.49 build system with ninja-1.5 or greater - glib-2.32 or greater - openssl (for ssl support) -- perl-5.6 or greater (for Perl support) +- perl-5.8 or greater (for building, and optionally Perl scripts) - terminfo or ncurses (for text frontend) For most people, this should work just fine: diff --git a/meson.build b/meson.build index 1a8c23f3..064376c4 100644 --- a/meson.build +++ b/meson.build @@ -394,7 +394,7 @@ 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', '-Eprint $INC{"ExtUtils/ParseXS.pm"} =~ s{ParseXS\\.pm$}{xsubpp}r').stdout() + xsubpp_file_c = run_command(build_perl, '-MExtUtils::ParseXS', '-e($r = $INC{"ExtUtils/ParseXS.pm"}) =~ s{ParseXS\\.pm$}{xsubpp}; print $r').stdout() endif xsubpp = generator(build_perl, output : '@BASENAME@.c', From 590ca4dbdf5e6629c908091896d113473559cda0 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 9 Aug 2023 18:52:16 +0000 Subject: [PATCH 034/117] Merge pull request #1484 from ailin-nemui/realposix change realpath to use syntax based on _POSIX_VERSION (cherry picked from commit f9c9485d155c1b0545fb30b0d2d6d884079b2f76) --- src/lib-config/write.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib-config/write.c b/src/lib-config/write.c index 5dbbd1ed..b7c6edb5 100644 --- a/src/lib-config/write.c +++ b/src/lib-config/write.c @@ -305,6 +305,9 @@ int config_write(CONFIG_REC *rec, const char *fname, int create_mode) const char *base_name; char *tmp_name = NULL; char *dest_name = NULL; +#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L + char resolved_path[PATH_MAX] = { 0 }; +#endif g_return_val_if_fail(rec != NULL, -1); g_return_val_if_fail(fname != NULL || rec->fname != NULL, -1); @@ -313,16 +316,15 @@ int config_write(CONFIG_REC *rec, const char *fname, int create_mode) base_name = fname != NULL ? fname : rec->fname; /* expand all symlinks; else we may replace a symlink with a regular file */ - dest_name = realpath(base_name, NULL); - - if (errno == EINVAL) { - /* variable path length not supported by glibc < 2.3, Solaris < 11 */ - char resolved_path[PATH_MAX] = { 0 }; - errno = 0; - if ((dest_name = realpath(base_name, resolved_path)) != NULL) { - dest_name = g_strdup(dest_name); - } +#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L + /* variable path length not supported by glibc < 2.3, Solaris < 11 */ + errno = 0; + if ((dest_name = realpath(base_name, resolved_path)) != NULL) { + dest_name = g_strdup(dest_name); } +#else + dest_name = realpath(base_name, NULL); +#endif if (dest_name == NULL) { if (errno == ENOENT) { From 5a0dc0db093b11e7c2c5fcfb5f68165f566863cb Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 12 Sep 2023 14:53:59 +0000 Subject: [PATCH 035/117] Merge pull request #1488 from emilengler/remove-unused-var core: remove unused len variable (cherry picked from commit f04375668c569b1a8ded8a127f9e3d9ffe8f019d) --- src/irc/core/netsplit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index 38b63fe5..4a902c9e 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -222,7 +222,7 @@ NETSPLIT_CHAN_REC *netsplit_find_channel(IRC_SERVER_REC *server, int quitmsg_is_split(const char *msg) { const char *host2, *p; - int prev, len, host1_dot, host2_dot; + int prev, host1_dot, host2_dot; g_return_val_if_fail(msg != NULL, FALSE); @@ -242,7 +242,8 @@ int quitmsg_is_split(const char *msg) - can't contain ':' or '/' chars (some servers allow URLs) */ host2 = NULL; - prev = '\0'; len = 0; host1_dot = host2_dot = 0; + prev = '\0'; + host1_dot = host2_dot = 0; while (*msg != '\0') { if (*msg == ' ') { if (prev == '.' || prev == '\0') { @@ -254,7 +255,7 @@ int quitmsg_is_split(const char *msg) return FALSE; /* only one space allowed */ if (!host1_dot) return FALSE; /* host1 didn't have domain */ - host2 = msg+1; len = -1; + host2 = msg + 1; } else if (*msg == '.') { if (prev == '\0' || prev == ' ' || prev == '.') { /* domains can't start with '.' @@ -270,7 +271,7 @@ int quitmsg_is_split(const char *msg) return FALSE; prev = *msg; - msg++; len++; + msg++; } if (!host2_dot || prev == '.') From 1226a587b729866027f962eefaba59bfece573e4 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 6 Sep 2023 14:04:20 +0000 Subject: [PATCH 036/117] Merge pull request #1492 from ailin-nemui/meson-apple document meson apple workaround (cherry picked from commit 8c8e4e34d48c4f9bc830f88f6dbb7c6cc6861ac9) --- INSTALL | 8 ++++++++ docs/meson-macos-ar.txt | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 docs/meson-macos-ar.txt diff --git a/INSTALL b/INSTALL index 376960d1..9c6245a1 100644 --- a/INSTALL +++ b/INSTALL @@ -144,3 +144,11 @@ Getting perl scripting to work needs a few things: It doesn't hurt to be defined everywhere, so configure irssi with: CFLAGS='-DUSEIMPORTLIB' ./configure --with-perl-staticlib + + + Apple MacOS / Darwin + +At the time of writing, meson has an open issue with correctly linking +libraries on macos. + +See docs/meson-macos-ar.txt for a workaround. diff --git a/docs/meson-macos-ar.txt b/docs/meson-macos-ar.txt new file mode 100644 index 00000000..77e5cb8e --- /dev/null +++ b/docs/meson-macos-ar.txt @@ -0,0 +1,6 @@ +;; manual workaround for meson bug https://github.com/mesonbuild/meson/issues/11165 +;; fixes compilation with meson on apple macos +;; usage: meson --native-file ./docs/meson-macos-ar.txt ... + +[binaries] +ar = ['/bin/sh', '-c', 'ar=${AR:-ar}; ranlib=${RANLIB:-ranlib -c -}; case "x$1" in xcsr*) $ar "$@" && $ranlib "$2" || exit $?; ;; *) exec $ar "$@"; ;; esac;', 'ar'] From db4dad3dd0bc7185c862016ae9fc92bc132b9cef Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 12 Sep 2023 11:27:03 +0000 Subject: [PATCH 037/117] Merge pull request #1493 from ailin-nemui/macsuffix add explicit name_suffix to shared modules (cherry picked from commit f1c9fb4296f1f2795d61b031302bfd9fe1fc7d6b) --- meson.build | 10 ++++++++++ src/irc/proxy/meson.build | 1 + src/otr/meson.build | 1 + src/perl/common/meson.build | 1 + src/perl/irc/meson.build | 1 + src/perl/meson.build | 2 ++ src/perl/textui/meson.build | 1 + src/perl/ui/meson.build | 1 + 8 files changed, 18 insertions(+) diff --git a/meson.build b/meson.build index 064376c4..700fac21 100644 --- a/meson.build +++ b/meson.build @@ -73,6 +73,16 @@ def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK' + +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()) + module_suffix = 'so' + perl_module_suffix = 'bundle' +endif + ############## # Help files # ############## diff --git a/src/irc/proxy/meson.build b/src/irc/proxy/meson.build index be91c7d5..30ac90a4 100644 --- a/src/irc/proxy/meson.build +++ b/src/irc/proxy/meson.build @@ -9,6 +9,7 @@ shared_module('irc_proxy', + [ irssi_version_h ], include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, dependencies : dep, diff --git a/src/otr/meson.build b/src/otr/meson.build index 10b9fa55..5b7d256f 100644 --- a/src/otr/meson.build +++ b/src/otr/meson.build @@ -11,6 +11,7 @@ shared_module('otr_core', ), include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, dependencies : dep, diff --git a/src/perl/common/meson.build b/src/perl/common/meson.build index f2a69bc9..4162756b 100644 --- a/src/perl/common/meson.build +++ b/src/perl/common/meson.build @@ -20,6 +20,7 @@ libperl_Irssi_a = shared_module('Irssi', ) + [ irssi_version_h ], name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi', include_directories : rootinc, diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build index 0a8fd9f9..c83d4b49 100644 --- a/src/perl/irc/meson.build +++ b/src/perl/irc/meson.build @@ -21,6 +21,7 @@ libperl_Irssi_Irc_a = shared_module('Irc', 'module.h', ), name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi' / 'Irc', include_directories : rootinc, diff --git a/src/perl/meson.build b/src/perl/meson.build index d81173d9..0ae1ec26 100644 --- a/src/perl/meson.build +++ b/src/perl/meson.build @@ -34,6 +34,7 @@ libperl_core_a = shared_module('perl_core', ], include_directories : [ rootinc ] + [ generated_files_inc ], implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, install_rpath : perl_rpath, @@ -57,6 +58,7 @@ libfe_perl_a = shared_module('fe_perl', ], include_directories : rootinc, implicit_include_directories : false, + name_suffix : module_suffix, install : true, install_dir : moduledir, dependencies : dep, diff --git a/src/perl/textui/meson.build b/src/perl/textui/meson.build index 1705fa36..429e988e 100644 --- a/src/perl/textui/meson.build +++ b/src/perl/textui/meson.build @@ -17,6 +17,7 @@ libperl_Irssi_TextUI_a = shared_module('TextUI', 'module.h', ), name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi' / 'TextUI', include_directories : rootinc, diff --git a/src/perl/ui/meson.build b/src/perl/ui/meson.build index 14bc7699..26ef42eb 100644 --- a/src/perl/ui/meson.build +++ b/src/perl/ui/meson.build @@ -15,6 +15,7 @@ libperl_Irssi_UI_a = shared_module('UI', 'module.h', ), name_prefix : '', + name_suffix : perl_module_suffix, install : true, install_dir : perlmoddir / 'auto' / 'Irssi' / 'UI', include_directories : rootinc, From 7145e1ef20957c6aab6b9109108accadebc31c64 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sat, 9 Sep 2023 11:00:37 +0000 Subject: [PATCH 038/117] Merge pull request #1494 from RealKindOne/master Add -notls and -notls_verify into help file and src/core/chat-commands.c (cherry picked from commit e7f1268478dc07e356e7fc0d79b3f810f4d05e8f) --- docs/help/in/server.in | 4 +++- src/core/chat-commands.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/help/in/server.in b/docs/help/in/server.in index 47b2d524..84b5ad78 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -16,11 +16,13 @@ -4: Connects using IPv4. -6: Connects using IPv6. -tls: Connects using TLS encryption. + -notls: Connect without TLS encrption. -tls_cert: The TLS client certificate file. -tls_pkey: The TLS client private key, if not included in the certificate file. -tls_pass: The password for the TLS client private key or certificate. - -tls_verify: Verifies the TLS certificate of the server. + -tls_verify: Verifies the TLS certificate of the server. + -notls_verify: Doesn't verify the TLS certificate of the server. -tls_cafile: The file with the list of CA certificates. -tls_capath: The directory which contains the CA certificates. -tls_ciphers: TLS cipher suite preference lists. diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index a88a27ab..faeec451 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -211,8 +211,8 @@ static void cmd_server(const char *data, SERVER_REC *server, WI_ITEM_REC *item) command_runsub("server", data, server, item); } -/* SYNTAX: SERVER CONNECT [-4 | -6] [-tls] [-tls_cert ] [-tls_pkey ] - [-tls_pass ] [-tls_verify] [-tls_cafile ] +/* SYNTAX: SERVER CONNECT [-4 | -6] [-tls | -notls] [-tls_cert ] [-tls_pkey ] + [-tls_pass ] [-tls_verify | -notls_verify] [-tls_cafile ] [-tls_capath ] [-tls_ciphers ] [-tls_pinned_cert ] [-tls_pinned_pubkey ] [-!] [-noautosendcmd] [-nocap] From 91593cfec39725d8505ef3f7fbb885073972b534 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 13 Sep 2023 20:55:21 +0000 Subject: [PATCH 039/117] Merge pull request #1495 from ailin-nemui/terminclude fe-text: include the real tputs(3) from term.h (cherry picked from commit db32744ee42ff30cfa710d32ef1c8bbc6f2ff9a1) --- src/fe-text/term-terminfo.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 78496a64..9902bc03 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -30,6 +30,13 @@ #include #include +#ifdef HAVE_TERM_H +#include +#else +/* TODO: This needs arguments, starting with C2X. */ +int tputs(); +#endif + /* returns number of characters in the beginning of the buffer being a a single character, or -1 if more input is needed. The character will be saved in result */ @@ -314,9 +321,6 @@ inline static int term_putchar(int c) return fputc(c, current_term->out); } -/* copied from terminfo-core.c */ -int tputs(); - static int termctl_set_color_24bit(int bg, unsigned int lc) { static char buf[20]; From 6438fcfe70712a019138cd0b4321867db74418e8 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sun, 1 Oct 2023 11:31:07 +0000 Subject: [PATCH 040/117] Merge pull request #1498 from ailin-nemui/perl5380locale Restore locale after loading Perl (cherry picked from commit 48bc90eb17ec3c6549afd69c5d6f16d07fd57db0) --- src/perl/irssi-core.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/perl/irssi-core.pl b/src/perl/irssi-core.pl index 46066a38..0999de9e 100644 --- a/src/perl/irssi-core.pl +++ b/src/perl/irssi-core.pl @@ -52,3 +52,10 @@ sub eval_file { die "cap_sasl has been unloaded from Irssi ".Irssi::version()." because it conflicts with the built-in SASL support. See /help network for configuring SASL or read the ChangeLog for more information."; } } + +if ( $] >= 5.037005 && $] <= 5.038000 ) { + # https://github.com/Perl/perl5/issues/21366 + print STDERR "\e7 \e[A Irssi: applying locale workaround for Perl 5.38.0 \e8"; + require POSIX; + POSIX::setlocale(&POSIX::LC_ALL, ""); +} From ce4dd911bc6e8fdf819c8b40365855f9bab3a7ec Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Thu, 14 Sep 2023 13:32:44 +0000 Subject: [PATCH 041/117] Merge pull request #1497 from ailin-nemui/github-workflow-error Slightly improve GitHub workflow (cherry picked from commit 2a1291f26f6dc47b1d3169d18faba8f995bd3ea6) --- .github/workflows/check.yml | 57 ++++++++++++++++++++++++++++++++++--- meson.build | 5 ++++ 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 97cb3feb..3e324649 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -114,9 +114,58 @@ jobs: ^set -clear log_day_changed ^set -clear log_open_string ^set log_timestamp * - ^window log on' > irssi-test/startup - echo load perl >> irssi-test/startup - echo load proxy >> irssi-test/startup - echo ^quit >> irssi-test/startup + ^window log on + load perl + load otr + load proxy + ^quit' > irssi-test/startup + irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl + cat irc.log.* + annotation-warnings: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + env: + CC: clang + steps: + - name: prepare required software + run: | + sudo apt update && sudo apt install $apt_build_deps + - uses: actions/checkout@main + - name: Setup local annotations + uses: irssi-import/actions-irssi/problem-matchers@master + - name: set PATH + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: prepare required software + env: + meson_ver: ${{ matrix.meson_ver }} + setuptools_ver: ${{ matrix.setuptools_ver }} + run: | + sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_meson + eval "$get_pip_build_deps_meson" + curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl + - name: build and install with meson + run: | + meson Build $build_options_meson --prefix=${prefix/\~/~} + ninja -C Build + ninja -C Build install >/dev/null + - name: run launch test + env: + TERM: xterm + run: | + # automated irssi launch test + cd + mkdir irssi-test + echo 'echo automated irssi launch test + ^set settings_autosave off + ^set -clear log_close_string + ^set -clear log_day_changed + ^set -clear log_open_string + ^set log_timestamp * + ^window log on + load perl + load otr + load proxy + ^quit' > irssi-test/startup irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl cat irc.log.* diff --git a/meson.build b/meson.build index 700fac21..b6ab6178 100644 --- a/meson.build +++ b/meson.build @@ -382,6 +382,11 @@ if want_perl if perl_version == UNSET perl_version = run_command(cross_perl, '-V::version:').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) From bcf07a2546b5adfecf0df56553f2e8be0920c6c5 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 1 Oct 2023 15:46:01 +0200 Subject: [PATCH 042/117] tag as 1.4.5 --- NEWS | 21 +++++++++++++++++++++ configure.ac | 2 +- meson.build | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 63aea544..204d8f32 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,24 @@ +v1.4.5 2023-10-03 The Irssi team + + Add workaround for Perl 5.38.0 bug that breaks the Irssi + locale and glyph rendering (scripts.irssi.org#857, #1498) + - Fix Perl scripts broken by Perl 5.38 (scripts.irssi.org#851, + #1474). With input from Leon Timmermans + - Document workaround to fix linker errors when building with + meson on Apple (#1435, #1492) + - Fix meson using wrong filenames on Apple, leading to broken + Perl support (#1483, #1493) + - Fix /upgrade not accepting `~' (#1460, #1462). By Lukas Mai + - Improve compatibility with Perl5-IDEA (#1465, #1467). By + Charlie Daffern + - Fix logic in how own actions are printed for other protocols + (codeberg!5, #1471). By Andrej Kacian + - Fix crash on old PowerPC Mac (#1482, #1484) + - Fix wrong prototype of library function used in terminal + handling (#1495). By Emil Engler + - Minor cleanups (#1488, #1497). Includes work by Emil Engler + - Minor help and documentation fixes (#1458, #1494, #1477, + #1478). Includes work by KindOne + v1.4.4 2023-03-31 The Irssi team * Expose location of signals.txt via pkg-config (codeberg!1, #1439, #1446, #1447). By Andrej Kacian diff --git a/configure.ac b/configure.ac index 5c5ba3c6..9a5c2521 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(irssi, 1.4.4) +AC_INIT(irssi, 1.4.5) AC_CONFIG_SRCDIR([src]) AC_CONFIG_AUX_DIR(build-aux) AC_PREREQ(2.50) diff --git a/meson.build b/meson.build index b6ab6178..99809868 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('irssi', 'c', - version : '1.4.4', + version : '1.4.5', meson_version : '>=0.49', default_options : ['warning_level=1']) From ea434591f4576e231a49b8b4df979ac360bf94aa Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 31 Oct 2023 10:58:14 +0100 Subject: [PATCH 043/117] Add SET window_default_ to See also in window help --- docs/help/in/window.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/help/in/window.in b/docs/help/in/window.in index 2566668b..5a8ecbd0 100644 --- a/docs/help/in/window.in +++ b/docs/help/in/window.in @@ -74,5 +74,5 @@ /WINDOW HIDELEVEL ^JOINS ^PARTS ^QUITS /WINDOW LOGFILE ~/logs/notices.log -%9See also:%9 JOIN, LEVELS, LOG, QUERY +%9See also:%9 JOIN, LEVELS, LOG, QUERY, SET window_default_level, SET window_default_hidelevel From ed2825f28b77f61af6714a57a5543d4b83f45011 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Sat, 11 Nov 2023 02:13:34 +0100 Subject: [PATCH 044/117] Update bind.in Better explanation for upper-/lowercase usage for keys --- docs/help/in/bind.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/help/in/bind.in b/docs/help/in/bind.in index 8fcc744b..761d971e 100644 --- a/docs/help/in/bind.in +++ b/docs/help/in/bind.in @@ -17,13 +17,15 @@ Details: Adds or removes a binding; the binding itself is case-sensitive and may contain as many characters as you want. - Uppercase characters usually indicate that you need to keep the shift-key - pressed to use the binding. + Key bindings are case sensitive so uppercase letters mean you also have + to use the shift key, except for ctrl which does not support shift but + the keys must always be typed in uppercase. %9Examples:%9 /BIND /BIND meta-c /CLEAR + /BIND meta-C /CYCLE /BIND meta-q change_window 16 /BIND -delete meta-y /BIND ^W^C /WINDOW NEW HIDE From a11df816b729c8ffdd57c27969dda992c3d934f5 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 19 Dec 2023 13:51:46 +0100 Subject: [PATCH 045/117] explicitly list pkg-config as build dependency, since meson needs it to find glib --- INSTALL | 1 + 1 file changed, 1 insertion(+) diff --git a/INSTALL b/INSTALL index 9c88325d..ed5a14a3 100644 --- a/INSTALL +++ b/INSTALL @@ -5,6 +5,7 @@ To compile Irssi you need: - meson-0.53 build system with ninja-1.8 or greater +- pkg-config (or compatible) - glib-2.32 or greater - openssl (for ssl support) - perl-5.8 or greater (for building, and optionally Perl scripts) From 514f1cdcf6e0c8c6d09d47481e7583eed0d11393 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 22 Dec 2023 13:03:28 +0100 Subject: [PATCH 046/117] Revert "Merge pull request #1498 from ailin-nemui/perl5380locale" This reverts commit 48bc90eb17ec3c6549afd69c5d6f16d07fd57db0, reversing changes made to 2a1291f26f6dc47b1d3169d18faba8f995bd3ea6. --- src/perl/irssi-core.pl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/perl/irssi-core.pl b/src/perl/irssi-core.pl index 880bd6a3..cf987b31 100644 --- a/src/perl/irssi-core.pl +++ b/src/perl/irssi-core.pl @@ -50,10 +50,3 @@ sub eval_file { die "cap_sasl has been unloaded from Irssi ".Irssi::version()." because it conflicts with the built-in SASL support. See /help network for configuring SASL or read the ChangeLog for more information."; } } - -if ( $] >= 5.037005 && $] <= 5.038000 ) { - # https://github.com/Perl/perl5/issues/21366 - print STDERR "\e7 \e[A Irssi: applying locale workaround for Perl 5.38.0 \e8"; - require POSIX; - POSIX::setlocale(&POSIX::LC_ALL, ""); -} From a0caf5e5e64fff9c7f0274800d1fca34b63fcc7a Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 22 Dec 2023 13:03:24 +0100 Subject: [PATCH 047/117] restore locale if perl breaks it --- src/perl/perl-core.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 79d5c13c..fe52874a 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -90,24 +90,41 @@ static void xs_init(pTHX) void perl_scripts_init(void) { char *code, *use_code; + int broken_perl; perl_scripts = NULL; perl_sources_start(); perl_signals_start(); my_perl = perl_alloc(); + broken_perl = wcwidth(160); perl_construct(my_perl); + broken_perl = broken_perl != wcwidth(160); - perl_parse(my_perl, xs_init, G_N_ELEMENTS(perl_args)-1, perl_args, NULL); + perl_parse(my_perl, xs_init, G_N_ELEMENTS(perl_args) - 1, perl_args, NULL); - perl_common_start(); + perl_common_start(); use_code = perl_get_use_list(); code = g_strdup_printf(irssi_core_code, use_code); perl_eval_pv(code, TRUE); + if (broken_perl) { + g_warning("applying locale workaround for Perl %d.%d, see " + "https://github.com/Perl/perl5/issues/21366", + PERL_REVISION, PERL_VERSION); + perl_eval_pv("package Irssi::Core;" + /* https://github.com/Perl/perl5/issues/21746 */ + "if ( $] == $] )" + "{" + "require POSIX;" + "POSIX::setlocale(&POSIX::LC_ALL, \"\");" + "}" + "1;", + TRUE); + } g_free(code); - g_free(use_code); + g_free(use_code); } /* Destroy all perl scripts and deinitialize perl interpreter */ @@ -441,7 +458,7 @@ void perl_core_init(void) char **argv = perl_args; PERL_SYS_INIT3(&argc, &argv, &environ); - print_script_errors = 1; + print_script_errors = 1; settings_add_str("perl", "perl_use_lib", PERL_USE_LIB); /*PL_perl_destruct_level = 1; - this crashes with some people.. */ From 41f8213fe0f2f4fa4dad535203770cffc9b7f06f Mon Sep 17 00:00:00 2001 From: Gunter Labes Date: Thu, 1 Feb 2024 21:56:20 +0100 Subject: [PATCH 048/117] typo fixes --- docs/help/in/scrollback.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/help/in/scrollback.in b/docs/help/in/scrollback.in index 5f59d842..e91513cd 100644 --- a/docs/help/in/scrollback.in +++ b/docs/help/in/scrollback.in @@ -20,10 +20,10 @@ %9Description:%9 - Manipulate the text in the window to go to a to the given line number, or + Manipulate the text in the window to go to the given line number, or clear the buffers. - The timestamp format is format is '[dd[.mm] | -] hh:mi[:ss]'. + The timestamp format is '[dd[.mm] | -] hh:mi[:ss]'. %9Examples:%9 From 4dd57cf24e9166aaaf2ffcbb2b50e013020a847c Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 23 Feb 2024 17:04:41 +0100 Subject: [PATCH 049/117] missing shell quotes --- utils/irssi-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/irssi-version.sh b/utils/irssi-version.sh index 3a425dcc..afb05546 100755 --- a/utils/irssi-version.sh +++ b/utils/irssi-version.sh @@ -1,6 +1,6 @@ #!/bin/sh -DATE=`grep '^v' $1/NEWS | head -1` +DATE=`grep '^v' "$1"/NEWS | head -1` VERSION_DATE=`echo "$DATE" | cut -f 2 -d ' ' | tr -d -` case $VERSION_DATE in *xx) From cf6615a70e3bded62d449563eb9b40cb44901011 Mon Sep 17 00:00:00 2001 From: maflcko <6399679+maflcko@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:33:24 +0100 Subject: [PATCH 050/117] Update server.c: Add missing include --- 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 c91a5bcd..25579c8c 100644 --- a/src/fe-fuzz/server.c +++ b/src/fe-fuzz/server.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include From e295caa86691fe1172b5a9048da511655fb9e03e Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Mon, 1 Apr 2024 01:44:08 +0200 Subject: [PATCH 051/117] Fix github issue #1504 - irssi switches to af_unix if network name contains / In addition to looking for a /, we also check if the network name is known. --- src/core/chat-commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index faeec451..10da0d2c 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -91,7 +92,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, return NULL; } - if (strchr(addr, '/') != NULL) + if (strchr(addr, '/') != NULL && chatnet_find(addr) == NULL) conn->unix_socket = TRUE; /* TLS options are handled in server_create_conn_opt ... -> server_setup_fill_optlist */ From f2b97631e1209d60e77f2a918809c88bd37fdd04 Mon Sep 17 00:00:00 2001 From: Patrick Okraku Date: Wed, 11 Oct 2023 21:43:34 +0200 Subject: [PATCH 052/117] Added support for SCRAM-SHA-1, SCRAM-SHA-256 and SCRAM-SHA-512 --- docs/help/in/network.in | 4 +- src/irc/core/irc-core.c | 4 + src/irc/core/irc-servers-setup.c | 24 ++- src/irc/core/irc-servers.h | 2 + src/irc/core/meson.build | 2 + src/irc/core/sasl.c | 72 ++++++++ src/irc/core/sasl.h | 3 + src/irc/core/scram.c | 303 +++++++++++++++++++++++++++++++ src/irc/core/scram.h | 27 +++ 9 files changed, 435 insertions(+), 6 deletions(-) create mode 100644 src/irc/core/scram.c create mode 100644 src/irc/core/scram.h diff --git a/docs/help/in/network.in b/docs/help/in/network.in index 788c1c65..16ff9f47 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -36,8 +36,8 @@ -cmdmax: Specifies the maximum number of commands to perform before starting the internal flood protection. -sasl_mechanism Specifies the mechanism to use for the SASL authentication. - At the moment irssi only supports the 'plain' and the - 'external' mechanisms. + Irssi supports: PLAIN, EXTERNAL, SCRAM-SHA-1, SCRAM-SHA-256 + and SCRAM-SHA-512 Use '' to disable the authentication. -sasl_username Specifies the username to use during the SASL authentication. -sasl_password Specifies the password to use during the SASL authentication. diff --git a/src/irc/core/irc-core.c b/src/irc/core/irc-core.c index 725ae28a..136bff85 100644 --- a/src/irc/core/irc-core.c +++ b/src/irc/core/irc-core.c @@ -77,6 +77,10 @@ static void destroy_server_connect(SERVER_CONNECT_REC *conn) g_free_not_null(ircconn->alternate_nick); g_free_not_null(ircconn->sasl_username); g_free_not_null(ircconn->sasl_password); + + if (ircconn->scram_session != NULL) { + scram_session_free(ircconn->scram_session); + } } void irc_core_init(void) diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index c1603a48..a575ee34 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -128,11 +128,27 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn, conn->sasl_password = g_strdup(ircnet->sasl_password); } else g_warning("The fields sasl_username and sasl_password are either missing or empty"); - } - else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) { + } else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-1") || + !g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-256") || + !g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-512")) { + /* The SCRAM-SHA-* methods need both the username and the password */ + if (ircnet->sasl_username != NULL && *ircnet->sasl_username && + ircnet->sasl_password != NULL && *ircnet->sasl_password) { + if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-1")) + conn->sasl_mechanism = SASL_MECHANISM_SCRAM_SHA_1; + if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-256")) + conn->sasl_mechanism = SASL_MECHANISM_SCRAM_SHA_256; + if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-512")) + conn->sasl_mechanism = SASL_MECHANISM_SCRAM_SHA_512; + + conn->sasl_username = g_strdup(ircnet->sasl_username); + conn->sasl_password = g_strdup(ircnet->sasl_password); + } else + g_warning("The fields sasl_username and sasl_password are either " + "missing or empty"); + } else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) { conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL; - } - else + } else g_warning("Unsupported SASL mechanism \"%s\" selected", ircnet->sasl_mechanism); } } diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 6e78c4da..01605b7d 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -4,6 +4,7 @@ #include #include #include +#include /* * 63 is the maximum hostname length defined by the protocol. 10 is a common @@ -54,6 +55,7 @@ struct _IRC_SERVER_CONNECT_REC { int sasl_mechanism; char *sasl_username; char *sasl_password; + SCRAM_SESSION_REC *scram_session; int max_cmds_at_once; int cmd_queue_speed; diff --git a/src/irc/core/meson.build b/src/irc/core/meson.build index 81559f3e..a63ff214 100644 --- a/src/irc/core/meson.build +++ b/src/irc/core/meson.build @@ -28,6 +28,7 @@ libirc_core_a = static_library('irc_core', 'modes.c', 'netsplit.c', 'sasl.c', + 'scram.c', 'servers-idle.c', 'servers-redirect.c', ), @@ -70,6 +71,7 @@ install_headers( 'module.h', 'netsplit.h', 'sasl.h', + 'scram.h', 'servers-idle.h', 'servers-redirect.h', ), diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c index 9bc40ff2..e9689b12 100644 --- a/src/irc/core/sasl.c +++ b/src/irc/core/sasl.c @@ -80,6 +80,18 @@ static void sasl_start(IRC_SERVER_REC *server, const char *data, const char *fro case SASL_MECHANISM_EXTERNAL: irc_send_cmd_now(server, "AUTHENTICATE EXTERNAL"); break; + + case SASL_MECHANISM_SCRAM_SHA_1: + irc_send_cmd_now(server, "AUTHENTICATE SCRAM-SHA-1"); + break; + + case SASL_MECHANISM_SCRAM_SHA_256: + irc_send_cmd_now(server, "AUTHENTICATE SCRAM-SHA-256"); + break; + + case SASL_MECHANISM_SCRAM_SHA_512: + irc_send_cmd_now(server, "AUTHENTICATE SCRAM-SHA-512"); + break; } server->sasl_timeout = g_timeout_add(SASL_TIMEOUT, (GSourceFunc) sasl_timeout, server); } @@ -223,6 +235,54 @@ void sasl_send_response(IRC_SERVER_REC *server, GString *response) g_free(enc); } +/* + * Sends AUTHENTICATE messages to log in via SCRAM. + */ +static void scram_authenticate(IRC_SERVER_REC *server, const char *data, const char *digest) +{ + char *output; + int ret; + size_t output_len; + IRC_SERVER_CONNECT_REC *conn = server->connrec; + + if (conn->scram_session == NULL) { + conn->scram_session = + scram_session_create(digest, conn->sasl_username, conn->sasl_password); + + if (conn->scram_session == NULL) { + g_error("Could not create SCRAM session with digest %s", digest); + irc_send_cmd_now(server, "AUTHENTICATE *"); + return; + } + } + + ret = scram_process(conn->scram_session, data, &output, &output_len); + + if (ret == SCRAM_IN_PROGRESS) { + // Authentication is still in progress + GString *resp = g_string_new(output); + sasl_send_response(server, resp); + g_string_free(resp, TRUE); + g_free(output); + } else if (ret == SCRAM_SUCCESS) { + // Authentication succeeded + irc_send_cmd_now(server, "AUTHENTICATE +"); + scram_session_free(conn->scram_session); + conn->scram_session = NULL; + } else if (ret == SCRAM_ERROR) { + // Authentication failed + irc_send_cmd_now(server, "AUTHENTICATE *"); + + if (conn->scram_session->error != NULL) { + g_warning("SASL SCRAM authentication failed: %s", + conn->scram_session->error); + } + + scram_session_free(conn->scram_session); + conn->scram_session = NULL; + } +} + /* * Called when the incoming SASL request is completely received. */ @@ -258,6 +318,18 @@ static void sasl_step_complete(IRC_SERVER_REC *server, GString *data) /* Empty response */ sasl_send_response(server, NULL); break; + + case SASL_MECHANISM_SCRAM_SHA_1: + scram_authenticate(server, data->str, "SHA1"); + break; + + case SASL_MECHANISM_SCRAM_SHA_256: + scram_authenticate(server, data->str, "SHA256"); + break; + + case SASL_MECHANISM_SCRAM_SHA_512: + scram_authenticate(server, data->str, "SHA512"); + break; } } diff --git a/src/irc/core/sasl.h b/src/irc/core/sasl.h index 04d0cd9d..67c8567b 100644 --- a/src/irc/core/sasl.h +++ b/src/irc/core/sasl.h @@ -25,6 +25,9 @@ enum { SASL_MECHANISM_NONE = 0, SASL_MECHANISM_PLAIN, SASL_MECHANISM_EXTERNAL, + SASL_MECHANISM_SCRAM_SHA_1, + SASL_MECHANISM_SCRAM_SHA_256, + SASL_MECHANISM_SCRAM_SHA_512, SASL_MECHANISM_MAX }; diff --git a/src/irc/core/scram.c b/src/irc/core/scram.c new file mode 100644 index 00000000..42812ccc --- /dev/null +++ b/src/irc/core/scram.c @@ -0,0 +1,303 @@ +/* + scram.c : irssi + + Copyright (C) 2023 Patrick Okraku + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "module.h" +#include +#include +#include + +#define NONCE_LENGTH 18 +#define CLIENT_KEY "Client Key" +#define SERVER_KEY "Server Key" + +// EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed in OpenSSL 1.1.0 +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) +#define EVP_MD_CTX_new(ctx) EVP_MD_CTX_create(ctx) +#define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy(ctx) +#endif + +SCRAM_SESSION_REC *scram_session_create(const char *digest, const char *username, + const char *password) +{ + SCRAM_SESSION_REC *session; + const EVP_MD *md; +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) + OpenSSL_add_all_algorithms(); +#endif + md = EVP_get_digestbyname(digest); + + if (md == NULL) { + // Unknown message digest + return NULL; + } + + session = g_new0(SCRAM_SESSION_REC, 1); + session->digest = md; + session->digest_size = EVP_MD_size(md); + session->username = g_strdup(username); + session->password = g_strdup(password); + return session; +} + +void scram_session_free(SCRAM_SESSION_REC *session) +{ + if (session == NULL) { + return; + } + + g_free(session->username); + g_free(session->password); + g_free(session->client_nonce_b64); + g_free(session->client_first_message_bare); + g_free(session->salted_password); + g_free(session->auth_message); + g_free(session->error); + + g_free(session); +} + +static int create_nonce(void *buffer, size_t length) +{ + return RAND_bytes(buffer, length); +} + +static int create_SHA(SCRAM_SESSION_REC *session, const unsigned char *input, size_t input_len, + unsigned char *output, unsigned int *output_len) +{ + EVP_MD_CTX *md_ctx = EVP_MD_CTX_new(); + + if (!EVP_DigestInit_ex(md_ctx, session->digest, NULL)) { + session->error = g_strdup("Message digest initialization failed"); + EVP_MD_CTX_free(md_ctx); + return SCRAM_ERROR; + } + + if (!EVP_DigestUpdate(md_ctx, input, input_len)) { + session->error = g_strdup("Message digest update failed"); + EVP_MD_CTX_free(md_ctx); + return SCRAM_ERROR; + } + + if (!EVP_DigestFinal_ex(md_ctx, output, output_len)) { + session->error = g_strdup("Message digest finalization failed"); + EVP_MD_CTX_free(md_ctx); + return SCRAM_ERROR; + } + + EVP_MD_CTX_free(md_ctx); + return SCRAM_IN_PROGRESS; +} + +static scram_status process_client_first(SCRAM_SESSION_REC *session, char **output, + size_t *output_len) +{ + char nonce[NONCE_LENGTH]; + + if (!create_nonce(nonce, NONCE_LENGTH)) { + session->error = g_strdup("Could not create client nonce"); + return SCRAM_ERROR; + } + + session->client_nonce_b64 = g_base64_encode((guchar *) nonce, NONCE_LENGTH); + *output = g_strdup_printf("n,,n=%s,r=%s", session->username, session->client_nonce_b64); + *output_len = strlen(*output); + session->client_first_message_bare = g_strdup(*output + 3); + session->step++; + return SCRAM_IN_PROGRESS; +} + +static scram_status process_server_first(SCRAM_SESSION_REC *session, const char *data, + char **output, size_t *output_len) +{ + char **params, *client_final_message_without_proof, *salt, *server_nonce_b64, + *client_proof_b64; + unsigned char *client_key, stored_key[EVP_MAX_MD_SIZE], *client_signature, *client_proof; + unsigned int i, param_count, iteration_count, client_key_len, stored_key_len; + gsize salt_len = 0; + size_t client_nonce_len; + + params = g_strsplit(data, ",", -1); + param_count = g_strv_length(params); + + if (param_count < 3) { + session->error = g_strdup_printf("Invalid server-first-message: %s", data); + g_strfreev(params); + return SCRAM_ERROR; + } + + server_nonce_b64 = NULL; + salt = NULL; + iteration_count = 0; + + for (i = 0; i < param_count; i++) { + if (!strncmp(params[i], "r=", 2)) { + g_free(server_nonce_b64); + server_nonce_b64 = g_strdup(params[i] + 2); + } else if (!strncmp(params[i], "s=", 2)) { + g_free(salt); + salt = g_strdup(params[i] + 2); + } else if (!strncmp(params[i], "i=", 2)) { + iteration_count = strtoul(params[i] + 2, NULL, 10); + } + } + + g_strfreev(params); + + if (server_nonce_b64 == NULL || *server_nonce_b64 == '\0' || salt == NULL || + *salt == '\0' || iteration_count == 0) { + session->error = g_strdup_printf("Invalid server-first-message: %s", data); + g_free(server_nonce_b64); + g_free(salt); + return SCRAM_ERROR; + } + + client_nonce_len = strlen(session->client_nonce_b64); + + // The server can append his nonce to the client's nonce + if (strlen(server_nonce_b64) < client_nonce_len || + strncmp(server_nonce_b64, session->client_nonce_b64, client_nonce_len)) { + session->error = g_strdup_printf("Invalid server nonce: %s", server_nonce_b64); + return SCRAM_ERROR; + } + + g_base64_decode_inplace((gchar *) salt, &salt_len); + + // SaltedPassword := Hi(Normalize(password), salt, i) + session->salted_password = g_malloc(session->digest_size); + + PKCS5_PBKDF2_HMAC(session->password, strlen(session->password), (unsigned char *) salt, + salt_len, iteration_count, session->digest, session->digest_size, + session->salted_password); + + // AuthMessage := client-first-message-bare + "," + + // server-first-message + "," + + // client-final-message-without-proof + client_final_message_without_proof = g_strdup_printf("c=biws,r=%s", server_nonce_b64); + + session->auth_message = g_strdup_printf("%s,%s,%s", session->client_first_message_bare, + data, client_final_message_without_proof); + + // ClientKey := HMAC(SaltedPassword, "Client Key") + client_key = g_malloc0(session->digest_size); + + HMAC(session->digest, session->salted_password, session->digest_size, + (unsigned char *) CLIENT_KEY, strlen(CLIENT_KEY), client_key, &client_key_len); + + // StoredKey := H(ClientKey) + if (!create_SHA(session, client_key, session->digest_size, stored_key, &stored_key_len)) { + g_free(client_final_message_without_proof); + g_free(server_nonce_b64); + g_free(salt); + g_free(client_key); + return SCRAM_ERROR; + } + + // ClientSignature := HMAC(StoredKey, AuthMessage) + client_signature = g_malloc0(session->digest_size); + HMAC(session->digest, stored_key, stored_key_len, (unsigned char *) session->auth_message, + strlen((char *) session->auth_message), client_signature, NULL); + + // ClientProof := ClientKey XOR ClientSignature + client_proof = g_malloc0(client_key_len); + + for (i = 0; i < client_key_len; i++) { + client_proof[i] = client_key[i] ^ client_signature[i]; + } + + client_proof_b64 = g_base64_encode((guchar *) client_proof, client_key_len); + + *output = g_strdup_printf("%s,p=%s", client_final_message_without_proof, client_proof_b64); + *output_len = strlen(*output); + + g_free(server_nonce_b64); + g_free(salt); + g_free(client_final_message_without_proof); + g_free(client_key); + g_free(client_signature); + g_free(client_proof); + g_free(client_proof_b64); + + session->step++; + return SCRAM_IN_PROGRESS; +} + +static scram_status process_server_final(SCRAM_SESSION_REC *session, const char *data) +{ + char *verifier; + unsigned char *server_key, *server_signature; + unsigned int server_key_len = 0, server_signature_len = 0; + gsize verifier_len = 0; + + if (strlen(data) < 3 || (data[0] != 'v' && data[1] != '=')) { + return SCRAM_ERROR; + } + + verifier = g_strdup(data + 2); + g_base64_decode_inplace(verifier, &verifier_len); + + // ServerKey := HMAC(SaltedPassword, "Server Key") + server_key = g_malloc0(session->digest_size); + HMAC(session->digest, session->salted_password, session->digest_size, + (unsigned char *) SERVER_KEY, strlen(SERVER_KEY), server_key, &server_key_len); + + // ServerSignature := HMAC(ServerKey, AuthMessage) + server_signature = g_malloc0(session->digest_size); + HMAC(session->digest, server_key, session->digest_size, + (unsigned char *) session->auth_message, strlen((char *) session->auth_message), + server_signature, &server_signature_len); + + if (verifier_len == server_signature_len && + memcmp(verifier, server_signature, verifier_len) == 0) { + g_free(verifier); + g_free(server_key); + g_free(server_signature); + return SCRAM_SUCCESS; + } else { + g_free(verifier); + g_free(server_key); + g_free(server_signature); + return SCRAM_ERROR; + } +} + +scram_status scram_process(SCRAM_SESSION_REC *session, const char *input, char **output, + size_t *output_len) +{ + scram_status status; + + switch (session->step) { + case 0: + status = process_client_first(session, output, output_len); + break; + case 1: + status = process_server_first(session, input, output, output_len); + break; + case 2: + status = process_server_final(session, input); + break; + default: + *output = NULL; + *output_len = 0; + status = SCRAM_ERROR; + break; + } + + return status; +} \ No newline at end of file diff --git a/src/irc/core/scram.h b/src/irc/core/scram.h new file mode 100644 index 00000000..ee605142 --- /dev/null +++ b/src/irc/core/scram.h @@ -0,0 +1,27 @@ +#ifndef IRSSI_IRC_CORE_SCRAM_H +#define IRSSI_IRC_CORE_SCRAM_H + +#include + +typedef struct { + const EVP_MD *digest; + size_t digest_size; + char *username; + char *password; + char *client_nonce_b64; + char *client_first_message_bare; + unsigned char *salted_password; + char *auth_message; + char *error; + int step; +} SCRAM_SESSION_REC; + +typedef enum { SCRAM_ERROR = 0, SCRAM_IN_PROGRESS, SCRAM_SUCCESS } scram_status; + +SCRAM_SESSION_REC *scram_session_create(const char *digset, const char *username, + const char *password); +void scram_session_free(SCRAM_SESSION_REC *session); +scram_status scram_process(SCRAM_SESSION_REC *session, const char *input, char **output, + size_t *output_len); + +#endif \ No newline at end of file From 98b391f62e986e743589b15af866fcbd6072964b Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 1 Apr 2024 16:33:36 +0200 Subject: [PATCH 053/117] minor cleanup --- src/irc/core/sasl.c | 6 +++--- src/irc/core/scram.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c index e9689b12..1695fc4c 100644 --- a/src/irc/core/sasl.c +++ b/src/irc/core/sasl.c @@ -250,7 +250,7 @@ static void scram_authenticate(IRC_SERVER_REC *server, const char *data, const c scram_session_create(digest, conn->sasl_username, conn->sasl_password); if (conn->scram_session == NULL) { - g_error("Could not create SCRAM session with digest %s", digest); + g_critical("Could not create SCRAM session with digest %s", digest); irc_send_cmd_now(server, "AUTHENTICATE *"); return; } @@ -260,13 +260,13 @@ static void scram_authenticate(IRC_SERVER_REC *server, const char *data, const c if (ret == SCRAM_IN_PROGRESS) { // Authentication is still in progress - GString *resp = g_string_new(output); + GString *resp = g_string_new_len(output, output_len); sasl_send_response(server, resp); g_string_free(resp, TRUE); g_free(output); } else if (ret == SCRAM_SUCCESS) { // Authentication succeeded - irc_send_cmd_now(server, "AUTHENTICATE +"); + sasl_send_response(server, NULL); scram_session_free(conn->scram_session); conn->scram_session = NULL; } else if (ret == SCRAM_ERROR) { diff --git a/src/irc/core/scram.c b/src/irc/core/scram.c index 42812ccc..4c950140 100644 --- a/src/irc/core/scram.c +++ b/src/irc/core/scram.c @@ -137,7 +137,8 @@ static scram_status process_server_first(SCRAM_SESSION_REC *session, const char param_count = g_strv_length(params); if (param_count < 3) { - session->error = g_strdup_printf("Invalid server-first-message: %s", data); + /* Invalid server-first-message */ + session->error = g_strdup_printf("%s", data); g_strfreev(params); return SCRAM_ERROR; } @@ -300,4 +301,4 @@ scram_status scram_process(SCRAM_SESSION_REC *session, const char *input, char * } return status; -} \ No newline at end of file +} From 08bb648850ca73695d5bf39c53dbd7e9846a0a94 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 1 Apr 2024 16:33:57 +0200 Subject: [PATCH 054/117] proper sasl mechanism variable initialisation --- src/irc/core/irc-servers-setup.c | 7 +++++-- src/irc/core/irc-servers.c | 1 + src/irc/core/sasl.c | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index a575ee34..2d94a48b 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -148,8 +148,11 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn, "missing or empty"); } else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) { conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL; - } else - g_warning("Unsupported SASL mechanism \"%s\" selected", ircnet->sasl_mechanism); + } else { + g_warning("Unsupported SASL mechanism \"%s\" selected", + ircnet->sasl_mechanism); + conn->sasl_mechanism = SASL_MECHANISM_MAX; + } } } diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 29f63c21..e3fe3143 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -475,6 +475,7 @@ SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn) server->send_message = send_message; server->query_find_func = (QUERY_REC * (*) (SERVER_REC *, const char *) ) irc_query_find; server->nick_comp_func = irc_nickcmp_rfc1459; + server->sasl_success = FALSE; server_connect_init((SERVER_REC *) server); return (SERVER_REC *) server; diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c index 1695fc4c..89ca4a9e 100644 --- a/src/irc/core/sasl.c +++ b/src/irc/core/sasl.c @@ -92,6 +92,12 @@ static void sasl_start(IRC_SERVER_REC *server, const char *data, const char *fro case SASL_MECHANISM_SCRAM_SHA_512: irc_send_cmd_now(server, "AUTHENTICATE SCRAM-SHA-512"); break; + + case SASL_MECHANISM_MAX: + signal_emit("server sasl failure", 2, server, + "Irssi: Unsupported SASL mechanism"); + irc_cap_finish_negotiation(server); + return; } server->sasl_timeout = g_timeout_add(SASL_TIMEOUT, (GSourceFunc) sasl_timeout, server); } From 2f2fa029f92706301ffebf04ce90e428d6c835bd Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 1 Apr 2024 16:37:35 +0200 Subject: [PATCH 055/117] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 59566dc8..9f6c54a2 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 52 +#define IRSSI_ABI_VERSION 53 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From e13df83dc8efe19b817460d9dbb8223af8cb5266 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 9 Aug 2023 22:47:53 +0200 Subject: [PATCH 056/117] new code for g_module_open which might work with apple dylibs given new enough glib --- src/core/modules-load.c | 58 +++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/src/core/modules-load.c b/src/core/modules-load.c index be1bb385..11c4dd6b 100644 --- a/src/core/modules-load.c +++ b/src/core/modules-load.c @@ -102,10 +102,41 @@ static char *module_get_sub(const char *name, const char *root) return g_strdup(name); } -static GModule *module_open(const char *name, int *found) +static GModule *module_open(const char *name) { - struct stat statbuf; GModule *module; +#if GLIB_CHECK_VERSION(2, 75, 0) + /* in this version of glib, g_module_open knows how to construct system-dependent module + file names, and g_module_build_path is deprecated. */ + + char *path; + + if (g_path_is_absolute(name) || *name == '~' || + (*name == '.' && name[1] == G_DIR_SEPARATOR)) + path = g_strdup(name); + else { + /* first try from home dir */ + path = g_strdup_printf("%s/modules/%s", get_irssi_dir(), name); + + module = g_module_open(path, (GModuleFlags) 0); + g_free(path); + if (module != NULL) { + return module; + } + + /* module not found from home dir, try global module dir */ + path = g_strdup_printf("%s/%s", MODULEDIR, name); + } + + module = g_module_open(path, (GModuleFlags) 0); + g_free(path); + return module; + +#else /* GLib < 2.75.0 */ + /* in this version of glib, we build the module path with g_module_build_path. + unfortunately, this is broken on Darwin when compiled with meson. */ + + struct stat statbuf; char *path, *str; if (g_path_is_absolute(name) || *name == '~' || @@ -120,7 +151,6 @@ static GModule *module_open(const char *name, int *found) if (stat(path, &statbuf) == 0) { module = g_module_open(path, (GModuleFlags) 0); g_free(path); - *found = TRUE; return module; } @@ -129,10 +159,11 @@ static GModule *module_open(const char *name, int *found) path = g_module_build_path(MODULEDIR, name); } - *found = stat(path, &statbuf) == 0; module = g_module_open(path, (GModuleFlags) 0); g_free(path); return module; + +#endif } static char *module_get_func(const char *rootmodule, const char *submodule, @@ -151,8 +182,7 @@ static char *module_get_func(const char *rootmodule, const char *submodule, signal_emit("module error", 4, GINT_TO_POINTER(error), text, \ rootmodule, submodule) -/* Returns 1 if ok, 0 if error in module and - -1 if module wasn't found */ +/* Returns 1 if ok, 0 if not */ static int module_load_name(const char *path, const char *rootmodule, const char *submodule, int silent) { @@ -166,15 +196,15 @@ static int module_load_name(const char *path, const char *rootmodule, gpointer value1, value2 = NULL; char *versionfunc, *initfunc, *deinitfunc; int module_abi_version = 0; - int found; + int valid; - gmodule = module_open(path, &found); + gmodule = module_open(path); if (gmodule == NULL) { - if (!silent || found) { + if (!silent) { module_error(MODULE_ERROR_LOAD, g_module_error(), rootmodule, submodule); } - return found ? 0 : -1; + return 0; } /* get the module's irssi abi version and bail out on mismatch */ @@ -201,12 +231,12 @@ static int module_load_name(const char *path, const char *rootmodule, /* get the module's init() and deinit() functions */ initfunc = module_get_func(rootmodule, submodule, "init"); deinitfunc = module_get_func(rootmodule, submodule, "deinit"); - found = g_module_symbol(gmodule, initfunc, &value1) && - g_module_symbol(gmodule, deinitfunc, &value2); + valid = g_module_symbol(gmodule, initfunc, &value1) && + g_module_symbol(gmodule, deinitfunc, &value2); g_free(initfunc); g_free(deinitfunc); - if (!found) { + if (!valid) { module_error(MODULE_ERROR_INVALID, NULL, rootmodule, submodule); g_module_close(gmodule); @@ -310,7 +340,7 @@ static int module_load_full(const char *path, const char *rootmodule, /* check if the given module exists.. */ try_prefixes = g_strcmp0(rootmodule, submodule) == 0; status = module_load_name(path, rootmodule, submodule, try_prefixes); - if (status == -1 && try_prefixes) { + if (status <= 0 && try_prefixes) { /* nope, try loading the module_core, fe_module, etc. */ status = module_load_prefixes(path, rootmodule, From c48354307ef1eace3b51fc3886614110809de284 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Mon, 1 Apr 2024 22:10:35 +0200 Subject: [PATCH 057/117] Update minimum required Perl version in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 963fbfca..bfe521d3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ ninja -C Build && sudo ninja -C Build install - [glib-2.32](https://wiki.gnome.org/Projects/GLib) or greater - [openssl](https://www.openssl.org/) -- [perl-5.6](https://www.perl.org/) or greater (for perl support) +- [perl-5.8](https://www.perl.org/) or greater (for perl support) - terminfo or ncurses (for text frontend) #### See the [INSTALL](INSTALL) file for details From 111e9160a96986fa65dd59ae6790b4c2dbbdba2c Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 1 Apr 2024 22:28:17 +0200 Subject: [PATCH 058/117] github actions nodejs churn --- .github/workflows/abicheck.yml | 10 +++++----- .github/workflows/check.yml | 4 ++-- .github/workflows/termuxpkg.yml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/abicheck.yml b/.github/workflows/abicheck.yml index d21d55cd..3ac39146 100644 --- a/.github/workflows/abicheck.yml +++ b/.github/workflows/abicheck.yml @@ -37,7 +37,7 @@ jobs: echo base abi : $base_abi ./base$prefix/bin/irssi --version echo base_abi=$base_abi >> $GITHUB_OUTPUT - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: base.inst path: base @@ -71,7 +71,7 @@ jobs: echo merge abi : $merge_abi ./merge$prefix/bin/irssi --version echo merge_abi=$merge_abi >> $GITHUB_OUTPUT - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: merge.inst path: merge @@ -89,12 +89,12 @@ jobs: run: | sudo apt install abigail-tools - name: fetch base build - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: base.inst path: base - name: fetch merge build - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: merge.inst path: merge @@ -103,7 +103,7 @@ jobs: abipkgdiff -l base merge >abipkgdiff.out && diff_ret=0 || diff_ret=$? echo "diff_ret=$diff_ret" >> $GITHUB_ENV cat abipkgdiff.out - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: abipkgdiff.out - run: | diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 65f56b17..2fee4b8b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -21,7 +21,7 @@ jobs: - name: make dist run: | ./utils/make-dist.sh - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: irssi-*.tar.gz retention-days: 1 @@ -51,7 +51,7 @@ jobs: flags: meson-latest FAILURE-OK steps: - name: fetch dist - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: set PATH run: | echo "$HOME/.local/bin" >> $GITHUB_PATH diff --git a/.github/workflows/termuxpkg.yml b/.github/workflows/termuxpkg.yml index 2cb8ccd3..23f35695 100644 --- a/.github/workflows/termuxpkg.yml +++ b/.github/workflows/termuxpkg.yml @@ -73,7 +73,7 @@ jobs: - name: build irssi package run: | sudo ./scripts/run-docker.sh ./build-package.sh -I irssi-an - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: irssi-termux-pkg path: output/irssi-an*.deb From 455dcb18ecfa125469bf913655c5a9c1b31a7dd5 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 1 Apr 2024 22:03:33 +0200 Subject: [PATCH 059/117] deprecated openssl3 function --- src/core/network-openssl.c | 58 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index 9956f217..5104e7dd 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -751,44 +752,49 @@ static void set_server_temporary_key_info(TLS_REC *tls, SSL *ssl) #ifdef SSL_get_server_tmp_key /* Show ephemeral key information. */ EVP_PKEY *ephemeral_key = NULL; - - /* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */ -#ifndef OPENSSL_NO_EC - EC_KEY *ec_key = NULL; -#endif char *ephemeral_key_algorithm = NULL; - char *cname = NULL; - int nid; g_return_if_fail(tls != NULL); g_return_if_fail(ssl != NULL); if (SSL_get_server_tmp_key(ssl, &ephemeral_key)) { - switch (EVP_PKEY_id(ephemeral_key)) { - case EVP_PKEY_DH: - tls_rec_set_ephemeral_key_algorithm(tls, "DH"); - tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); - break; + int keytype = EVP_PKEY_id(ephemeral_key); + switch (keytype) { + case EVP_PKEY_DH: + tls_rec_set_ephemeral_key_algorithm(tls, "DH"); + tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); + break; + /* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */ #ifndef OPENSSL_NO_EC - case EVP_PKEY_EC: - ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key); - nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key)); - EC_KEY_free(ec_key); - cname = (char *)OBJ_nid2sn(nid); - ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname); + case EVP_PKEY_EC: { +#if (OPENSSL_VERSION_NUMBER >= 0x30000000L) + char cname[50]; + EVP_PKEY_get_group_name(ephemeral_key, cname, sizeof(cname), NULL); +#else + EC_KEY *ec_key = NULL; + char *cname = NULL; + int nid; - tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm); - tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); + ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key); + nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key)); + EC_KEY_free(ec_key); + cname = (char *) OBJ_nid2sn(nid); +#endif + ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname); - g_free_and_null(ephemeral_key_algorithm); - break; + tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm); + tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); + + g_free_and_null(ephemeral_key_algorithm); + break; + } #endif - default: - tls_rec_set_ephemeral_key_algorithm(tls, "Unknown"); - tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); - break; + default: + tls_rec_set_ephemeral_key_algorithm(tls, OBJ_nid2ln(keytype)); + tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key)); + break; } EVP_PKEY_free(ephemeral_key); From 9d0787fc1063b7bd3313aec90bccf8fccdba05cc Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Tue, 2 Apr 2024 05:23:10 +0000 Subject: [PATCH 060/117] Ensure all files have newlines at the end --- .github/workflows/clangformat.yml | 2 +- .github/workflows/trigger-pages.yml | 2 +- docs/design.html | 2 +- docs/faq.html | 2 +- src/irc/core/scram.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/clangformat.yml b/.github/workflows/clangformat.yml index 9076edc2..cf701e2e 100644 --- a/.github/workflows/clangformat.yml +++ b/.github/workflows/clangformat.yml @@ -26,4 +26,4 @@ jobs: if: failure() with: name: git-clang-format.diff - path: git-clang-format.diff \ No newline at end of file + path: git-clang-format.diff diff --git a/.github/workflows/trigger-pages.yml b/.github/workflows/trigger-pages.yml index e0d4b8ed..0f2d3212 100644 --- a/.github/workflows/trigger-pages.yml +++ b/.github/workflows/trigger-pages.yml @@ -17,4 +17,4 @@ jobs: repo: 'irssi.github.io', workflow_id: 'pages.yml', ref: 'main' - }) \ No newline at end of file + }) diff --git a/docs/design.html b/docs/design.html index 3865a7fb..e4f9bb06 100644 --- a/docs/design.html +++ b/docs/design.html @@ -162,4 +162,4 @@ server reconnections and irc network splits
  • placing channels and queries in windows
  • nick completion
  • printing infomation of some events
  • - \ No newline at end of file + diff --git a/docs/faq.html b/docs/faq.html index 50b404a0..7909b5b4 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -78,4 +78,4 @@

    Q: How to pronounce Irssi?

    -

    A: Check here

    \ No newline at end of file +

    A: Check here

    diff --git a/src/irc/core/scram.h b/src/irc/core/scram.h index ee605142..14068e48 100644 --- a/src/irc/core/scram.h +++ b/src/irc/core/scram.h @@ -24,4 +24,4 @@ void scram_session_free(SCRAM_SESSION_REC *session); scram_status scram_process(SCRAM_SESSION_REC *session, const char *input, char **output, size_t *output_len); -#endif \ No newline at end of file +#endif From 822fd501327aec58c3466d841355159b5f3b9529 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 12 Apr 2024 22:55:20 +0200 Subject: [PATCH 061/117] fix /ban command --- src/fe-common/irc/fe-events-numeric.c | 33 +-------------------------- src/fe-common/irc/fe-irc-channels.c | 32 ++++++++++++++++++++++++++ src/fe-common/irc/fe-irc-channels.h | 1 + src/fe-common/irc/fe-irc-commands.c | 14 +++++++----- 4 files changed, 42 insertions(+), 38 deletions(-) diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 951bd31f..8035cebf 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -35,6 +35,7 @@ #include #include #include +#include static void print_event_received(IRC_SERVER_REC *server, const char *data, const char *nick, int target_param); @@ -138,38 +139,6 @@ static void event_end_of_who(IRC_SERVER_REC *server, const char *data) g_free(params); } -/* Get time elapsed since an event */ -static char *time_ago(time_t seconds) -{ - static char ret[128]; - long unsigned years, weeks, days, hours, minutes; - - seconds = time(NULL) - seconds; - - years = seconds / (86400 * 365); - seconds %= (86400 * 365); - weeks = seconds / 604800; - days = (seconds / 86400) % 7; - hours = (seconds / 3600) % 24; - minutes = (seconds / 60) % 60; - seconds %= 60; - - if (years) - snprintf(ret, sizeof(ret), "%luy %luw %lud", years, weeks, days); - else if (weeks) - snprintf(ret, sizeof(ret), "%luw %lud %luh", weeks, days, hours); - else if (days) - snprintf(ret, sizeof(ret), "%lud %luh %lum", days, hours, minutes); - else if (hours) - snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes); - else if (minutes) - snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned) seconds); - else - snprintf(ret, sizeof(ret), "%lus", (long unsigned) seconds); - - return ret; -} - static void event_ban_list(IRC_SERVER_REC *server, const char *data) { IRC_CHANNEL_REC *chanrec; diff --git a/src/fe-common/irc/fe-irc-channels.c b/src/fe-common/irc/fe-irc-channels.c index 93ff3603..39752984 100644 --- a/src/fe-common/irc/fe-irc-channels.c +++ b/src/fe-common/irc/fe-irc-channels.c @@ -73,6 +73,38 @@ const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target) return target; } +/* Get time elapsed since an event */ +char *time_ago(time_t seconds) +{ + static char ret[128]; + long unsigned years, weeks, days, hours, minutes; + + seconds = time(NULL) - seconds; + + years = seconds / (86400 * 365); + seconds %= (86400 * 365); + weeks = seconds / 604800; + days = (seconds / 86400) % 7; + hours = (seconds / 3600) % 24; + minutes = (seconds / 60) % 60; + seconds %= 60; + + if (years) + snprintf(ret, sizeof(ret), "%luy %luw %lud", years, weeks, days); + else if (weeks) + snprintf(ret, sizeof(ret), "%luw %lud %luh", weeks, days, hours); + else if (days) + snprintf(ret, sizeof(ret), "%lud %luh %lum", days, hours, minutes); + else if (hours) + snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes); + else if (minutes) + snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned) seconds); + else + snprintf(ret, sizeof(ret), "%lus", (long unsigned) seconds); + + return ret; +} + static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec) { g_return_if_fail(rec != NULL); diff --git a/src/fe-common/irc/fe-irc-channels.h b/src/fe-common/irc/fe-irc-channels.h index a5770107..080cd484 100644 --- a/src/fe-common/irc/fe-irc-channels.h +++ b/src/fe-common/irc/fe-irc-channels.h @@ -3,6 +3,7 @@ int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target); const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target); +char *time_ago(time_t seconds); void fe_irc_channels_init(void); void fe_irc_channels_deinit(void); diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index 40ad36e0..368a3fa6 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -39,6 +39,7 @@ #include #include #include +#include /* SYNTAX: ME */ static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) @@ -224,15 +225,16 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server) /* show bans.. */ counter = 1; for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) { + char *timestr, *ago; BAN_REC *rec = tmp->data; + timestr = my_asctime(rec->time); + ago = time_ago(rec->time); printformat(server, channel->visible_name, MSGLEVEL_CRAP, - (rec->setby == NULL || *rec->setby == '\0') ? - IRCTXT_BANLIST : IRCTXT_BANLIST_LONG, - counter, channel->visible_name, - rec->ban, rec->setby, - (int) (time(NULL)-rec->time)); - counter++; + (rec->setby == NULL || *rec->setby == '\0') ? IRCTXT_BANLIST : + IRCTXT_BANLIST_LONG, + counter, channel->visible_name, rec->ban, rec->setby, ago, timestr); + counter++; } } From 19e7d3f6b8fa4610984b7a9145b5b4a29de8ae46 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 12 Apr 2024 23:00:52 +0200 Subject: [PATCH 062/117] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 9f6c54a2..ec3b9726 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 53 +#define IRSSI_ABI_VERSION 54 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 2dce273264ca92962adaacf4ee93a531152c4b94 Mon Sep 17 00:00:00 2001 From: Arrigo Marchiori Date: Sat, 27 Apr 2024 21:38:21 +0200 Subject: [PATCH 063/117] Mention the section of the capsicum settings. --- docs/capsicum.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/capsicum.txt b/docs/capsicum.txt index a3a1b8a7..d2ad920c 100644 --- a/docs/capsicum.txt +++ b/docs/capsicum.txt @@ -9,13 +9,13 @@ To make Irssi enter capability mode on startup, add capsicum = "yes"; awaylog_file = "~/irclogs/away.log"; -to your ~/.irssi/config and restart the client. Alternatively you can -enter it "by hand", using the "/capsicum enter" command. From the security -point of view it's strongly preferable to use the former method, to avoid -establishing connections without the sandbox protection; the "/capsicum" -command is only intended for experimentation, and in cases where you need -to do something that's not possible in capability mode - run scripts, -for example - before continuing. +to your ~/.irssi/config in the settings/core section, and restart the +client. Alternatively you can enter it "by hand", using the +"/capsicum enter" command. From the security point of view it's strongly +preferable to use the former method, to avoid establishing connections +without the sandbox protection; the "/capsicum" command is only intended +for experimentation, and in cases where you need to do something that's not +possible in capability mode - run scripts, for example - before continuing. There is no way to leave the capability mode, apart from exiting Irssi. When running in capability mode, there are certain restrictions - Irssi From ae094ba3e68c9d57223a0ead21ed4db96f84db61 Mon Sep 17 00:00:00 2001 From: Pontus Lundkvist Date: Sun, 17 Nov 2024 23:42:00 +0100 Subject: [PATCH 064/117] Bump actions/upload-artifact from deprecated (defunct) v1 to v4. --- .github/workflows/cifuzz.yml | 2 +- .github/workflows/clangformat.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 6325d671..3b20e427 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -44,7 +44,7 @@ jobs: dry-run: false sanitizer: ${{ matrix.sanitizer }} - name: Upload Crash - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' with: name: ${{ matrix.sanitizer }}-artifacts diff --git a/.github/workflows/clangformat.yml b/.github/workflows/clangformat.yml index cf701e2e..55aca4f3 100644 --- a/.github/workflows/clangformat.yml +++ b/.github/workflows/clangformat.yml @@ -22,7 +22,7 @@ jobs: | CLANG_FORMAT=clang-format-14 git-clang-format-14 --diff FETCH_HEAD HEAD | tee git-clang-format.diff cmp -s <(echo no modified files to format) git-clang-format.diff || cmp -s <(echo -n) git-clang-format.diff - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 if: failure() with: name: git-clang-format.diff From ca1cd7a26a559c5f98165c867b43814d0de3fbeb Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 16 Dec 2024 19:42:12 +0100 Subject: [PATCH 065/117] new setuptools broken in github workflow --- .github/workflows/abicheck.yml | 2 +- .github/workflows/check.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/abicheck.yml b/.github/workflows/abicheck.yml index 3ac39146..6149f050 100644 --- a/.github/workflows/abicheck.yml +++ b/.github/workflows/abicheck.yml @@ -4,7 +4,7 @@ env: build_options: -Dbuildtype=debug -Denable-true-color=yes -Dwith-proxy=yes -Dc_args=-DPERL_EUPXS_ALWAYS_EXPORT prefix: /usr/local apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev - get_pip_build_deps: pip3 install setuptools; pip3 install wheel; pip3 install 'meson<0.59.0' + get_pip_build_deps: pip3 install 'setuptools<66'; pip3 install wheel; pip3 install 'meson<0.59.0' getabidef_def: getabidef() { awk '$1=="#define" && $2=="IRSSI_ABI_VERSION" { print $3 }' "$1"/include/irssi/src/common.h; } jobs: build-base-ref: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2fee4b8b..c771504e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -38,6 +38,7 @@ jobs: builder: [meson] compiler: [clang, gcc] flags: [regular] + setuptools_ver: [<66] include: - os: ubuntu-20.04 builder: meson From a775f50572bc7751b5ff01e7aa3e2e2d3ea5d262 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 16 Dec 2024 19:57:30 +0100 Subject: [PATCH 066/117] add glib dependency to github workflows --- .github/workflows/abicheck.yml | 2 +- .github/workflows/check.yml | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/abicheck.yml b/.github/workflows/abicheck.yml index 6149f050..d1387b82 100644 --- a/.github/workflows/abicheck.yml +++ b/.github/workflows/abicheck.yml @@ -3,7 +3,7 @@ name: abicheck env: build_options: -Dbuildtype=debug -Denable-true-color=yes -Dwith-proxy=yes -Dc_args=-DPERL_EUPXS_ALWAYS_EXPORT prefix: /usr/local - apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev + apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev libglib2.0-dev get_pip_build_deps: pip3 install 'setuptools<66'; pip3 install wheel; pip3 install 'meson<0.59.0' getabidef_def: getabidef() { awk '$1=="#define" && $2=="IRSSI_ABI_VERSION" { print $3 }' "$1"/include/irssi/src/common.h; } jobs: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c771504e..646b58d8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,8 +5,7 @@ on: pull_request: name: Check Irssi env: - apt_build_deps: libutf8proc-dev libperl-dev libotr5-dev - apt_build_deps_meson: ninja-build + apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev libglib2.0-dev get_pip_build_deps_meson: pip3 install setuptools${setuptools_ver}; pip3 install wheel; pip3 install meson${meson_ver} build_options_meson: -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes -Dwith-otr=yes prefix: ~/irssi-build @@ -35,20 +34,16 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, ubuntu-latest] - builder: [meson] compiler: [clang, gcc] flags: [regular] setuptools_ver: [<66] include: - os: ubuntu-20.04 - builder: meson meson_ver: ==0.53.2 setuptools_ver: <51 - os: ubuntu-latest - builder: meson meson_ver: <0.63.0 - os: ubuntu-latest - builder: meson flags: meson-latest FAILURE-OK steps: - name: fetch dist @@ -61,8 +56,8 @@ jobs: meson_ver: ${{ matrix.meson_ver }} setuptools_ver: ${{ matrix.setuptools_ver }} run: | - sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }} - eval "$get_pip_build_deps_${{ matrix.builder }}" + sudo apt update && sudo apt install $apt_build_deps + eval "$get_pip_build_deps_meson" 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 run: tar xaf artifact/irssi-*.tar.gz @@ -73,14 +68,12 @@ jobs: meson Build $build_options_meson --prefix=${prefix/\~/~} ninja -C Build ninja -C Build install - if: ${{ matrix.builder == 'meson' }} - name: run tests with Meson run: | # ninja test cd irssi-*/ ninja -C Build test find -name testlog.txt -exec sed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} + - if: ${{ matrix.builder == 'meson' }} - name: run launch test env: TERM: xterm @@ -125,7 +118,7 @@ jobs: meson_ver: ${{ matrix.meson_ver }} setuptools_ver: ${{ matrix.setuptools_ver }} run: | - sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_meson + sudo apt update && sudo apt install $apt_build_deps eval "$get_pip_build_deps_meson" curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl - name: build and install with meson From a7bb40f5301f28476493162e2375dc0c3d07bf72 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 16 Dec 2024 20:11:24 +0100 Subject: [PATCH 067/117] pin setuptools and meson ver for make dist in workflow --- .github/workflows/check.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 646b58d8..37b59749 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -12,10 +12,14 @@ env: jobs: dist: runs-on: ubuntu-latest + env: + meson_ver: <0.63.0 + setuptools_ver: <66 steps: - name: prepare required software run: | sudo apt update && sudo apt install $apt_build_deps + eval "$get_pip_build_deps_meson" - uses: actions/checkout@main - name: make dist run: | From e8e5bf5d817f5a8b590c8da4b21ebd8d4550f267 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 16 Dec 2024 20:43:48 +0100 Subject: [PATCH 068/117] patch old setuptools for python 3.12 for github workflow --- .github/workflows/check.yml | 24 ++++++++++++++++++++++++ utils/make-dist.sh | 9 +++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 37b59749..67465f1a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,6 +20,30 @@ jobs: run: | sudo apt update && sudo apt install $apt_build_deps eval "$get_pip_build_deps_meson" + patch ~/.local/lib/python3.12/site-packages/pkg_resources/__init__.py <<- PATCH + --- __init__.py 2024-12-16 20:37:46.733230351 +0100 + +++ __init__.py 2024-12-16 20:38:42.479554540 +0100 + @@ -2188,7 +2188,8 @@ def resolve_egg_link(path): + return next(dist_groups, ()) + + + -register_finder(pkgutil.ImpImporter, find_on_path) + +if hasattr(pkgutil, 'ImpImporter'): + + register_finder(pkgutil.ImpImporter, find_on_path) + + if hasattr(importlib_machinery, 'FileFinder'): + register_finder(importlib_machinery.FileFinder, find_on_path) + @@ -2345,7 +2346,8 @@ def file_ns_handler(importer, path_item, + return subpath + + + -register_namespace_handler(pkgutil.ImpImporter, file_ns_handler) + +if hasattr(pkgutil, 'ImpImporter'): + + register_namespace_handler(pkgutil.ImpImporter, file_ns_handler) + register_namespace_handler(zipimport.zipimporter, file_ns_handler) + + if hasattr(importlib_machinery, 'FileFinder'): + PATCH - uses: actions/checkout@main - name: make dist run: | diff --git a/utils/make-dist.sh b/utils/make-dist.sh index 3ea56599..81d450d7 100755 --- a/utils/make-dist.sh +++ b/utils/make-dist.sh @@ -80,10 +80,11 @@ echo "Creating sdist..." python3 -W ignore -c 'from setuptools import *;setup()' --quiet sdist --formats=tar tar --delete --file "dist/$name-$version.tar" \ - "$name-$version/setup.cfg" \ - "$name-$version/pyproject.toml" \ - "$name-$version/$name.egg-info" \ - "$name-$version/PKG-INFO" + $(tar tf "dist/$name-$version.tar" | grep -F \ + "$name-$version/setup.cfg +$name-$version/pyproject.toml +$name-$version/$name.egg-info +$name-$version/PKG-INFO") echo "Zipping..." xz -k "dist/$name-$version.tar" From d6c146a1fae01f9eb5693dbd98adfa41701c4ad9 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 24 Mar 2025 08:54:01 +0100 Subject: [PATCH 069/117] initialise memory in ctcp ping reply --- src/fe-common/irc/fe-ctcp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c index 14893966..cc60ea92 100644 --- a/src/fe-common/irc/fe-ctcp.c +++ b/src/fe-common/irc/fe-ctcp.c @@ -119,11 +119,10 @@ static void ctcp_default_reply(IRC_SERVER_REC *server, const char *data, g_free(ctcp); } -static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, - const char *nick, const char *addr, - const char *target) +static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, const char *nick, + const char *addr, const char *target) { - gint64 tv, tv2; + gint64 tv, tv2 = 0; long usecs; g_return_if_fail(data != NULL); @@ -141,8 +140,9 @@ static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, tv2 += tv * G_TIME_SPAN_SECOND; tv = g_get_real_time(); usecs = tv - tv2; - printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS, - IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND, usecs % G_TIME_SPAN_SECOND); + printformat(server, server_ischannel(SERVER(server), target) ? target : nick, + MSGLEVEL_CTCPS, IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND, + usecs % G_TIME_SPAN_SECOND); } void fe_ctcp_init(void) From 26fd0585cddfa5282bc09d1b4e60afab8ab28e70 Mon Sep 17 00:00:00 2001 From: steering7253 Date: Sat, 2 Nov 2024 17:08:32 -0600 Subject: [PATCH 070/117] add ipaddr and family to connrec and perl SERVER_REC --- docs/perl.txt | 2 ++ src/core/server-connect-rec.h | 1 + src/core/servers.c | 8 +++++++- src/perl/perl-common.c | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/perl.txt b/docs/perl.txt index 964f4f72..b8e097c7 100644 --- a/docs/perl.txt +++ b/docs/perl.txt @@ -522,6 +522,8 @@ Connect->{} address - Address where we connected (irc.blah.org) port - Port where we connected chatnet - Chat network + chosen_family - IP family chosen to connect to + ipaddr - IP address connected to password - Password we used in connection. wanted_nick - Nick which we would prefer to use diff --git a/src/core/server-connect-rec.h b/src/core/server-connect-rec.h index 2f68bd04..16513109 100644 --- a/src/core/server-connect-rec.h +++ b/src/core/server-connect-rec.h @@ -12,6 +12,7 @@ char *proxy_string, *proxy_string_after, *proxy_password; unsigned short family; /* 0 = don't care, AF_INET or AF_INET6 */ unsigned short chosen_family; /* family actually chosen during name resolution */ +char *ipaddr; char *tag; /* try to keep this tag when connected to server */ char *address; int port; diff --git a/src/core/servers.c b/src/core/servers.c index 65829c10..0ea8f937 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -212,13 +212,18 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip, g_return_if_fail(ip != NULL || unix_socket != NULL); + if (ip != NULL) { + server->connrec->chosen_family = ip->family; + net_ip2host(ip, ipaddr); + server->connrec->ipaddr = g_strdup(ipaddr); + } + signal_emit("server connecting", 2, server, ip); if (server->connrec->no_connect) return; if (ip != NULL) { - server->connrec->chosen_family = ip->family; own_ip = IPADDR_IS_V6(ip) ? server->connrec->own_ip6 : server->connrec->own_ip4; port = server->connrec->proxy != NULL ? server->connrec->proxy_port : server->connrec->port; @@ -637,6 +642,7 @@ void server_connect_unref(SERVER_CONNECT_REC *conn) g_free_not_null(conn->proxy_string_after); g_free_not_null(conn->proxy_password); + g_free_not_null(conn->ipaddr); g_free_not_null(conn->tag); g_free_not_null(conn->address); g_free_not_null(conn->chatnet); diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index d9d00035..c54ee643 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -287,6 +287,8 @@ void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn) (void) hv_store(hv, "type", 4, new_pv(type), 0); (void) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0); + (void) hv_store(hv, "chosen_family", 13, newSViv(conn->chosen_family), 0); + (void) hv_store(hv, "ipaddr", 6, new_pv(conn->ipaddr), 0); (void) hv_store(hv, "tag", 3, new_pv(conn->tag), 0); (void) hv_store(hv, "address", 7, new_pv(conn->address), 0); (void) hv_store(hv, "port", 4, newSViv(conn->port), 0); From 49d7302e986dc41724f6ee9dfba97d950d3ce555 Mon Sep 17 00:00:00 2001 From: steering7253 Date: Mon, 7 Apr 2025 13:53:39 -0600 Subject: [PATCH 071/117] fix irssi SASL negotiation with multiple CAP ACK when attempting SASL, if multiple CAP ACK were received (for example, because a script sent an additional CAP REQ), then any not containing `sasl` would cause SASL to fail (immediately aborting the connection with no message, depending on sasl_disconnect_on_failure setting) check not only if SASL is set in this line, but also if we've already seen it in a previous line. --- src/irc/core/irc-cap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/irc/core/irc-cap.c b/src/irc/core/irc-cap.c index ce7e1616..2c2df7f9 100644 --- a/src/irc/core/irc-cap.c +++ b/src/irc/core/irc-cap.c @@ -234,7 +234,7 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add } } else if (!g_ascii_strcasecmp(evt, "ACK")) { - int got_sasl = FALSE; + int got_sasl = (i_slist_find_string(server->cap_active, "sasl") != NULL); /* Emit a signal for every ack'd cap */ for (i = 0; i < caps_length; i++) { From 99c37387a402791e17b0bde5b5ee5ddf3225fc4d Mon Sep 17 00:00:00 2001 From: steering7253 Date: Mon, 7 Apr 2025 14:36:10 -0600 Subject: [PATCH 072/117] bump ABI_VERSION --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index ec3b9726..b5947de6 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 54 +#define IRSSI_ABI_VERSION 55 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 7bac5eb76250d26d93048ee1595a36c04daadcf1 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 8 Apr 2025 07:42:10 +0200 Subject: [PATCH 073/117] include curses.h when needed --- meson.build | 22 ++++++++++++++++++++++ src/fe-text/term-terminfo.c | 10 ++++++---- src/fe-text/terminfo-core.c | 3 +++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 0d06c466..866bfd27 100644 --- a/meson.build +++ b/meson.build @@ -569,6 +569,28 @@ foreach h : headers endif endforeach +if want_textui and conf.get('HAVE_TERM_H', 0) == 1 + if not cc.links(''' +#include +#include +int main () { + return tputs("x", 1, putchar); +} +''', dependencies : textui_dep) + if cc.has_header('curses.h') and cc.links(''' +#include +#include +int main () { + return tputs("x", 1, putchar); +} +''', dependencies : textui_dep, name : 'working Curses') + conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h') + else + error('could not link terminfo') + endif + endif +endif + conf.set('HAVE_LIBUTF8PROC', have_libutf8proc) conf.set_quoted('PACKAGE_VERSION', package_version) conf.set_quoted('PACKAGE_TARNAME', meson.project_name()) diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 06310cc9..698ff84c 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -31,6 +31,9 @@ #include #ifdef HAVE_TERM_H +#ifdef NEED_CURSES_H +#include +#endif #include #else /* TODO: This needs arguments, starting with C2X. */ @@ -40,14 +43,13 @@ int tputs(); /* returns number of characters in the beginning of the buffer being a a single character, or -1 if more input is needed. The character will be saved in result */ -typedef int (*TERM_INPUT_FUNC)(const unsigned char *buffer, int size, - unichar *result); +typedef int (*TERM_INPUT_FUNC)(const unsigned char *buffer, int size, unichar *result); struct _TERM_WINDOW { - /* Terminal to use for window */ + /* Terminal to use for window */ TERM_REC *term; - /* Area for window in terminal */ + /* Area for window in terminal */ int x, y; int width, height; }; diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index 7c21d509..bd735731 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -13,6 +13,9 @@ inline static int term_putchar(int c) } #ifdef HAVE_TERM_H +#ifdef NEED_CURSES_H +#include +#endif #include #else /* Don't bother including curses.h because of these - From 382bde9ab3ee8290f03012432d7c772d373fc987 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 8 Apr 2025 08:04:21 +0200 Subject: [PATCH 074/117] namespace TERM_REC functions (conflict with curses.h) --- src/fe-text/term-terminfo.c | 34 +++---- src/fe-text/terminfo-core.c | 181 ++++++++++++++++++------------------ src/fe-text/terminfo-core.h | 87 ++++++++--------- 3 files changed, 148 insertions(+), 154 deletions(-) diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 698ff84c..d4db942a 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -369,8 +369,8 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne if (!term_use_colors && bg > 0) col |= ATTR_REVERSE; - set_normal = ((col & ATTR_RESETFG) && last_fg != COLOR_RESET) || - ((col & ATTR_RESETBG) && last_bg != COLOR_RESET); + set_normal = ((col & ATTR_RESETFG) && last_fg != COLOR_RESET) || + ((col & ATTR_RESETBG) && last_bg != COLOR_RESET); if (((last_attrs & ATTR_BOLD) && (col & ATTR_BOLD) == 0) || ((last_attrs & ATTR_REVERSE) && (col & ATTR_REVERSE) == 0) || ((last_attrs & ATTR_BLINK) && (col & ATTR_BLINK) == 0)) { @@ -381,19 +381,17 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne if (set_normal) { last_fg = last_bg = COLOR_RESET; - last_attrs = 0; + last_attrs = 0; terminfo_set_normal(); } /* set foreground color */ - if (fg != last_fg && - (fg != 0 || (col & ATTR_RESETFG) == 0)) { - if (term_use_colors) { + if (fg != last_fg && (fg != 0 || (col & ATTR_RESETFG) == 0)) { + if (term_use_colors) { last_fg = fg; if (fg >> 8) - termctl_set_color_24bit(0, - last_fg == COLOR_BLACK24 ? 0 - : last_fg >> 8); + termctl_set_color_24bit(0, last_fg == COLOR_BLACK24 ? 0 : + last_fg >> 8); else terminfo_set_fg(last_fg); } @@ -401,19 +399,17 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne /* set background color */ if (window && window->term->TI_colors && - (term_color256map[bg&0xff]&8) == window->term->TI_colors) + (term_color256map[bg & 0xff] & 8) == window->term->TI_colors) col |= ATTR_BLINK; if (col & ATTR_BLINK) - current_term->set_blink(current_term); + current_term->tr_set_blink(current_term); - if (bg != last_bg && - (bg != 0 || (col & ATTR_RESETBG) == 0)) { - if (term_use_colors) { + if (bg != last_bg && (bg != 0 || (col & ATTR_RESETBG) == 0)) { + if (term_use_colors) { last_bg = bg; if (bg >> 8) - termctl_set_color_24bit(1, - last_bg == COLOR_BLACK24 ? 0 - : last_bg >> 8); + termctl_set_color_24bit(1, last_bg == COLOR_BLACK24 ? 0 : + last_bg >> 8); else terminfo_set_bg(last_bg); } @@ -425,7 +421,7 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne /* bold */ if (window && window->term->TI_colors && - (term_color256map[fg&0xff]&8) == window->term->TI_colors) + (term_color256map[fg & 0xff] & 8) == window->term->TI_colors) col |= ATTR_BOLD; if (col & ATTR_BOLD) terminfo_set_bold(); @@ -445,7 +441,7 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne terminfo_set_italic(FALSE); /* update the new attribute settings whilst ignoring color values. */ - last_attrs = col & ~( BG_MASK | FG_MASK ); + last_attrs = col & ~(BG_MASK | FG_MASK); } void term_move(TERM_WINDOW *window, int x, int y) diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index bd735731..fe98efae 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -172,20 +172,20 @@ static void _set_cursor_visible(TERM_REC *term, int set) /* Scroll (change_scroll_region+parm_rindex+parm_index / csr+rin+indn) */ static void _scroll_region(TERM_REC *term, int y1, int y2, int count) { - /* setup the scrolling region to wanted area */ - scroll_region_setup(term, y1, y2); + /* setup the scrolling region to wanted area */ + scroll_region_setup(term, y1, y2); - term->move(term, 0, y1); + term->tr_move(term, 0, y1); if (count > 0) { - term->move(term, 0, y2); + term->tr_move(term, 0, y2); tput(tparm(term->TI_indn, count, count, 0, 0, 0, 0, 0, 0, 0)); } else if (count < 0) { - term->move(term, 0, y1); + term->tr_move(term, 0, y1); tput(tparm(term->TI_rin, -count, -count, 0, 0, 0, 0, 0, 0, 0)); } - /* reset the scrolling region to full screen */ - scroll_region_setup(term, 0, term->height-1); + /* reset the scrolling region to full screen */ + scroll_region_setup(term, 0, term->height - 1); } /* Scroll (change_scroll_region+scroll_reverse+scroll_forward / csr+ri+ind) */ @@ -193,21 +193,21 @@ static void _scroll_region_1(TERM_REC *term, int y1, int y2, int count) { int i; - /* setup the scrolling region to wanted area */ - scroll_region_setup(term, y1, y2); + /* setup the scrolling region to wanted area */ + scroll_region_setup(term, y1, y2); if (count > 0) { - term->move(term, 0, y2); + term->tr_move(term, 0, y2); for (i = 0; i < count; i++) tput(tparm(term->TI_ind, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } else if (count < 0) { - term->move(term, 0, y1); + term->tr_move(term, 0, y1); for (i = count; i < 0; i++) tput(tparm(term->TI_ri, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } - /* reset the scrolling region to full screen */ - scroll_region_setup(term, 0, term->height-1); + /* reset the scrolling region to full screen */ + scroll_region_setup(term, 0, term->height - 1); } /* Scroll (parm_insert_line+parm_delete_line / il+dl) */ @@ -216,22 +216,22 @@ static void _scroll_line(TERM_REC *term, int y1, int y2, int count) /* setup the scrolling region to wanted area - this might not necessarily work with il/dl, but at least it looks better if it does */ - scroll_region_setup(term, y1, y2); + scroll_region_setup(term, y1, y2); if (count > 0) { - term->move(term, 0, y1); + term->tr_move(term, 0, y1); tput(tparm(term->TI_dl, count, count, 0, 0, 0, 0, 0, 0, 0)); - term->move(term, 0, y2-count+1); + term->tr_move(term, 0, y2 - count + 1); tput(tparm(term->TI_il, count, count, 0, 0, 0, 0, 0, 0, 0)); } else if (count < 0) { - term->move(term, 0, y2+count+1); + term->tr_move(term, 0, y2 + count + 1); tput(tparm(term->TI_dl, -count, -count, 0, 0, 0, 0, 0, 0, 0)); - term->move(term, 0, y1); + term->tr_move(term, 0, y1); tput(tparm(term->TI_il, -count, -count, 0, 0, 0, 0, 0, 0, 0)); } - /* reset the scrolling region to full screen */ - scroll_region_setup(term, 0, term->height-1); + /* reset the scrolling region to full screen */ + scroll_region_setup(term, 0, term->height - 1); } /* Scroll (insert_line+delete_line / il1+dl1) */ @@ -240,17 +240,17 @@ static void _scroll_line_1(TERM_REC *term, int y1, int y2, int count) int i; if (count > 0) { - term->move(term, 0, y1); - for (i = 0; i < count; i++) + term->tr_move(term, 0, y1); + for (i = 0; i < count; i++) tput(tparm(term->TI_dl1, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - term->move(term, 0, y2-count+1); - for (i = 0; i < count; i++) + term->tr_move(term, 0, y2 - count + 1); + for (i = 0; i < count; i++) tput(tparm(term->TI_il1, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } else if (count < 0) { - term->move(term, 0, y2+count+1); + term->tr_move(term, 0, y2 + count + 1); for (i = count; i < 0; i++) tput(tparm(term->TI_dl1, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - term->move(term, 0, y1); + term->tr_move(term, 0, y1); for (i = count; i < 0; i++) tput(tparm(term->TI_il1, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } @@ -265,14 +265,14 @@ static void _clear_screen(TERM_REC *term) /* Clear screen (clr_eos / ed) */ static void _clear_eos(TERM_REC *term) { - term->move(term, 0, 0); + term->tr_move(term, 0, 0); tput(tparm(term->TI_ed, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } /* Clear screen (parm_delete_line / dl) */ static void _clear_del(TERM_REC *term) { - term->move(term, 0, 0); + term->tr_move(term, 0, 0); tput(tparm(term->TI_dl, term->height, term->height, 0, 0, 0, 0, 0, 0, 0)); } @@ -281,8 +281,8 @@ static void _clear_del_1(TERM_REC *term) { int i; - term->move(term, 0, 0); - for (i = 0; i < term->height; i++) + term->tr_move(term, 0, 0); + for (i = 0; i < term->height; i++) tput(tparm(term->TI_dl1, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } @@ -455,10 +455,7 @@ static void terminfo_colors_deinit(TERM_REC *term) terminal capabilities don't contain color codes */ void terminfo_setup_colors(TERM_REC *term, int force) { - static const char ansitab[16] = { - 0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15 - }; + static const char ansitab[16] = { 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15 }; unsigned int i, color; terminfo_colors_deinit(term); @@ -466,16 +463,15 @@ void terminfo_setup_colors(TERM_REC *term, int force) if (force && term->TI_setf == NULL && term->TI_setaf == NULL) term->TI_colors = 8; - if ((term->TI_setf || term->TI_setaf || force) && - term->TI_colors > 0) { + if ((term->TI_setf || term->TI_setaf || force) && term->TI_colors > 0) { term->TI_fg = g_new0(char *, term->TI_colors); term->TI_bg = g_new0(char *, term->TI_colors); - term->set_fg = _set_fg; - term->set_bg = _set_bg; + term->tr_set_fg = _set_fg; + term->tr_set_bg = _set_bg; } else { /* no colors */ term->TI_colors = 0; - term->set_fg = term->set_bg = _ignore_parm; + term->tr_set_fg = term->tr_set_bg = _ignore_parm; } if (term->TI_setaf) { @@ -489,7 +485,7 @@ void terminfo_setup_colors(TERM_REC *term, int force) term->TI_fg[i] = g_strdup(tparm(term->TI_setf, i, 0, 0, 0, 0, 0, 0, 0, 0)); } else if (force) { for (i = 0; i < 8; i++) - term->TI_fg[i] = g_strdup_printf("\033[%dm", 30+ansitab[i]); + term->TI_fg[i] = g_strdup_printf("\033[%dm", 30 + ansitab[i]); } if (term->TI_setab) { @@ -503,7 +499,7 @@ void terminfo_setup_colors(TERM_REC *term, int force) term->TI_bg[i] = g_strdup(tparm(term->TI_setb, i, 0, 0, 0, 0, 0, 0, 0, 0)); } else if (force) { for (i = 0; i < 8; i++) - term->TI_bg[i] = g_strdup_printf("\033[%dm", 40+ansitab[i]); + term->TI_bg[i] = g_strdup_printf("\033[%dm", 40 + ansitab[i]); } } @@ -581,12 +577,12 @@ static int term_setup(TERM_REC *term) { GString *str; int err; - char *term_env; + char *term_env; term_env = getenv("TERM"); if (term_env == NULL) { fprintf(stderr, "TERM environment not set\n"); - return 0; + return 0; } if (setupterm(term_env, 1, &err) != 0) { @@ -594,98 +590,99 @@ static int term_setup(TERM_REC *term) return 0; } - term_fill_capabilities(term); + term_fill_capabilities(term); /* Cursor movement */ if (term->TI_cup) - term->move = _move_cup; + term->tr_move = _move_cup; else if (term->TI_hpa && term->TI_vpa) - term->move = _move_pa; + term->tr_move = _move_pa; else { - fprintf(stderr, "Terminal doesn't support cursor movement\n"); + fprintf(stderr, "Terminal doesn't support cursor movement\n"); return 0; } - term->move_relative = _move_relative; - term->set_cursor_visible = term->TI_civis && term->TI_cnorm ? - _set_cursor_visible : _ignore_parm; + term->tr_move_relative = _move_relative; + term->tr_set_cursor_visible = + term->TI_civis && term->TI_cnorm ? _set_cursor_visible : _ignore_parm; - /* Scrolling */ + /* Scrolling */ if ((term->TI_csr || term->TI_wind) && term->TI_rin && term->TI_indn) - term->scroll = _scroll_region; + term->tr_scroll = _scroll_region; else if (term->TI_il && term->TI_dl) - term->scroll = _scroll_line; + term->tr_scroll = _scroll_line; else if ((term->TI_csr || term->TI_wind) && term->TI_ri && term->TI_ind) - term->scroll = _scroll_region_1; - else if (term->scroll == NULL && (term->TI_il1 && term->TI_dl1)) - term->scroll = _scroll_line_1; - else if (term->scroll == NULL) { - fprintf(stderr, "Terminal doesn't support scrolling\n"); + term->tr_scroll = _scroll_region_1; + else if (term->tr_scroll == NULL && (term->TI_il1 && term->TI_dl1)) + term->tr_scroll = _scroll_line_1; + else if (term->tr_scroll == NULL) { + fprintf(stderr, "Terminal doesn't support scrolling\n"); return 0; } /* Clearing screen */ if (term->TI_clear) - term->clear = _clear_screen; + term->tr_clear = _clear_screen; else if (term->TI_ed) - term->clear = _clear_eos; + term->tr_clear = _clear_eos; else if (term->TI_dl) - term->clear = _clear_del; + term->tr_clear = _clear_del; else if (term->TI_dl1) - term->clear = _clear_del_1; + term->tr_clear = _clear_del_1; else { /* we could do this by line inserts as well, but don't bother - if some terminal has insert line it most probably has delete line as well, if not a regular clear screen */ - fprintf(stderr, "Terminal doesn't support clearing screen\n"); + fprintf(stderr, "Terminal doesn't support clearing screen\n"); return 0; } /* Clearing to end of line */ if (term->TI_el) - term->clrtoeol = _clrtoeol; + term->tr_clrtoeol = _clrtoeol; else { - fprintf(stderr, "Terminal doesn't support clearing to end of line\n"); + fprintf(stderr, "Terminal doesn't support clearing to end of line\n"); return 0; } /* Repeating character */ if (term->TI_rep) - term->repeat = _repeat; + term->tr_repeat = _repeat; else - term->repeat = _repeat_manual; + term->tr_repeat = _repeat_manual; /* Bold, underline, standout, reverse, italics */ - term->set_blink = term->TI_blink ? _set_blink : _ignore; - term->set_bold = term->TI_bold ? _set_bold : _ignore; - term->set_reverse = term->TI_rev ? _set_reverse : - term->TI_smso ? _set_standout_on : _ignore; - term->set_uline = term->TI_smul && term->TI_rmul ? - _set_uline : _ignore_parm; - term->set_standout = term->TI_smso && term->TI_rmso ? - _set_standout : _ignore_parm; - term->set_italic = term->TI_sitm && term->TI_ritm ? - _set_italic : _ignore_parm; + term->tr_set_blink = term->TI_blink ? _set_blink : _ignore; + term->tr_set_bold = term->TI_bold ? _set_bold : _ignore; + term->tr_set_reverse = term->TI_rev ? _set_reverse : + term->TI_smso ? _set_standout_on : + _ignore; + term->tr_set_uline = term->TI_smul && term->TI_rmul ? _set_uline : _ignore_parm; + term->tr_set_standout = term->TI_smso && term->TI_rmso ? _set_standout : _ignore_parm; + term->tr_set_italic = term->TI_sitm && term->TI_ritm ? _set_italic : _ignore_parm; - /* Create a string to set all attributes off */ - str = g_string_new(NULL); + /* Create a string to set all attributes off */ + str = g_string_new(NULL); if (term->TI_sgr0) g_string_append(str, term->TI_sgr0); - if (term->TI_rmul && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmul, term->TI_sgr0) != 0)) + if (term->TI_rmul && + (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmul, term->TI_sgr0) != 0)) g_string_append(str, term->TI_rmul); - if (term->TI_rmso && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmso, term->TI_sgr0) != 0)) + if (term->TI_rmso && + (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmso, term->TI_sgr0) != 0)) g_string_append(str, term->TI_rmso); - if (term->TI_ritm && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0)) + if (term->TI_ritm && + (term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0)) g_string_append(str, term->TI_ritm); - term->TI_normal = str->str; + term->TI_normal = str->str; g_string_free(str, FALSE); - term->set_normal = _set_normal; + term->tr_set_normal = _set_normal; - term->beep = term->TI_bel ? _beep : _ignore; + term->tr_beep = term->TI_bel ? _beep : _ignore; terminfo_setup_colors(term, FALSE); terminfo_input_init0(term); - terminfo_cont(term); - return 1; + terminfo_cont(term); + return 1; } void term_set_appkey_mode(int enable) @@ -730,14 +727,14 @@ void terminfo_core_deinit(TERM_REC *term) TERM_REC *old_term; old_term = current_term; - current_term = term; - term->set_normal(term); - current_term = old_term; + current_term = term; + term->tr_set_normal(term); + current_term = old_term; - terminfo_stop(term); + terminfo_stop(term); g_free(term->TI_normal); terminfo_colors_deinit(term); - g_free(term); + g_free(term); } diff --git a/src/fe-text/terminfo-core.h b/src/fe-text/terminfo-core.h index a077d0bf..ba103de9 100644 --- a/src/fe-text/terminfo-core.h +++ b/src/fe-text/terminfo-core.h @@ -3,48 +3,49 @@ #include -#define terminfo_move(x, y) current_term->move(current_term, x, y) -#define terminfo_move_relative(oldx, oldy, x, y) current_term->move_relative(current_term, oldx, oldy, x, y) -#define terminfo_set_cursor_visible(set) current_term->set_cursor_visible(current_term, set) -#define terminfo_scroll(y1, y2, count) current_term->scroll(current_term, y1, y2, count) -#define terminfo_clear() current_term->clear(current_term) -#define terminfo_clrtoeol() current_term->clrtoeol(current_term) -#define terminfo_repeat(chr, count) current_term->repeat(current_term, chr, count) -#define terminfo_set_fg(color) current_term->set_fg(current_term, color) -#define terminfo_set_bg(color) current_term->set_bg(current_term, color) -#define terminfo_set_normal() current_term->set_normal(current_term) -#define terminfo_set_bold() current_term->set_bold(current_term) -#define terminfo_set_uline(set) current_term->set_uline(current_term, set) -#define terminfo_set_standout(set) current_term->set_standout(current_term, set) -#define terminfo_set_reverse() current_term->set_reverse(current_term) -#define terminfo_set_italic(set) current_term->set_italic(current_term, set) +#define terminfo_move(x, y) current_term->tr_move(current_term, x, y) +#define terminfo_move_relative(oldx, oldy, x, y) \ + current_term->tr_move_relative(current_term, oldx, oldy, x, y) +#define terminfo_set_cursor_visible(set) current_term->tr_set_cursor_visible(current_term, set) +#define terminfo_scroll(y1, y2, count) current_term->tr_scroll(current_term, y1, y2, count) +#define terminfo_clear() current_term->tr_clear(current_term) +#define terminfo_clrtoeol() current_term->tr_clrtoeol(current_term) +#define terminfo_repeat(chr, count) current_term->tr_repeat(current_term, chr, count) +#define terminfo_set_fg(color) current_term->tr_set_fg(current_term, color) +#define terminfo_set_bg(color) current_term->tr_set_bg(current_term, color) +#define terminfo_set_normal() current_term->tr_set_normal(current_term) +#define terminfo_set_bold() current_term->tr_set_bold(current_term) +#define terminfo_set_uline(set) current_term->tr_set_uline(current_term, set) +#define terminfo_set_standout(set) current_term->tr_set_standout(current_term, set) +#define terminfo_set_reverse() current_term->tr_set_reverse(current_term) +#define terminfo_set_italic(set) current_term->tr_set_italic(current_term, set) #define terminfo_is_colors_set(term) (term->TI_fg != NULL) -#define terminfo_beep(term) current_term->beep(current_term) +#define terminfo_beep(term) current_term->tr_beep(current_term) typedef struct _TERM_REC TERM_REC; struct _TERM_REC { - /* Functions */ - void (*move)(TERM_REC *term, int x, int y); - void (*move_relative)(TERM_REC *term, int oldx, int oldy, int x, int y); - void (*set_cursor_visible)(TERM_REC *term, int set); - void (*scroll)(TERM_REC *term, int y1, int y2, int count); + /* Functions */ + void (*tr_move)(TERM_REC *term, int x, int y); + void (*tr_move_relative)(TERM_REC *term, int oldx, int oldy, int x, int y); + void (*tr_set_cursor_visible)(TERM_REC *term, int set); + void (*tr_scroll)(TERM_REC *term, int y1, int y2, int count); - void (*clear)(TERM_REC *term); - void (*clrtoeol)(TERM_REC *term); - void (*repeat)(TERM_REC *term, char chr, int count); + void (*tr_clear)(TERM_REC *term); + void (*tr_clrtoeol)(TERM_REC *term); + void (*tr_repeat)(TERM_REC *term, char chr, int count); - void (*set_fg)(TERM_REC *term, int color); - void (*set_bg)(TERM_REC *term, int color); - void (*set_normal)(TERM_REC *term); - void (*set_blink)(TERM_REC *term); - void (*set_bold)(TERM_REC *term); - void (*set_reverse)(TERM_REC *term); - void (*set_uline)(TERM_REC *term, int set); - void (*set_standout)(TERM_REC *term, int set); - void (*set_italic)(TERM_REC *term, int set); + void (*tr_set_fg)(TERM_REC *term, int color); + void (*tr_set_bg)(TERM_REC *term, int color); + void (*tr_set_normal)(TERM_REC *term); + void (*tr_set_blink)(TERM_REC *term); + void (*tr_set_bold)(TERM_REC *term); + void (*tr_set_reverse)(TERM_REC *term); + void (*tr_set_uline)(TERM_REC *term, int set); + void (*tr_set_standout)(TERM_REC *term, int set); + void (*tr_set_italic)(TERM_REC *term, int set); - void (*beep)(TERM_REC *term); + void (*tr_beep)(TERM_REC *term); #ifndef HAVE_TERMINFO char buffer1[1024], buffer2[1024]; @@ -52,13 +53,13 @@ struct _TERM_REC { FILE *in, *out; struct termios tio, old_tio; - /* Terminal size */ - int width, height; + /* Terminal size */ + int width, height; - /* Cursor movement */ + /* Cursor movement */ const char *TI_smcup, *TI_rmcup, *TI_cup; const char *TI_hpa, *TI_vpa, *TI_cub1, *TI_cuf1; - const char *TI_civis, *TI_cnorm; + const char *TI_civis, *TI_cnorm; /* Scrolling */ const char *TI_csr, *TI_wind; @@ -68,26 +69,26 @@ struct _TERM_REC { /* Clearing screen */ const char *TI_clear, *TI_ed; /* + *TI_dl, *TI_dl1; */ - /* Clearing to end of line */ + /* Clearing to end of line */ const char *TI_el; /* Repeating character */ const char *TI_rep; /* Colors */ - int TI_colors; /* numbers of colors in TI_fg[] and TI_bg[] */ - const char *TI_sgr0; /* turn off all attributes */ + int TI_colors; /* numbers of colors in TI_fg[] and TI_bg[] */ + const char *TI_sgr0; /* turn off all attributes */ const char *TI_smul, *TI_rmul; /* underline on/off */ const char *TI_smso, *TI_rmso; /* standout on/off */ const char *TI_sitm, *TI_ritm; /* italic on/off */ const char *TI_bold, *TI_blink, *TI_rev; const char *TI_setaf, *TI_setab, *TI_setf, *TI_setb; - /* Colors - generated and dynamically allocated */ + /* Colors - generated and dynamically allocated */ char **TI_fg, **TI_bg, *TI_normal; /* Beep */ - char *TI_bel; + char *TI_bel; /* Keyboard-transmit mode */ const char *TI_smkx; From 6dce0a091b8578fe5c715c13c05f4523f99bec27 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 7 Apr 2025 19:01:13 +0200 Subject: [PATCH 075/117] test solaris build with vmactions --- .github/workflows/solarisvm.yml | 104 ++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .github/workflows/solarisvm.yml diff --git a/.github/workflows/solarisvm.yml b/.github/workflows/solarisvm.yml new file mode 100644 index 00000000..0681b0e3 --- /dev/null +++ b/.github/workflows/solarisvm.yml @@ -0,0 +1,104 @@ +on: + push: + branches: + - master + pull_request: + workflow_dispatch: +name: Check Irssi on Solaris +env: + get_pip_build_deps_meson: pip3 install setuptools${setuptools_ver}; pip3 install wheel + prefix: ~/irssi-build +jobs: + dist: + runs-on: ubuntu-latest + env: + setuptools_ver: <66 + steps: + - name: prepare required software + run: | + sudo apt update && sudo apt install $apt_build_deps + eval "$get_pip_build_deps_meson" + patch ~/.local/lib/python3.12/site-packages/pkg_resources/__init__.py <<- PATCH + --- __init__.py 2024-12-16 20:37:46.733230351 +0100 + +++ __init__.py 2024-12-16 20:38:42.479554540 +0100 + @@ -2188,7 +2188,8 @@ def resolve_egg_link(path): + return next(dist_groups, ()) + + + -register_finder(pkgutil.ImpImporter, find_on_path) + +if hasattr(pkgutil, 'ImpImporter'): + + register_finder(pkgutil.ImpImporter, find_on_path) + + if hasattr(importlib_machinery, 'FileFinder'): + register_finder(importlib_machinery.FileFinder, find_on_path) + @@ -2345,7 +2346,8 @@ def file_ns_handler(importer, path_item, + return subpath + + + -register_namespace_handler(pkgutil.ImpImporter, file_ns_handler) + +if hasattr(pkgutil, 'ImpImporter'): + + register_namespace_handler(pkgutil.ImpImporter, file_ns_handler) + register_namespace_handler(zipimport.zipimporter, file_ns_handler) + + if hasattr(importlib_machinery, 'FileFinder'): + PATCH + - uses: actions/checkout@main + - name: make dist + run: | + ./utils/make-dist.sh + - uses: actions/upload-artifact@v4 + with: + path: irssi-*.tar.gz + retention-days: 1 + install: + runs-on: ubuntu-latest + needs: dist + steps: + - name: fetch dist + uses: actions/download-artifact@v4 + - name: Test in Solaris + uses: vmactions/solaris-vm@v1 + with: + usesh: true + sync: rsync + release: "11.4-gcc" + prepare: | + pkg update --accept + pkg install meson + pkgutil -y -i curl + pkgutil -y -i gtar + pkgutil -y -i findutils + run: | + set -ex + export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig + curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl + gtar xzf artifact/irssi-*.tar.gz + # ninja install + cd irssi-*/ + meson Build -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes --prefix=$HOME/irssi-build + ninja -C Build + ninja -C Build install + # ninja test + ninja -C Build test + gfind -name testlog.txt -exec gsed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} + + export TERM=xterm + # automated irssi launch test + cd + mkdir irssi-test + echo 'echo automated irssi launch test + ^set settings_autosave off + ^set -clear log_close_string + ^set -clear log_day_changed + ^set -clear log_open_string + ^set log_timestamp * + ^window log on + load irc + load dcc + load flood + load notifylist + load perl + load otr + load proxy + ^quit' > irssi-test/startup + irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl + cat irc.log.* From 4b2951c8283c34e6d6e01bf85bd0c4f7f627f2be Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 1 Nov 2024 21:56:21 +0100 Subject: [PATCH 076/117] Include to get select(3). This is the header required by POSIX-1.2024. This change is needed to build irssi on operating systems such as Sortix that have a strict libc without obsolete behaviors. --- src/core/net-disconnect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/net-disconnect.c b/src/core/net-disconnect.c index a2f7e290..2ed3a421 100644 --- a/src/core/net-disconnect.c +++ b/src/core/net-disconnect.c @@ -21,6 +21,8 @@ #include "module.h" #include +#include + /* when quitting, wait for max. 5 seconds before forcing to close the socket */ #define MAX_QUIT_CLOSE_WAIT 5 From 38440cf34077b2f348dad02d37148892dd1e31cd Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 1 Nov 2024 22:10:33 +0100 Subject: [PATCH 077/117] Replace obsolescent inet_addr(3)/inet_aton(3) with inet_pton(3). inet_addr has become obsolescent as of POSIX-1.2024 and is not available on strict POSIX 2024 libc implementations. inet_pton(3) is the standard and portable replacement available on all POSIX-1.2001 systems. --- src/core/network.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/core/network.c b/src/core/network.c index 85fe9896..9e47528d 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -491,8 +491,6 @@ int net_ip2host(IPADDR *ip, char *host) int net_host2ip(const char *host, IPADDR *ip) { - unsigned long addr; - if (strchr(host, ':') != NULL) { /* IPv6 */ ip->family = AF_INET6; @@ -501,16 +499,8 @@ int net_host2ip(const char *host, IPADDR *ip) } else { /* IPv4 */ ip->family = AF_INET; -#ifdef HAVE_INET_ATON - if (inet_aton(host, &ip->ip.s_addr) == 0) + if (inet_pton(AF_INET, host, &ip->ip) == 0) return -1; -#else - addr = inet_addr(host); - if (addr == INADDR_NONE) - return -1; - - memcpy(&ip->ip, &addr, 4); -#endif } return 0; From f24d859c801b58068eb1121157f637f28f16249c Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 1 Nov 2024 22:23:46 +0100 Subject: [PATCH 078/117] Fix using HOST_NOT_FOUND instead of EAI_NONAME. HOST_NOT_FOUND is a gethostbyname(3) error condition rather than a getaddrinfo(3) error condition and cannot be passed to net_gethosterror as documented as it calls gai_strerror(3). EAI_NONAME is the appropriate similar error condition as standardized by POSIX for getaddrinfo(3). --- src/core/network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/network.c b/src/core/network.c index 85fe9896..01ce00b5 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -430,7 +430,7 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) } if (count_v4 == 0 && count_v6 == 0) - return HOST_NOT_FOUND; /* shouldn't happen? */ + return EAI_NONAME; /* shouldn't happen? */ /* if there are multiple addresses, return random one */ use_v4 = count_v4 <= 1 ? 0 : rand() % count_v4; From 32adf7c1dde8368629faa635c34a1b53fb6b0789 Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Mon, 14 Aug 2023 11:53:34 +0200 Subject: [PATCH 079/117] fe-text: remove const for better Darwin support This commit removes the `const` qualifier from certain member fields, as the Darwin version of several `` related functions only accept a `char *` rather than a `const char *`, thereby resulting in dozens of compiler warnings. --- src/fe-text/terminfo-core.c | 4 ++-- src/fe-text/terminfo-core.h | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index fe98efae..48e1de8c 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -38,8 +38,8 @@ int tigetflag(); #define CAP_TYPE_STR 2 typedef struct { - const char *ti_name; /* terminfo name */ - const char *tc_name; /* termcap name */ + char *ti_name; /* terminfo name */ + char *tc_name; /* termcap name */ int type; unsigned int offset; } TERMINFO_REC; diff --git a/src/fe-text/terminfo-core.h b/src/fe-text/terminfo-core.h index ba103de9..cb0e41e2 100644 --- a/src/fe-text/terminfo-core.h +++ b/src/fe-text/terminfo-core.h @@ -57,32 +57,32 @@ struct _TERM_REC { int width, height; /* Cursor movement */ - const char *TI_smcup, *TI_rmcup, *TI_cup; - const char *TI_hpa, *TI_vpa, *TI_cub1, *TI_cuf1; - const char *TI_civis, *TI_cnorm; + char *TI_smcup, *TI_rmcup, *TI_cup; + char *TI_hpa, *TI_vpa, *TI_cub1, *TI_cuf1; + char *TI_civis, *TI_cnorm; /* Scrolling */ - const char *TI_csr, *TI_wind; - const char *TI_ri, *TI_rin, *TI_ind, *TI_indn; - const char *TI_il, *TI_il1, *TI_dl, *TI_dl1; + char *TI_csr, *TI_wind; + char *TI_ri, *TI_rin, *TI_ind, *TI_indn; + char *TI_il, *TI_il1, *TI_dl, *TI_dl1; /* Clearing screen */ - const char *TI_clear, *TI_ed; /* + *TI_dl, *TI_dl1; */ + char *TI_clear, *TI_ed; /* + *TI_dl, *TI_dl1; */ /* Clearing to end of line */ - const char *TI_el; + char *TI_el; /* Repeating character */ - const char *TI_rep; + char *TI_rep; /* Colors */ - int TI_colors; /* numbers of colors in TI_fg[] and TI_bg[] */ - const char *TI_sgr0; /* turn off all attributes */ - const char *TI_smul, *TI_rmul; /* underline on/off */ - const char *TI_smso, *TI_rmso; /* standout on/off */ - const char *TI_sitm, *TI_ritm; /* italic on/off */ - const char *TI_bold, *TI_blink, *TI_rev; - const char *TI_setaf, *TI_setab, *TI_setf, *TI_setb; + int TI_colors; /* numbers of colors in TI_fg[] and TI_bg[] */ + char *TI_sgr0; /* turn off all attributes */ + char *TI_smul, *TI_rmul; /* underline on/off */ + char *TI_smso, *TI_rmso; /* standout on/off */ + char *TI_sitm, *TI_ritm; /* italic on/off */ + char *TI_bold, *TI_blink, *TI_rev; + char *TI_setaf, *TI_setab, *TI_setf, *TI_setb; /* Colors - generated and dynamically allocated */ char **TI_fg, **TI_bg, *TI_normal; @@ -91,8 +91,8 @@ struct _TERM_REC { char *TI_bel; /* Keyboard-transmit mode */ - const char *TI_smkx; - const char *TI_rmkx; + char *TI_smkx; + char *TI_rmkx; /* Terminal mode states */ int appkey_enabled; From b9511a9b7e927db1496fd077e5d4941d034fc6a1 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 27 Apr 2025 12:23:54 +0200 Subject: [PATCH 080/117] update to ubuntu 22.04 in github actions --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 67465f1a..186c2e83 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -61,12 +61,12 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-latest] + os: [ubuntu-22.04, ubuntu-latest] compiler: [clang, gcc] flags: [regular] setuptools_ver: [<66] include: - - os: ubuntu-20.04 + - os: ubuntu-22.04 meson_ver: ==0.53.2 setuptools_ver: <51 - os: ubuntu-latest From 8acda3f9eb704a01b9b97a63d61e09ea9a807ddd Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 14 Apr 2025 18:43:18 +0200 Subject: [PATCH 081/117] make bitfields unsigned --- src/irc/core/irc-servers-setup.h | 2 +- src/irc/core/irc-servers.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/irc/core/irc-servers-setup.h b/src/irc/core/irc-servers-setup.h index 7b11a2fe..ce5f0868 100644 --- a/src/irc/core/irc-servers-setup.h +++ b/src/irc/core/irc-servers-setup.h @@ -25,7 +25,7 @@ typedef struct { int cmd_queue_speed; int max_query_chans; int starttls; - int no_cap : 1; + unsigned int no_cap : 1; } IRC_SERVER_SETUP_REC; void irc_servers_setup_init(void); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 01605b7d..53ff1436 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -43,7 +43,6 @@ #define IS_IRC_SERVER_CONNECT(conn) \ (IRC_SERVER_CONNECT(conn) ? TRUE : FALSE) -/* clang-format off */ /* all strings should be either NULL or dynamically allocated */ /* address and nick are mandatory, rest are optional */ struct _IRC_SERVER_CONNECT_REC { @@ -62,11 +61,10 @@ struct _IRC_SERVER_CONNECT_REC { int max_query_chans; int max_kicks, max_msgs, max_modes, max_whois; - int disallow_starttls:1; - int starttls:1; - int no_cap:1; + unsigned int disallow_starttls : 1; + unsigned int starttls : 1; + unsigned int no_cap : 1; }; -/* clang-format on */ #define STRUCT_SERVER_CONNECT_REC IRC_SERVER_CONNECT_REC struct _IRC_SERVER_REC { From c7c8d074bde99d47c21480f0ba4fdb20e14d4e48 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 27 Apr 2025 12:04:34 +0200 Subject: [PATCH 082/117] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index b5947de6..e514f279 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 55 +#define IRSSI_ABI_VERSION 56 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 From 485758656467777cd67655676547502c2c23cc2c Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 29 Apr 2025 20:52:56 +0200 Subject: [PATCH 083/117] adapt pep440 dev version in make-dist.sh --- utils/make-dist.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/make-dist.sh b/utils/make-dist.sh index 81d450d7..2e26701c 100755 --- a/utils/make-dist.sh +++ b/utils/make-dist.sh @@ -43,6 +43,7 @@ if [ -z "$name" ] || [ -z "$version" ]; then echo "**Error**: ${PKG_NAME} make-dist.sh could not find either name or version, cannot proceed." exit 1 fi +version=$(echo "$version"|perl -p -e 's/-head/.dev0/') git log > ChangeLog From 5c53f2a3293059091215bbbef108fcd597de0191 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 29 Apr 2025 20:59:17 +0200 Subject: [PATCH 084/117] test the void --- .github/workflows/voiddocker.yml | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/voiddocker.yml diff --git a/.github/workflows/voiddocker.yml b/.github/workflows/voiddocker.yml new file mode 100644 index 00000000..6e1b7d28 --- /dev/null +++ b/.github/workflows/voiddocker.yml @@ -0,0 +1,72 @@ +on: + push: + branches: + - master + pull_request: + workflow_dispatch: +name: Check Irssi on Void Linux glibc +jobs: + dist: + runs-on: ubuntu-latest + container: ghcr.io/void-linux/void-glibc:latest + steps: + - name: prepare required software + run: | + xbps-install -Syu + xbps-install -Sy git findutils python3-setuptools tar xz gzip + - uses: actions/checkout@main + - name: make dist + run: | + git config --global --add safe.directory /__w/irssi/irssi + ./utils/make-dist.sh + - uses: actions/upload-artifact@v4 + with: + path: irssi-*.tar.gz + retention-days: 1 + install: + runs-on: ubuntu-latest + container: ghcr.io/void-linux/void-glibc:latest + needs: dist + steps: + - name: prepare required software + run: | + xbps-install -Syu + xbps-install -Sy meson base-devel libglib-devel libutf8proc-devel ncurses-devel ncurses-base openssl-devel libotr-devel libgcrypt-devel tar findutils curl + - name: fetch dist + uses: actions/download-artifact@v4 + - name: Setup local annotations + uses: irssi-import/actions-irssi/problem-matchers@master + - name: Test on Void Linux glibc + run: | + set -ex + tar xzf artifact/irssi-*.tar.gz + # ninja install + cd irssi-*/ + meson Build -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes --prefix=$HOME/irssi-build --buildtype debugoptimized + ninja -C Build + ninja -C Build install + # ninja test + ninja -C Build test + find -name testlog.txt -exec gsed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} + + export TERM=xterm + # automated irssi launch test + cd + mkdir irssi-test + echo 'echo automated irssi launch test + ^set settings_autosave off + ^set -clear log_close_string + ^set -clear log_day_changed + ^set -clear log_open_string + ^set log_timestamp * + ^window log on + load irc + load dcc + load flood + load notifylist + load perl + load otr + load proxy + ^quit' > irssi-test/startup + export LC_CTYPE=C.utf8 + irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl + cat irc.log.* From af4fa60d3e1a04f0685aa804fc3e7908015a05f8 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 29 Apr 2025 22:14:52 +0200 Subject: [PATCH 085/117] s/gsed/sed --- .github/workflows/voiddocker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/voiddocker.yml b/.github/workflows/voiddocker.yml index 6e1b7d28..3ed94ddd 100644 --- a/.github/workflows/voiddocker.yml +++ b/.github/workflows/voiddocker.yml @@ -47,7 +47,7 @@ jobs: ninja -C Build install # ninja test ninja -C Build test - find -name testlog.txt -exec gsed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} + + find -name testlog.txt -exec sed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} + export TERM=xterm # automated irssi launch test cd From 8eea7bef927c14704295f78f0f327d73fd0fcc1b Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 29 Apr 2025 22:19:02 +0200 Subject: [PATCH 086/117] curl render --- .github/workflows/voiddocker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/voiddocker.yml b/.github/workflows/voiddocker.yml index 3ed94ddd..3098b551 100644 --- a/.github/workflows/voiddocker.yml +++ b/.github/workflows/voiddocker.yml @@ -39,6 +39,7 @@ jobs: - name: Test on Void Linux glibc run: | set -ex + curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl tar xzf artifact/irssi-*.tar.gz # ninja install cd irssi-*/ From 9fd6df2a15bf5ddc794b47042fb312d77941ad5a Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 27 Apr 2025 12:09:17 +0200 Subject: [PATCH 087/117] add missing include for wcwidth thread test --- src/perl/perl-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index fe52874a..59ca58fe 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -18,6 +18,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define _GNU_SOURCE +#include + #define NEED_PERL_H #define PERL_NO_GET_CONTEXT #include "module.h" From f12ed4ff5492676015b64ea0d5bd1593018a07cd Mon Sep 17 00:00:00 2001 From: Christian Carey Date: Fri, 2 May 2025 00:02:46 -0400 Subject: [PATCH 088/117] Resolve issue #1513. --- src/fe-text/mainwindows.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index 26b94248..b9f77c0a 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -233,8 +233,10 @@ MAIN_WINDOW_REC *mainwindow_create(int right) if (MAIN_WINDOW_TEXT_HEIGHT(parent) < WINDOW_MIN_SIZE+NEW_WINDOW_SIZE) parent = find_window_with_room(); - if (parent == NULL) + if (parent == NULL) { + g_free(rec); return NULL; /* not enough space */ + } space = parent->height / 2; rec->first_line = parent->first_line; @@ -255,8 +257,10 @@ MAIN_WINDOW_REC *mainwindow_create(int right) if (MAIN_WINDOW_TEXT_WIDTH(parent) < 2 * NEW_WINDOW_WIDTH) { parent = find_window_with_room_right(); } - if (parent == NULL) + if (parent == NULL) { + g_free(rec); return NULL; /* not enough space */ + } space = parent->width / 2; rec->first_line = parent->first_line; From 838f8d179e58edc5c0963f789ad8bd27192a022d Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 13 Jul 2025 19:33:52 +0200 Subject: [PATCH 089/117] fix _GNU_SOURCE redefined warning due to perl ccflags --- src/perl/perl-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 59ca58fe..67fff292 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -18,7 +18,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #define NEED_PERL_H From 7681cb7585ec4e28fc943d5ed2d1c616ac0b5c35 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Sun, 20 Jul 2025 22:40:59 +0200 Subject: [PATCH 090/117] Add -priority to hilight syntax line --- src/fe-common/core/hilight-text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 66e2dfd3..9bcad57a 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -626,7 +626,7 @@ static void cmd_hilight_show(void) } /* SYNTAX: HILIGHT [-nick | -word | -line] [-mask | -full | -matchcase | -regexp] - [-color ] [-actcolor ] [-level ] + [-color ] [-actcolor ] [-level ] [-priority ] [-network ] [-channels ] */ static void cmd_hilight(const char *data) { From 6276fe1a68d3ae2611c9a1280ce0cfb60e2b856d Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 20 Jul 2025 23:03:52 +0200 Subject: [PATCH 091/117] debug logging solarisvm prepare --- .github/workflows/solarisvm.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/solarisvm.yml b/.github/workflows/solarisvm.yml index 0681b0e3..da1ffa17 100644 --- a/.github/workflows/solarisvm.yml +++ b/.github/workflows/solarisvm.yml @@ -63,11 +63,11 @@ jobs: sync: rsync release: "11.4-gcc" prepare: | - pkg update --accept - pkg install meson - pkgutil -y -i curl - pkgutil -y -i gtar - pkgutil -y -i findutils + pkg update --accept || echo 1:$? + pkg install meson || echo 2:$? + pkgutil -y -i curl || echo 3:$? + pkgutil -y -i gtar || echo 4:$? + pkgutil -y -i findutils || echo 5:$? run: | set -ex export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig From 9f0b2bc50d4434fec29ff274e3a060a8fb77b778 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Mon, 21 Jul 2025 00:23:01 +0200 Subject: [PATCH 092/117] detect third argument type of puts --- meson.build | 31 ++++++++++++++++++++++++------- src/fe-text/term-terminfo.c | 7 ++++++- src/fe-text/terminfo-core.c | 7 ++++++- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 866bfd27..f2550641 100644 --- a/meson.build +++ b/meson.build @@ -570,23 +570,40 @@ foreach h : headers endforeach if want_textui and conf.get('HAVE_TERM_H', 0) == 1 - if not cc.links(''' + if cc.links(''' #include #include -int main () { +int main (void) { return tputs("x", 1, putchar); } -''', dependencies : textui_dep) - if cc.has_header('curses.h') and cc.links(''' +''', 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(''' #include #include -int main () { +int main (void) { return tputs("x", 1, putchar); } -''', dependencies : textui_dep, name : 'working Curses') +''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working with curses.h') conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h') else - error('could not link terminfo') + if has_curses_h and cc.links(''' +#include +#include +int char_putchar (char c) { + return putchar(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)') + else + error('could not link terminfo') + endif endif endif endif diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index d4db942a..9bcdd5a0 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -318,7 +318,12 @@ void term_window_scroll(TERM_WINDOW *window, int count) term_lines_empty[window->y+y] = FALSE; } -inline static int term_putchar(int c) +#ifdef TPUTS_SVR4 +#define putc_arg_t char +#else +#define putc_arg_t int +#endif +inline static int term_putchar(putc_arg_t c) { return fputc(c, current_term->out); } diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index 48e1de8c..6e904c9e 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -6,8 +6,13 @@ # define _POSIX_VDISABLE 0 #endif +#ifdef TPUTS_SVR4 +#define putc_arg_t char +#else +#define putc_arg_t int +#endif #define tput(s) tputs(s, 0, term_putchar) -inline static int term_putchar(int c) +inline static int term_putchar(putc_arg_t c) { return fputc(c, current_term->out); } From 8eee36d1eaa025e62eadf94e8c4ee25d95b9cf03 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 22 Jul 2025 11:40:04 +0200 Subject: [PATCH 093/117] replace str->str & g_string_free with g_string_free_and_steal solving unused warning in GLib 2.76 --- src/core/levels.c | 4 ++-- src/core/misc.c | 15 +++++++++++---- src/core/misc.h | 6 ++++++ src/core/servers.c | 3 +-- src/core/special-vars.c | 9 +++------ src/fe-common/core/completion.c | 6 ++---- src/fe-common/core/fe-log.c | 3 +-- src/fe-common/core/fe-messages.c | 8 +++----- src/fe-common/core/formats.c | 12 ++++-------- src/fe-common/core/hilight-text.c | 3 +-- src/fe-common/core/printtext.c | 7 +++---- src/fe-common/core/themes.c | 28 ++++++++++++---------------- src/fe-text/terminfo-core.c | 4 ++-- src/irc/core/bans.c | 5 ++--- src/irc/core/irc-servers.c | 3 +-- src/irc/core/modes.c | 7 +++---- src/irc/dcc/dcc-get.c | 6 ++---- src/lib-config/write.c | 12 ++++++++++-- src/perl/perl-common.c | 5 ++--- src/perl/perl-core.c | 5 ++--- 20 files changed, 73 insertions(+), 78 deletions(-) diff --git a/src/core/levels.c b/src/core/levels.c index d4dafba2..0cd99b10 100644 --- a/src/core/levels.c +++ b/src/core/levels.c @@ -19,6 +19,7 @@ */ #include "module.h" +#include #include /* the order of these levels must match the bits in levels.h */ @@ -169,8 +170,7 @@ char *bits2level(int bits) if (str->len > 0) g_string_truncate(str, str->len-1); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } diff --git a/src/core/misc.c b/src/core/misc.c index f0bbf4e0..9ee549a1 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -135,6 +135,15 @@ GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *defaul } #endif +#if GLIB_CHECK_VERSION(2, 76, 0) +/* nothing */ +#else +gchar *g_string_free_and_steal(GString *string) +{ + return g_string_free(string, FALSE); +} +#endif + int find_substr(const char *list, const char *item) { const char *ptr; @@ -261,8 +270,7 @@ char *gslistptr_to_string(GSList *list, int offset, const char *delimiter) list = list->next; } - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } @@ -280,8 +288,7 @@ char *i_slist_to_string(GSList *list, const char *delimiter) list = list->next; } - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } diff --git a/src/core/misc.h b/src/core/misc.h index 622470f7..c7355fc0 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -26,6 +26,12 @@ long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATE GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz); #endif +#if GLIB_CHECK_VERSION(2, 76, 0) +/* nothing */ +#else +gchar *g_string_free_and_steal(GString *string); +#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/core/servers.c b/src/core/servers.c index 0ea8f937..811081e8 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -134,8 +134,7 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn) } g_free(tag); - tag = str->str; - g_string_free(str, FALSE); + tag = g_string_free(str, FALSE); return tag; } diff --git a/src/core/special-vars.c b/src/core/special-vars.c index 802fcb36..8c890645 100644 --- a/src/core/special-vars.c +++ b/src/core/special-vars.c @@ -88,8 +88,7 @@ static char *get_argument(char **cmd, char **arglist) } if (str->len > 0) g_string_truncate(str, str->len-1); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } @@ -412,8 +411,7 @@ char *get_alignment(const char *text, int align, int flags, char pad) } } - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } @@ -604,8 +602,7 @@ char *parse_special_string(const char *cmd, SERVER_REC *server, void *item, } g_strfreev(arglist); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c index e2c4d2a9..852eabff 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -111,8 +111,7 @@ char *auto_word_complete(const char *line, int *pos) *pos = startpos+strlen(replace); g_string_insert(result, startpos, replace); - ret = result->str; - g_string_free(result, FALSE); + ret = g_string_free_and_steal(result); } g_free(word); @@ -290,8 +289,7 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i g_free_not_null(last_line); last_line = g_strdup(result->str); - ret = result->str; - g_string_free(result, FALSE); + ret = g_string_free_and_steal(result); /* free the data */ g_free(data); diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index f0f055f6..0d29d6c3 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -214,8 +214,7 @@ static char *log_items_get_list(LOG_REC *log) if(rec->servertag != NULL) g_string_append_printf(str, " (%s)", rec->servertag); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index 355d4fd4..c6e9a838 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -133,8 +133,7 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text) } } - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } @@ -730,9 +729,8 @@ static void sig_nicklist_new(CHANNEL_REC *channel, NICK_REC *nick) n++; } while (printnick_exists(firstnick, nick, newnick->str)); - g_hash_table_insert(printnicks, nick, newnick->str); - g_string_free(newnick, FALSE); - g_free(nickhost); + g_hash_table_insert(printnicks, nick, g_string_free_and_steal(newnick)); + g_free(nickhost); } static void sig_nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick) diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index 33f80e14..f7614b6f 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -616,8 +616,7 @@ char *format_string_expand(const char *text, int *flags) text++; } - ret = out->str; - g_string_free(out, FALSE); + ret = g_string_free_and_steal(out); return ret; } @@ -792,8 +791,7 @@ static char *format_get_text_args(TEXT_DEST_REC *dest, text++; } - ret = out->str; - g_string_free(out, FALSE); + ret = g_string_free_and_steal(out); return ret; } @@ -888,8 +886,7 @@ char *format_add_linestart(const char *text, const char *linestart) text++; } - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } @@ -913,8 +910,7 @@ char *format_add_lineend(const char *text, const char *linestart) } g_string_append(str, linestart); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 9bcad57a..2412a1f8 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -469,8 +469,7 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text, } g_string_append(str, text + pos); - newstr = str->str; - g_string_free(str, FALSE); + newstr = g_string_free_and_steal(str); format_dest_meta_stash(dest, "hilight-start", tmp = g_strdup_printf("%d", hilight_start)); diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 18652689..9de8d740 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -240,8 +241,7 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str, } } - ret = out->str; - g_string_free(out, FALSE); + ret = g_string_free_and_steal(out); return ret; } @@ -270,8 +270,7 @@ static char *printtext_expand_formats(const char *str, int *flags) } } - ret = out->str; - g_string_free(out, FALSE); + ret = g_string_free_and_steal(out); return ret; } diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index 04f00477..58d17b8e 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -395,9 +395,8 @@ char *theme_format_expand_get(THEME_REC *theme, const char **format) (*format)++; } - ret = str->str; - g_string_free(str, FALSE); - return ret; + ret = g_string_free_and_steal(str); + return ret; } static char *theme_format_expand_data_rec(THEME_REC *theme, const char **format, @@ -496,8 +495,7 @@ static char *theme_format_expand_abstract(THEME_REC *theme, const char **formatp p++; } g_free(ret); - abstract = str->str; - g_string_free(str, FALSE); + abstract = g_string_free_and_steal(str); /* abstract may itself contain abstracts or replaces */ p = abstract; @@ -568,15 +566,14 @@ static char *theme_format_expand_data_rec(THEME_REC *theme, const char **format, } } - /* save the last color */ - if (save_last_fg != NULL) - *save_last_fg = last_fg; - if (save_last_bg != NULL) - *save_last_bg = last_bg; + /* save the last color */ + if (save_last_fg != NULL) + *save_last_fg = last_fg; + if (save_last_bg != NULL) + *save_last_bg = last_bg; - ret = str->str; - g_string_free(str, FALSE); - return ret; + ret = g_string_free_and_steal(str); + return ret; } /* expand the data part in {abstract data} */ @@ -645,9 +642,8 @@ static char *theme_format_compress_colors(THEME_REC *theme, const char *format) } } - ret = str->str; - g_string_free(str, FALSE); - return ret; + ret = g_string_free_and_steal(str); + return ret; } char *theme_format_expand(THEME_REC *theme, const char *format) diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index 6e904c9e..0aa329f4 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -1,5 +1,6 @@ #include "module.h" #include +#include #include #ifndef _POSIX_VDISABLE @@ -678,8 +679,7 @@ static int term_setup(TERM_REC *term) if (term->TI_ritm && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0)) g_string_append(str, term->TI_ritm); - term->TI_normal = str->str; - g_string_free(str, FALSE); + term->TI_normal = g_string_free_and_steal(str); term->tr_set_normal = _set_normal; term->tr_beep = term->TI_bel ? _beep : _ignore; diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c index 8a43d398..5281ac95 100644 --- a/src/irc/core/bans.c +++ b/src/irc/core/bans.c @@ -106,9 +106,8 @@ char *ban_get_masks(IRC_CHANNEL_REC *channel, const char *nicks, int ban_type) if (str->len > 0) g_string_truncate(str, str->len-1); - ret = str->str; - g_string_free(str, FALSE); - return ret; + ret = g_string_free_and_steal(str); + return ret; } void ban_set(IRC_CHANNEL_REC *channel, const char *bans, int ban_type) diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index e3fe3143..7e8fdb5a 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -874,8 +874,7 @@ char *irc_server_get_channels(IRC_SERVER_REC *server, int rejoin_channels_mode) if (use_keys) g_string_append_printf(chans, " %s", keys->str); } - ret = chans->str; - g_string_free(chans, FALSE); + ret = g_string_free_and_steal(chans); g_string_free(keys, TRUE); return ret; diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index b0de2f18..ff37a1e1 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -21,6 +21,7 @@ #include "module.h" #include #include +#include #include #include @@ -443,8 +444,7 @@ char *modes_join(IRC_SERVER_REC *server, const char *old, } g_free(dup); - modestr = newmode->str; - g_string_free(newmode, FALSE); + modestr = g_string_free_and_steal(newmode); return modestr; } @@ -755,8 +755,7 @@ static char *get_nicks(IRC_SERVER_REC *server, WI_ITEM_REC *item, } if (str->len > 0) g_string_truncate(str, str->len-1); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); g_strfreev(matches); cmd_params_free(free_arg); diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 0214387b..cc1c9e43 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -88,8 +88,7 @@ static char *dcc_get_rename_file(const char *fname) num++; } while (stat(newname->str, &statbuf) == 0); - ret = newname->str; - g_string_free(newname, FALSE); + ret = g_string_free_and_steal(newname); return ret; } @@ -416,8 +415,7 @@ char *get_file_name(char **params, int fileparams) out = g_string_append(out, params[pos]); } - ret = out->str; - g_string_free(out, FALSE); + ret = g_string_free_and_steal(out); return ret; } diff --git a/src/lib-config/write.c b/src/lib-config/write.c index b7c6edb5..168b4e40 100644 --- a/src/lib-config/write.c +++ b/src/lib-config/write.c @@ -26,6 +26,15 @@ #define CONFIG_INDENT_SIZE 2 static const char *indent_block = " "; /* needs to be the same size as CONFIG_INDENT_SIZE! */ +#if GLIB_CHECK_VERSION(2, 76, 0) +/* nothing */ +#else +static gchar *g_string_free_and_steal(GString *string) +{ + return g_string_free(string, FALSE); +} +#endif + /* write needed amount of indentation to the start of the line */ static int config_write_indent(CONFIG_REC *rec) { @@ -108,8 +117,7 @@ static char *config_escape_string(const char *text) g_string_append_c(str, '"'); - ret = str->str; - g_string_free(str, FALSE); + ret = g_string_free_and_steal(str); return ret; } diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index c54ee643..58b56bb8 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -239,9 +239,8 @@ char *perl_get_use_list(void) for (tmp = use_protocols; tmp != NULL; tmp = tmp->next) g_string_append_printf(str, "use Irssi::%s;", (char *) tmp->data); - ret = str->str; - g_string_free(str, FALSE); - return ret; + ret = g_string_free_and_steal(str); + return ret; } void irssi_callXS(void (*subaddr)(pTHX_ CV* cv), CV *cv, SV **mark) diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 67fff292..fe2d2f62 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -202,9 +202,8 @@ static char *script_data_get_name(void) n++; } while (perl_script_find(name->str) != NULL); - ret = name->str; - g_string_free(name, FALSE); - return ret; + ret = g_string_free_and_steal(name); + return ret; } static int perl_script_eval(PERL_SCRIPT_REC *script) From d21ff2e6589341c9c514d05893483a69914fc980 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 25 Jul 2025 16:22:00 +0200 Subject: [PATCH 094/117] fix xbps --- .github/workflows/voiddocker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/voiddocker.yml b/.github/workflows/voiddocker.yml index 3098b551..9dc2addf 100644 --- a/.github/workflows/voiddocker.yml +++ b/.github/workflows/voiddocker.yml @@ -12,6 +12,7 @@ jobs: steps: - name: prepare required software run: | + xbps-install -Syu xbps || : xbps-install -Syu xbps-install -Sy git findutils python3-setuptools tar xz gzip - uses: actions/checkout@main @@ -30,6 +31,7 @@ jobs: steps: - name: prepare required software run: | + xbps-install -Syu xbps || : xbps-install -Syu xbps-install -Sy meson base-devel libglib-devel libutf8proc-devel ncurses-devel ncurses-base openssl-devel libotr-devel libgcrypt-devel tar findutils curl - name: fetch dist From df8aa427789050c3036d66bf6cce761d2968fdae Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 25 Jul 2025 16:15:05 +0100 Subject: [PATCH 095/117] make compilation work on cygwin --- meson.build | 5 +++++ src/core/modules-load.c | 2 +- src/fe-common/irc/dcc/meson.build | 2 +- src/fe-common/irc/meson.build | 2 +- src/fe-common/irc/notifylist/meson.build | 2 +- src/fe-common/meson.build | 6 ++---- src/fe-none/meson.build | 6 +++++- src/fe-text/meson.build | 6 +++++- src/irc/core/meson.build | 3 ++- src/irc/dcc/meson.build | 2 +- src/irc/flood/meson.build | 2 +- src/irc/notifylist/meson.build | 2 +- src/meson.build | 21 +++++++++++---------- src/perl/common/meson.build | 2 +- src/perl/irc/meson.build | 2 +- src/perl/meson.build | 3 ++- src/perl/textui/meson.build | 2 +- src/perl/ui/meson.build | 2 +- 18 files changed, 43 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index f2550641..9499a126 100644 --- a/meson.build +++ b/meson.build @@ -13,10 +13,15 @@ rootinc = include_directories('.') dep = [] textui_dep = [] need_dl_cross_link = false +need_dl_cross_link_main = false +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' need_dl_cross_link = true +elif host_machine.system() == 'cygwin' + need_dl_cross_link = true + need_dl_cross_link_main = true endif includedir = get_option('includedir') diff --git a/src/core/modules-load.c b/src/core/modules-load.c index 11c4dd6b..f4278897 100644 --- a/src/core/modules-load.c +++ b/src/core/modules-load.c @@ -42,7 +42,7 @@ static char *module_get_name(const char *path, int *start, int *end) if (name == NULL) name = path; - if (strncmp(name, "lib", 3) == 0) + if (strncmp(name, "lib", 3) == 0 || strncmp(name, "cyg", 3) == 0) name += 3; module_name = g_strdup(name); diff --git a/src/fe-common/irc/dcc/meson.build b/src/fe-common/irc/dcc/meson.build index 487d1aea..f380fb10 100644 --- a/src/fe-common/irc/dcc/meson.build +++ b/src/fe-common/irc/dcc/meson.build @@ -21,7 +21,7 @@ shared_module('fe_irc_dcc', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_with : dl_cross_irc_dcc, + link_with : dl_cross_irc_dcc + dl_cross_irc_core + dl_cross_irssi_main, link_whole : libfe_irc_dcc_a) install_headers( diff --git a/src/fe-common/irc/meson.build b/src/fe-common/irc/meson.build index 9b198e24..decce520 100644 --- a/src/fe-common/irc/meson.build +++ b/src/fe-common/irc/meson.build @@ -32,7 +32,7 @@ shared_module('fe_common_irc', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_with : dl_cross_irc_core, + link_with : dl_cross_irc_core + dl_cross_irssi_main, link_whole : libfe_common_irc_a) install_headers( diff --git a/src/fe-common/irc/notifylist/meson.build b/src/fe-common/irc/notifylist/meson.build index 0f9c4d68..fd28306b 100644 --- a/src/fe-common/irc/notifylist/meson.build +++ b/src/fe-common/irc/notifylist/meson.build @@ -16,7 +16,7 @@ shared_module('fe_irc_notifylist', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_with : dl_cross_irc_notifylist, + link_with : dl_cross_irc_notifylist + dl_cross_irssi_main, link_whole : libfe_irc_notifylist_a) install_headers( diff --git a/src/fe-common/meson.build b/src/fe-common/meson.build index 05ab38a1..91a46324 100644 --- a/src/fe-common/meson.build +++ b/src/fe-common/meson.build @@ -1,6 +1,4 @@ # this file is part of irssi -subdir('core') -foreach s : chat_modules - subdir(s) -endforeach +# intentionally empty + diff --git a/src/fe-none/meson.build b/src/fe-none/meson.build index 8f6b797d..49cfe517 100644 --- a/src/fe-none/meson.build +++ b/src/fe-none/meson.build @@ -1,12 +1,13 @@ # this file is part of irssi -executable('botti', +fe_none_irssi = executable('botti', files( 'irssi.c', ), include_directories : rootinc, implicit_include_directories : false, export_dynamic : true, + implib : true, link_with : [ libconfig_a, libcore_a, @@ -14,6 +15,9 @@ executable('botti', install : true, dependencies : dep ) +if need_dl_cross_link_main + dl_cross_irssi_main = [ fe_none_irssi ] +endif # noinst_headers = files( # 'module.h', diff --git a/src/fe-text/meson.build b/src/fe-text/meson.build index 94990c82..1c885b89 100644 --- a/src/fe-text/meson.build +++ b/src/fe-text/meson.build @@ -1,6 +1,6 @@ # this file is part of irssi -executable('irssi', +fe_text_irssi = executable('irssi', files( #### terminfo_sources #### 'term-terminfo.c', @@ -35,6 +35,7 @@ executable('irssi', include_directories : rootinc, implicit_include_directories : false, export_dynamic : true, + implib : true, link_with : [ libconfig_a, libcore_a, @@ -44,6 +45,9 @@ executable('irssi', dependencies : dep + textui_dep ) +if need_dl_cross_link_main + dl_cross_irssi_main = [ fe_text_irssi ] +endif install_headers( files( diff --git a/src/irc/core/meson.build b/src/irc/core/meson.build index a63ff214..40ef1cdd 100644 --- a/src/irc/core/meson.build +++ b/src/irc/core/meson.build @@ -43,7 +43,8 @@ libirc_core_sm = shared_module('irc_core', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_whole : libirc_core_a) + link_whole : libirc_core_a, + link_with : dl_cross_irssi_main) dl_cross_irc_core = [] if need_dl_cross_link diff --git a/src/irc/dcc/meson.build b/src/irc/dcc/meson.build index e5e2b0c6..cf5b1365 100644 --- a/src/irc/dcc/meson.build +++ b/src/irc/dcc/meson.build @@ -16,7 +16,7 @@ libirc_dcc_sm = shared_module('irc_dcc', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_with : dl_cross_irc_core, + link_with : dl_cross_irc_core + dl_cross_irssi_main, dependencies : dep) dl_cross_irc_dcc = [] diff --git a/src/irc/flood/meson.build b/src/irc/flood/meson.build index 0ba94282..02ad222b 100644 --- a/src/irc/flood/meson.build +++ b/src/irc/flood/meson.build @@ -12,7 +12,7 @@ shared_module('irc_flood', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_with : dl_cross_irc_core, + link_with : dl_cross_irc_core + dl_cross_irssi_main, link_whole : libirc_flood_a) install_headers( diff --git a/src/irc/notifylist/meson.build b/src/irc/notifylist/meson.build index 212d68e5..1bf9dd98 100644 --- a/src/irc/notifylist/meson.build +++ b/src/irc/notifylist/meson.build @@ -13,7 +13,7 @@ libirc_notifylist_sm = shared_module('irc_notifylist', name_suffix : module_suffix, install : true, install_dir : moduledir, - link_with : dl_cross_irc_core, + link_with : dl_cross_irc_core + dl_cross_irssi_main, dependencies : dep) dl_cross_irc_notifylist = [] diff --git a/src/meson.build b/src/meson.build index dee8dc3c..cc30da1b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,22 +2,23 @@ subdir('lib-config') subdir('core') -foreach s : chat_modules - subdir(s) -endforeach -subdir('fe-common') -if have_perl - subdir('perl') -endif -if have_otr - subdir('otr') -endif +subdir('fe-common' / 'core') if want_bot subdir('fe-none') endif if want_textui subdir('fe-text') endif +foreach s : chat_modules + subdir(s) + subdir('fe-common' / s) +endforeach +if have_perl + subdir('perl') +endif +if have_otr + subdir('otr') +endif if want_fuzzer subdir('fe-fuzz') endif diff --git a/src/perl/common/meson.build b/src/perl/common/meson.build index 5b174399..ae408a7e 100644 --- a/src/perl/common/meson.build +++ b/src/perl/common/meson.build @@ -26,7 +26,7 @@ shared_module('Irssi', include_directories : rootinc, implicit_include_directories : true, dependencies : dep + [ perl_dep ], - link_with : dl_cross_perl_core, + link_with : dl_cross_perl_core + dl_cross_irssi_main, ) install_headers( diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build index a95fd778..7b366aa8 100644 --- a/src/perl/irc/meson.build +++ b/src/perl/irc/meson.build @@ -27,7 +27,7 @@ shared_module('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, + link_with : dl_cross_perl_core + dl_cross_irc_dcc + dl_cross_irc_notifylist + dl_cross_irc_core + dl_cross_irssi_main, ) install_headers( diff --git a/src/perl/meson.build b/src/perl/meson.build index f859c7c4..09d4f8a6 100644 --- a/src/perl/meson.build +++ b/src/perl/meson.build @@ -40,6 +40,7 @@ libperl_core_sm = shared_module('perl_core', build_rpath : perl_rpath, dependencies : dep_cflagsonly + [ perl_dep ] + dl_cross_dep, override_options : ['b_asneeded=false'], + link_with : dl_cross_irssi_main, ) dl_cross_perl_core = [] @@ -61,7 +62,7 @@ shared_module('fe_perl', install : true, install_dir : moduledir, dependencies : dep, - link_with : dl_cross_perl_core, + link_with : dl_cross_perl_core + dl_cross_irssi_main, ) subdir('common') diff --git a/src/perl/textui/meson.build b/src/perl/textui/meson.build index 23c8d458..5b2ed136 100644 --- a/src/perl/textui/meson.build +++ b/src/perl/textui/meson.build @@ -23,7 +23,7 @@ shared_module('TextUI', include_directories : rootinc, implicit_include_directories : true, dependencies : dep + [ perl_dep ], - link_with : dl_cross_perl_core, + link_with : dl_cross_perl_core + dl_cross_irssi_main, ) install_headers( diff --git a/src/perl/ui/meson.build b/src/perl/ui/meson.build index 1577dcf6..e74d0898 100644 --- a/src/perl/ui/meson.build +++ b/src/perl/ui/meson.build @@ -21,7 +21,7 @@ shared_module('UI', include_directories : rootinc, implicit_include_directories : true, dependencies : dep + [ perl_dep ], - link_with : dl_cross_perl_core, + link_with : dl_cross_perl_core + dl_cross_irssi_main, ) install_headers( From 989ddd8429173a3b5fa7feda1c09f4b717af3d79 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 25 Jul 2025 19:49:53 +0200 Subject: [PATCH 096/117] replace shared_module with shared_library according to mesonbuild irc chat --- src/fe-common/irc/dcc/meson.build | 5 +++-- src/fe-common/irc/meson.build | 5 +++-- src/fe-common/irc/notifylist/meson.build | 5 +++-- src/irc/core/meson.build | 5 +++-- src/irc/dcc/meson.build | 5 +++-- src/irc/flood/meson.build | 5 +++-- src/irc/notifylist/meson.build | 5 +++-- src/irc/proxy/meson.build | 3 ++- src/otr/meson.build | 3 ++- src/perl/common/meson.build | 3 ++- src/perl/irc/meson.build | 3 ++- src/perl/meson.build | 7 ++++--- src/perl/textui/meson.build | 3 ++- src/perl/ui/meson.build | 3 ++- 14 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/fe-common/irc/dcc/meson.build b/src/fe-common/irc/dcc/meson.build index f380fb10..5edf2477 100644 --- a/src/fe-common/irc/dcc/meson.build +++ b/src/fe-common/irc/dcc/meson.build @@ -17,12 +17,13 @@ libfe_irc_dcc_a = static_library('fe_irc_dcc', def_sysconfdir, ], dependencies : dep) -shared_module('fe_irc_dcc', +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) + link_whole : libfe_irc_dcc_a, + override_options : ['b_lundef=false']) install_headers( files( diff --git a/src/fe-common/irc/meson.build b/src/fe-common/irc/meson.build index decce520..518dfbfa 100644 --- a/src/fe-common/irc/meson.build +++ b/src/fe-common/irc/meson.build @@ -28,12 +28,13 @@ libfe_common_irc_a = static_library('fe_common_irc', def_themesdir, ], dependencies : dep) -shared_module('fe_common_irc', +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) + link_whole : libfe_common_irc_a, + override_options : ['b_lundef=false']) install_headers( files( diff --git a/src/fe-common/irc/notifylist/meson.build b/src/fe-common/irc/notifylist/meson.build index fd28306b..cdb5168b 100644 --- a/src/fe-common/irc/notifylist/meson.build +++ b/src/fe-common/irc/notifylist/meson.build @@ -12,12 +12,13 @@ libfe_irc_notifylist_a = static_library('fe_irc_notifylist', def_sysconfdir, ], dependencies : dep) -shared_module('fe_irc_notifylist', +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) + link_whole : libfe_irc_notifylist_a, + override_options : ['b_lundef=false']) install_headers( files( diff --git a/src/irc/core/meson.build b/src/irc/core/meson.build index 40ef1cdd..94ed20a2 100644 --- a/src/irc/core/meson.build +++ b/src/irc/core/meson.build @@ -39,12 +39,13 @@ libirc_core_a = static_library('irc_core', def_sysconfdir, ], dependencies : dep) -libirc_core_sm = shared_module('irc_core', +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) + link_with : dl_cross_irssi_main, + override_options : ['b_lundef=false']) dl_cross_irc_core = [] if need_dl_cross_link diff --git a/src/irc/dcc/meson.build b/src/irc/dcc/meson.build index cf5b1365..3ab1bace 100644 --- a/src/irc/dcc/meson.build +++ b/src/irc/dcc/meson.build @@ -1,6 +1,6 @@ # this file is part of irssi -libirc_dcc_sm = shared_module('irc_dcc', +libirc_dcc_sm = shared_library('irc_dcc', files( 'dcc-autoget.c', 'dcc-chat.c', @@ -17,7 +17,8 @@ libirc_dcc_sm = shared_module('irc_dcc', install : true, install_dir : moduledir, link_with : dl_cross_irc_core + dl_cross_irssi_main, - dependencies : dep) + dependencies : dep, + override_options : ['b_lundef=false']) dl_cross_irc_dcc = [] if need_dl_cross_link diff --git a/src/irc/flood/meson.build b/src/irc/flood/meson.build index 02ad222b..257e5c11 100644 --- a/src/irc/flood/meson.build +++ b/src/irc/flood/meson.build @@ -8,12 +8,13 @@ libirc_flood_a = static_library('irc_flood', include_directories : rootinc, implicit_include_directories : false, dependencies : dep) -shared_module('irc_flood', +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) + link_whole : libirc_flood_a, + override_options : ['b_lundef=false']) install_headers( files('module.h'), diff --git a/src/irc/notifylist/meson.build b/src/irc/notifylist/meson.build index 1bf9dd98..34517b34 100644 --- a/src/irc/notifylist/meson.build +++ b/src/irc/notifylist/meson.build @@ -1,6 +1,6 @@ # this file is part of irssi -libirc_notifylist_sm = shared_module('irc_notifylist', +libirc_notifylist_sm = shared_library('irc_notifylist', files( 'notify-commands.c', 'notify-ison.c', @@ -14,7 +14,8 @@ libirc_notifylist_sm = shared_module('irc_notifylist', install : true, install_dir : moduledir, link_with : dl_cross_irc_core + dl_cross_irssi_main, - dependencies : dep) + dependencies : dep, + override_options : ['b_lundef=false']) dl_cross_irc_notifylist = [] if need_dl_cross_link diff --git a/src/irc/proxy/meson.build b/src/irc/proxy/meson.build index 30ac90a4..4cc2b658 100644 --- a/src/irc/proxy/meson.build +++ b/src/irc/proxy/meson.build @@ -1,6 +1,6 @@ # this file is part of irssi -shared_module('irc_proxy', +shared_library('irc_proxy', files( 'dump.c', 'listen.c', @@ -13,6 +13,7 @@ shared_module('irc_proxy', install : true, install_dir : moduledir, dependencies : dep, + override_options : ['b_lundef=false'], ) # noinst_headers = files( diff --git a/src/otr/meson.build b/src/otr/meson.build index 5b7d256f..13b564ea 100644 --- a/src/otr/meson.build +++ b/src/otr/meson.build @@ -1,6 +1,6 @@ # this file is part of irssi -shared_module('otr_core', +shared_library('otr_core', files( 'key.c', 'otr-fe.c', @@ -15,6 +15,7 @@ shared_module('otr_core', install : true, install_dir : moduledir, dependencies : dep, + override_options : ['b_lundef=false'], ) # noinst_headers = files( diff --git a/src/perl/common/meson.build b/src/perl/common/meson.build index ae408a7e..0f3f3bb5 100644 --- a/src/perl/common/meson.build +++ b/src/perl/common/meson.build @@ -1,5 +1,5 @@ -shared_module('Irssi', +shared_library('Irssi', [ xsubpp.process( files( 'Channel.xs', @@ -27,6 +27,7 @@ shared_module('Irssi', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irssi_main, + override_options : ['b_lundef=false'], ) install_headers( diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build index 7b366aa8..e033c260 100644 --- a/src/perl/irc/meson.build +++ b/src/perl/irc/meson.build @@ -1,4 +1,4 @@ -shared_module('Irc', +shared_library('Irc', [ xsubpp.process( files( 'Channel.xs', @@ -28,6 +28,7 @@ shared_module('Irc', 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, + override_options : ['b_lundef=false'], ) install_headers( diff --git a/src/perl/meson.build b/src/perl/meson.build index 09d4f8a6..1c6e2fbc 100644 --- a/src/perl/meson.build +++ b/src/perl/meson.build @@ -17,7 +17,7 @@ irssi_core_pl_h = custom_target('irssi-core.pl.h', # required as of Meson 0.58.0 generated_files_inc = include_directories('.') -libperl_core_sm = shared_module('perl_core', +libperl_core_sm = shared_library('perl_core', files( 'perl-common.c', 'perl-core.c', @@ -39,7 +39,7 @@ libperl_core_sm = shared_module('perl_core', install_rpath : perl_rpath, build_rpath : perl_rpath, dependencies : dep_cflagsonly + [ perl_dep ] + dl_cross_dep, - override_options : ['b_asneeded=false'], + override_options : ['b_asneeded=false', 'b_lundef=false'], link_with : dl_cross_irssi_main, ) @@ -48,7 +48,7 @@ if need_dl_cross_link dl_cross_perl_core += libperl_core_sm endif -shared_module('fe_perl', +shared_library('fe_perl', files( 'module-formats.c', 'perl-fe.c', @@ -63,6 +63,7 @@ shared_module('fe_perl', install_dir : moduledir, dependencies : dep, link_with : dl_cross_perl_core + dl_cross_irssi_main, + override_options : ['b_lundef=false'], ) subdir('common') diff --git a/src/perl/textui/meson.build b/src/perl/textui/meson.build index 5b2ed136..b7d769c5 100644 --- a/src/perl/textui/meson.build +++ b/src/perl/textui/meson.build @@ -1,4 +1,4 @@ -shared_module('TextUI', +shared_library('TextUI', [ xsubpp.process( files( 'Statusbar.xs', @@ -24,6 +24,7 @@ shared_module('TextUI', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irssi_main, + override_options : ['b_lundef=false'], ) install_headers( diff --git a/src/perl/ui/meson.build b/src/perl/ui/meson.build index e74d0898..a6e5c93c 100644 --- a/src/perl/ui/meson.build +++ b/src/perl/ui/meson.build @@ -1,4 +1,4 @@ -shared_module('UI', +shared_library('UI', [ xsubpp.process( files( 'Formats.xs', @@ -22,6 +22,7 @@ shared_module('UI', implicit_include_directories : true, dependencies : dep + [ perl_dep ], link_with : dl_cross_perl_core + dl_cross_irssi_main, + override_options : ['b_lundef=false'], ) install_headers( From f293277765706a1470c46b4c1ee3bf5046f73114 Mon Sep 17 00:00:00 2001 From: arza Date: Tue, 23 Sep 2025 00:01:54 +0300 Subject: [PATCH 097/117] Increase default scrollback_lines It seems common that people miss important messages when being away and want to increase the scrollback. --- src/fe-text/gui-printtext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index 2091b5a3..7482d470 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -405,7 +405,7 @@ void gui_printtext_init(void) indent_functions = g_hash_table_new((GHashFunc) g_str_hash, (GCompareFunc) g_str_equal); - settings_add_int("history", "scrollback_lines", 500); + settings_add_int("history", "scrollback_lines", 5000); settings_add_time("history", "scrollback_time", "1day"); settings_add_time("history", "scrollback_max_age", "0"); settings_add_int("history", "scrollback_burst_remove", 10); From 3316202c489074b2d08c457397a6209484f4aafe Mon Sep 17 00:00:00 2001 From: Juha Remes Date: Sat, 22 Nov 2025 14:27:53 +0000 Subject: [PATCH 098/117] Typo fix in docs/help/in/lusers.in --- docs/help/in/lusers.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/help/in/lusers.in b/docs/help/in/lusers.in index f9edf535..99089fb7 100644 --- a/docs/help/in/lusers.in +++ b/docs/help/in/lusers.in @@ -5,7 +5,7 @@ %9Parameters:%9 - The server to search on and the remote sever to search on; if no arguments + The server to search on and the remote server to search on; if no arguments are given, the active server will be used. %9Description:%9 From 5416843d2d8a8292abfd9ab28a9b9f9b9b604d49 Mon Sep 17 00:00:00 2001 From: soulseller Date: Sat, 22 Nov 2025 22:30:38 +0200 Subject: [PATCH 099/117] fe-netsplit: fix nickname truncation to avoid trailing comma-space --- src/fe-common/irc/fe-netsplit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c index b76d4ce7..990c4fe2 100644 --- a/src/fe-common/irc/fe-netsplit.c +++ b/src/fe-common/irc/fe-netsplit.c @@ -137,7 +137,7 @@ static void get_server_splits(void *key, NETSPLIT_REC *split, g_string_append_printf(chanrec->nicks, "%s, ", split->nick); if (chanrec->nick_count == netsplit_max_nicks) - chanrec->maxnickpos = chanrec->nicks->len; + chanrec->maxnickpos = chanrec->nicks->len - 2; } } } From 3811b1ffc9f38d52a0e433b0d9ddce9b2b3e2486 Mon Sep 17 00:00:00 2001 From: soulseller Date: Wed, 26 Nov 2025 23:49:58 +0200 Subject: [PATCH 100/117] formats: fix hide_text_style and hide_colors to mitigate color bleed --- src/fe-common/core/formats.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index f7614b6f..db2148d0 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -1546,9 +1546,13 @@ void format_send_as_gui_flags(TEXT_DEST_REC *dest, const char *text, SIGNAL_FUNC break; case 15: /* remove all styling */ - fgcolor = theme->default_color; - bgcolor = -1; - flags &= GUI_PRINT_FLAG_INDENT|GUI_PRINT_FLAG_MONOSPACE; + if (!hide_text_style) { + if (!hide_colors) { + fgcolor = theme->default_color; + bgcolor = -1; + } + flags &= GUI_PRINT_FLAG_INDENT | GUI_PRINT_FLAG_MONOSPACE; + } break; case 17: if (!hide_text_style) From d145f24c2226b1ca461249e3020e69d4e71509d4 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 27 Dec 2025 20:41:26 +0100 Subject: [PATCH 101/117] run syncscripts.sh autoop 1.10 -> 1.11 mail 2.92 -> 2.93 scriptassist 2022053100 -> 2023111700 --- scripts/autoop.pl | 11 +- scripts/mail.pl | 6 +- scripts/scriptassist.pl | 392 ++++++++++++++++++++++++++-------------- 3 files changed, 265 insertions(+), 144 deletions(-) diff --git a/scripts/autoop.pl b/scripts/autoop.pl index b72def15..ce37e705 100644 --- a/scripts/autoop.pl +++ b/scripts/autoop.pl @@ -5,7 +5,7 @@ use Irssi; use strict; use vars qw($VERSION %IRSSI); -$VERSION = "1.10"; +$VERSION = "1.11"; %IRSSI = ( authors => 'Timo Sirainen & Jostein Kjønigsen', name => 'autoop', @@ -98,10 +98,11 @@ sub load_autoops { %opnicks = (); open(CONF, "<", "$file") or return; while (my $line = ) { - if ($line !=~ /^\s*$/) { - cmd_autoop($line); - $count++; - } + chomp($line); + if ($line !~ /^\s*$/) { + cmd_autoop($line); + $count++; + } } close(CONF); diff --git a/scripts/mail.pl b/scripts/mail.pl index 23f99c01..bf14503a 100644 --- a/scripts/mail.pl +++ b/scripts/mail.pl @@ -1,6 +1,6 @@ use strict; use vars qw($VERSION %IRSSI); -$VERSION = "2.92"; +$VERSION = "2.93"; %IRSSI = ( authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei", contact => "tss\@iki.fi, matti\@hiljanen.com, joost\@carnique.nl, bart\@dreamflow.nl", @@ -63,8 +63,8 @@ sub cmd_print_help { "/MAILBOX SHOW\n". " - Shows a list of the defined mailboxes.\n\n". "Use the following commands to change the behaviour:\n\n". - "/SET MAILDIRMODE on|off\n". - " - If maildirmode is on, the mailboxes in the list are assumed to be ". + "/SET MAILDIR_MODE on|off\n". + " - If maildir_mode is on, the mailboxes in the list are assumed to be ". "directories. Otherwise they are assumed to be spool files.\n". " Default: off.\n". "/SET MAIL_OLDNOTNEW on|off\n". diff --git a/scripts/scriptassist.pl b/scripts/scriptassist.pl index 5cad3838..665615db 100644 --- a/scripts/scriptassist.pl +++ b/scripts/scriptassist.pl @@ -5,7 +5,7 @@ use strict; -our $VERSION = '2022053100'; +our $VERSION = '2023111700'; our %IRSSI = ( authors => 'Stefan \'tommie\' Tomanek', contact => 'stefan@pico.ruhr.de', @@ -22,6 +22,8 @@ our ($forked, %remote_db, $have_gpg, @complist); use Irssi 20020324; use CPAN::Meta::YAML; use LWP::UserAgent; +use Hash::Util qw(lock_ref_keys); +use JSON::PP; use POSIX; use version; @@ -43,7 +45,7 @@ sub show_help { /scriptassist info Display information about /scriptassist ratings - Retrieve the average ratings of the the scripts + Retrieve the average ratings of the scripts /scriptassist top Retrieve the first top rated scripts /scriptassist new @@ -199,87 +201,163 @@ sub get_unknown { } sub get_names { - my ($sname, $db) = shift; + my ($sname, $db, $votes) = @_; $sname =~ s/\s+$//; - $sname =~ s/\.pl$//; - my $plname = "$sname.pl"; + my $ext = 'pl'; # default extension + if ($sname =~ s/\.(\w{2,3})$//) { + $ext = $1; + } + my $plname = "$sname.$ext"; $sname =~ s/^.*\///; my $xname = $sname; $xname =~ s/\W/_/g; my $pname = "${xname}::"; if ($xname ne $sname || $sname =~ /_/) { my $dir = Irssi::get_irssi_dir()."/scripts/"; - if ($db && exists $db->{"$sname.pl"}) { + if ($db && exists $db->{$plname}) { # $found = 1; - } elsif (-e $dir.$plname || -e $dir."$sname.pl" || -e $dir."autorun/$sname.pl") { + } elsif (-e $dir.$plname || -e $dir."autorun/".$plname) { # $found = 1; } else { # not found my $pat = $xname; $pat =~ y/_/?/; my $re = "\Q$xname"; $re =~ s/\Q_/./g; if ($db) { - my ($cand) = grep /^$re\.pl$/, sort keys %$db; + my ($cand) = grep /^$re\.\Q$ext\E$/, sort keys %$db; if ($cand) { - return get_names($cand, $db); + return get_names($cand, $db, $votes); } } - my ($cand) = glob "'$dir$pat.pl' '${dir}autorun/$pat.pl'"; + my ($cand) = glob "'$dir$pat.$ext' '${dir}autorun/$pat.$ext'"; if ($cand) { $cand =~ s/^.*\///; - return get_names($cand, $db); + return get_names($cand, $db, $votes); } } } - ($sname, $plname, $pname, $xname) + my ($script_stash, $script_irssi, $script_db, $local_version); + $script_db = $db->{$plname} if $db && exists $db->{$plname}; + if (lc $ext eq 'pl') { + $script_stash = $Irssi::Script::{$pname}; + } + elsif (lc $ext eq 'py' && is_python_loaded()) { + my $filename; + capture_print_text_command( + 'py list', + sub { + for my $line (@_[ 1 .. $#_ ]) { + my ($script, $fn) = split ' ', $line, 2; + if ($script eq $sname) { + $filename = $fn; + } + } + }); + if (defined $filename) { + my $filename_quoted = $filename; + $filename_quoted =~ s/[\\']/\\$&/g; + capture_print_text_command( + # make sure the command line stays short + 'py exec ' . + (join ';', split /\n/, < $doc->{IRSSI}, VERSION => \($doc->{__version__}) }; + }; + } + ); + } + } + if (defined $script_stash) { + $script_irssi = $script_stash->{IRSSI}; + $local_version = ${$script_stash->{VERSION}} + if $script_stash->{VERSION}; + } + lock_ref_keys({ + sname => $ext eq 'pl' ? $sname : $plname, + plname => $plname, + pname => $pname, + xname => $xname, + stash => $script_stash, + irssi => $script_irssi, + db => $script_db, + db_version => ($script_db ? $script_db->{version} : undef), + local_version => $local_version, + ($votes ? (votes => $votes->{$plname}) : ()), + }) } sub script_info { my ($scripts) = @_; my %result; my $xml = get_scripts(); + my $py = is_python_loaded(); foreach (@{$scripts}) { - my ($sname, $plname, $pname) = get_names($_, $xml); - next unless (defined $xml->{$plname} || ( exists $Irssi::Script::{$pname} && exists $Irssi::Script::{$pname}{IRSSI} )); - $result{$sname}{version} = get_remote_version($sname, $xml); + my %r; + my $n = get_names($_, $xml); + next unless (defined $n->{db} || defined $n->{irssi}); + $r{version} = $n->{db_version}; my @headers = ('authors', 'contact', 'description', 'license', 'source'); foreach my $entry (@headers) { - $result{$sname}{$entry} = $Irssi::Script::{$pname}{IRSSI}{$entry}; - if (defined $xml->{$plname}{$entry}) { - $result{$sname}{$entry} = $xml->{$plname}{$entry}; + $r{$entry} = $n->{irssi}{$entry}; + if ($n->{db} && defined $n->{db}{$entry}) { + $r{$entry} = $n->{db}{$entry}; } } - if ($xml->{$plname}{signature_available}) { - $result{$sname}{signature_available} = 1; + if ($n->{db} && $n->{db}{signature_available}) { + $r{signature_available} = 1; } - if (defined $xml->{$plname}{modules}) { - my $modules = $xml->{$plname}{modules}; + if ($n->{db} && defined $n->{db}{modules}) { + my $modules = $n->{db}{modules}; foreach my $mod (split(/ /, $modules)) { my $opt = ($mod =~ /\((.*)\)/)? 1 : 0; $mod = $1 if $1; - $result{$sname}{modules}{$mod}{optional} = $opt; - $result{$sname}{modules}{$mod}{installed} = module_exist($mod); + $r{modules}{$mod}{optional} = $opt; + $r{modules}{$mod}{installed} = module_exist($mod); } - } elsif (defined $Irssi::Script::{$pname}{IRSSI}{modules}) { - my $modules = $Irssi::Script::{$pname}{IRSSI}{modules}; + } elsif ($n->{irssi} && defined $n->{irssi}{modules}) { + my $modules = $n->{irssi}{modules}; foreach my $mod (split(/ /, $modules)) { my $opt = ($mod =~ /\((.*)\)/)? 1 : 0; $mod = $1 if $1; - $result{$sname}{modules}{$mod}{optional} = $opt; - $result{$sname}{modules}{$mod}{installed} = module_exist($mod); + $r{modules}{$mod}{optional} = $opt; + $r{modules}{$mod}{installed} = module_exist($mod); } } - # if (defined $xml->{$plname}{depends}) { - # my $depends = $xml->{$plname}{depends}; + if (!$py && $n->{db} && $n->{db}{language} eq 'Python') { # py + $r{modules}{'irssi-python module'}{installed} = 0; + } + # if (defined $n->{db}{depends}) { + # my $depends = $n->{db}{depends}; # foreach my $dep (split(/ /, $depends)) { - # $result{$sname}{depends}{$dep}{installed} = 1; #(defined ${ 'Irssi::Script::'.$dep }); + # $r{depends}{$dep}{installed} = 1; #(defined ${ 'Irssi::Script::'.$dep }); # } # } + $result{$n->{sname}} = \%r; } return \%result; } sub get_rate_url { my ($src) = @_; + if (ref $src) { ($src) = grep { $_ } map { $_->{source} } values %$src; } + die("No script source address found\n") unless $src; my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30); $ua->agent('ScriptAssist/'.$VERSION); my $request = HTTP::Request->new('GET', $src); @@ -288,6 +366,9 @@ sub get_rate_url { my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), ''; die("Fetching ratings location failed: $error"); } + if (my $error = $response->header('X-Died')) { + die("$error\n"); + } my $votes_url; for my $tag ($response->content() =~ /]*)>/g) { my $attr = " $tag "; @@ -299,7 +380,7 @@ sub get_rate_url { } $request = HTTP::Request->new('GET', $votes_url); $response = $ua->request($request); - if (!$response->is_success) { + if (!$response->is_success || $response->header('X-Died')) { my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), ''; die("Fetching ratings failed: $error"); } @@ -311,16 +392,16 @@ sub get_rate_url { sub rate_script { my ($script, $stars) = @_; my $xml = get_scripts(); - my $votes = get_rate_url(map { $_->{source} } values %$xml); - my ($sname, $plname, $pname) = get_names($script, $xml); - die "Script $script not found\n" unless $votes->{$plname}; - return $votes->{$plname}{u} + my $votes = get_rate_url($xml); + my $n = get_names($script, $xml, $votes); + die "Script $script not found\n" unless $n->{votes}; + return $n->{votes}{u} } sub get_ratings { my ($scripts, $limit) = @_; my $xml = get_scripts(); - my $votes = get_rate_url(map { $_->{source} } values %$xml); + my $votes = get_rate_url($xml); foreach (keys %{$votes}) { if ($xml->{$_}) { $xml->{$_}{votes} = $votes->{$_}{v}; @@ -329,9 +410,9 @@ sub get_ratings { my %result; if (@{$scripts}) { foreach (@{$scripts}) { - my ($sname, $plname, $pname) = get_names($_, $xml); - next unless (defined $xml->{$plname} || ( exists $Irssi::Script::{$pname} && exists $Irssi::Script::{$pname}{IRSSI} )); - $result{$plname} = [$xml->{$plname}{votes}]; + my $n = get_names($_, $xml); + next unless ($n->{db} || $n->{irssi}); + $result{$n->{plname}} = [$n->{db}{votes}]; } } else { my @keys = sort { $xml->{$b}{votes} <=> $xml->{$a}{votes} @@ -371,16 +452,22 @@ sub debug_scripts { my ($scripts) = @_; my %result; my $xml = get_scripts(); + my $py = is_python_loaded(); foreach (@{$scripts}) { - my ($sname, $plname) = get_names($_, $xml); - if (defined $xml->{$plname}{modules}) { - my $modules = $xml->{$plname}{modules}; + my %r; + my $n = get_names($_, $xml); + if ($n->{db} && defined $n->{db}{modules}) { + my $modules = $n->{db}{modules}; foreach my $mod (split(/ /, $modules)) { my $opt = ($mod =~ /\((.*)\)/)? 1 : 0; $mod = $1 if $1; - $result{$sname}{$mod}{optional} = $opt; - $result{$sname}{$mod}{installed} = module_exist($mod); + $r{$mod}{optional} = $opt; + $r{$mod}{installed} = module_exist($mod); } + $result{$n->{sname}} = \%r; + } + if (!$py && $n->{db} && $n->{db}{language} eq 'Python') { # py + $result{$n->{sname}}{'irssi-python module'}{installed} = 0; } } return(\%result); @@ -391,11 +478,11 @@ sub install_scripts { my %success; my $dir = Irssi::get_irssi_dir()."/scripts/"; foreach (@{$scripts}) { - my ($sname, $plname, $pname) = get_names($_, $xml); - if (get_local_version($sname) && (-e $dir.$plname)) { - $success{$sname}{installed} = -2; + my $n = get_names($_, $xml); + if ($n->{stash} && (-e $dir.$n->{plname})) { + $success{$n->{sname}}{installed} = -2; } else { - $success{$sname} = download_script($sname, $xml); + $success{$n->{sname}} = download_script($n->{sname}, $xml); } } return \%success; @@ -406,24 +493,24 @@ sub update_scripts { $list = loaded_scripts() if ($list->[0] eq "all" || scalar(@$list) == 0); my %status; foreach (@{$list}) { - my ($sname) = get_names($_, $database); - my $local = get_local_version($sname); - my $remote = get_remote_version($sname, $database); + my $n = get_names($_, $database); + my $local = $n->{local_version}; + my $remote = $n->{db_version}; next if $local eq '' || $remote eq ''; if (compare_versions($local, $remote) eq "older") { - $status{$sname} = download_script($sname, $database); + $status{$n->{sname}} = download_script($n->{sname}, $database); } else { - $status{$sname}{installed} = -2; + $status{$n->{sname}}{installed} = -2; } - $status{$sname}{remote} = $remote; - $status{$sname}{local} = $local; + $status{$n->{sname}}{remote} = $remote; + $status{$n->{sname}}{local} = $local; } return \%status; } sub search_scripts { my ($query, $database) = @_; - $query =~ s/\.pl\Z//; + $query =~ s/\.pl\Z//; # pl my %result; foreach (sort keys %{$database}) { my %entry = %{$database->{$_}}; @@ -432,7 +519,7 @@ sub search_scripts { $string .= $entry{description} if defined $entry{description}; if ($string =~ /$query/i) { my $name = $_; - $name =~ s/\.pl$//; + $name =~ s/\.pl$//; # pl if (defined $entry{description}) { $result{$name}{desc} = $entry{description}; } else { @@ -443,7 +530,7 @@ sub search_scripts { } else { $result{$name}{authors} = ""; } - if (get_local_version($name)) { + if (get_names($name, $database)->{stash}) { $result{$name}{installed} = 1; } else { $result{$name}{installed} = 0; @@ -531,8 +618,8 @@ sub print_unknown { my $text .= "The command '/".$cmd."' is provided by the script '".$data->{$cmd}{$_}{name}."'.\n"; $text .= "This script is currently not installed on your system.\n"; $text .= "If you want to install the script, enter\n"; - my ($name) = get_names($_); - $text .= " %U/script install ".$name."%U "; + my $n = get_names($_); + $text .= " %U/script install ".$n->{sname}."%U "; my $output = draw_box("ScriptAssist", $text, "'".$_."' missing", 1); print CLIENTCRAP $output; } @@ -541,10 +628,10 @@ sub print_unknown { sub check_autorun { my ($script) = @_; - my (undef, $plname) = get_names($script); + my $n = get_names($script); my $dir = Irssi::get_irssi_dir()."/scripts/"; - if (-e $dir."/autorun/".$plname) { - if (readlink($dir."/autorun/".$plname) eq "../".$plname) { + if (-e $dir."/autorun/".$n->{plname}) { + if (readlink($dir."/autorun/".$n->{plname}) eq "../".$n->{plname}) { return 1; } } @@ -582,14 +669,15 @@ sub print_info { my $line; foreach my $script (sort keys(%data)) { my ($local, $autorun); - if (get_local_version($script)) { + my $n = get_names($script); + if ($n->{stash}) { $line .= "%go%n "; - $local = get_local_version($script); + $local = $n->{local_version}; } else { $line .= "%ro%n "; $local = undef; } - if (defined $local || check_autorun($script)) { + if ($n->{stash} || check_autorun($script)) { $autorun = "no"; $autorun = "yes" if check_autorun($script); } else { @@ -643,7 +731,7 @@ sub print_ratings { my @table; foreach my $script (sort {$data{$b}{rating}<=>$data{$a}{rating}} keys(%data)) { my @line; - if (get_local_version($script)) { + if (get_names($script)->{stash}) { push @line, "%go%n"; } else { push @line, "%yo%n"; @@ -660,13 +748,13 @@ sub print_new { my @table; foreach (sort {$list->{$b}{modified} cmp $list->{$a}{modified}} keys %$list) { my @line; - my ($name) = get_names($_); - if (get_local_version($name)) { + my $n = get_names($_); + if ($n->{stash}) { push @line, "%go%n"; } else { push @line, "%yo%n"; } - push @line, "%9".$name."%9"; + push @line, "%9".$n->{sname}."%9"; push @line, $list->{$_}{modified}; push @table, \@line; } @@ -678,14 +766,23 @@ sub print_debug { my $line; foreach my $script (sort keys %data) { $line .= "%ro%n %9".$script."%9 failed to load\n"; - $line .= " Make sure you have the following perl modules installed:\n"; + my $py = $data{$script}{'irssi-python module'}; + if ($py) { # py + $line .= " You are attempting to load a Python script!\n"; + } else { + $line .= " Make sure you have the following perl modules installed:\n"; + } foreach (sort keys %{$data{$script}}) { if ( $data{$script}{$_}{installed} == 1 ) { $line .= " %g->%n ".$_." (found)"; } else { $line .= " %r->%n ".$_." (not found)\n"; $line .= " [This module is optional]\n" if $data{$script}{$_}{optional}; - $line .= " [Try /scriptassist cpan ".$_."]"; + if ($py) { # py + $line .= " [If you have it installed, try: /load python]"; + } else { + $line .= " [Try /scriptassist cpan ".$_."]"; + } } $line .= "\n"; } @@ -695,7 +792,13 @@ sub print_debug { sub load_script { my ($script) = @_; - Irssi::command('script load '.$script); + if ($script =~ s/\.py$//i) { # py + if (is_python_loaded()) { + Irssi::command('py load '.$script); + } + } else { + Irssi::command('script load '.$script); # pl + } } sub print_install { @@ -715,7 +818,7 @@ sub print_install { } else { load_script($script) unless (lc($script) eq lc($IRSSI{name})); } - if (get_local_version($script) && not lc($script) eq lc($IRSSI{name})) { + if (get_names($script)->{stash} && not lc($script) eq lc($IRSSI{name})) { $line .= "%go%n %9".$script."%9 installed\n"; push @installed, $script; } elsif (lc($script) eq lc($IRSSI{name})) { @@ -751,16 +854,14 @@ sub list_sbitems { my ($scripts) = @_; my $text; foreach (@$scripts) { - next unless exists $Irssi::Script::{"${_}::"}; - next unless exists $Irssi::Script::{"${_}::"}{IRSSI}; - my $header = $Irssi::Script::{"${_}::"}{IRSSI}; - next unless $header->{sbitems}; + my $n = get_names($_); + next unless $n->{irssi}{sbitems}; $text .= '%9"'.$_.'"%9 provides the following statusbar item(s):'."\n"; - $text .= ' ->'.$_."\n" foreach (split / /, $header->{sbitems}); + $text .= ' ->'.$_."\n" foreach (split / /, $n->{irssi}{sbitems}); } return unless $text; $text .= "\n"; - $text .= "Enter '/statusbar window add ' to add an item."; + $text .= "Enter '/statusbar additem window' to add an item."; print CLIENTCRAP draw_box('ScriptAssist', $text, 'sbitems', 1); } @@ -838,14 +939,12 @@ sub print_update { sub contact_author { my ($script) = @_; - my ($sname, $plname, $pname) = get_names($script); - return unless exists $Irssi::Script::{$pname}; - my $header = $Irssi::Script::{$pname}{IRSSI}; - if ($header && defined $header->{contact}) { - my @ads = split(/ |,/, $header->{contact}); + my $n = get_names($script); + if ($n->{irssi} && defined $n->{irssi}{contact}) { + my @ads = split(/ |,/, $n->{irssi}{contact}); my $address = $ads[0]; $address .= '?subject='.$script; - $address .= '_'.get_local_version($script) if defined get_local_version($script); + $address .= '_'.$n->{local_version} if $n->{local_version}; call_openurl($address) if $address =~ /[\@:]/; } } @@ -874,6 +973,10 @@ sub get_scripts { $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), ''; next; } + if (my $died = $response->header('X-Died')) { + $error = $died; + next; + } $fetched = 1; my $data = $response->content(); my $src = $site; @@ -929,20 +1032,6 @@ sub get_scripts { return $remote_db{db}; } -sub get_remote_version { - my ($script, $database) = @_; - my $plname = (get_names($script, $database))[1]; - return $database->{$plname}{version}; -} - -sub get_local_version { - my ($script) = @_; - my $pname = (get_names($script))[2]; - return unless exists $Irssi::Script::{$pname}; - my $vref = $Irssi::Script::{$pname}{VERSION}; - return $vref ? $$vref : undef; -} - sub compare_versions { my ($ver1, $ver2) = @_; for ($ver1, $ver2) { @@ -959,11 +1048,42 @@ sub compare_versions { return 'equal'; } +sub is_python_loaded { + !! grep { $_->{cmd} eq 'py' } Irssi::commands +} + +my @print_text_capture; +sub capture_print_text { + my ($dest, $text, $plain) = @_; + push @print_text_capture, $plain; + Irssi::signal_stop; +} + +sub capture_print_text_command { + my ($command, $sub) = @_; + Irssi::signal_add_first('print text', 'capture_print_text'); + @print_text_capture = (); + Irssi::command($command); + my @capture = @print_text_capture; + Irssi::signal_remove('print text', 'capture_print_text'); + @print_text_capture = (); + $sub->(@capture); +} + sub loaded_scripts { my @modules; - foreach (sort grep(s/::$//, keys %Irssi::Script::)) { + foreach (sort grep(s/::$//, keys %Irssi::Script::)) { # pl push @modules, $_; } + if (is_python_loaded()) { + capture_print_text_command( + 'py list', sub { + for my $line (@_[ 1 .. $#_ ]) { + my ($script, $file) = split ' ', $line, 2; + push @modules, "$script.py"; + } + }); + } return \@modules; } @@ -971,9 +1091,9 @@ sub check_scripts { my ($data) = @_; my %versions; foreach (@{loaded_scripts()}) { - my ($sname) = get_names($_, $data); - my $remote = get_remote_version($sname, $data); - my $local = get_local_version($sname); + my $n = get_names($_, $data); + my $remote = $n->{db_version}; + my $local = $n->{local_version}; my $state; if ($local && $remote) { $state = compare_versions($local, $remote); @@ -986,9 +1106,9 @@ sub check_scripts { $remote = '/'; } if ($state) { - $versions{$sname}{state} = $state; - $versions{$sname}{remote} = $remote; - $versions{$sname}{local} = $local; + $versions{$n->{sname}}{state} = $state; + $versions{$n->{sname}}{remote} = $remote; + $versions{$n->{sname}}{local} = $local; } } return \%versions; @@ -996,40 +1116,40 @@ sub check_scripts { sub download_script { my ($script, $xml) = @_; - my ($sname, $plname) = get_names($script, $xml); + my $n = get_names($script, $xml); + my $site = $n->{db}{source}; my %result; - my $site = $xml->{$plname}{source}; $result{installed} = 0; $result{signed} = 0; my $dir = Irssi::get_irssi_dir(); - my $ua = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1,timeout => 30); + my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout => 30); $ua->agent('ScriptAssist/'.2003020803); - my $request = HTTP::Request->new('GET', $site.'/scripts/'.$script.'.pl'); + my $request = HTTP::Request->new('GET', $site.'/scripts/'.$n->{plname}); my $response = $ua->request($request); - if ($response->is_success()) { + if ($response->is_success() && !$response->header('X-Died')) { my $file = $response->content(); mkdir $dir.'/scripts/' unless (-e $dir.'/scripts/'); - open(my $F, '>', $dir.'/scripts/'.$plname.'.new'); - print $F $file; - close($F); + open(my $f, '>', $dir.'/scripts/'.$n->{plname}.'.new'); + print $f $file; + close($f); if ($have_gpg && Irssi::settings_get_bool('scriptassist_use_gpg')) { my $ua2 = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1,timeout => 30); $ua->agent('ScriptAssist/'.2003020803); - my $request2 = HTTP::Request->new('GET', $site.'/signatures/'.$plname.'.asc'); + my $request2 = HTTP::Request->new('GET', $site.'/signatures/'.$n->{plname}.'.asc'); my $response2 = $ua->request($request2); - if ($response2->is_success()) { + if ($response2->is_success() && !$response->header('X-Died')) { my $sig_dir = $dir.'/scripts/signatures/'; mkdir $sig_dir unless (-e $sig_dir); - open(my $S, '>', $sig_dir.$plname.'.asc'); + open(my $s, '>', $sig_dir.$n->{plname}.'.asc'); my $file2 = $response2->content(); - print $S $file2; - close($S); + print $s $file2; + close($s); my $sig; foreach (1..2) { # FIXME gpg needs two rounds to load the key my $gpg = new GnuPG(); eval { - $sig = $gpg->verify( file => $dir.'/scripts/'.$plname.'.new', signature => $sig_dir.$plname.'.asc' ); + $sig = $gpg->verify( file => $dir.'/scripts/'.$n->{plname}.'.new', signature => $sig_dir.$n->{plname}.'.asc' ); }; } if (defined $sig->{user}) { @@ -1055,8 +1175,8 @@ sub download_script { if ($result{installed}) { my $old_dir = "$dir/scripts/old/"; mkdir $old_dir unless (-e $old_dir); - rename "$dir/scripts/$plname", "$old_dir/$plname.old" if -e "$dir/scripts/$plname"; - rename "$dir/scripts/$plname.new", "$dir/scripts/$plname"; + rename "$dir/scripts/".$n->{plname}, "$old_dir/".$n->{plname}.".old" if -e "$dir/scripts/".$n->{plname}; + rename "$dir/scripts/".$n->{plname}.".new", "$dir/scripts/".$n->{plname}; } return \%result; } @@ -1083,23 +1203,23 @@ sub print_check { sub toggle_autorun { my ($script) = @_; - my ($sname, $plname) = get_names($script); + my $n = get_names($script); my $dir = Irssi::get_irssi_dir()."/scripts/"; mkdir $dir."autorun/" unless (-e $dir."autorun/"); - return unless (-e $dir.$plname); - if (-e $dir."/autorun/".$plname) { - if (readlink($dir."/autorun/".$plname) eq "../".$plname) { - if (unlink($dir."/autorun/".$plname)) { - print CLIENTCRAP "%R>>%n Autorun of ".$sname." disabled"; + return unless (-e $dir.$n->{plname}); + if (-e $dir."/autorun/".$n->{plname}) { + if (readlink($dir."/autorun/".$n->{plname}) eq "../".$n->{plname}) { + if (unlink($dir."/autorun/".$n->{plname})) { + print CLIENTCRAP "%R>>%n Autorun of ".$n->{sname}." disabled"; } else { print CLIENTCRAP "%R>>%n Unable to delete link"; } } else { - print CLIENTCRAP "%R>>%n ".$dir."/autorun/".$plname." is not a correct link"; + print CLIENTCRAP "%R>>%n ".$dir."/autorun/".$n->{plname}." is not a correct link"; } } else { - if (symlink("../".$plname, $dir."/autorun/".$plname)) { - print CLIENTCRAP "%R>>%n Autorun of ".$sname." enabled"; + if (symlink("../".$n->{plname}, $dir."/autorun/".$n->{plname})) { + print CLIENTCRAP "%R>>%n Autorun of ".$n->{sname}." enabled"; } else { print CLIENTCRAP "%R>>%n Unable to create autorun link"; } @@ -1178,9 +1298,9 @@ sub cmd_help { sub sig_command_script_load { my ($script, $server, $witem) = @_; - my ($sname, $plname, $pname, $xname) = get_names($script); - if ( exists $Irssi::Script::{$pname} ) { - if (my $code = "Irssi::Script::${pname}"->can('pre_unload')) { + my $n = get_names($script); + if ( $n->{stash} ) { + if (my $code = ("Irssi::Script::".$n->{pname})->can('pre_unload')) { print CLIENTCRAP "%R>>%n Triggering pre_unload function of $script..."; $code->(); } From 82b253f63ea0dfc4fd9b8b523a3a1bec63a9b872 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 27 Dec 2025 22:27:11 +0100 Subject: [PATCH 102/117] run syncdocs.sh added New-users and qna, removed faq and startup-HOWTO from sync --- docs/New-users.html | 110 +++++++++++++++++++++++++ docs/New-users.txt | 193 ++++++++++++++++++++++++++++++++++++++++++++ docs/qna.html | 52 ++++++++++++ docs/qna.txt | 111 +++++++++++++++++++++++++ utils/syncdocs.sh | 58 +++++++------ 5 files changed, 501 insertions(+), 23 deletions(-) create mode 100644 docs/New-users.html create mode 100644 docs/New-users.txt create mode 100644 docs/qna.html create mode 100644 docs/qna.txt diff --git a/docs/New-users.html b/docs/New-users.html new file mode 100644 index 00000000..496f319e --- /dev/null +++ b/docs/New-users.html @@ -0,0 +1,110 @@ + +

    New users guide

    +
    +

    New to IRC

    +

    Internet Relay Chat was created in 1988 and has hardly changed. It can be used to exchange text messages (one message = single line) with other people, either privately (called query, PM, private message, MSG) or in a room (channel). Pictures are shared by uploading them to a temporary host like https://pomf.lain.la/ and then pasting the HTTP links. Code snippets or longer texts are shared by pasting them to a Pastebin like https://paste.opensuse.org/ and then sharing the HTTP link.

    +

    IRC does not have message history. You can only receive replies while your computer is turned on and connected to the channel you want to follow. Some people run their IRC programs on remote servers for that reason.

    +

    IRC is organised into networks. Each network consists of many servers. It (mostly) does not matter which server you connect to as long as it belongs to the network you want to use. Irssi supports connections to many networks at the same time.

    +

    Each network contains many channels, rooms that are often dedicated to discussing a specific topic. You can find many channels on https://netsplit.de/ or using a search engine with the keyword “IRC”. Irssi supports joining many channels at the same time.

    +

    There is a rather large IRC network catering to free and open-source software and peer directed projects at https://libera.chat/ and a smaller one at https://www.oftc.net/ – many free software projects still have support channels on these IRC networks (although some have moved to Matrix or proprietary platforms like Discord).

    +
    +
    +

    First start

    +

    After (compiling and) installing Irssi, to start it, open a shell (Terminal) and type:

    +
    irssi
    +
    +
    +

    You should be greeted by a blinking cursor behind [(status)]. You are now in the status window of Irssi. Window is the Irssi name for what you might nowadays call a “Web browser tab”.

    +

    If you’re confused about what you are seeing on the Irssi screen, you can find an annotated screenshot of it at User interface.

    +

    If you want, you can pick a nick name (handle) that will be shown to others reading your messages now, by typing

    +
    /set nick whatyouwant
    +
    +
    +

    Each command or message can be sent by pressing Enter. Commands in Irssi start with a /. If there is no /, then the line that you wrote will be sent as a message to the channel that you have open, for everyone to see.

    +
    +

    Leaving

    +

    Type /quit to get out of Irssi.

    +
    +
    +
    +

    Connecting to a network

    +

    Irssi comes with some predefined networks. You can see the current list of networks by typing

    +
    /network
    +
    +
    +

    (the list will be shown in your status window)

    +

    To connect to one of the networks in the list, type /connect networkname, for example:

    +
    /connect liberachat
    +
    +
    +

    You should see several messages scroll by. After a while, you should be connected to the Libera Chat network.

    +
    +

    Attention

    +

    Irssi version 1.2 or older may be lacking the liberachat network entry. See https://github.com/shabble/irssi-docs/wiki/liberachat for how to add it.

    +
    +
    +

    Nickname registration

    +

    Many IRC networks (but not all) offer a way to register a user account. Sometimes (but not on all networks) the account registration also includes reserving a nick for you. How to register also differs by network. Some channels only allow users with registered accounts to join them, so it may be very important for you to register a user account.

    +

    User accounts are always specific to a network.

    +

    For the Libera Chat network, you can find instructions how to register and set up your account with Irssi on https://github.com/shabble/irssi-docs/wiki/liberachat#configure-sasl-automated-log-in

    +
    +
    +
    +

    Joining a channel

    +

    Once you are connected to a network, you can join channels by typing /join #channelname, for example:

    +
    /join #irssi
    +
    +
    +

    Now, a new window will open and you can send messages to the channel.

    +
    +

    Changing windows

    +

    You can change between windows using the Ctrl+n or Ctrl+p keys, or–if your terminal is configured properly–using Alt+1, Alt+2, … See bind -list for a list of all default key bindings.

    +
    +
    +

    Removing clutter

    +

    By default, Irssi shows when someone joins or leaves a channel. These messages can waste a lot of lines and obscure the actual chat. To hide them, type

    +
    /window hidelevel +joins +parts +quits
    +
    +
    +

    To get them back

    +
    /window hidelevel -joins -parts -quits
    +
    +
    +

    If you want to hide them by default, /set window_default_hidelevel hidden joins parts quits

    +
    +
    +
    +

    Adding a new network

    +

    If you want to join a network that is not there, you first need to find at least one server of that network. Let’s say you have found the room #hackint on netsplit.de and want to join it. Then you can find that the server is irc.hackint.org, port 6697, SSL (TLS) on. To add it to Irssi, use the commands:

    +
    /network add hackint
    +/server add -tls -network hackint irc.hackint.org 6697
    +
    +
    +

    Then, you can connect to the newly added network with

    +
    /connect hackint
    +
    +
    +
    +

    Multiple networks

    +

    If you are connected to multiple networks, you can change which one you are “talking” to (which one to send commands) by using the Ctrl+x key in the status window.

    +
    +
    +
    +

    On-line help

    +

    Most /commands have a help page, you can read it with

    +
    /help commandname
    +
    +
    +

    or on-line.

    +

    The settings that can be changed with /SET are described on Settings Documentation – the settingshelp script can be used to read it from within /help

    +
    +
    +

    About Scripts

    +

    You can enhance your Irssi by installing scripts. Many Perl scripts written by other Irssi users can be found on https://scripts.irssi.org/

    +

    Most of them should be compatible with Irssi 1.4 (but some may not, also see the Full Change log for some incompatible ones)

    +
    +
    +

    About Themes

    +

    Irssi’s look can be thoroughly changed with themes. Many themes created by other Irssi users can be found on https://themes.irssi.org/

    +

    If you want to modify the look of Irssi yourself, the default theme which can be found in your ~/.irssi folder is a good starting point. It also has a few comments explaining what some of the abstracts are used for

    +
    \ No newline at end of file diff --git a/docs/New-users.txt b/docs/New-users.txt new file mode 100644 index 00000000..5c5a268c --- /dev/null +++ b/docs/New-users.txt @@ -0,0 +1,193 @@ +# New users guide # + +## New to IRC ## + +Internet Relay Chat was created in 1988 and has hardly changed. It can be used +to exchange text messages (one message = single line) with other people, either +privately (called query, PM, private message, MSG) or in a room (channel). +Pictures are shared by uploading them to a temporary host like [1]https:// +pomf.lain.la/ and then pasting the HTTP links. Code snippets or longer texts +are shared by pasting them to a Pastebin like [2]https://paste.opensuse.org/ +and then sharing the HTTP link. + +IRC does not have message history. You can only receive replies while your +computer is turned on and connected to the channel you want to follow. Some +people run their IRC programs on remote servers for that reason. + +IRC is organised into networks. Each network consists of many servers. It +(mostly) does not matter which server you connect to as long as it belongs to +the network you want to use. Irssi supports connections to many networks at the +same time. + +Each network contains many channels, rooms that are often dedicated to +discussing a specific topic. You can find many channels on [3]https:// +netsplit.de/ or using a search engine with the keyword “IRC”. Irssi supports +joining many channels at the same time. + +There is a rather large IRC network catering to free and open-source software +and peer directed projects at [4]https://libera.chat/ and a smaller one at [5] +https://www.oftc.net/ – many free software projects still have support channels +on these IRC networks (although some have moved to Matrix or proprietary +platforms like Discord). + +## First start ## + +After (compiling and) installing Irssi, to start it, open a shell (Terminal) +and type: + +irssi + +You should be greeted by a blinking cursor behind [(status)]. You are now in +the status window of Irssi. Window is the Irssi name for what you might +nowadays call a “Web browser tab”. + +If you’re confused about what you are seeing on the Irssi screen, you can find +an annotated screenshot of it at [6]User interface. + +If you want, you can pick a nick name (handle) that will be shown to others +reading your messages now, by typing + +/set nick whatyouwant + +Each command or message can be sent by pressing Enter. Commands in Irssi start +with a /. If there is no /, then the line that you wrote will be sent as a +message to the channel that you have open, for everyone to see. + +### Leaving ### + +Type /quit to get out of Irssi. + +## Connecting to a network ## + +Irssi comes with some predefined networks. You can see the current list of +networks by typing + +/network + +(the list will be shown in your status window) + +To connect to one of the networks in the list, type /connect networkname, for +example: + +/connect liberachat + +You should see several messages scroll by. After a while, you should be +connected to the Libera Chat network. + +Attention + +Irssi version 1.2 or older may be lacking the liberachat network entry. See [7] +https://github.com/shabble/irssi-docs/wiki/liberachat for how to add it. + +### Nickname registration ### + +Many IRC networks (but not all) offer a way to register a user account. +Sometimes (but not on all networks) the account registration also includes +reserving a nick for you. How to register also differs by network. Some +channels only allow users with registered accounts to join them, so it may be +very important for you to register a user account. + +User accounts are always specific to a network. + +For the Libera Chat network, you can find instructions how to register and set +up your account with Irssi on [8]https://github.com/shabble/irssi-docs/wiki/ +liberachat#configure-sasl-automated-log-in + +## Joining a channel ## + +Once you are connected to a network, you can join channels by typing /join # +channelname, for example: + +/join #irssi + +Now, a new window will open and you can send messages to the channel. + +### Changing windows ### + +You can change between windows using the Ctrl+n or Ctrl+p keys, or–if your +terminal is configured properly–using Alt+1, Alt+2, … See [9]bind -list for a +list of all default key bindings. + +### Removing clutter ### + +By default, Irssi shows when someone joins or leaves a channel. These messages +can waste a lot of lines and obscure the actual chat. To hide them, type + +/window hidelevel +joins +parts +quits + +To get them back + +/window hidelevel -joins -parts -quits + +If you want to hide them by default, /set window_default_hidelevel hidden joins +parts quits + +## Adding a new network ## + +If you want to join a network that is not there, you first need to find at +least one server of that network. Let’s say you have found the room [10]# +hackint on netsplit.de and want to join it. Then you can find that the [11] +server is irc.hackint.org, port 6697, SSL (TLS) on. To add it to Irssi, use the +commands: + +/network add hackint +/server add -tls -network hackint irc.hackint.org 6697 + +Then, you can connect to the newly added network with + +/connect hackint + +### Multiple networks ### + +If you are connected to multiple networks, you can change which one you are +“talking” to (which one to send commands) by using the Ctrl+x key in the status +window. + +## On-line help ## + +Most /commands have a help page, you can read it with + +/help commandname + +or [12]on-line. + +The settings that can be changed with /SET are described on [13]Settings +Documentation – the settingshelp [14]script can be used to read it from within +/help + +## About Scripts ## + +You can enhance your Irssi by installing scripts. Many Perl scripts written by +other Irssi users can be found on [15]https://scripts.irssi.org/ + +Most of them should be compatible with Irssi 1.4 (but some may not, also see +the Full Change log for some incompatible ones) + +## About Themes ## + +Irssi’s look can be thoroughly changed with themes. Many themes created by +other Irssi users can be found on [16]https://themes.irssi.org/ + +If you want to modify the look of Irssi yourself, the default theme which can +be found in your ~/.irssi folder is a good starting point. It also has a few +comments explaining what some of the abstracts are used for + + +References: + +[1] https://pomf.lain.la/ +[2] https://paste.opensuse.org/ +[3] https://netsplit.de/ +[4] https://libera.chat/ +[5] https://www.oftc.net/ +[6] https://irssi.org/User-interface/ +[7] https://github.com/shabble/irssi-docs/wiki/liberachat +[8] https://github.com/shabble/irssi-docs/wiki/liberachat#configure-sasl-automated-log-in +[9] https://irssi.org/documentation/help/bind_-list/ +[10] https://netsplit.de/channels/details.php?room=%23hackint&net=hackint +[11] https://netsplit.de/servers/?net=hackint +[12] https://irssi.org/documentation/help/ +[13] https://irssi.org/documentation/settings/ +[14] https://irssi.org/New-users/#about-scripts +[15] https://scripts.irssi.org/ +[16] https://themes.irssi.org/ diff --git a/docs/qna.html b/docs/qna.html new file mode 100644 index 00000000..a61ee40d --- /dev/null +++ b/docs/qna.html @@ -0,0 +1,52 @@ + + +

    Right-aligned nicks

    +

    To create a “tabular” effect of the chat view, or to align nick names in a column, you can use Irssi’s theme/format system. The basic commands are the following:

    +
    /format own_msg {ownmsgnick $2 {ownnick $[-9]0}}$1
    +/format own_msg_channel {ownmsgnick $3 {ownnick $[-9]0}{msgchannel $1}}$2
    +/format pubmsg_me {pubmsgmenick $2 {menick $[-9]0}}$1
    +/format pubmsg_me_channel {pubmsgmenick $3 {menick $[-9]0}{msgchannel $1}}$2
    +/format pubmsg_hilight {pubmsghinick $0 $3 $[-9]1}$2
    +/format pubmsg_hilight_channel {pubmsghinick $0 $4 $[-9]1{msgchannel $2}}$3
    +/format pubmsg {pubmsgnick $2 {pubnick $[-9]0}}$1
    +/format pubmsg_channel {pubmsgnick $3 {pubnick $[-9]0}{msgchannel $1}}$2
    +
    +
    +

    These are copied from the default theme’s default values, which are responsible for displaying your own messages sent to a channel (own_msg) as well as received messages (pubmsg) and the two basic highlightings (me and hilight).

    +

    Then, in front of the argument that contains the nick name ($0 in most cases, but $1 in pubmsg_hilight), an alignment modifier (see Appendix B: Special Variables and Expandos) has been added: [-9]. This means that the nicks will be right-aligned and truncated to 9 characters.

    +

    Note: Modifiers only work in the /format section of a theme (this may change in the future)

    +

    There are also some scripts that try to do the alignment for you, like: nm, nm2.

    +

    There are also some nice themes that extend the alignment to further formats, like: weed.

    +

    Automatic log-in to NickServ

    +

    Please check here => Automatic log-in to NickServ

    +

    CertFP Log-in

    +

    CertFP, short for Certificate Finger Print, is another method to log you in to NickServ. Instead of a password, it uses a Client Certificate.

    +

    In order to use it, you

    +
      +
    • first need a certificate,

    • +
    • then configure Irssi to use this certificate,

    • +
    • and finally register the certificate with NickServ.

    • +
    +

    Irssi does not have built-in certificate management commands, so you need to use an external tool like openssl to create the certificate.

    +

    A step-by-step guide for the Libera Chat network can be found here => https://github.com/shabble/irssi-docs/wiki/liberachat_certfp

    +

    It is necessary that the certificate be available as a file; PKCS#11 is not supported.

    +

    Tor (The Onion Router)

    +

    Tor is an overlay network for anonymous communication. It operates a local SOCKS proxy for applications to use.

    +

    Unfortunately, Irssi currently does not support SOCKS proxies natively. As a workaround, you can install the ProxyChains-NG program (note, it must be the NG version).

    +

    Afterwards, you can launch Irssi like this:

    +
    proxychains4 irssi
    +
    +
    +

    Now your connections will go through the Proxy configured in ProxyChains-NG (Tor by default).

    +

    IRC networks may have different requirements to be able to connect via Tor. For the Libera Chat network, you will first need to set up CertFP Log-in using a clearnet connection, and then connect to their Onion Service palladium.libera.chat. More detailed instructions can be found here => https://github.com/shabble/irssi-docs/wiki/liberator

    +

    The following signatures were invalid: EXPKEYSIG

    +

    If you see such a message

    +
    Err:4 home:/ailin_nemui:/irssi-an  InRelease
    +  The following signatures were invalid: EXPKEYSIG EDB7AED941EEDB57 home:ailin_nemui OBS Project <home:ailin_nemui@build.opensuse.org>
    +
    +
    +

    this means that the automatic signing key used by the Open Build Service expired. OBS renews the key periodically, but Debian does not support this.

    +
    +

    Fix

    +

    Download the key again, following the regular OBS instructions. If it still does not work, verify if there is a second expired copy of the key in /etc/apt/trusted.gpg.d or in apt-key list and remove it as well.

    +
    \ No newline at end of file diff --git a/docs/qna.txt b/docs/qna.txt new file mode 100644 index 00000000..92f4f64c --- /dev/null +++ b/docs/qna.txt @@ -0,0 +1,111 @@ +# Right-aligned nicks # + +To create a “tabular” effect of the chat view, or to align nick names in a +column, you can use Irssi’s theme/format system. The basic commands are the +following: + +/format own_msg {ownmsgnick $2 {ownnick $[-9]0}}$1 +/format own_msg_channel {ownmsgnick $3 {ownnick $[-9]0}{msgchannel $1}}$2 +/format pubmsg_me {pubmsgmenick $2 {menick $[-9]0}}$1 +/format pubmsg_me_channel {pubmsgmenick $3 {menick $[-9]0}{msgchannel $1}}$2 +/format pubmsg_hilight {pubmsghinick $0 $3 $[-9]1}$2 +/format pubmsg_hilight_channel {pubmsghinick $0 $4 $[-9]1{msgchannel $2}}$3 +/format pubmsg {pubmsgnick $2 {pubnick $[-9]0}}$1 +/format pubmsg_channel {pubmsgnick $3 {pubnick $[-9]0}{msgchannel $1}}$2 + +These are copied from the default theme’s default values, which are responsible +for displaying your own messages sent to a channel (own_msg) as well as +received messages (pubmsg) and the two basic highlightings (me and hilight). + +Then, in front of the argument that contains the nick name ($0 in most cases, +but $1 in pubmsg_hilight), an alignment modifier (see [1]Appendix B: Special +Variables and Expandos) has been added: [-9]. This means that the nicks will be +right-aligned and truncated to 9 characters. + +Note: Modifiers only work in the /format section of a theme (this may change in +the future) + +There are also some scripts that try to do the alignment for you, like: nm, +nm2. + +There are also some nice themes that extend the alignment to further formats, +like: [2]weed. + +# Automatic log-in to NickServ # + +Please check here => [3]Automatic log-in to NickServ + +# CertFP Log-in # + +CertFP, short for Certificate Finger Print, is another method to log you in to +NickServ. Instead of a password, it uses a [4]Client Certificate. + +In order to use it, you + + • first need a certificate, + + • then configure Irssi to use this certificate, + + • and finally register the certificate with NickServ. + +Irssi does not have built-in certificate management commands, so you need to +use an external tool like openssl to create the certificate. + +A step-by-step guide for the Libera Chat network can be found here => [5]https: +//github.com/shabble/irssi-docs/wiki/liberachat_certfp + +It is necessary that the certificate be available as a file; PKCS#11 is not +supported. + +# Tor (The Onion Router) # + +[6]Tor is an overlay network for anonymous communication. It operates a local +[7]SOCKS proxy for applications to use. + +Unfortunately, Irssi currently does not support SOCKS proxies natively. As a +workaround, you can install the [8]ProxyChains-NG program (note, it must be the +NG version). + +Afterwards, you can launch Irssi like this: + +proxychains4 irssi + +Now your connections will go through the Proxy configured in ProxyChains-NG +(Tor by default). + +IRC networks may have different requirements to be able to connect via Tor. For +the Libera Chat network, you will first need to set up [9]CertFP Log-in using a +clearnet connection, and then connect to their [10]Onion Service +palladium.libera.chat. More detailed instructions can be found here => [11] +https://github.com/shabble/irssi-docs/wiki/liberator + +# The following signatures were invalid: EXPKEYSIG # + +If you see such a message + +Err:4 home:/ailin_nemui:/irssi-an InRelease + The following signatures were invalid: EXPKEYSIG EDB7AED941EEDB57 home:ailin_nemui OBS Project + +this means that the automatic signing key used by the Open Build Service +expired. OBS renews the key periodically, but Debian does not support this. + +## Fix ## + +Download the key again, following the regular OBS instructions. If it still +does not work, verify if there is a second expired copy of the key in /etc/apt/ +trusted.gpg.d or in apt-key list and remove it as well. + + +References: + +[1] https://irssi.org/documentation/settings/#a-b +[2] https://github.com/ronilaukkarinen/weed +[3] https://irssi.org/documentation/manual/automation/#automatic-log-in-to-nickserv +[4] https://en.wikipedia.org/wiki/Client_certificate +[5] https://github.com/shabble/irssi-docs/wiki/liberachat_certfp +[6] https://www.torproject.org/ +[7] https://en.wikipedia.org/wiki/SOCKS +[8] https://github.com/rofl0r/proxychains-ng +[9] https://irssi.org/documentation/qna/certfp/ +[10] https://libera.chat/guides/connect#accessing-liberachat-via-tor +[11] https://github.com/shabble/irssi-docs/wiki/liberator diff --git a/utils/syncdocs.sh b/utils/syncdocs.sh index 77ac93bf..73c69c03 100755 --- a/utils/syncdocs.sh +++ b/utils/syncdocs.sh @@ -1,19 +1,22 @@ #!/bin/sh -e -# Run this to download FAQ and startup-HOWTO from irssi.org +# Run this to download QNA and New-users from irssi.org PKG_NAME="Irssi" +export LC_ALL=en_IE.utf8 site=https://irssi.org -faq=$site/documentation/faq/ -howto=$site/documentation/startup/ -design=$site/documentation/design/ +qna=$site/documentation/qna/ +howto=$site/New-users/ +#design=$site/documentation/design/ # remove everything until H1 and optionally 2 DIVs before the # FOOTER. May need to be adjusted as the source pages change pageclean_regex='s{.*(?=)?\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..." +echo "Documentation: html -> txt... [converter: $converter]" -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/qna.html \ + | $addheadermark | $converter > "$srcdir"/docs/qna.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/New-users.html \ + | $addheadermark | $converter > "$srcdir"/docs/New-users.txt -cat "$srcdir"/docs/design.html \ - | LC_ALL=en_IE.utf8 $converter > "$srcdir"/docs/design.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 103/117] 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 d1387b82..254c64f9 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 104/117] 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 | 120 +++++++----------- src/core/net-nonblock.h | 18 +-- src/core/network.c | 182 ++++++++++---------------- 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 | 190 +++++++++++++++------------- 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, 317 insertions(+), 343 deletions(-) diff --git a/docs/help/in/toggle.in b/docs/help/in/toggle.in index f87a6462..9469ba5c 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 d55e362e..073abe18 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 9499a126..4f78600e 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 e514f279..06b63a15 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 10da0d2c..9e2b80e8 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 643884ee..494d9894 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; +typedef struct { + NetGethostbynameContinuationFunc cont; + void *cont_data; +} NET_GETHOSTBYNAME_CALLBACK_DATA; - (void) reverse_lookup; /* Kept for API backward compatibility */ +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 { + iprec->ailist = ailist; + } + g_object_unref(resolver); + resolved_ip_ref(iprec); + + data->cont(iprec, data->cont_data); + g_free(data); +} + +/* nonblocking gethostbyname() */ +GCancellable *net_gethostbyname_nonblock(const char *addr, GResolverNameLookupFlags flags, + NetGethostbynameContinuationFunc cont, void *cont_data) +{ + GResolver *resolver; + GCancellable *cancellable; + NET_GETHOSTBYNAME_CALLBACK_DATA *data; g_return_val_if_fail(addr != NULL, FALSE); - pid = fork(); - if (pid > 0) { - /* parent */ - pidwait_add(pid); - return pid; - } - - 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; - } else { - errorstr = net_gethosterror(rec.error); - rec.errlen = errorstr == NULL ? 0 : strlen(errorstr)+1; - } - - 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; -} - -/* get the resolved IP address */ -int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec) -{ - 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; -} - -/* Kill the resolver child */ -void net_disconnect_nonblock(int pid) -{ - g_return_if_fail(pid > 0); - - 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 c93dd9e3..c4cb7824 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 fa70d62a..c763a7c6 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; + iprec->refcount++; +} + +int resolved_ip_unref(RESOLVED_IP_REC *iprec) +{ + if (--iprec->refcount > 0) { + return TRUE; + } + + g_resolver_free_addresses(iprec->ailist); + if (iprec->error != NULL) { + g_error_free(iprec->error); + } + g_free(iprec); + + return FALSE; +} + +/* Get IP addresses for host, both IPv4 and IPv6 if possible. */ +static RESOLVED_IP_REC *net_gethostbyname(const char *addr, GResolverNameLookupFlags flags) +{ + /* GList */ + GList *ailist; + GError *error; + GResolver *resolver; + RESOLVED_IP_REC *iprec; #ifdef HAVE_CAPSICUM if (capsicum_enabled()) - return (capsicum_net_gethostbyname(addr, ip4, ip6)); + return (capsicum_net_gethostbyname(addr, flags)); #endif - g_return_val_if_fail(addr != NULL, -1); + g_return_val_if_fail(addr != NULL, NULL); - 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++; + 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); - 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++; - } - } - freeaddrinfo(ailist); - return 0; + return iprec; } -/* 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) +int net_gethostbyname_first_ips(const char *addr, GResolverNameLookupFlags flags, IPADDR *ip4, + IPADDR *ip6) { - union sockaddr_union so; - int host_error; - char hostname[NI_MAXHOST]; + RESOLVED_IP_REC *iprec; - g_return_val_if_fail(ip != NULL, -1); - g_return_val_if_fail(name != NULL, -1); + iprec = net_gethostbyname(addr, flags); + if (iprec->error == NULL) { + GList *curr; - *name = NULL; + for (curr = iprec->ailist; curr->next; curr = curr->next) { + unsigned short family; + GInetAddress *addr; - memset(&so, 0, sizeof(so)); - sin_set_ip(&so, ip); + 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)); + } + } - /* 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; - - *name = g_strdup(hostname); - - 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 5cd85ccc..647cd8c7 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 16513109..de1f06df 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 6c7c63e3..e43245a7 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 a9d9422b..64af6287 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 ff3d6584..97206328 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 811081e8..e62f09ec 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); - } - g_free(iprec.errorstr); + 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; + + 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 d52603eb..5e5a7fd2 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 9724354f..06240d5c 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 19aba87d..1fed639e 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 d32b6009..240df971 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 105/117] 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 4f78600e..c7eed79d 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 5e50e9a5..e6c649fc 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 106/117] Add a few more compile dependencies to INSTALL document --- INSTALL | 3 +++ 1 file changed, 3 insertions(+) diff --git a/INSTALL b/INSTALL index ed5a14a3..ac7c419f 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 107/117] 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 c763a7c6..8dd5cf9d 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 108/117] 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 c078a1b5..f96f4d33 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 1d95462d..b5ace267 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 33be93d5..80033fba 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 00000000..65a30c44 --- /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 e033c260..af68ce7f 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 109/117] 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 0a4d78f6..398eb1c7 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 110/117] up abi --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 06b63a15..4e9b5c79 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 111/117] 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 494d9894..1a06a662 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 647cd8c7..78092375 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 112/117] 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 f96f4d33..a6d2c473 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 113/117] 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 3216210b..39493c53 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 1d15316e..fab1e90a 100644 --- a/utils/clang-format-xs/format-xs-1.pl +++ b/utils/clang-format-xs/format-xs-1.pl @@ -30,7 +30,7 @@ while (<>) { $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 114/117] 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 8dd5cf9d..c641b203 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 97206328..8747eea3 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 e62f09ec..04852104 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 115/117] 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 00000000..47fce5d2 --- /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 7fe95d43..6eaa3025 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 a58faed3..f6761200 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 c7eed79d..d6c582b5 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 072ac3ea..10fdc34b 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 56b6ec77..521015d4 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 73cb156a..a84f12eb 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 5edf2477..b347cd00 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 518dfbfa..b4d78032 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 cdb5168b..894c1d89 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 893f5937..af9dea6e 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 730c9240..65d316d3 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 5ab19651..55071a30 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 49cfe517..b6b91b57 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 1c885b89..6165b461 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 94ed20a2..d1b7db78 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 3ab1bace..c09f07b2 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 257e5c11..9df0ef84 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 34517b34..75f92810 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 4cc2b658..4d5ed554 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 2bc094dd..c4818dcd 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 cc30da1b..b1663d18 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 13b564ea..9611b428 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 0f3f3bb5..1d0ba953 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 af68ce7f..4dd0f5e1 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 1c6e2fbc..9e85ca06 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 b7d769c5..9a5b08cf 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 a6e5c93c..5a24d5d6 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 44b11222..a3181f7b 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 397bd39f..68def5f8 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 f63f4fa8..d59b645d 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 78556331..9da3dda5 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 d58dddf4..bdf2519e 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 116/117] Format root meson.build --- meson.build | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/meson.build b/meson.build index d6c582b5..bb6d2829 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) +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') +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 117/117] 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 00000000..6fa06d38 --- /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