From 2003446e988280d86aebd2bc2492670f3329a9b7 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 7 Sep 2021 01:21:35 +0200 Subject: [PATCH 001/248] continue head --- NEWS | 2 ++ configure.ac | 2 +- meson.build | 2 +- src/core/expandos.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b3282761..87cd3cfd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +v1.4-head-an 2022-xx-xx Ailin Nemui + v1.3.0-an 2021-09-05 Ailin Nemui * /SET resolve_reverse_lookup setting was removed (#1135) * Irssi will try to connect on IPv4 if IPv6 connection failed diff --git a/configure.ac b/configure.ac index 3a9e7bd6..a51edf3c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(irssi, 1.3-head) +AC_INIT(irssi, 1.4-head-an) AC_CONFIG_SRCDIR([src]) AC_CONFIG_AUX_DIR(build-aux) AC_PREREQ(2.50) diff --git a/meson.build b/meson.build index bd192a92..31bdfa9f 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('irssi', 'c', - version : '1.3-head', + version : '1.4-head-an', meson_version : '>=0.49', default_options : ['warning_level=1']) diff --git a/src/core/expandos.c b/src/core/expandos.c index da84b568..0f317e51 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -322,7 +322,7 @@ static char *expando_last_invite(SERVER_REC *server, void *item, int *free_ret) /* client version text string */ static char *expando_version(SERVER_REC *server, void *item, int *free_ret) { - return PACKAGE_VERSION "-an"; + return PACKAGE_VERSION; } /* current value of CMDCHARS */ From 521c0d4e6fb906f65855f13e70c063ec7eb13552 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 8 Sep 2021 11:57:25 +0200 Subject: [PATCH 002/248] remove oragono.io/maxline-2 --- src/irc/core/irc-servers.c | 21 --------------------- src/irc/core/irc-servers.h | 1 - 2 files changed, 22 deletions(-) diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 1c9f0cec..664ca9a4 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -282,7 +282,6 @@ static void server_init_1(IRC_SERVER_REC *server) irc_cap_toggle(server, CAP_SASL, TRUE); } - irc_cap_toggle(server, CAP_MAXLINE, TRUE); irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE); irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE); irc_cap_toggle(server, CAP_SETNAME, TRUE); @@ -647,24 +646,6 @@ static void sig_server_quit(IRC_SERVER_REC *server, const char *msg) g_free(recoded); } -static void cap_maxline(IRC_SERVER_REC *server) -{ - unsigned int maxline = 0; - gboolean parse_successful = FALSE; - const char *maxline_str; - - maxline_str = g_hash_table_lookup(server->cap_supported, CAP_MAXLINE); - if (maxline_str != NULL) { - parse_successful = parse_uint(maxline_str, NULL, 10, &maxline); - - } - - if (parse_successful && - maxline >= MAX_IRC_MESSAGE_LEN + 2 /* 2 bytes for CR+LF */) { - server->max_message_len = maxline - 2; - } -} - void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const char *data) { char *recoded; @@ -1226,7 +1207,6 @@ void irc_servers_init(void) signal_add_first("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_add_last("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_add_last("server quit", (SIGNAL_FUNC) sig_server_quit); - signal_add("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline); signal_add("event 670", (SIGNAL_FUNC) event_starttls); signal_add("event 451", (SIGNAL_FUNC) event_registerfirst); signal_add("server cap end", (SIGNAL_FUNC) event_capend); @@ -1258,7 +1238,6 @@ void irc_servers_deinit(void) signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_remove("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_remove("server quit", (SIGNAL_FUNC) sig_server_quit); - signal_remove("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline); signal_remove("event 670", (SIGNAL_FUNC) event_starttls); signal_remove("event 451", (SIGNAL_FUNC) event_registerfirst); signal_remove("server cap end", (SIGNAL_FUNC) event_capend); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 93fa02a4..903de773 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -15,7 +15,6 @@ #define MAX_IRC_USER_TAGS_LEN 4094 #define CAP_LS_VERSION "302" -#define CAP_MAXLINE "oragono.io/maxline-2" #define CAP_MESSAGE_TAGS "message-tags" #define CAP_SASL "sasl" #define CAP_MULTI_PREFIX "multi-prefix" From 85eb4f118fca71daaf67c0c1440f169c164bd87f Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 8 Sep 2021 12:03:05 +0200 Subject: [PATCH 003/248] also remove from NEWS --- NEWS | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 87cd3cfd..7ed44195 100644 --- a/NEWS +++ b/NEWS @@ -136,9 +136,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui /SET show_account_notify to enable + Add support for IRCv3 invite-notify (#1094) + Add support for receiving IRCv3 message-tags (#576, #1090) - + Add support for sending IRCv3 message-tags (#1092) - + Add support for the oragono.io/maxline-2 CAP to increase IRC - protocol line length (#1092) + + Add support for sending IRCv3 message-tags (#1092, an#34) + Enable the znc.in/self-message CAP by default (#1123) + Add support for IRCv3 away-notify. /SET away_notify_public to enable (#1099, GL#33, #1105) From 27a73e253b66240d02d0738e38c6162765e27726 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 8 Sep 2021 12:04:18 +0200 Subject: [PATCH 004/248] duplicate issue in NEWS reported by @tobbez --- NEWS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 87cd3cfd..0515314f 100644 --- a/NEWS +++ b/NEWS @@ -129,8 +129,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui join_extended_account, that theme writers need to take into account if desired. - + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33, - #1104, #1254) + + Add support for IRCv3 setname (#1093, #1104, #1254, GL#33) + Add support for IRCv3 account-notify (#1100, #1098, GL#33, #1105, #1131). Credit to oss-fuzz /SET show_account_notify to enable From 949dc06af3a023436712ba5e2a1f90641fd56d23 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 15 Sep 2021 17:48:27 +0200 Subject: [PATCH 005/248] correctly store updated message levels e.g. from /hilight --- src/fe-text/textbuffer-formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-text/textbuffer-formats.c b/src/fe-text/textbuffer-formats.c index 20abc0df..50d6250a 100644 --- a/src/fe-text/textbuffer-formats.c +++ b/src/fe-text/textbuffer-formats.c @@ -265,7 +265,7 @@ static void sig_gui_print_text_finished(WINDOW_REC *window, TEXT_DEST_REC *dest) info->meta = line_meta_create(dest->meta); - info->level |= MSGLEVEL_FORMAT; + info->level = dest->level | MSGLEVEL_FORMAT; /* the line will be inserted into the view with textbuffer_view_insert_line by gui-printtext.c:view_add_eol */ From 515e493db392a9e6944551a156e1780d653cd208 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 15 Sep 2021 17:52:44 +0200 Subject: [PATCH 006/248] update news --- NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f4a7a199..1934dfbf 100644 --- a/NEWS +++ b/NEWS @@ -4,9 +4,10 @@ v1.3.0-an 2021-09-05 Ailin Nemui * /SET resolve_reverse_lookup setting was removed (#1135) * Irssi will try to connect on IPv4 if IPv6 connection failed (#1146). By Shivaram Lingamneni + * The display system now renders formats on the fly (#1079, - #1188, #1191, #1192, #1204, #1205, #1209, an#13, an#14, an#28, - an#29) + #1188, #1191, #1192, #1204, #1205, #1209, #1349, an#13, + an#14, an#28, an#29, an#36) This major change will break scripts that try to modify printed text during "print text" signal (#1189). They need From bcea697e7c3eba1df2affdfd68f6c54f2bb0da06 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sun, 19 Sep 2021 20:59:14 +0200 Subject: [PATCH 007/248] fix pedantic error in MSGLEVEL enum reported by horgh --- src/core/levels.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/levels.h b/src/core/levels.h index 04893b34..7f1aa931 100644 --- a/src/core/levels.h +++ b/src/core/levels.h @@ -42,7 +42,7 @@ enum { MSGLEVEL_HIDDEN = 0x10000000, /* Hidden from view */ MSGLEVEL_RESERVED1 = 0x20000000, MSGLEVEL_RESERVED2 = 0x40000000, - MSGLEVEL_FORMAT = 0x80000000 /* Format data */ + MSGLEVEL_FORMAT = (int)0x80000000 /* Format data */ }; /* clang-format on */ From df227eb0946aa4967613a26bba74fcaf96880a95 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 22 Sep 2021 10:50:20 +0200 Subject: [PATCH 008/248] update github actions ubuntu version to 18.04 and meson to <0.60.0 --- .github/workflows/check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 61de72ff..97cb3feb 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,7 +18,7 @@ jobs: steps: - name: prepare required software run: | - sudo apt install $apt_build_deps $apt_build_deps_autotools + sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_autotools - uses: actions/checkout@main - name: make dist run: | @@ -38,18 +38,18 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-16.04, ubuntu-latest] + os: [ubuntu-18.04, ubuntu-latest] builder: [meson, configure] compiler: [clang, gcc] flags: [regular] include: - - os: ubuntu-16.04 + - os: ubuntu-18.04 builder: meson meson_ver: ==0.49.2 setuptools_ver: <51 - os: ubuntu-latest builder: meson - meson_ver: <0.59.0 + meson_ver: <0.60.0 - os: ubuntu-latest builder: meson flags: meson-latest FAILURE-OK @@ -64,7 +64,7 @@ jobs: meson_ver: ${{ matrix.meson_ver }} setuptools_ver: ${{ matrix.setuptools_ver }} run: | - sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }} + sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }} eval "$get_pip_build_deps_${{ matrix.builder }}" curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl - name: unpack archive From 32a3f4463c435304717883f810d222c0f79492a9 Mon Sep 17 00:00:00 2001 From: bw1 Date: Sun, 19 Sep 2021 19:56:14 +0200 Subject: [PATCH 009/248] update docs + version() + $abiversion + parse_special() --- docs/perl.txt | 6 ++++++ docs/special_vars.txt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docs/perl.txt b/docs/perl.txt index 761b2f4d..964f4f72 100644 --- a/docs/perl.txt +++ b/docs/perl.txt @@ -205,6 +205,12 @@ Window::command(cmd) Windowitem::command(cmd) Send a command `cmd' (in current channel). The '/' char isn't needed. +version() - return client release date and time (format YYYYMMDD.hhmm) + +parse_special(cmd, data="", flags=0) +Server::parse_special(cmd, data="", flags=0) +Windowitem::parse_special(cmd, data="", flags=0) + evaluate a string with special vars *** Themes diff --git a/docs/special_vars.txt b/docs/special_vars.txt index 36517f78..1101c8a6 100644 --- a/docs/special_vars.txt +++ b/docs/special_vars.txt @@ -94,6 +94,8 @@ $A .. $Z is important. $winname window name $itemname like $T, but use item's visible_name which may be different (eg. $T = !12345chan, $itemname = !chan) + $abiversion IRSSI_ABI_VERSION + https://github.com/irssi/irssi/wiki/irssi_abi_version For example, assume you have the following alias: From 6a83eddf84573acd0d489dc2eb18796699494a23 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 21 Sep 2021 22:40:14 +0200 Subject: [PATCH 010/248] run syncdocs.sh and syncscripts.sh --- docs/faq.html | 4 +- docs/faq.txt | 6 +- docs/startup-HOWTO.html | 4 +- docs/startup-HOWTO.txt | 4 +- scripts/quitmsg.pl | 27 +++----- scripts/scriptassist.pl | 139 +++++++++++++++++++++++++--------------- 6 files changed, 104 insertions(+), 80 deletions(-) diff --git a/docs/faq.html b/docs/faq.html index 7c17f45d..50b404a0 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -2,7 +2,7 @@

Frequently Asked Questions

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

-

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

+

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

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

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

Q: Will there be /DETACH-like feature?

-

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

+

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

Q: How do I run scripts automatically at startup?

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

And finally channels:

-
/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet
+
/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet
 /CHANNEL ADD -auto #secret IRCnet password
 
@@ -395,7 +395,7 @@ Ctrl-X - set the next server in list active

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

-
 [user@host] ~% cat
+
 [cras@hurina] ~% cat
  ^[OP
 
diff --git a/docs/startup-HOWTO.txt b/docs/startup-HOWTO.txt index bff33108..90d278de 100644 --- a/docs/startup-HOWTO.txt +++ b/docs/startup-HOWTO.txt @@ -218,7 +218,7 @@ IRC network, other servers are automatically connected in same network if the And finally channels: -/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet +/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet /CHANNEL ADD -auto #secret IRCnet password -bots and -botcmd should be the only ones needing a bit of explaining. They’re @@ -442,7 +442,7 @@ They might differ a bit with each terminal, so you’ll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in cat. Here’s an example for pressing F1 key: - [user@host] ~% cat + [cras@hurina] ~% cat ^[OP So in irssi you would use /BIND ^[OP /ECHO F1 pressed. If you use multiple diff --git a/scripts/quitmsg.pl b/scripts/quitmsg.pl index e289468c..102d9aa5 100644 --- a/scripts/quitmsg.pl +++ b/scripts/quitmsg.pl @@ -6,36 +6,27 @@ use Irssi::Irc; use strict; use vars qw($VERSION %IRSSI); -$VERSION = "1.00"; +$VERSION = "1.01"; %IRSSI = ( authors => 'Timo Sirainen', name => 'quitmsg', description => 'Random quit messages', license => 'Public Domain', - changed => 'Sun Mar 10 23:18 EET 2002' + changed => 'Mon Jul 22 20:00 EET 2020' ); -my $quitfile = glob "~/.irssi/irssi.quit"; +my $quitfile = Irssi::get_irssi_dir() . "/irssi.quit"; sub cmd_quit { my ($data, $server, $channel) = @_; return if ($data ne ""); + + open (my $fh, "<", $quitfile) || return; + my @lines = <$fh>; - open (f, "<", $quitfile) || return; - my $lines = 0; while() { $lines++; }; - - my $line = int(rand($lines))+1; - - my $quitmsg; - seek(f, 0, 0); $. = 0; - while() { - next if ($. != $line); - - chomp; - $quitmsg = $_; - last; - } - close(f); + my $quitmsg = $lines[int(rand(@lines))]; + chomp($quitmsg); + close($fh); foreach my $server (Irssi::servers) { $server->command("/disconnect ".$server->{tag}." $quitmsg"); diff --git a/scripts/scriptassist.pl b/scripts/scriptassist.pl index 536ef33a..cf02d57e 100644 --- a/scripts/scriptassist.pl +++ b/scripts/scriptassist.pl @@ -5,7 +5,7 @@ use strict; -our $VERSION = '2003020807'; +our $VERSION = '2020042700'; our %IRSSI = ( authors => 'Stefan \'tommie\' Tomanek', contact => 'stefan@pico.ruhr.de', @@ -23,12 +23,15 @@ use Irssi 20020324; use CPAN::Meta::YAML; use LWP::UserAgent; use POSIX; +use version; # GnuPG is not always needed $have_gpg = 0; eval "use GnuPG qw(:algo :trust);"; $have_gpg = 1 if not ($@); +my $irssi_version = qv(Irssi::parse_special('v$J') =~ s/-.*//r); + sub show_help { my $help = "scriptassist $VERSION /scriptassist check @@ -39,15 +42,15 @@ sub show_help { Search the script database /scriptassist info Display information about -".#/scriptassist ratings -# Retrieve the average ratings of the the scripts -#/scriptassist top -# Retrieve the first top rated scripts -"/scriptassist new +/scriptassist ratings + Retrieve the average ratings of the the scripts +/scriptassist top + Retrieve the first top rated scripts +/scriptassist new Display the newest scripts -".#/scriptassist rate )?\s*(
\s*){0,3})}{\1\2}g;' +s{(\s*)?\s*((\r?\n)*\s*\s*)?(
\s*){0,3})}{\1\2}g; +s{}{}g; +s{(.*?)}{\1}g;' srcdir=`dirname "$0"` test -z "$srcdir" && srcdir=. @@ -45,6 +48,7 @@ else any=false fi +addheadermark="perl -p -e s{\\K}{(q:#:x\$1).q: :}ge;s{(?=)}{q: :.(q:#:x\$1)}ge" if type w3m >/dev/null 2>&1 ; then converter="w3m -o display_link_number=1 -dump -T text/html" any=true @@ -83,25 +87,33 @@ download_it() { mv "$3".tmp "$3" } -download_it "FAQ" "$faq" "$srcdir"/docs/faq.html -download_it "Startup How-To" "$howto" "$srcdir"/docs/startup-HOWTO.html -download_it "Design" "$design" "$srcdir"/docs/design.html +download_it_nested() { + name=$1; shift + src=$1; shift + dest=$1; shift + download_it "$name" "$src" "$dest".nest + echo > "$dest" + eval $(perl -n -0777 -e 'print qq{download_it "\$name ($2)" "\${src}$1/" "\${dest}.$1"; +cat "\${dest}.$1" >> "\${dest}.tmp"; +rm "\${dest}.$1";\n} + while(m{(.*?)}g)' "$dest".nest) + rm "$dest".nest + perl -i -0777 -p -e 's{}{}g;s{\A}{\n}' "$dest".tmp + mv "$dest".tmp "$dest" +} + +download_it_nested "QNA" "$qna" "$srcdir"/docs/qna.html +download_it "New users guide" "$howto" "$srcdir"/docs/New-users.html +#download_it "Design" "$design" "$srcdir"/docs/design.html # .html -> .txt with lynx or elinks -echo "Documentation: html -> txt..." +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 234/248] 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 235/248] 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 236/248] 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 237/248] 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 238/248] 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 239/248] 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 240/248] 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 241/248] 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 242/248] 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 243/248] 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 244/248] 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 245/248] 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 246/248] 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 247/248] 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 248/248] 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