commit:     7b39f68de4ed86238ae0ebbf4394eee0edba867c
Author:     Ronny (tastytea) Gutbrod <gentoo <AT> tastytea <DOT> de>
AuthorDate: Mon Aug 24 17:37:47 2020 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Mon Aug 24 17:44:04 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=7b39f68d

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 <AT> tastytea.de>

 net-im/biboumi/biboumi-9.0_rc1-r1.ebuild           | 100 +++++++++++++++++++++
 .../files/biboumi-9.0_rc1-split-cap-on-space.patch |  70 +++++++++++++++
 2 files changed, 170 insertions(+)

diff --git a/net-im/biboumi/biboumi-9.0_rc1-r1.ebuild 
b/net-im/biboumi/biboumi-9.0_rc1-r1.ebuild
new file mode 100644
index 0000000..93f7451
--- /dev/null
+++ b/net-im/biboumi/biboumi-9.0_rc1-r1.ebuild
@@ -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
+}

diff --git a/net-im/biboumi/files/biboumi-9.0_rc1-split-cap-on-space.patch 
b/net-im/biboumi/files/biboumi-9.0_rc1-split-cap-on-space.patch
new file mode 100644
index 0000000..af86ead
--- /dev/null
+++ b/net-im/biboumi/files/biboumi-9.0_rc1-split-cap-on-space.patch
@@ -0,0 +1,70 @@
+From b98434b5d04d1ada9b24475e17ee8947d96ad1e3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?louiz=E2=80=99?= <[email protected]>
+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 didn’t 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 didn’t 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
+

Reply via email to