/* 0066_out_of_band_data.c generated by valac 0.56.19, the Vala compiler
 * generated from 0066_out_of_band_data.vala, do not modify */

#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))

static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
xmpp_xep_out_of_band_data_add_url_to_message (XmppMessageStanza* message,
                                              const gchar* url,
                                              const gchar* desc)
{
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	g_return_if_fail (message != NULL);
	g_return_if_fail (url != NULL);
	_tmp0_ = ((XmppStanza*) message)->stanza;
	_tmp1_ = xmpp_stanza_node_new_build ("x", XMPP_XEP_OUT_OF_BAND_DATA_NS_URI, NULL, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = xmpp_stanza_node_add_self_xmlns (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmpp_stanza_node_new_build ("url", XMPP_XEP_OUT_OF_BAND_DATA_NS_URI, NULL, NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_node_new_text (url);
	_tmp8_ = _tmp7_;
	_tmp9_ = xmpp_stanza_node_put_node (_tmp6_, _tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = xmpp_stanza_node_put_node (_tmp4_, _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = xmpp_stanza_node_put_node (_tmp0_, _tmp12_);
	_tmp14_ = _tmp13_;
	_xmpp_stanza_entry_unref0 (_tmp14_);
	_xmpp_stanza_entry_unref0 (_tmp12_);
	_xmpp_stanza_entry_unref0 (_tmp10_);
	_xmpp_stanza_entry_unref0 (_tmp8_);
	_xmpp_stanza_entry_unref0 (_tmp6_);
	_xmpp_stanza_entry_unref0 (_tmp4_);
	_xmpp_stanza_entry_unref0 (_tmp2_);
}

gchar*
xmpp_xep_out_of_band_data_get_url_from_message (XmppMessageStanza* message)
{
	XmppStanzaNode* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (message != NULL, NULL);
	_tmp0_ = ((XmppStanza*) message)->stanza;
	_tmp1_ = xmpp_stanza_node_get_deep_string_content (_tmp0_, XMPP_XEP_OUT_OF_BAND_DATA_NS_URI ":x", XMPP_XEP_OUT_OF_BAND_DATA_NS_URI ":url", NULL);
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

