ibis/ibisstandardreply.h

Mon, 03 Feb 2025 22:50:26 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 03 Feb 2025 22:50:26 -0600
changeset 166
2cd48d29fc4e
parent 139
5755cc8f0e51
permissions
-rw-r--r--

Prepare for the next round of development

Testing Done:
Ran `meson dist`

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

/*
 * 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_STANDARD_REPLY_H
#define IBIS_STANDARD_REPLY_H

#include <glib.h>
#include <glib-object.h>

#include "ibisversion.h"

G_BEGIN_DECLS

#define IBIS_TYPE_STANDARD_REPLY (ibis_standard_reply_get_type())

/**
 * IbisStandardReply:
 *
 * An object that represents a Standard Reply.
 *
 * See [Standard Replies](https://ircv3.net/specs/extensions/standard-replies)
 * for more information.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
G_DECLARE_FINAL_TYPE(IbisStandardReply, ibis_standard_reply, IBIS,
                     STANDARD_REPLY, GObject)

#include "ibismessage.h"

/**
 * ibis_standard_reply_get_code:
 *
 * Gets the code from @reply.
 *
 * Returns: The machine-readable code from @reply.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
const char *ibis_standard_reply_get_code(IbisStandardReply *reply);

/**
 * ibis_standard_reply_get_command:
 *
 * Gets the command that this reply is related to.
 *
 * Returns: The command that this reply is related to or `*`.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
const char *ibis_standard_reply_get_command(IbisStandardReply *reply);

/**
 * ibis_standard_reply_get_context:
 *
 * Gets the context from @reply.
 *
 * Returns: (transfer none) (nullable): The parameters.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
GStrv ibis_standard_reply_get_context(IbisStandardReply *reply);

/**
 * ibis_standard_reply_get_description:
  *
 * Gets the description from this reply.
 *
 * Returns: The description from this reply.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
const char *ibis_standard_reply_get_description(IbisStandardReply *reply);

/**
 * ibis_standard_reply_get_reply_type:
 *
 * Gets the type from @reply.
 *
 * Returns: The type.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
const char *ibis_standard_reply_get_reply_type(IbisStandardReply *reply);

/**
 * ibis_standard_reply_is_type:
 * @type: the type to check
 *
 * Checks if the type of @reply is @type.
 *
 * Returns: true if the type of @reply is @type; false otherwise.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
gboolean ibis_standard_reply_is_type(IbisStandardReply *reply, const char *type);

/**
 * ibis_standard_reply_parse:
 * @message: the message
 *
 * Attempts to create a standard reply from @message.
 *
 * If @str is not a valid standard reply, %NULL will be returned.
 *
 * Returns: (transfer full) (nullable): The standard reply if successful.
 *
 * Since: 0.8
 */
IBIS_AVAILABLE_IN_0_8
IbisStandardReply *ibis_standard_reply_parse(IbisMessage *message);

G_END_DECLS

#endif /* IBIS_STANDARD_REPLY_H */

mercurial