xeme/xeme

Add a simple unit test for the input stream and fix a few issues
/*
* Copyright (C) 2023 Dodo 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 DODO_MESSAGE_H
#define DODO_MESSAGE_H
#include <glib.h>
#include <glib-object.h>
#include <dodo/dodostanza.h>
G_BEGIN_DECLS
#define DODO_TYPE_MESSAGE (dodo_message_get_type())
G_DECLARE_FINAL_TYPE(DodoMessage, dodo_message, DODO, MESSAGE, DodoStanza)
/**
* dodo_message_new:
*
* Creates a new [class@Message] instance.
*
* returns: (transfer full): The new message.
*
* Since: 0.1.0
*/
DodoStanza *dodo_message_new(void);
/**
* dodo_message_get_thread:
* @message: The instance.
*
* Gets the thread identifier of @message.
*
* Returns: (transfer none) (nullable): The thread id.
*
* Since: 0.1.0
*/
const char *dodo_message_get_thread(DodoMessage *message);
/**
* dodo_message_set_thread:
* @message: The instance.
* @thread: (nullable): The new thread identifier.
*
* Sets the thread identifier of @message.
*
* Since: 3.0.0
*/
void dodo_message_set_thread(DodoMessage *message, const char *thread);
/**
* dodo_message_get_thread_parent:
* @message: The instance.
*
* Gets the thread parent identifier of @message.
*
* Returns: (transfer none) (nullable): The thread id.
*
* Since: 0.1.0
*/
const char *dodo_message_get_thread_parent(DodoMessage *message);
/**
* dodo_message_set_thread_parent:
* @message: The instance.
* @thread_parent: (nullable): The new thread parent identifier.
*
* Sets the thread parent identifier of @message.
*
* Since: 3.0.0
*/
void dodo_message_set_thread_parent(DodoMessage *message, const char *thread_parent);
/**
* dodo_message_add_subject:
* @message: The instance.
* @language: (nullable): The value for the xml:lang tag.
* @content: The content.
*
* Add @content as a subject to @message. If a subject already exists with
* @language, it will be replaced by the new @content.
*
* Since: 0.1.0
*/
void dodo_message_add_subject(DodoMessage *message, const char *language, const char *content);
/**
* dodo_message_add_body:
* @message: The instance.
* @language: (nullable): The value for the xml:lang tag.
* @content: The content.
*
* Add @content as a body to @message. If a body already exists with @language,
* it will be replaced by the new @content.
*
* Since: 0.1.0
*/
void dodo_message_add_body(DodoMessage *message, const char *language, const char *content);
G_END_DECLS
#endif /* DODO_MESSAGE_H */