WIP patch: https://lists.sr.ht/~emersion/soju-dev/patches/23822
Another attempt is here. https://lists.sr.ht/~emersion/soju-dev/patches/33206 May need more cleanup.