/* 0104_http_scheme_url_data.c generated by valac 0.56.19, the Vala compiler
 * generated from 0104_http_scheme_url_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);

gchar*
xmpp_xep_http_scheme_for_url_data_get_url (XmppStanzaNode* node)
{
	XmppStanzaNode* url_data_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_get_subnode (node, "url-data", XMPP_XEP_HTTP_SCHEME_FOR_URL_DATA_NS_URI, FALSE);
	url_data_node = _tmp0_;
	_tmp1_ = url_data_node;
	if (_tmp1_ == NULL) {
		result = NULL;
		_xmpp_stanza_entry_unref0 (url_data_node);
		return result;
	}
	_tmp2_ = url_data_node;
	_tmp3_ = xmpp_stanza_node_get_attribute (_tmp2_, "target", NULL);
	_tmp4_ = g_strdup (_tmp3_);
	result = _tmp4_;
	_xmpp_stanza_entry_unref0 (url_data_node);
	return result;
}

XmppStanzaNode*
xmpp_xep_http_scheme_for_url_data_to_stanza_node (const gchar* url)
{
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* result;
	g_return_val_if_fail (url != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("url-data", XMPP_XEP_HTTP_SCHEME_FOR_URL_DATA_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_put_attribute (_tmp3_, "target", url, XMPP_XEP_HTTP_SCHEME_FOR_URL_DATA_NS_URI);
	_tmp5_ = _tmp4_;
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	result = _tmp5_;
	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;
}

