public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-im/biboumi/, net-im/biboumi/files/
@ 2022-02-01 10:36 Florian Schmaus
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Schmaus @ 2022-02-01 10:36 UTC (permalink / raw
  To: gentoo-commits

commit:     ceadc1716ca98100b76e0083d0dfae2d9bc6cfc1
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  1 10:35:01 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Tue Feb  1 10:35:16 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ceadc171

net-im/biboumi: initial import

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 net-im/biboumi/Manifest                |   1 +
 net-im/biboumi/biboumi-9.0-r2.ebuild   | 110 +++++++++++++++++++++++++++++++++
 net-im/biboumi/files/biboumi.initd     |  21 +++++++
 net-im/biboumi/files/biboumi.logrotate |  10 +++
 net-im/biboumi/metadata.xml            |  21 +++++++
 5 files changed, 163 insertions(+)

diff --git a/net-im/biboumi/Manifest b/net-im/biboumi/Manifest
new file mode 100644
index 000000000000..34c6c222de56
--- /dev/null
+++ b/net-im/biboumi/Manifest
@@ -0,0 +1 @@
+DIST biboumi-9.0.tar.xz 161192 BLAKE2B 27c19f5c44e23caae07bd579b01d663e73cd8b432203ac95ae77e651936eea7cc443f389e589acebe5b36c32e96f215fdf0a86c97193726d601b53b709a2d66e SHA512 cfaacd831b56031906922472275c55fd6f1a5307ebe54959d21e3799ad4612499e8beeb34e8736df9eabc9fec1a861d17567250d64f316ace47395fd6c8f3c18

diff --git a/net-im/biboumi/biboumi-9.0-r2.ebuild b/net-im/biboumi/biboumi-9.0-r2.ebuild
new file mode 100644
index 000000000000..4f571807cf7e
--- /dev/null
+++ b/net-im/biboumi/biboumi-9.0-r2.ebuild
@@ -0,0 +1,110 @@
+# Copyright 2020-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+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 postgres +sqlite +ssl systemd udns"
+
+DEPEND="
+	dev-libs/expat
+	virtual/libiconv
+	sys-apps/util-linux
+	sqlite? ( dev-db/sqlite:3 )
+	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
+"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DOCS=( README.rst CHANGELOG.rst doc/user.rst )
+
+src_configure() {
+	local mycmakeargs=(
+		-DSERVICE_USER="${PN}"
+		-DSERVICE_GROUP="${PN}"
+	)
+
+	# Account for biboumi's atypical configuration system.
+	if use systemd; then
+		mycmakeargs+=(-DWITH_SYSTEMD=yes)
+	else
+		mycmakeargs+=(-DWITHOUT_SYSTEMD=yes)
+	fi
+
+	if use idn; then
+		mycmakeargs+=(-DWITH_LIBIDN=yes)
+	else
+		mycmakeargs+=(-DWITHOUT_LIBIDN=yes)
+	fi
+
+	if use ssl; then
+		mycmakeargs+=(-DWITH_BOTAN=yes)
+	else
+		mycmakeargs+=(-DWITHOUT_BOTAN=yes)
+	fi
+
+	if use udns; then
+		mycmakeargs+=(-DWITH_UDNS=yes)
+	else
+		mycmakeargs+=(-DWITHOUT_UDNS=yes)
+	fi
+
+	if use sqlite; then
+		mycmakeargs+=(-DWITH_SQLITE3=yes)
+	else
+		mycmakeargs+=(-DWITHOUT_SQLITE3=yes)
+	fi
+
+	if use postgres; then
+		mycmakeargs+=(-DWITH_POSTGRESQL=yes)
+	else
+		mycmakeargs+=(-DWITHOUT_POSTGRESQL=yes)
+	fi
+
+	cmake_src_configure
+}
+
+src_compile() {
+	cmake_src_compile
+
+	cmake_build man
+}
+
+src_install() {
+	cmake_src_install
+
+	newinitd "${FILESDIR}/${PN}.initd" "${PN}"
+
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}/${PN}.logrotate" "${PN}"
+
+	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.initd b/net-im/biboumi/files/biboumi.initd
new file mode 100644
index 000000000000..665db9120c9c
--- /dev/null
+++ b/net-im/biboumi/files/biboumi.initd
@@ -0,0 +1,21 @@
+#!/sbin/openrc-run
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+description="XMPP gateway to IRC"
+pidfile="/var/run/biboumi.pid"
+command="/usr/bin/biboumi"
+command_args="${BIBOUMI_CONFIG:-/etc/biboumi/biboumi.cfg}"
+command_user="${BIBOUMI_USER:-biboumi}"
+command_background="true"
+extra_commands="reload"
+
+depend() {
+	use jabber-server
+}
+
+reload() {
+	ebegin "Reloading configuration of Biboumi"
+	start-stop-daemon --pidfile ${pidfile} --signal USR1
+	eend $?
+}

diff --git a/net-im/biboumi/files/biboumi.logrotate b/net-im/biboumi/files/biboumi.logrotate
new file mode 100644
index 000000000000..19964cf60f3f
--- /dev/null
+++ b/net-im/biboumi/files/biboumi.logrotate
@@ -0,0 +1,10 @@
+/var/log/biboumi/*.log {
+	missingok
+	notifempty
+	sharedscripts
+	postrotate
+		for service in /etc/init.d/biboumi*; do
+			rc-service $(basename ${service}) reload > /dev/null
+		done
+	endscript
+}

diff --git a/net-im/biboumi/metadata.xml b/net-im/biboumi/metadata.xml
new file mode 100644
index 000000000000..cbe709768d65
--- /dev/null
+++ b/net-im/biboumi/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<name>Florian Schmaus</name>
+		<email>flow@gentoo.org</email>
+	</maintainer>
+	<longdescription lang="en">
+		Biboumi is an XMPP gateway that connects to IRC servers and translates
+		between the two protocols. It can be used to access IRC channels using
+		any XMPP client as if these channels were XMPP MUCs.
+	</longdescription>
+	<upstream>
+		<doc>https://doc.biboumi.louiz.org/</doc>
+		<bugs-to> https://lab.louiz.org/louiz/biboumi/-/issues</bugs-to>
+	</upstream>
+	<use>
+		<flag name="udns">Asynchronously resolve domain names using
+		net-libs/udns</flag>
+	</use>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-im/biboumi/, net-im/biboumi/files/
@ 2022-02-27 10:27 Florian Schmaus
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Schmaus @ 2022-02-27 10:27 UTC (permalink / raw
  To: gentoo-commits

commit:     f57017c7b8db7183a8acb80a6292e700c0efd0d6
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 27 10:26:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Sun Feb 27 10:27:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f57017c7

net-im/biboumi: enable src_test

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 net-im/biboumi/biboumi-9.0-r3.ebuild               |  16 +-
 .../files/biboumi-9.0-use-system-catch2.patch      | 229 +++++++++++++++++++++
 2 files changed, 242 insertions(+), 3 deletions(-)

diff --git a/net-im/biboumi/biboumi-9.0-r3.ebuild b/net-im/biboumi/biboumi-9.0-r3.ebuild
index 90caef48feda..9f6fa3b33906 100644
--- a/net-im/biboumi/biboumi-9.0-r3.ebuild
+++ b/net-im/biboumi/biboumi-9.0-r3.ebuild
@@ -14,9 +14,10 @@ SRC_URI="https://git.louiz.org/biboumi/snapshot/biboumi-${MY_PV}.tar.xz"
 LICENSE="ZLIB"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="+idn postgres +sqlite +ssl systemd udns"
+IUSE="+idn postgres +sqlite +ssl systemd test udns"
+RESTRICT="!test? ( test )"
 
-DEPEND="
+COMMON_DEPEND="
 	dev-libs/expat
 	virtual/libiconv
 	sys-apps/util-linux
@@ -28,9 +29,13 @@ DEPEND="
 	!ssl? ( dev-libs/libgcrypt )
 	systemd? ( sys-apps/systemd:= )
 "
+DEPEND="
+	${COMMON_DEPEND}
+	test? ( dev-cpp/catch:0 )
+"
 BDEPEND="dev-python/sphinx"
 RDEPEND="
-	${DEPEND}
+	${COMMON_DEPEND}
 	acct-user/biboumi
 "
 
@@ -40,6 +45,7 @@ DOCS=( README.rst CHANGELOG.rst doc/user.rst )
 
 PATCHES=(
 	"${FILESDIR}/${PN}-9.0-fix-namespace-separator.patch"
+	"${FILESDIR}/${PN}-9.0-use-system-catch2.patch"
 )
 
 src_configure() {
@@ -94,6 +100,10 @@ src_compile() {
 	cmake_build man
 }
 
+src_test() {
+	cmake_build check
+}
+
 src_install() {
 	cmake_src_install
 

diff --git a/net-im/biboumi/files/biboumi-9.0-use-system-catch2.patch b/net-im/biboumi/files/biboumi-9.0-use-system-catch2.patch
new file mode 100644
index 000000000000..edda7a37c50b
--- /dev/null
+++ b/net-im/biboumi/files/biboumi-9.0-use-system-catch2.patch
@@ -0,0 +1,229 @@
+From 414ab9e13fc9e9fa79f7f0a8e1b4a46cd3bd92fd Mon Sep 17 00:00:00 2001
+From: Florian Schmaus <flo@geekplace.eu>
+Date: Sun, 27 Feb 2022 11:06:42 +0100
+Subject: [PATCH] Use the system installation of catch2 if possible
+
+---
+ CMakeLists.txt         | 41 ++++++++++++++++++++++++-----------------
+ tests/colors.cpp       |  2 +-
+ tests/config.cpp       |  2 +-
+ tests/database.cpp     |  2 +-
+ tests/encoding.cpp     |  2 +-
+ tests/iid.cpp          |  2 +-
+ tests/io_tester.cpp    |  2 +-
+ tests/irc.cpp          |  2 +-
+ tests/jid.cpp          |  2 +-
+ tests/logger.cpp       |  2 +-
+ tests/network.cpp      |  2 +-
+ tests/test.cpp         |  2 +-
+ tests/timed_events.cpp |  2 +-
+ tests/utils.cpp        |  2 +-
+ tests/uuid.cpp         |  2 +-
+ tests/xmpp.cpp         |  2 +-
+ 16 files changed, 39 insertions(+), 32 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f07b97feb57b..8175012fe070 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -288,24 +288,31 @@ foreach(file ${source_all})
+ endforeach()
+ 
+ #
+-## Add a rule to download the catch unit test framework
++## Catch unit test framework
+ #
+-include(ExternalProject)
+-ExternalProject_Add(catch
+-  GIT_REPOSITORY "https://lab.louiz.org/louiz/Catch.git"
+-  PREFIX "external"
+-  UPDATE_COMMAND ""
+-  CONFIGURE_COMMAND ""
+-  BUILD_COMMAND ""
+-  INSTALL_COMMAND ""
+-  )
+-set_target_properties(catch PROPERTIES EXCLUDE_FROM_ALL TRUE)
+-ExternalProject_Get_Property(catch SOURCE_DIR)
+-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
+-  target_include_directories(test_suite
+-    PUBLIC "${SOURCE_DIR}/single_include/"
+-    )
+-  add_dependencies(test_suite catch)
++find_package(Catch2 2.2.1)
++if(Catch2_FOUND)
++  target_link_libraries(test_suite Catch2::Catch2)
++else()
++  # No system-wide installation of the catch unit test framework was
++  # found, download it.
++  include(ExternalProject)
++  ExternalProject_Add(catch
++	GIT_REPOSITORY "https://lab.louiz.org/louiz/Catch.git"
++	PREFIX "external"
++	UPDATE_COMMAND ""
++	CONFIGURE_COMMAND ""
++	BUILD_COMMAND ""
++	INSTALL_COMMAND ""
++	)
++  set_target_properties(catch PROPERTIES EXCLUDE_FROM_ALL TRUE)
++  ExternalProject_Get_Property(catch SOURCE_DIR)
++  if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
++	target_include_directories(test_suite
++      PUBLIC "${SOURCE_DIR}/single_include/"
++      )
++	add_dependencies(test_suite catch)
++  endif()
+ endif()
+ 
+ #
+diff --git a/tests/colors.cpp b/tests/colors.cpp
+index bf529896dce7..a9761dfff648 100644
+--- a/tests/colors.cpp
++++ b/tests/colors.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <bridge/colors.hpp>
+ #include <xmpp/xmpp_stanza.hpp>
+diff --git a/tests/config.cpp b/tests/config.cpp
+index ec9844fbd5f6..76cfe92e3e51 100644
+--- a/tests/config.cpp
++++ b/tests/config.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ #include "io_tester.hpp"
+ 
+ #include <iostream>
+diff --git a/tests/database.cpp b/tests/database.cpp
+index 070a46013997..bf6bc20324cb 100644
+--- a/tests/database.cpp
++++ b/tests/database.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <biboumi.h>
+ 
+diff --git a/tests/encoding.cpp b/tests/encoding.cpp
+index b5192ffbdb8d..8129abc9230e 100644
+--- a/tests/encoding.cpp
++++ b/tests/encoding.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <utils/encoding.hpp>
+ 
+diff --git a/tests/iid.cpp b/tests/iid.cpp
+index 63b2ba38ca55..7e61f35e348b 100644
+--- a/tests/iid.cpp
++++ b/tests/iid.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <irc/iid.hpp>
+ #include <irc/irc_user.hpp>
+diff --git a/tests/io_tester.cpp b/tests/io_tester.cpp
+index 19c97c91aff8..34f89fdac603 100644
+--- a/tests/io_tester.cpp
++++ b/tests/io_tester.cpp
+@@ -1,5 +1,5 @@
+ #include "io_tester.hpp"
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ #include <iostream>
+ 
+ /**
+diff --git a/tests/irc.cpp b/tests/irc.cpp
+index 0f30f15e2fdf..cb53e3f226ff 100644
+--- a/tests/irc.cpp
++++ b/tests/irc.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <irc/irc_message.hpp>
+ 
+diff --git a/tests/jid.cpp b/tests/jid.cpp
+index 592d6f3d0b78..516f961fabbb 100644
+--- a/tests/jid.cpp
++++ b/tests/jid.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <xmpp/jid.hpp>
+ #include <biboumi.h>
+diff --git a/tests/logger.cpp b/tests/logger.cpp
+index 1e3392a4bd43..b4736da3648d 100644
+--- a/tests/logger.cpp
++++ b/tests/logger.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <logger/logger.hpp>
+ #include <config/config.hpp>
+diff --git a/tests/network.cpp b/tests/network.cpp
+index a52eb6acfef8..790190f8d0bf 100644
+--- a/tests/network.cpp
++++ b/tests/network.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ #include <network/tls_policy.hpp>
+ #include <sstream>
+ 
+diff --git a/tests/test.cpp b/tests/test.cpp
+index 0c7c351f437f..62bf7476a189 100644
+--- a/tests/test.cpp
++++ b/tests/test.cpp
+@@ -1,2 +1,2 @@
+ #define CATCH_CONFIG_MAIN
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+diff --git a/tests/timed_events.cpp b/tests/timed_events.cpp
+index fece422e99d5..6eaf99b3e1b9 100644
+--- a/tests/timed_events.cpp
++++ b/tests/timed_events.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <utils/timed_events.hpp>
+ 
+diff --git a/tests/utils.cpp b/tests/utils.cpp
+index 6151733e7cf4..22b45cf3113b 100644
+--- a/tests/utils.cpp
++++ b/tests/utils.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <utils/tolower.hpp>
+ #include <utils/revstr.hpp>
+diff --git a/tests/uuid.cpp b/tests/uuid.cpp
+index 12c6c32adbeb..7720e3aaee30 100644
+--- a/tests/uuid.cpp
++++ b/tests/uuid.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <xmpp/xmpp_component.hpp>
+ 
+diff --git a/tests/xmpp.cpp b/tests/xmpp.cpp
+index 14c51daa460f..01508a63481d 100644
+--- a/tests/xmpp.cpp
++++ b/tests/xmpp.cpp
+@@ -1,4 +1,4 @@
+-#include "catch.hpp"
++#include "catch2/catch.hpp"
+ 
+ #include <xmpp/xmpp_parser.hpp>
+ #include <xmpp/auth.hpp>
+-- 
+2.34.1
+


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-im/biboumi/, net-im/biboumi/files/
@ 2022-03-14 11:28 Florian Schmaus
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Schmaus @ 2022-03-14 11:28 UTC (permalink / raw
  To: gentoo-commits

commit:     d7d34d7858864fd5d350e5de430656f82b3ccc59
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 14 11:22:12 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 11:22:55 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7d34d78

net-im/biboumi: apply official fix for expact issue

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 ...biboumi-9.0-r3.ebuild => biboumi-9.0-r4.ebuild} |   2 +-
 ...t-use-as-a-namespace-separator-with-expat.patch | 301 +++++++++++++++++++++
 .../biboumi-9.0-fix-namespace-separator.patch      |  57 ----
 3 files changed, 302 insertions(+), 58 deletions(-)

diff --git a/net-im/biboumi/biboumi-9.0-r3.ebuild b/net-im/biboumi/biboumi-9.0-r4.ebuild
similarity index 96%
rename from net-im/biboumi/biboumi-9.0-r3.ebuild
rename to net-im/biboumi/biboumi-9.0-r4.ebuild
index 9f6fa3b33906..2c45760b3892 100644
--- a/net-im/biboumi/biboumi-9.0-r3.ebuild
+++ b/net-im/biboumi/biboumi-9.0-r4.ebuild
@@ -44,7 +44,7 @@ S="${WORKDIR}/${PN}-${MY_PV}"
 DOCS=( README.rst CHANGELOG.rst doc/user.rst )
 
 PATCHES=(
-	"${FILESDIR}/${PN}-9.0-fix-namespace-separator.patch"
+	"${FILESDIR}/${PN}-9.0-do-not-use-as-a-namespace-separator-with-expat.patch"
 	"${FILESDIR}/${PN}-9.0-use-system-catch2.patch"
 )
 

diff --git a/net-im/biboumi/files/biboumi-9.0-do-not-use-as-a-namespace-separator-with-expat.patch b/net-im/biboumi/files/biboumi-9.0-do-not-use-as-a-namespace-separator-with-expat.patch
new file mode 100644
index 000000000000..f82cbae81928
--- /dev/null
+++ b/net-im/biboumi/files/biboumi-9.0-do-not-use-as-a-namespace-separator-with-expat.patch
@@ -0,0 +1,301 @@
+From 0061298dd0945f7f67e7fa340c6649b179c804d5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?louiz=E2=80=99?= <louiz@louiz.org>
+Date: Thu, 10 Mar 2022 23:23:47 +0100
+Subject: [PATCH] Do not use ':' as a namespace separator with expat
+
+Instead use \1, and build our own nodes by explicitely separating the
+namespace and the node name.
+---
+ src/xmpp/adhoc_command.cpp          |  6 +++---
+ src/xmpp/adhoc_commands_handler.cpp | 12 ++++++------
+ src/xmpp/biboumi_adhoc_commands.cpp | 28 ++++++++++++++--------------
+ src/xmpp/xmpp_component.cpp         |  2 +-
+ src/xmpp/xmpp_parser.cpp            |  2 +-
+ src/xmpp/xmpp_parser.hpp            |  4 ++--
+ src/xmpp/xmpp_stanza.cpp            | 14 +++++++++++++-
+ src/xmpp/xmpp_stanza.hpp            |  6 ++++++
+ tests/xmpp.cpp                      |  2 ++
+ 9 files changed, 48 insertions(+), 28 deletions(-)
+
+diff --git a/src/xmpp/adhoc_command.cpp b/src/xmpp/adhoc_command.cpp
+index fbf4ce200b82..f8c8e4f146d6 100644
+--- a/src/xmpp/adhoc_command.cpp
++++ b/src/xmpp/adhoc_command.cpp
+@@ -26,7 +26,7 @@ void PingStep1(XmppComponent&, AdhocSession&, XmlNode& command_node)
+ 
+ void HelloStep1(XmppComponent&, AdhocSession&, XmlNode& command_node)
+ {
+-  XmlSubNode x(command_node, "jabber:x:data:x");
++  XmlSubNode x(command_node, "jabber:x:data", "x");
+   x["type"] = "form";
+   XmlSubNode title(x, "title");
+   title.set_inner("Configure your name.");
+@@ -65,9 +65,9 @@ void HelloStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node)
+         }
+     }
+   command_node.delete_all_children();
+-  XmlSubNode error(command_node, ADHOC_NS":error");
++  XmlSubNode error(command_node, ADHOC_NS, "error");
+   error["type"] = "modify";
+-  XmlSubNode condition(error, STANZA_NS":bad-request");
++  XmlSubNode condition(error, STANZA_NS, "bad-request");
+   session.terminate();
+ }
+ 
+diff --git a/src/xmpp/adhoc_commands_handler.cpp b/src/xmpp/adhoc_commands_handler.cpp
+index ff4c1e5506fb..7a84b2e11a45 100644
+--- a/src/xmpp/adhoc_commands_handler.cpp
++++ b/src/xmpp/adhoc_commands_handler.cpp
+@@ -36,16 +36,16 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
+   auto command_it = this->commands.find(node);
+   if (command_it == this->commands.end())
+     {
+-      XmlSubNode error(command_node, ADHOC_NS":error");
++      XmlSubNode error(command_node, ADHOC_NS, "error");
+       error["type"] = "cancel";
+-      XmlSubNode condition(error, STANZA_NS":item-not-found");
++      XmlSubNode condition(error, STANZA_NS, "item-not-found");
+     }
+   else if (command_it->second.is_admin_only() &&
+            !Config::is_in_list("admin", jid.bare()))
+     {
+-      XmlSubNode error(command_node, ADHOC_NS":error");
++      XmlSubNode error(command_node, ADHOC_NS, "error");
+       error["type"] = "cancel";
+-      XmlSubNode condition(error, STANZA_NS":forbidden");
++      XmlSubNode condition(error, STANZA_NS, "forbidden");
+     }
+   else
+     {
+@@ -94,9 +94,9 @@ XmlNode AdhocCommandsHandler::handle_request(const std::string& executor_jid, co
+         }
+       else                      // unsupported action
+         {
+-          XmlSubNode error(command_node, ADHOC_NS":error");
++          XmlSubNode error(command_node, ADHOC_NS, "error");
+           error["type"] = "modify";
+-          XmlSubNode condition(error, STANZA_NS":bad-request");
++          XmlSubNode condition(error, STANZA_NS, "bad-request");
+         }
+     }
+   return command_node;
+diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp
+index 792955c37ec7..aea316d64042 100644
+--- a/src/xmpp/biboumi_adhoc_commands.cpp
++++ b/src/xmpp/biboumi_adhoc_commands.cpp
+@@ -34,7 +34,7 @@ void DisconnectUserStep1(XmppComponent& xmpp_component, AdhocSession&, XmlNode&
+ {
+   auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
+ 
+-  XmlSubNode x(command_node, "jabber:x:data:x");
++  XmlSubNode x(command_node, "jabber:x:data", "x");
+   x["type"] = "form";
+   XmlSubNode title(x, "title");
+   title.set_inner("Disconnect a user from the gateway");
+@@ -108,9 +108,9 @@ void DisconnectUserStep2(XmppComponent& xmpp_component, AdhocSession& session, X
+           return;
+         }
+     }
+-  XmlSubNode error(command_node, ADHOC_NS":error");
++  XmlSubNode error(command_node, ADHOC_NS, "error");
+   error["type"] = "modify";
+-  XmlSubNode condition(error, STANZA_NS":bad-request");
++  XmlSubNode condition(error, STANZA_NS, "bad-request");
+   session.terminate();
+ }
+ 
+@@ -124,7 +124,7 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
+   auto options = Database::get_global_options(owner.bare());
+ 
+   command_node.delete_all_children();
+-  XmlSubNode x(command_node, "jabber:x:data:x");
++  XmlSubNode x(command_node, "jabber:x:data", "x");
+   x["type"] = "form";
+   XmlSubNode title(x, "title");
+   title.set_inner("Configure some global default settings.");
+@@ -220,9 +220,9 @@ void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session,
+       note.set_inner("Configuration successfully applied.");
+       return;
+     }
+-  XmlSubNode error(command_node, ADHOC_NS":error");
++  XmlSubNode error(command_node, ADHOC_NS, "error");
+   error["type"] = "modify";
+-  XmlSubNode condition(error, STANZA_NS":bad-request");
++  XmlSubNode condition(error, STANZA_NS, "bad-request");
+   session.terminate();
+ }
+ 
+@@ -238,7 +238,7 @@ void ConfigureIrcServerStep1(XmppComponent&, AdhocSession& session, XmlNode& com
+   auto commands = Database::get_after_connection_commands(options);
+ 
+   command_node.delete_all_children();
+-  XmlSubNode x(command_node, "jabber:x:data:x");
++  XmlSubNode x(command_node, "jabber:x:data", "x");
+   x["type"] = "form";
+   XmlSubNode title(x, "title");
+   title.set_inner("Configure the IRC server " + server_domain);
+@@ -565,9 +565,9 @@ void ConfigureIrcServerStep2(XmppComponent& xmpp_component, AdhocSession& sessio
+       note.set_inner("Configuration successfully applied.");
+       return;
+     }
+-  XmlSubNode error(command_node, ADHOC_NS":error");
++  XmlSubNode error(command_node, ADHOC_NS, "error");
+   error["type"] = "modify";
+-  XmlSubNode condition(error, STANZA_NS":bad-request");
++  XmlSubNode condition(error, STANZA_NS, "bad-request");
+   session.terminate();
+ }
+ 
+@@ -586,7 +586,7 @@ void insert_irc_channel_configuration_form(XmlNode& node, const Jid& requester,
+   auto options = Database::get_irc_channel_options_with_server_default(requester.local + "@" + requester.domain,
+                                                                        iid.get_server(), iid.get_local());
+   node.delete_all_children();
+-  XmlSubNode x(node, "jabber:x:data:x");
++  XmlSubNode x(node, "jabber:x:data", "x");
+   x["type"] = "form";
+   XmlSubNode title(x, "title");
+   title.set_inner("Configure the IRC channel " + iid.get_local() + " on server " + iid.get_server());
+@@ -671,9 +671,9 @@ void ConfigureIrcChannelStep2(XmppComponent& xmpp_component, AdhocSession& sessi
+     }
+   else
+     {
+-      XmlSubNode error(command_node, ADHOC_NS":error");
++      XmlSubNode error(command_node, ADHOC_NS, "error");
+       error["type"] = "modify";
+-      XmlSubNode condition(error, STANZA_NS":bad-request");
++      XmlSubNode condition(error, STANZA_NS, "bad-request");
+       session.terminate();
+     }
+ }
+@@ -749,7 +749,7 @@ void DisconnectUserFromServerStep1(XmppComponent& xmpp_component, AdhocSession&
+     { // Send a form to select the user to disconnect
+       auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
+ 
+-      XmlSubNode x(command_node, "jabber:x:data:x");
++      XmlSubNode x(command_node, "jabber:x:data", "x");
+       x["type"] = "form";
+       XmlSubNode title(x, "title");
+       title.set_inner("Disconnect a user from selected IRC servers");
+@@ -794,7 +794,7 @@ void DisconnectUserFromServerStep2(XmppComponent& xmpp_component, AdhocSession&
+   command_node.delete_all_children();
+   auto& biboumi_component = dynamic_cast<BiboumiComponent&>(xmpp_component);
+ 
+-  XmlSubNode x(command_node, "jabber:x:data:x");
++  XmlSubNode x(command_node, "jabber:x:data", "x");
+   x["type"] = "form";
+   XmlSubNode title(x, "title");
+   title.set_inner("Disconnect a user from selected IRC servers");
+diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
+index de9a7a631be6..62a98ce3bb2c 100644
+--- a/src/xmpp/xmpp_component.cpp
++++ b/src/xmpp/xmpp_component.cpp
+@@ -175,7 +175,7 @@ void XmppComponent::on_stanza(const Stanza& stanza)
+ 
+ void XmppComponent::send_stream_error(const std::string& name, const std::string& explanation)
+ {
+-  Stanza node("stream:error");
++  Stanza node("stream", "error");
+   {
+     XmlSubNode error(node, name);
+     error["xmlns"] = STREAM_NS;
+diff --git a/src/xmpp/xmpp_parser.cpp b/src/xmpp/xmpp_parser.cpp
+index 781fe4cd94b0..1f25fa6f982b 100644
+--- a/src/xmpp/xmpp_parser.cpp
++++ b/src/xmpp/xmpp_parser.cpp
+@@ -38,7 +38,7 @@ XmppParser::XmppParser():
+ void XmppParser::init_xml_parser()
+ {
+   // Create the expat parser
+-  this->parser = XML_ParserCreateNS("UTF-8", ':');
++  this->parser = XML_ParserCreateNS("UTF-8", '\1');
+   XML_SetUserData(this->parser, static_cast<void*>(this));
+ 
+   // Install Expat handlers
+diff --git a/src/xmpp/xmpp_parser.hpp b/src/xmpp/xmpp_parser.hpp
+index ec42f9a326e1..1e5e4e55a875 100644
+--- a/src/xmpp/xmpp_parser.hpp
++++ b/src/xmpp/xmpp_parser.hpp
+@@ -18,9 +18,9 @@
+  * stanza is reasonnably short.
+  *
+  * The element names generated by expat contain the namespace of the
+- * element, a colon (':') and then the actual name of the element.  To get
++ * element, a \1 separator and then the actual name of the element.  To get
+  * an element "x" with a namespace of "http://jabber.org/protocol/muc", you
+- * just look for an XmlNode named "http://jabber.org/protocol/muc:x"
++ * just look for an XmlNode named "http://jabber.org/protocol/muc\1x"
+  *
+  * TODO: enforce the size-limit for the stanza (limit the number of childs
+  * it can contain). For example forbid the parser going further than level
+diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp
+index 435f33313b09..0103dd71a357 100644
+--- a/src/xmpp/xmpp_stanza.cpp
++++ b/src/xmpp/xmpp_stanza.cpp
+@@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent):
+   parent(parent)
+ {
+   // split the namespace and the name
+-  auto n = name.rfind(':');
++  auto n = name.rfind('\1');
+   if (n == std::string::npos)
+     this->name = name;
+   else
+@@ -67,6 +67,18 @@ XmlNode::XmlNode(const std::string& name):
+ {
+ }
+ 
++XmlNode::XmlNode(const std::string& xmlns, const std::string& name, XmlNode* parent):
++    name(name),
++    parent(parent)
++{
++  this->attributes["xmlns"] = xmlns;
++}
++
++XmlNode::XmlNode(const std::string& xmlns, const std::string& name):
++    XmlNode(xmlns, name, nullptr)
++{
++}
++
+ void XmlNode::delete_all_children()
+ {
+   this->children.clear();
+diff --git a/src/xmpp/xmpp_stanza.hpp b/src/xmpp/xmpp_stanza.hpp
+index f4b394814e5b..a706337baca0 100644
+--- a/src/xmpp/xmpp_stanza.hpp
++++ b/src/xmpp/xmpp_stanza.hpp
+@@ -25,6 +25,8 @@ class XmlNode
+ public:
+   explicit XmlNode(const std::string& name, XmlNode* parent);
+   explicit XmlNode(const std::string& name);
++  explicit XmlNode(const std::string& xmlns, const std::string& name, XmlNode* parent);
++  explicit XmlNode(const std::string& xmlns, const std::string& name);
+   /**
+    * The copy constructor does not copy the parent attribute. The children
+    * nodes are all copied recursively.
+@@ -150,6 +152,10 @@ public:
+             XmlNode(name),
+             parent_to_add(parent_ref)
+     {}
++    XmlSubNode(XmlNode& parent_ref, const std::string& xmlns, const std::string& name):
++        XmlNode(xmlns, name),
++        parent_to_add(parent_ref)
++    {}
+ 
+     ~XmlSubNode()
+     {
+diff --git a/tests/xmpp.cpp b/tests/xmpp.cpp
+index 14c51daa460f..c49c2fda94ea 100644
+--- a/tests/xmpp.cpp
++++ b/tests/xmpp.cpp
+@@ -67,6 +67,8 @@ TEST_CASE("substanzas")
+       CHECK(!d.has_children());
+     }
+     CHECK(b.has_children());
++    XmlSubNode e(a, "namespace", "name");
++    CHECK(e.get_tag("xmlns") == "namespace");
+   }
+   CHECK(a.has_children());
+ }
+-- 
+2.34.1
+

diff --git a/net-im/biboumi/files/biboumi-9.0-fix-namespace-separator.patch b/net-im/biboumi/files/biboumi-9.0-fix-namespace-separator.patch
deleted file mode 100644
index 507382f66f67..000000000000
--- a/net-im/biboumi/files/biboumi-9.0-fix-namespace-separator.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 380abf66e930f5c4ead591014f31624d80a3151c Mon Sep 17 00:00:00 2001
-From: Florian Schmaus <flo@geekplace.eu>
-Date: Sat, 26 Feb 2022 21:41:34 +0100
-Subject: [PATCH] Fix bad namespace separator
-
-Fixes: https://lab.louiz.org/louiz/biboumi/-/issues/3465
----
- src/xmpp/xmpp_parser.cpp | 2 +-
- src/xmpp/xmpp_parser.hpp | 4 ++--
- src/xmpp/xmpp_stanza.cpp | 2 +-
- 3 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/xmpp/xmpp_parser.cpp b/src/xmpp/xmpp_parser.cpp
-index 781fe4cd94b0..1f25fa6f982b 100644
---- a/src/xmpp/xmpp_parser.cpp
-+++ b/src/xmpp/xmpp_parser.cpp
-@@ -38,7 +38,7 @@ XmppParser::XmppParser():
- void XmppParser::init_xml_parser()
- {
-   // Create the expat parser
--  this->parser = XML_ParserCreateNS("UTF-8", ':');
-+  this->parser = XML_ParserCreateNS("UTF-8", '\1');
-   XML_SetUserData(this->parser, static_cast<void*>(this));
- 
-   // Install Expat handlers
-diff --git a/src/xmpp/xmpp_parser.hpp b/src/xmpp/xmpp_parser.hpp
-index ec42f9a326e1..1e5e4e55a875 100644
---- a/src/xmpp/xmpp_parser.hpp
-+++ b/src/xmpp/xmpp_parser.hpp
-@@ -18,9 +18,9 @@
-  * stanza is reasonnably short.
-  *
-  * The element names generated by expat contain the namespace of the
-- * element, a colon (':') and then the actual name of the element.  To get
-+ * element, a \1 separator and then the actual name of the element.  To get
-  * an element "x" with a namespace of "http://jabber.org/protocol/muc", you
-- * just look for an XmlNode named "http://jabber.org/protocol/muc:x"
-+ * just look for an XmlNode named "http://jabber.org/protocol/muc\1x"
-  *
-  * TODO: enforce the size-limit for the stanza (limit the number of childs
-  * it can contain). For example forbid the parser going further than level
-diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp
-index 435f33313b09..bd668cf2f28d 100644
---- a/src/xmpp/xmpp_stanza.cpp
-+++ b/src/xmpp/xmpp_stanza.cpp
-@@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent):
-   parent(parent)
- {
-   // split the namespace and the name
--  auto n = name.rfind(':');
-+  auto n = name.rfind('\1');
-   if (n == std::string::npos)
-     this->name = name;
-   else
--- 
-2.34.1
-


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-14 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-27 10:27 [gentoo-commits] repo/gentoo:master commit in: net-im/biboumi/, net-im/biboumi/files/ Florian Schmaus
  -- strict thread matches above, loose matches on Subject: below --
2022-03-14 11:28 Florian Schmaus
2022-02-01 10:36 Florian Schmaus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox