Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ibis for openSUSE:Factory checked in at 2025-05-22 16:56:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ibis (Old) and /work/SRC/openSUSE:Factory/.ibis.new.2732 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ibis" Thu May 22 16:56:26 2025 rev:6 rq:1279016 version:0.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ibis/ibis.changes 2025-04-03 16:51:21.698625288 +0200 +++ /work/SRC/openSUSE:Factory/.ibis.new.2732/ibis.changes 2025-05-22 16:56:45.853644129 +0200 @@ -1,0 +2,10 @@ +Wed May 21 10:01:40 UTC 2025 - Richard Rahl <rra...@opensuse.org> + +- update to 0.14.0: + * Make sure the documentation lists all of our dependencies + * Annotate Ibis.Message.parse as a constructor + * Make the IBIS_FORMAT_ constants public + * Add helpers for handling hosts for DCC messages + * Implement client side pings + +------------------------------------------------------------------- Old: ---- ibis-0.13.1.tar.xz ibis-0.13.1.tar.xz.asc New: ---- ibis-0.14.0.tar.xz ibis-0.14.0.tar.xz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ibis.spec ++++++ --- /var/tmp/diff_new_pack.zRsfcM/_old 2025-05-22 16:56:46.493671065 +0200 +++ /var/tmp/diff_new_pack.zRsfcM/_new 2025-05-22 16:56:46.493671065 +0200 @@ -18,13 +18,13 @@ %define sover 0 Name: ibis -Version: 0.13.1 +Version: 0.14.0 Release: 0 Summary: Gobject based library License: GPL-2.0-or-later URL: https://keep.imfreedom.org/ibis/ibis -Source0: https://downloads.sf.net/pidgin/%{name}/%{name}-%{version}.tar.xz -Source1: https://downloads.sf.net/pidgin/%{name}/%{name}-%{version}.tar.xz.asc +Source0: https://downloads.sf.net/pidgin/%{name}-%{version}.tar.xz +Source1: https://downloads.sf.net/pidgin/%{name}-%{version}.tar.xz.asc Source2: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x40de1dc7288fe3f50ab938c548f66affd9bdb729#/%{name}.keyring BuildRequires: meson BuildRequires: pkgconfig ++++++ ibis-0.13.1.tar.xz -> ibis-0.14.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/.hg_archival.txt new/ibis-0.14.0/.hg_archival.txt --- old/ibis-0.13.1/.hg_archival.txt 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/.hg_archival.txt 2025-05-01 01:18:52.000000000 +0200 @@ -1,4 +1,4 @@ repo: ee571f6e8e7556786ca8029199b9a669e850c8cb -node: 7eab1ce2c21a22c6c6a6b73bd9ca8fd2d157d7d3 +node: 9e6fca7a14f9aee6546b430196244e3d66a9822b branch: default -tag: v0.13.1 +tag: v0.14.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ChangeLog new/ibis-0.14.0/ChangeLog --- old/ibis-0.13.1/ChangeLog 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ChangeLog 2025-05-01 01:18:52.000000000 +0200 @@ -1,3 +1,14 @@ +0.14.0: 2025-04-30 + * Make sure the documentation lists all of our dependencies (RR 3959) (Gary + Kramlich) + * Fix a compiler error on OpenBSD (RR 3958) (Gary Kramlich) + * Add pango to our debian build container (RR 3961) (Gary Kramlich) + * Annotate Ibis.Message.parse as a constructor (RR 3977) (Gary Kramlich) + * Make the IBIS_FORMAT_ constants public (IBIS-54) (RR 3979) (Gary Kramlich) + * Add helpers for handling hosts for DCC messages (IBIS-55) (RR 3980) (Gary + Kramlich) + * Implement client side pings (IBIS-28) (RR 3984) (Gary Kramlich) + 0.13.1: 2025-03-31 * Fix a few issues with formatting (RR 3940) (Gary Kramlich) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/containers/Dockerfile.debian-trixie-amd64 new/ibis-0.14.0/containers/Dockerfile.debian-trixie-amd64 --- old/ibis-0.13.1/containers/Dockerfile.debian-trixie-amd64 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/containers/Dockerfile.debian-trixie-amd64 2025-05-01 01:18:52.000000000 +0200 @@ -13,6 +13,7 @@ libgirepository1.0-dev \ libglib2.0-dev \ libidn11-dev \ + libpango1.0-dev \ mercurial \ meson \ python3-jinja2 \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisclient.c new/ibis-0.14.0/ibis/ibisclient.c --- old/ibis-0.13.1/ibis/ibisclient.c 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibisclient.c 2025-05-01 01:18:52.000000000 +0200 @@ -48,6 +48,7 @@ PROP_REGISTERED, PROP_USERNAME, PROP_HASL_CONTEXT, + PROP_CLIENT_PING_TIMEOUT, N_PROPERTIES, }; static GParamSpec *properties[N_PROPERTIES] = {NULL, }; @@ -103,10 +104,22 @@ /* A regex for matching mode strings. */ GRegex *mode_string_regex; + + /* Client side ping fields. */ + guint client_ping_timeout; + guint client_ping_source; + char *client_ping_token; }; G_DEFINE_QUARK(ibis-client-error, ibis_client_error) +#define IBIS_CLIENT_DEFAULT_CLIENT_PING_TIMEOUT 300 + +/****************************************************************************** + * Prototypes + *****************************************************************************/ +static void ibis_client_client_ping_cb(gpointer data); + /****************************************************************************** * Helpers *****************************************************************************/ @@ -381,10 +394,52 @@ } } +static void +ibis_client_schedule_client_ping(IbisClient *client) { + g_clear_handle_id(&client->client_ping_source, g_source_remove); + + client->client_ping_source = g_timeout_add_seconds_once(client->client_ping_timeout, + ibis_client_client_ping_cb, + client); +} + /****************************************************************************** * Callbacks *****************************************************************************/ static void +ibis_client_client_ping_cb(gpointer data) { + IbisClient *client = data; + + /* If we don't have a ping token we haven't sent a ping message yet. So we + * need to do that now. + */ + if(ibis_str_is_empty(client->client_ping_token)) { + IbisMessage *message = NULL; + guint32 token = 0; + + token = g_random_int_range(0x3fffffff, 0x7fffffff); + client->client_ping_token = g_strdup_printf("%u", token); + + message = ibis_message_new(IBIS_MSG_PING); + ibis_message_set_params(message, client->client_ping_token, NULL); + + ibis_client_write(client, message); + ibis_client_schedule_client_ping(client); + } else { + /* We still have a ping token which means we didn't get a response, so + * we need to disconnect with an error. + */ + + GError *error = NULL; + + error = g_error_new_literal(IBIS_CLIENT_ERROR, + IBIS_CLIENT_ERROR_NO_RESPONSE_FROM_SERVER, + "the server stopped responding"); + ibis_client_disconnect(client, error, NULL); + } +} + +static void ibis_client_capabilities_ready_cb(IbisCapabilities *capabilities, G_GNUC_UNUSED gpointer data) { @@ -524,6 +579,23 @@ g_free(nick); } + /* If we've received anything from the server, we can clear our client + * ping timeout. + */ + if(!ibis_str_is_empty(client->client_ping_token) && + ibis_str_equal(command, IBIS_MSG_PONG)) + { + GStrv params = ibis_message_get_params(message); + guint n_params = g_strv_length(params); + + if(n_params == 1 && + ibis_str_equal(params[0], client->client_ping_token)) + { + g_clear_pointer(&client->client_ping_token, g_free); + } + } + ibis_client_schedule_client_ping(client); + tags = ibis_message_get_tags(message); reference_tag = ibis_tags_lookup(tags, IBIS_TAG_BATCH); if(!ibis_str_is_empty(reference_tag)) { @@ -793,6 +865,9 @@ g_clear_pointer(&client->mode_string_regex, g_regex_unref); + g_clear_handle_id(&client->client_ping_source, g_source_remove); + g_clear_pointer(&client->client_ping_token, g_free); + G_OBJECT_CLASS(ibis_client_parent_class)->finalize(obj); } @@ -842,6 +917,9 @@ case PROP_HASL_CONTEXT: g_value_set_object(value, ibis_client_get_hasl_context(client)); break; + case PROP_CLIENT_PING_TIMEOUT: + g_value_set_uint(value, ibis_client_get_client_ping_timeout(client)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); break; @@ -870,6 +948,9 @@ case PROP_HASL_CONTEXT: ibis_client_set_hasl_context(client, g_value_get_object(value)); break; + case PROP_CLIENT_PING_TIMEOUT: + ibis_client_set_client_ping_timeout(client, g_value_get_uint(value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); break; @@ -880,6 +961,7 @@ ibis_client_init(IbisClient *client) { GError *error = NULL; + client->client_ping_timeout = IBIS_CLIENT_DEFAULT_CLIENT_PING_TIMEOUT; client->message_tags_negotiated = FALSE; client->capabilities = ibis_capabilities_new(); @@ -1102,6 +1184,22 @@ HASL_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + /** + * IbisClient:client-ping-timeout: + * + * The timeout in seconds to ping the server. + * + * If the server hasn't sent a message in this many seconds, the client + * will send a ping message to the server. If the server doesn't respond + * in this many seconds, the client will disconnect with an error. + * + * Since: 0.14 + */ + properties[PROP_CLIENT_PING_TIMEOUT] = g_param_spec_uint( + "client-ping-timeout", NULL, NULL, + 1, 3600, IBIS_CLIENT_DEFAULT_CLIENT_PING_TIMEOUT, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_properties(obj_class, N_PROPERTIES, properties); /** @@ -1298,6 +1396,14 @@ return client->capabilities; } +guint +ibis_client_get_client_ping_timeout(IbisClient *client) { + g_return_val_if_fail(IBIS_IS_CLIENT(client), + IBIS_CLIENT_DEFAULT_CLIENT_PING_TIMEOUT); + + return client->client_ping_timeout; +} + gboolean ibis_client_get_connected(IbisClient *client) { g_return_val_if_fail(IBIS_IS_CLIENT(client), FALSE); @@ -1577,6 +1683,19 @@ } void +ibis_client_set_client_ping_timeout(IbisClient *client, guint seconds) { + g_return_if_fail(IBIS_IS_CLIENT(client)); + g_return_if_fail(seconds > 0); + + if(client->client_ping_timeout != seconds) { + client->client_ping_timeout = seconds; + + g_object_notify_by_pspec(G_OBJECT(client), + properties[PROP_CLIENT_PING_TIMEOUT]); + } +} + +void ibis_client_start(IbisClient *client, GIOStream *stream, const char *password, GCancellable *cancellable) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisclient.h new/ibis-0.14.0/ibis/ibisclient.h --- old/ibis-0.13.1/ibis/ibisclient.h 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibisclient.h 2025-05-01 01:18:52.000000000 +0200 @@ -60,6 +60,8 @@ * parameters were provided to fully parse the mode string. * @IBIS_CLIENT_ERROR_PARSE_MODE_STRING_TOO_MANY_PARAMETERS: more parameters * were given than the mode string called for. + * @IBIS_CLIENT_ERROR_NO_RESPONSE_FROM_SERVER: a ping was sent to the server, + * but it did not respond. * * Error codes returned by the client. * @@ -70,6 +72,7 @@ IBIS_CLIENT_ERROR_NO_MORE_NICKS IBIS_AVAILABLE_ENUMERATOR_IN_0_12, IBIS_CLIENT_ERROR_PARSE_MODE_STRING_NOT_ENOUGH_PARAMETERS IBIS_AVAILABLE_ENUMERATOR_IN_0_12, IBIS_CLIENT_ERROR_PARSE_MODE_STRING_TOO_MANY_PARAMETERS IBIS_AVAILABLE_ENUMERATOR_IN_0_12, + IBIS_CLIENT_ERROR_NO_RESPONSE_FROM_SERVER IBIS_AVAILABLE_ENUMERATOR_IN_0_14, } IbisClientError; /** @@ -105,6 +108,11 @@ * will need to return %FALSE to let the default handler implement this * feature. * + * The client also implements client pings which will be sent if no data is + * received from the server for [property@Client:client-ping-timeout] seconds. + * If no response is received before that number of seconds again, then the + * client will be disconnected with an error. + * * Since: 0.1 */ @@ -211,6 +219,18 @@ IbisCapabilities *ibis_client_get_capabilities(IbisClient *client); /** + * ibis_client_get_client_ping_timeout: + * + * Gets the client ping timeout in seconds. + * + * Returns: The number of seconds to wait before sending a client ping. + * + * Since: 0.14 + */ +IBIS_AVAILABLE_IN_0_14 +guint ibis_client_get_client_ping_timeout(IbisClient *client); + +/** * ibis_client_get_connected: * * Gets whether or not @client is currently connected. @@ -476,6 +496,19 @@ IbisModeChange *ibis_client_parse_mode_string(IbisClient *client, const char *mode_string, GStrv params, guint *n_changes, GError **error); /** + * ibis_client_set_client_ping_timeout: + * @seconds: the number of seconds before time out. + * + * Sets the number of seconds for the client ping timeout. + * + * The new timeout will be used after the current one expires or is removed. + * + * Since: 0.14 + */ +IBIS_AVAILABLE_IN_0_14 +void ibis_client_set_client_ping_timeout(IbisClient *client, guint seconds); + +/** * ibis_client_start: * @stream: the [class@Gio.IOStream] to process * @password: (nullable): the optional server password to use diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisconstants.h new/ibis-0.14.0/ibis/ibisconstants.h --- old/ibis-0.13.1/ibis/ibisconstants.h 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibisconstants.h 2025-05-01 01:18:52.000000000 +0200 @@ -615,6 +615,84 @@ #define IBIS_CTCP_VERSION "VERSION" IBIS_AVAILABLE_MACRO_IN_0_1 /** + * IBIS_DCC_ACCEPT: + * + * A constant representing the DCC `ACCEPT` type. + * + * See + * [en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_SEND](https://en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_SEND) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_DCC_ACCEPT "ACCEPT" IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_DCC_CHAT: + * + * A constant representing the DCC `CHAT` type. + * + * See + * [modern.ircdocs.horse/dcc#dcc-chat](https://modern.ircdocs.horse/dcc#dcc-chat) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_DCC_CHAT "CHAT" IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_DCC_CHAT_PROTOCOL_CHAT: + * + * A constant representing the DCC CHAT chat protocol. + * + * See + * [en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_CHAT](https://en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_CHAT) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_DCC_CHAT_PROTOCOL_CHAT "chat" IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_DCC_CHAT_PROTOCOL_WHITEBOARD: + * + * A constant representing the DCC CHAT Whiteboard protocol. + * + * See + * [en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_Whiteboard](https://en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_Whiteboard) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_DCC_CHAT_PROTOCOL_WHITEBOARD "wboard" IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_DCC_RESUME: + * + * A constant representing the DCC `RESUME` type. + * + * See + * [en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_SEND](https://en.wikipedia.org/wiki/Direct_Client-to-Client#DCC_SEND) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_DCC_RESUME "RESUME" IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_DCC_SEND: + * + * A constant representing the DCC `SEND` type. + * + * See + * [modern.ircdocs.horse/dcc#dcc-send](https://modern.ircdocs.horse/dcc#dcc-send) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_DCC_SEND "SEND" IBIS_AVAILABLE_MACRO_IN_0_14 + +/** * IBIS_ERR_ALREADYREGISTERED: * * A constant for the %ALREADYREGISTERED error. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisdcc.c new/ibis-0.14.0/ibis/ibisdcc.c --- old/ibis-0.13.1/ibis/ibisdcc.c 1970-01-01 01:00:00.000000000 +0100 +++ new/ibis-0.14.0/ibis/ibisdcc.c 2025-05-01 01:18:52.000000000 +0200 @@ -0,0 +1,87 @@ +/* + * Ibis - IRCv3 Library + * Copyright (C) 2022-2025 Ibis Developers + * + * Ibis is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, see <https://www.gnu.org/licenses/>. + */ + +#include <stdlib.h> + +#include "ibisdcc.h" + +#include "ibisstring.h" + +/****************************************************************************** + * Public API + *****************************************************************************/ +GInetAddress * +ibis_dcc_host_parse(const char *host) { + GInetAddress *address = NULL; + guint32 value = 0; + + g_return_val_if_fail(!ibis_str_is_empty(host), NULL); + + /* Attempt to create the address directly from the string. */ + address = g_inet_address_new_from_string(host); + if(G_IS_INET_ADDRESS(address)) { + return address; + } + + /* That didn't work, so let's see if this is an integer that we can turn + * into an IPv4 address. + */ + value = g_htonl(atoi(host)); + address = g_inet_address_new_from_bytes((const guint8 *)&value, + G_SOCKET_FAMILY_IPV4); + if(G_IS_INET_ADDRESS(address)) { + return address; + } + + return NULL; +} + +char * +ibis_dcc_host_to_string(GInetAddress *address) { + GSocketFamily family = G_SOCKET_FAMILY_INVALID; + + g_return_val_if_fail(G_IS_INET_ADDRESS(address), NULL); + + family = g_inet_address_get_family(address); + switch(family) { + case G_SOCKET_FAMILY_IPV4: { + const guint8 *bytes = NULL; + + bytes = g_inet_address_to_bytes(address); + if(g_inet_address_get_native_size(address) == 4) { + guint32 *network = (guint32 *)bytes; + return g_strdup_printf("%u", g_ntohl(*network)); + } + + break; + } + case G_SOCKET_FAMILY_IPV6: + return g_inet_address_to_string(address); + break; + case G_SOCKET_FAMILY_INVALID: + case G_SOCKET_FAMILY_UNIX: + default: + break; + } + + return NULL; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisdcc.h new/ibis-0.14.0/ibis/ibisdcc.h --- old/ibis-0.13.1/ibis/ibisdcc.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ibis-0.14.0/ibis/ibisdcc.h 2025-05-01 01:18:52.000000000 +0200 @@ -0,0 +1,82 @@ +/* + * Ibis - IRCv3 Library + * Copyright (C) 2022-2025 Ibis Developers + * + * Ibis is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, see <https://www.gnu.org/licenses/>. + */ + +#if !defined(IBIS_GLOBAL_HEADER_INSIDE) && !defined(IBIS_COMPILATION) +# error "only <ibis.h> may be included directly" +#endif + +#ifndef IBIS_DCC_H +#define IBIS_DCC_H + +#include <glib.h> + +#include <gio/gio.h> + +#include "ibisversion.h" + +G_BEGIN_DECLS + +/** + * ibis_dcc_host_parse: + * @host: the host value + * + * Parses the host value from a DCC request. + * + * The host parameter of a DCC request is the integer representation for IPv4 + * and the hex representation for IPv6. This function will attempt to parse + * either into a valid [class@Gio.InetAddress]. + * + * This will properly parse a positive 32 bit integer like `2130706433` into + * an IPv4 address of `127.0.0.1` and for IPv6 addresses it will parse the + * normal hexadecimal representation like `::1` to a `localhost` address. + * + * Returns: (transfer full) (nullable): The address if parsing was successful. + * + * Since: 0.14 + */ +IBIS_AVAILABLE_IN_0_14 +GInetAddress *ibis_dcc_host_parse(const char *host); + +/** + * ibis_dcc_host_to_string: + * @address: the host address + * + * Serializes the address to the correct format. + * + * The host parameter of a DCC request is the integer representation for IPv4 + * and the hex representation for IPv6. This function will serialize @address + * to the correct format. + * + * For an IPv4 address like `127.0.0.1` this will be serialized to `2130706433` + * and for an IPv6 address this will return normal hexadecimal representation. + * + * Returns: (transfer full) (nullable): The value if serialization was + * successful. + * + * Since: 0.14 + */ +IBIS_AVAILABLE_IN_0_14 +char *ibis_dcc_host_to_string(GInetAddress *address); + +G_END_DECLS + +#endif /* IBIS_DCC_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisformatting.c new/ibis-0.14.0/ibis/ibisformatting.c --- old/ibis-0.13.1/ibis/ibisformatting.c 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibisformatting.c 2025-05-01 01:18:52.000000000 +0200 @@ -22,16 +22,6 @@ #include "ibisformatting.h" -#define IBIS_FORMAT_BOLD (0x02) -#define IBIS_FORMAT_COLOR (0x03) -#define IBIS_FORMAT_HEX_COLOR (0x04) -#define IBIS_FORMAT_ITALIC (0x1d) -#define IBIS_FORMAT_MONOSPACE (0x11) -#define IBIS_FORMAT_RESET (0x0f) -#define IBIS_FORMAT_REVERSE (0x16) -#define IBIS_FORMAT_STRIKETHROUGH (0x1e) -#define IBIS_FORMAT_UNDERLINE (0x1f) - /* These colors are copied from https://modern.ircdocs.horse/formatting#colors * and https://modern.ircdocs.horse/formatting#colors-16-98. */ @@ -414,7 +404,7 @@ break; } - case IBIS_FORMAT_HEX_COLOR: + case IBIS_FORMAT_HEX_COLOR: { PangoColor bg; PangoColor fg; gboolean bg_set = FALSE; @@ -453,6 +443,7 @@ i += offset; break; + } default: g_string_append_c(str, text[i]); position += 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisformatting.h new/ibis-0.14.0/ibis/ibisformatting.h --- old/ibis-0.13.1/ibis/ibisformatting.h 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibisformatting.h 2025-05-01 01:18:52.000000000 +0200 @@ -36,6 +36,114 @@ G_BEGIN_DECLS /** + * IBIS_FORMAT_BOLD: + * + * A constant for the bold formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_BOLD (0x02) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_COLOR: + * + * A constant for the color formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_COLOR (0x03) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_HEX_COLOR: + * + * A constant for the hex color formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_HEX_COLOR (0x04) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_ITALIC: + * + * A constant for the italic formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_ITALIC (0x1d) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_MONOSPACE: + * + * A constant for the monospace formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_MONOSPACE (0x11) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_RESET: + * + * A constant for the reset formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_RESET (0x0f) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_REVERSE: + * + * A constant for the revert color formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_REVERSE (0x16) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_STRIKETHROUGH: + * + * A constant for the strike-through formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_STRIKETHROUGH (0x1e) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** + * IBIS_FORMAT_UNDERLINE: + * + * A constant for the underline formatting character. + * + * See the [formatting specification](https://modern.ircdocs.horse/formatting) + * for more information. + * + * Since: 0.14 + */ +#define IBIS_FORMAT_UNDERLINE (0x1f) IBIS_AVAILABLE_MACRO_IN_0_14 + +/** * ibis_formatting_parse: * @text: (nullable): the text to parse * @attrs: (out) (optional): a return address for the formatting attributes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibismessage.c new/ibis-0.14.0/ibis/ibismessage.c --- old/ibis-0.13.1/ibis/ibismessage.c 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibismessage.c 2025-05-01 01:18:52.000000000 +0200 @@ -436,7 +436,7 @@ * The raw message that was parsed. * * This property will only be non %NULL if the message was created with - * [func@Message.parse]. + * [ctor@Message.parse]. * * Since: 0.1 */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibismessage.h new/ibis-0.14.0/ibis/ibismessage.h --- old/ibis-0.13.1/ibis/ibismessage.h 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibismessage.h 2025-05-01 01:18:52.000000000 +0200 @@ -319,7 +319,7 @@ void ibis_message_take_error(IbisMessage *message, GError *error); /** - * ibis_message_parse: + * ibis_message_parse: (constructor) * @buffer: the raw IRC message * @error: (nullable): return address for a #GError * @@ -346,7 +346,7 @@ * * Gets the `raw-message` that @message was parsed from. * - * If @message was not created via [func@Message.parse], then this will be + * If @message was not created via [ctor@Message.parse], then this will be * %NULL. * * Returns: (nullable): The raw message if available. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/ibisversion.h new/ibis-0.14.0/ibis/ibisversion.h --- old/ibis-0.13.1/ibis/ibisversion.h 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/ibisversion.h 2025-05-01 01:18:52.000000000 +0200 @@ -437,6 +437,30 @@ #define IBIS_AVAILABLE_TYPE_IN_0_13 #endif +/** + * IBIS_VERSION_0_14: + * + * A macro that evaluates to the 0.14 version of ibis, in a format that can be + * used by the C pre-processor. + * + * Since: 0.14 + */ +#define IBIS_VERSION_0_14 (G_ENCODE_VERSION(0, 14)) + +#if IBIS_VERSION_MAX_ALLOWED < IBIS_VERSION_0_14 +#define IBIS_AVAILABLE_IN_0_14 IBIS_UNAVAILABLE(0, 14) +#define IBIS_AVAILABLE_STATIC_INLINE_IN_0_14 IBIS_UNAVAILABLE_STATIC_INLINE(0, 14) +#define IBIS_AVAILABLE_MACRO_IN_0_14 IBIS_UNAVAILABLE_MACRO(0, 14) +#define IBIS_AVAILABLE_ENUMERATOR_IN_0_14 IBIS_UNAVAILABLE_ENUMERATOR(0, 14) +#define IBIS_AVAILABLE_TYPE_IN_0_14 IBIS_UNAVAILABLE_TYPE(0, 14) +#else +#define IBIS_AVAILABLE_IN_0_14 _IBIS_EXTERN +#define IBIS_AVAILABLE_STATIC_INLINE_IN_0_14 +#define IBIS_AVAILABLE_MACRO_IN_0_14 +#define IBIS_AVAILABLE_ENUMERATOR_IN_0_14 +#define IBIS_AVAILABLE_TYPE_IN_0_14 +#endif + G_BEGIN_DECLS /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/meson.build new/ibis-0.14.0/ibis/meson.build --- old/ibis-0.13.1/ibis/meson.build 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/meson.build 2025-05-01 01:18:52.000000000 +0200 @@ -4,6 +4,7 @@ 'ibischanmodes.c', 'ibisclient.c', 'ibisctcpmessage.c', + 'ibisdcc.c', 'ibisfeatures.c', 'ibisformatting.c', 'ibismessage.c', @@ -24,6 +25,7 @@ 'ibisconstants.h', 'ibiscore.h', 'ibisctcpmessage.h', + 'ibisdcc.h', 'ibisfeatures.h', 'ibisformatting.h', 'ibismessage.h', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/reference/ibis.toml.in new/ibis-0.14.0/ibis/reference/ibis.toml.in --- old/ibis-0.13.1/ibis/reference/ibis.toml.in 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/reference/ibis.toml.in 2025-05-01 01:18:52.000000000 +0200 @@ -7,7 +7,7 @@ logo_url = "" license = "LGPL-2.1-or-later" description = "Ibis IRCv3 Parsing Library" -dependencies = [ "GLib-2.0", "GObject-2.0" ] +dependencies = [ "Birb-1.0", "Gio-2.0", "GLib-2.0", "GObject-2.0", "Hasl-1.0", "Pango-1.0" ] devhelp = true search_index = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/tests/meson.build new/ibis-0.14.0/ibis/tests/meson.build --- old/ibis-0.13.1/ibis/tests/meson.build 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/tests/meson.build 2025-05-01 01:18:52.000000000 +0200 @@ -3,6 +3,7 @@ 'chanmodes', 'client', 'ctcp_message', + 'dcc', 'features', 'formatting', 'message', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/tests/test_client.c new/ibis-0.14.0/ibis/tests/test_client.c --- old/ibis-0.13.1/ibis/tests/test_client.c 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/ibis/tests/test_client.c 2025-05-01 01:18:52.000000000 +0200 @@ -36,10 +36,12 @@ char *realname = NULL; char *username = NULL; gboolean connected = FALSE; + guint client_ping_timeout = 0; client = g_object_new( IBIS_TYPE_CLIENT, "alt-nick", "nick1", + "client-ping-timeout", 1000, "nick", "nick", "realname", "realname", "username", "username", @@ -50,6 +52,7 @@ "alt-nick", &alt_nick, "cancellable", &cancellable, "capabilities", &capabilities, + "client-ping-timeout", &client_ping_timeout, "connected", &connected, "error", &error, "features", &features, @@ -66,6 +69,8 @@ g_assert_true(IBIS_IS_CAPABILITIES(capabilities)); g_clear_object(&capabilities); + g_assert_cmpuint(client_ping_timeout, ==, 1000); + g_assert_false(connected); g_assert_no_error(error); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/ibis/tests/test_dcc.c new/ibis-0.14.0/ibis/tests/test_dcc.c --- old/ibis-0.13.1/ibis/tests/test_dcc.c 1970-01-01 01:00:00.000000000 +0100 +++ new/ibis-0.14.0/ibis/tests/test_dcc.c 2025-05-01 01:18:52.000000000 +0200 @@ -0,0 +1,136 @@ +/* + * Ibis - IRCv3 Library + * Copyright (C) 2022-2025 Ibis Developers + * + * Ibis is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, see <https://www.gnu.org/licenses/>. + */ + +#include <glib.h> + +#include <birb.h> + +#include <ibis.h> + +typedef struct { + const char *hostname; + const char *to_string; +} TestIbisDCCHostData; + +/****************************************************************************** + * Tests + *****************************************************************************/ +static void +test_ibis_dcc_host_ipv4(gconstpointer data) { + const TestIbisDCCHostData *host_data = data; + GInetAddress *address = NULL ; + GSocketFamily family = G_SOCKET_FAMILY_INVALID; + char *serialized = NULL; + char *to_string = NULL; + + address = ibis_dcc_host_parse(host_data->hostname); + birb_assert_type(address, G_TYPE_INET_ADDRESS); + + family = g_inet_address_get_family(address); + g_assert_cmpuint(family, ==, G_SOCKET_FAMILY_IPV4); + + to_string = g_inet_address_to_string(address); + g_assert_cmpstr(to_string, ==, host_data->to_string); + g_free(to_string); + + serialized = ibis_dcc_host_to_string(address); + g_assert_cmpstr(serialized, ==, host_data->hostname); + + g_assert_finalize_object(address); + g_free(serialized); +} + +static void +test_ibis_dcc_host_ipv6(gconstpointer data) { + GInetAddress *address = NULL ; + GSocketFamily family = G_SOCKET_FAMILY_INVALID; + char *serialized = NULL; + const char *host = data; + + address = ibis_dcc_host_parse(host); + birb_assert_type(address, G_TYPE_INET_ADDRESS); + + family = g_inet_address_get_family(address); + g_assert_cmpuint(family, ==, G_SOCKET_FAMILY_IPV6); + + serialized = ibis_dcc_host_to_string(address); + g_assert_cmpstr(serialized, ==, host); + + g_assert_finalize_object(address); + g_free(serialized); +} + +/****************************************************************************** + * Main + *****************************************************************************/ +int +main(int argc, char **argv) { + g_test_init(&argc, &argv, NULL); + + g_test_set_nonfatal_assertions(); + + g_test_add_data_func("/ibis/dcc/host/ipv4/localhost", + &(const TestIbisDCCHostData){"2130706433", "127.0.0.1"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/1.0.0.1", + &(const TestIbisDCCHostData){"16777217", "1.0.0.1"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/1.1.1.1", + &(const TestIbisDCCHostData){"16843009", "1.1.1.1"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/8.8.4.4", + &(const TestIbisDCCHostData){"134743044", "8.8.4.4"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/8.8.8.8", + &(const TestIbisDCCHostData){"134744072", "8.8.8.8"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/10.0.0.1", + &(const TestIbisDCCHostData){"167772161", "10.0.0.1"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/172.16.0.1", + &(const TestIbisDCCHostData){"2886729729", "172.16.0.1"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/192.168.0.1", + &(const TestIbisDCCHostData){"3232235521", "192.168.0.1"}, + test_ibis_dcc_host_ipv4); + g_test_add_data_func("/ibis/dcc/host/ipv4/192.168.1.1", + &(const TestIbisDCCHostData){"3232235777", "192.168.1.1"}, + test_ibis_dcc_host_ipv4); + + g_test_add_data_func("/ibis/dcc/host/ipv6/localhost", + "::1", + test_ibis_dcc_host_ipv6); + g_test_add_data_func("/ibis/dcc/host/ipv6/cloudflare-dns-1", + "2606:4700:4700::1001", + test_ibis_dcc_host_ipv6); + g_test_add_data_func("/ibis/dcc/host/ipv6/cloudflare-dns-2", + "2606:4700:4700::1111", + test_ibis_dcc_host_ipv6); + g_test_add_data_func("/ibis/dcc/host/ipv6/google-dns-1", + "2001:4860:4860::8888", + test_ibis_dcc_host_ipv6); + g_test_add_data_func("/ibis/dcc/host/ipv6/google-dns-2", + "2001:4860:4860::8844", + test_ibis_dcc_host_ipv6); + + return g_test_run(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibis-0.13.1/meson.build new/ibis-0.14.0/meson.build --- old/ibis-0.13.1/meson.build 2025-03-31 05:09:55.000000000 +0200 +++ new/ibis-0.14.0/meson.build 2025-05-01 01:18:52.000000000 +0200 @@ -2,7 +2,7 @@ default_options : ['c_std=c17', 'warning_level=2'], license : 'LGPL-2.1-or-later', meson_version : '>=1.0.0', - version : '0.13.1') + version : '0.14.0') toplevel_inc = include_directories('.') @@ -52,10 +52,10 @@ ############################################################################### # Dependencies ############################################################################### -glib_dep = dependency('glib-2.0', version : '>=2.76.0') +glib_dep = dependency('glib-2.0', version : '>=2.80.0') add_project_arguments( - '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_76', - '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_76', + '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_80', + '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_80', language : 'c') gio_dep = dependency('gio-2.0')