xeme/xemestream.h

Wed, 22 Jan 2025 22:13:20 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Wed, 22 Jan 2025 22:13:20 -0600
changeset 51
1294ebed86cf
parent 47
0822a5847e59
permissions
-rw-r--r--

Add a library version

Testing Done:
Compiled and confirmed the shared library had a version, and symlinks were installed.

Bugs closed: XEME-2

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

/*
 * Copyright (C) 2023 Xeme Developers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

#ifndef XEME_STREAM_H
#define XEME_STREAM_H

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

#include <gio/gio.h>

#include "xemeversion.h"

G_BEGIN_DECLS

/**
 * XEME_STREAM_PI:
 *
 * A constant for the XML processing instruction with a UTF-8 encoding.
 *
 * Since: 0.1
 */
#define XEME_STREAM_PI "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" XEME_AVAILABLE_MACRO_IN_0_1

/**
 * XEME_STREAM_VERSION:
 *
 * The version of the XMPP stream protocol.
 *
 * Since: 0.1
 */
#define XEME_STREAM_VERSION "1.0" XEME_AVAILABLE_MACRO_IN_0_1

/**
 * XEME_STREAM_XMLNS:
 *
 * The XML namespace that is used as the default namespace for the stream.
 *
 * Since: 0.1
 */
#define XEME_STREAM_XMLNS "jabber:client" XEME_AVAILABLE_MACRO_IN_0_1

/**
 * XEME_STREAM_XMLNS_STREAM:
 *
 * The XML namespace that is used for the `streams` namespace.
 *
 * Since: 0.1
 */
#define XEME_STREAM_XMLNS_STREAM "http://etherx.jabber.org/streams" XEME_AVAILABLE_MACRO_IN_0_1

/**
 * XemeStream:
 *
 * A base class for all streams.
 *
 * Since: 0.1
 */

#define XEME_TYPE_STREAM (xeme_stream_get_type())

XEME_AVAILABLE_IN_0_1
G_DECLARE_DERIVABLE_TYPE(XemeStream, xeme_stream, XEME, STREAM, GObject)

struct _XemeStreamClass {
	/*< private >*/
	GObjectClass parent;

	/*< private >*/
	gpointer reserved[8];
};

/**
 * xeme_stream_get_cancellable:
 * @stream: The instance.
 *
 * Gets the cancellable that @stream is using.
 *
 * Returns: (transfer none): The cancellable for @stream.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
GCancellable *xeme_stream_get_cancellable(XemeStream *stream);

/**
 * xeme_stream_get_id:
 * @stream: The instance.
 *
 * Gets the identifier for @stream.
 *
 * Returns: The id.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
const char *xeme_stream_get_id(XemeStream *stream);

/**
 * xeme_stream_set_id:
 * @stream: The instance.
 * @id: (nullable): The new id.
 *
 * Sets the identifier for @stream.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
void xeme_stream_set_id(XemeStream *stream, const char *id);

/**
 * xeme_stream_get_to:
 * @stream: The instance.
 *
 * Gets the bare jid of the remote side of @stream.
 *
 * Returns: The bare jid of the remote side.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
const char *xeme_stream_get_to(XemeStream *stream);

/**
 * xeme_stream_set_to:
 * @stream: The instance.
 * @to: (nullable): The bare jid of the remote side.
 *
 * Sets the bare jid for the remote side of @stream.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
void xeme_stream_set_to(XemeStream *stream, const char *to);

/**
 * xeme_stream_get_from:
 * @stream: The instance.
 *
 * Gets the bare jid of the local side of @stream.
 *
 * Returns: The bare jid of the local side.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
const char *xeme_stream_get_from(XemeStream *stream);

/**
 * xeme_stream_set_from:
 * @stream: The instance.
 * @from: (nullable): The bare jid of the local side.
 *
 * Sets the bare jid for the local side of @stream.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
void xeme_stream_set_from(XemeStream *stream, const char *from);

/**
 * xeme_stream_get_language:
 * @stream: The instance.
 *
 * Gets the language that @stream is using.
 *
 * Returns: The language that @stream is using.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
const char *xeme_stream_get_language(XemeStream *stream);

/**
 * xeme_stream_set_language:
 * @stream: The instance.
 * @language: (nullable): The language for this stream.
 *
 * Sets the language of @stream to @language. This is only really useful
 * before the stream is started but will be populated if the remote side
 * sends it.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
void xeme_stream_set_language(XemeStream *stream, const char *language);

/**
 * xeme_stream_get_version:
 * @stream: The instance.
 *
 * Gets the XMPP version for the stream.
 *
 * Returns: The version of @stream or %NULL if unset.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
const char *xeme_stream_get_version(XemeStream *stream);

/**
 * xeme_stream_set_version:
 * @stream: The instance.
 * @version: The version to set for the stream.
 *
 * Sets the XMPP version for @stream.
 *
 * Since: 0.1
 */
XEME_AVAILABLE_IN_0_1
void xeme_stream_set_version(XemeStream *stream, const char *version);

G_END_DECLS

#endif /* XEME_STREAM_H */

mercurial