net-im/biboumi: Revbump 9.0_rc1-r1; Add CAP message patch.

Patches a bug that prevented connections to FreeNode.
From <https://lab.louiz.org/louiz/biboumi/-/commit/b98434b>.

Signed-off-by: Ronny (tastytea) Gutbrod <gentoo@tastytea.de>
This commit is contained in:
Ronny (tastytea) Gutbrod
2020-08-24 19:37:47 +02:00
parent b2fabdcc19
commit 7b39f68de4
2 changed files with 170 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake fcaps
MY_PV="${PV/_/-}"
DESCRIPTION="XMPP gateway to IRC"
HOMEPAGE="https://biboumi.louiz.org/"
SRC_URI="https://git.louiz.org/biboumi/snapshot/biboumi-${MY_PV}.tar.xz"
LICENSE="ZLIB"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+idn logrotate postgres +sqlite +ssl systemd udns"
DEPEND="
dev-libs/expat
virtual/libiconv
sys-apps/util-linux
sqlite? ( dev-db/sqlite )
postgres? ( dev-db/postgresql:* )
idn? ( net-dns/libidn )
udns? ( net-libs/udns )
ssl? ( dev-libs/botan:2 )
!ssl? ( dev-libs/libgcrypt )
systemd? ( sys-apps/systemd )
"
BDEPEND="dev-python/sphinx"
RDEPEND="
${DEPEND}
acct-user/biboumi"
PATCHES=( "${FILESDIR}/biboumi-9.0_rc1-split-cap-on-space.patch" )
S="${WORKDIR}/${PN}-${MY_PV}"
DOCS=( README.rst CHANGELOG.rst doc/user.rst )
# Allow biboumi to run an identd on port 113.
FILECAPS=( cap_net_bind_service+ep usr/bin/biboumi )
src_prepare() {
cmake_src_prepare
if ! use systemd; then # Don't install biboumi.service.
sed -i '/DESTINATION lib\/systemd\/system/d' CMakeLists.txt || die
fi
}
src_configure() {
local mycmakeargs=(
-DWITH_BOTAN="$(usex ssl)"
-DWITH_LIBIDN="$(usex idn)"
-DWITH_SYSTEMD="$(usex systemd)"
-DWITH_UDNS="$(usex udns)"
-DWITH_SQLITE3="$(usex sqlite)"
-DWITH_POSTGRESQL="$(usex postgres)"
-DWITHOUT_SYSTEMD="$(usex systemd no yes)"
-DWITHOUT_POSTGRESQL="$(usex postgres no yes)"
) # The WITHOUT_* is really needed.
cmake_src_configure
}
src_compile() {
cmake_src_compile
cmake_build man
}
src_install() {
cmake_src_install
if ! use systemd; then
newinitd "${FILESDIR}/${PN}.initd" "${PN}"
fi
if use logrotate; then
insinto etc/logrotate.d
if use systemd; then
newins "${FILESDIR}/${PN}.logrotate.systemd" "${PN}"
else
newins "${FILESDIR}/${PN}.logrotate.openrc" "${PN}"
fi
fi
diropts --owner=biboumi --group=biboumi --mode=750
if use sqlite; then
keepdir var/lib/biboumi
fi
keepdir var/log/biboumi
insinto etc/biboumi
insopts --group=biboumi --mode=640
newins conf/biboumi.cfg biboumi.cfg.example
}

View File

@@ -0,0 +1,70 @@
From b98434b5d04d1ada9b24475e17ee8947d96ad1e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?louiz=E2=80=99?= <louiz@louiz.org>
Date: Sun, 16 Aug 2020 16:05:15 +0200
Subject: [PATCH] In CAP messages, handle the last arg as a list of
capabilities
Instead of just one. This fixes the issue of the "trailing whitespace" since we
now split it on ' '
Fix #3442
---
src/irc/irc_client.cpp | 25 ++++++++++++++-----------
tests/utils.cpp | 3 +++
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 3ae5ac6..5f0d9b9 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -1340,19 +1340,22 @@ long int IrcClient::get_throttle_limit() const
void IrcClient::on_cap(const IrcMessage &message)
{
const auto& sub_command = message.arguments[1];
- const auto& cap = message.arguments[2];
- auto it = this->capabilities.find(cap);
- if (it == this->capabilities.end())
+ const auto& caps = utils::split(message.arguments[2], ' ', false);
+ for (const auto& cap: caps)
{
- log_warning("Received a CAP message for something we didnt ask, or that we already handled.");
- return;
+ auto it = this->capabilities.find(cap);
+ if (it == this->capabilities.end())
+ {
+ log_warning("Received a CAP message for something we didnt ask, or that we already handled: [", cap, "]");
+ return;
+ }
+ Capability& capability = it->second;
+ if (sub_command == "ACK")
+ capability.on_ack();
+ else if (sub_command == "NACK")
+ capability.on_nack();
+ this->capabilities.erase(it);
}
- Capability& capability = it->second;
- if (sub_command == "ACK")
- capability.on_ack();
- else if (sub_command == "NACK")
- capability.on_nack();
- this->capabilities.erase(it);
if (this->capabilities.empty())
this->cap_end();
}
diff --git a/tests/utils.cpp b/tests/utils.cpp
index 6de19f0..6151733 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -28,6 +28,9 @@ TEST_CASE("String split")
CHECK(splitted.size() == 2);
CHECK(splitted[0] == "");
CHECK(splitted[1] == "a");
+ splitted = utils::split("multi-prefix ", ' ');
+ CHECK(splitted[0] == "multi-prefix");
+ CHECK(splitted.size() == 1);
}
TEST_CASE("tolower")
--
2.26.2