ibis/ibissource.h

Thu, 28 Nov 2024 15:04:10 -0600

author
Markus Fischer <ivanhoe@fiscari.de>
date
Thu, 28 Nov 2024 15:04:10 -0600
changeset 139
5755cc8f0e51
parent 138
6d6d1ba84722
permissions
-rw-r--r--

Follow more of the gnome guidelines for doc comments

Removed the instance parameter descriptions where possible.
Applied the [callable symbols guidelines](https://developer.gnome.org/documentation/guidelines/devel-docs.html#callable-symbols) regarding parameters and return values also to signal descriptions. And also applied the callable symbols guidelines regarding the description to both signals and functions.

Testing Done:
Ran the turtles.

Bugs closed: IBIS-42

Reviewed at https://reviews.imfreedom.org/r/3685/

/*
 * Ibis - IRCv3 Library
 * Copyright (C) 2022-2024 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_SOURCE_H
#define IBIS_SOURCE_H

#include <glib.h>

#include "ibisversion.h"

G_BEGIN_DECLS

/**
 * ibis_source_parse:
 * @source: the source to parse
 * @nick: (out) (transfer full): a return address for the nick
 * @user: (out) (transfer full): a return address for the user
 * @host: (out) (transfer full): a return address for the host
 *
 * Parses a `source` string like `pidgy!~u@53unc8n42i868.irc` into its nick,
 * user, and host parts per https://modern.ircdocs.horse/#source.
 *
 * If the user or host aren't present in @source, but a return address is
 * provided for them, that pointer will be set to %NULL.
 *
 * Since: 0.1
 */
IBIS_AVAILABLE_IN_0_1
void ibis_source_parse(const char *source, char **nick, char **user, char **host);

/**
 * ibis_source_serialize:
 * @nick: the nick
 * @user: (nullable): the user field
 * @host: (nullable): the host field
 *
 * Creates a source from its parts.
 *
 * This does the reverse of [func@source_parse].
 *
 * Returns: The new source.
 *
 * Since: 0.9
 */
IBIS_AVAILABLE_IN_0_9
char *ibis_source_serialize(const char *nick, const char *user, const char *host);

/**
 * ibis_source_strip_prefix:
 * @source: the source to strip
 * @prefixes: the list of prefixes that should be stripped
 *
 * Removes any characters from the start of @source that are in @prefixes until
 * a character that is not in @prefixes is found.
 *
 * If for some reason, @source is a single character that's in @prefixes, an
 * empty string will be returned.
 *
 * @prefixes should be in descending order, from the prefix that gives the most
 * privileges to the prefix that gives the least. The server will send them in
 * this order. See [PREFIX
 * Parameter](https://modern.ircdocs.horse/#prefix-parameter) for more
 * information.
 *
 * Returns: (transfer full): The source with the prefix removed.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
char *ibis_source_strip_prefix(const char *source, const char *prefixes);

/**
 * ibis_source_get_prefix:
 * @source: the source
 * @prefixes: the list of valid prefixes
 *
 * Gets the prefixes from @source.
 *
 * @prefixes should be in descending order, from the prefix that gives the most
 * privileges to the prefix that gives the least. The server will send them in
 * this order. See [PREFIX
 * Parameter](https://modern.ircdocs.horse/#prefix-parameter) for more
 * information.
 *
 * Returns: (transfer full) (nullable): The prefixes from @source if found.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
char *ibis_source_get_prefix(const char *source, const char *prefixes);

G_END_DECLS

#endif /* IBIS_SOURCE_H */

mercurial