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

#include "xmpp-vala.h"
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gobject/gvaluecollector.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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_xep_service_discovery_identity_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_service_discovery_identity_unref (var), NULL)))
typedef struct _XmppXepServiceDiscoveryParamSpecInfoResult XmppXepServiceDiscoveryParamSpecInfoResult;

struct _XmppXepServiceDiscoveryInfoResultPrivate {
	XmppIqStanza* _iq;
};

struct _XmppXepServiceDiscoveryParamSpecInfoResult {
	GParamSpec parent_instance;
};

static gint XmppXepServiceDiscoveryInfoResult_private_offset;
static gpointer xmpp_xep_service_discovery_info_result_parent_class = NULL;

static void xmpp_xep_service_discovery_info_result_set_iq (XmppXepServiceDiscoveryInfoResult* self,
                                                    XmppIqStanza* value);
static XmppXepServiceDiscoveryInfoResult* xmpp_xep_service_discovery_info_result_new_from_iq (XmppIqStanza* iq);
static XmppXepServiceDiscoveryInfoResult* xmpp_xep_service_discovery_info_result_construct_from_iq (GType object_type,
                                                                                             XmppIqStanza* iq);
static void xmpp_xep_service_discovery_info_result_finalize (XmppXepServiceDiscoveryInfoResult * obj);
static GType xmpp_xep_service_discovery_info_result_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_service_discovery_info_result_get_instance_private (XmppXepServiceDiscoveryInfoResult* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepServiceDiscoveryInfoResult_private_offset);
}

XmppXepServiceDiscoveryInfoResult*
xmpp_xep_service_discovery_info_result_construct (GType object_type,
                                                  XmppIqStanza* iq_request)
{
	XmppXepServiceDiscoveryInfoResult* self = NULL;
	XmppIqStanza* _tmp0_;
	XmppIqStanza* _tmp1_;
	gchar* node = NULL;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	XmppStanzaNode* query = NULL;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	const gchar* _tmp12_;
	XmppIqStanza* _tmp15_;
	XmppStanzaNode* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	g_return_val_if_fail (iq_request != NULL, NULL);
	self = (XmppXepServiceDiscoveryInfoResult*) g_type_create_instance (object_type);
	_tmp0_ = xmpp_iq_stanza_new_result (iq_request, NULL);
	_tmp1_ = _tmp0_;
	xmpp_xep_service_discovery_info_result_set_iq (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = ((XmppStanza*) iq_request)->stanza;
	_tmp3_ = xmpp_stanza_node_get_subnode (_tmp2_, "query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmpp_stanza_node_get_attribute (_tmp4_, "node", NULL);
	_tmp6_ = g_strdup (_tmp5_);
	_tmp7_ = _tmp6_;
	_xmpp_stanza_entry_unref0 (_tmp4_);
	node = _tmp7_;
	_tmp8_ = xmpp_stanza_node_new_build ("query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, NULL, NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = xmpp_stanza_node_add_self_xmlns (_tmp9_);
	_tmp11_ = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp9_);
	query = _tmp11_;
	_tmp12_ = node;
	if (_tmp12_ != NULL) {
		XmppStanzaNode* _tmp13_;
		const gchar* _tmp14_;
		_tmp13_ = query;
		_tmp14_ = node;
		xmpp_stanza_node_set_attribute (_tmp13_, "node", _tmp14_, NULL);
	}
	_tmp15_ = self->priv->_iq;
	_tmp16_ = ((XmppStanza*) _tmp15_)->stanza;
	_tmp17_ = query;
	_tmp18_ = xmpp_stanza_node_put_node (_tmp16_, _tmp17_);
	_tmp19_ = _tmp18_;
	_xmpp_stanza_entry_unref0 (_tmp19_);
	_xmpp_stanza_entry_unref0 (query);
	_g_free0 (node);
	return self;
}

XmppXepServiceDiscoveryInfoResult*
xmpp_xep_service_discovery_info_result_new (XmppIqStanza* iq_request)
{
	return xmpp_xep_service_discovery_info_result_construct (XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT, iq_request);
}

static XmppXepServiceDiscoveryInfoResult*
xmpp_xep_service_discovery_info_result_construct_from_iq (GType object_type,
                                                          XmppIqStanza* iq)
{
	XmppXepServiceDiscoveryInfoResult* self = NULL;
	g_return_val_if_fail (iq != NULL, NULL);
	self = (XmppXepServiceDiscoveryInfoResult*) g_type_create_instance (object_type);
	xmpp_xep_service_discovery_info_result_set_iq (self, iq);
	return self;
}

static XmppXepServiceDiscoveryInfoResult*
xmpp_xep_service_discovery_info_result_new_from_iq (XmppIqStanza* iq)
{
	return xmpp_xep_service_discovery_info_result_construct_from_iq (XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT, iq);
}

XmppXepServiceDiscoveryInfoResult*
xmpp_xep_service_discovery_info_result_create_from_iq (XmppIqStanza* iq)
{
	XmppStanzaNode* query_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* feature_node = NULL;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* identity_node = NULL;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppXepServiceDiscoveryInfoResult* _tmp9_;
	XmppXepServiceDiscoveryInfoResult* result;
	g_return_val_if_fail (iq != NULL, NULL);
	if (xmpp_stanza_is_error ((XmppStanza*) iq)) {
		result = NULL;
		return result;
	}
	_tmp0_ = ((XmppStanza*) iq)->stanza;
	_tmp1_ = xmpp_stanza_node_get_subnode (_tmp0_, "query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
	query_node = _tmp1_;
	_tmp2_ = query_node;
	if (_tmp2_ == NULL) {
		result = NULL;
		_xmpp_stanza_entry_unref0 (query_node);
		return result;
	}
	_tmp3_ = query_node;
	_tmp4_ = xmpp_stanza_node_get_subnode (_tmp3_, "feature", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
	feature_node = _tmp4_;
	_tmp5_ = feature_node;
	if (_tmp5_ == NULL) {
		result = NULL;
		_xmpp_stanza_entry_unref0 (feature_node);
		_xmpp_stanza_entry_unref0 (query_node);
		return result;
	}
	_tmp6_ = query_node;
	_tmp7_ = xmpp_stanza_node_get_subnode (_tmp6_, "identity", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
	identity_node = _tmp7_;
	_tmp8_ = identity_node;
	if (_tmp8_ == NULL) {
		result = NULL;
		_xmpp_stanza_entry_unref0 (identity_node);
		_xmpp_stanza_entry_unref0 (feature_node);
		_xmpp_stanza_entry_unref0 (query_node);
		return result;
	}
	_tmp9_ = xmpp_xep_service_discovery_info_result_new_from_iq (iq);
	result = _tmp9_;
	_xmpp_stanza_entry_unref0 (identity_node);
	_xmpp_stanza_entry_unref0 (feature_node);
	_xmpp_stanza_entry_unref0 (query_node);
	return result;
}

void
xmpp_xep_service_discovery_info_result_add_feature (XmppXepServiceDiscoveryInfoResult* self,
                                                    const gchar* feature)
{
	XmppIqStanza* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (feature != NULL);
	_tmp0_ = self->priv->_iq;
	_tmp1_ = ((XmppStanza*) _tmp0_)->stanza;
	_tmp2_ = xmpp_stanza_node_get_subnode (_tmp1_, "query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_new_build ("feature", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, NULL, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp5_, "var", feature, NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_put_node (_tmp3_, _tmp7_);
	_tmp9_ = _tmp8_;
	_xmpp_stanza_entry_unref0 (_tmp9_);
	_xmpp_stanza_entry_unref0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp5_);
	_xmpp_stanza_entry_unref0 (_tmp3_);
}

void
xmpp_xep_service_discovery_info_result_add_identity (XmppXepServiceDiscoveryInfoResult* self,
                                                     XmppXepServiceDiscoveryIdentity* identity)
{
	XmppStanzaNode* identity_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	XmppIqStanza* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppStanzaNode* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (identity != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("identity", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_xep_service_discovery_identity_get_category (identity);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_put_attribute (_tmp1_, "category", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_xep_service_discovery_identity_get_type_ (identity);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_put_attribute (_tmp5_, "type", _tmp7_, NULL);
	_tmp9_ = _tmp8_;
	_xmpp_stanza_entry_unref0 (_tmp5_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	identity_node = _tmp9_;
	_tmp10_ = xmpp_xep_service_discovery_identity_get_name (identity);
	_tmp11_ = _tmp10_;
	if (_tmp11_ != NULL) {
		XmppStanzaNode* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		XmppStanzaNode* _tmp15_;
		XmppStanzaNode* _tmp16_;
		_tmp12_ = identity_node;
		_tmp13_ = xmpp_xep_service_discovery_identity_get_name (identity);
		_tmp14_ = _tmp13_;
		_tmp15_ = xmpp_stanza_node_put_attribute (_tmp12_, "name", _tmp14_, NULL);
		_tmp16_ = _tmp15_;
		_xmpp_stanza_entry_unref0 (_tmp16_);
	}
	_tmp17_ = self->priv->_iq;
	_tmp18_ = ((XmppStanza*) _tmp17_)->stanza;
	_tmp19_ = xmpp_stanza_node_get_subnode (_tmp18_, "query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
	_tmp20_ = _tmp19_;
	_tmp21_ = identity_node;
	_tmp22_ = xmpp_stanza_node_put_node (_tmp20_, _tmp21_);
	_tmp23_ = _tmp22_;
	_xmpp_stanza_entry_unref0 (_tmp23_);
	_xmpp_stanza_entry_unref0 (_tmp20_);
	_xmpp_stanza_entry_unref0 (identity_node);
}

XmppIqStanza*
xmpp_xep_service_discovery_info_result_get_iq (XmppXepServiceDiscoveryInfoResult* self)
{
	XmppIqStanza* result;
	XmppIqStanza* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_iq;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
xmpp_xep_service_discovery_info_result_set_iq (XmppXepServiceDiscoveryInfoResult* self,
                                               XmppIqStanza* value)
{
	XmppIqStanza* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_iq);
	self->priv->_iq = _tmp0_;
}

GeeList*
xmpp_xep_service_discovery_info_result_get_features (XmppXepServiceDiscoveryInfoResult* self)
{
	GeeList* result;
	GeeArrayList* ret = NULL;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	ret = _tmp0_;
	{
		GeeList* _feature_node_list = NULL;
		XmppIqStanza* _tmp1_;
		XmppStanzaNode* _tmp2_;
		XmppStanzaNode* _tmp3_;
		XmppStanzaNode* _tmp4_;
		GeeList* _tmp5_;
		GeeList* _tmp6_;
		gint _feature_node_size = 0;
		GeeList* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _feature_node_index = 0;
		_tmp1_ = self->priv->_iq;
		_tmp2_ = ((XmppStanza*) _tmp1_)->stanza;
		_tmp3_ = xmpp_stanza_node_get_subnode (_tmp2_, "query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
		_tmp4_ = _tmp3_;
		_tmp5_ = xmpp_stanza_node_get_subnodes (_tmp4_, "feature", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
		_tmp6_ = _tmp5_;
		_xmpp_stanza_entry_unref0 (_tmp4_);
		_feature_node_list = _tmp6_;
		_tmp7_ = _feature_node_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_feature_node_size = _tmp9_;
		_feature_node_index = -1;
		while (TRUE) {
			gint _tmp10_;
			gint _tmp11_;
			XmppStanzaNode* feature_node = NULL;
			GeeList* _tmp12_;
			gpointer _tmp13_;
			GeeArrayList* _tmp14_;
			XmppStanzaNode* _tmp15_;
			const gchar* _tmp16_;
			_feature_node_index = _feature_node_index + 1;
			_tmp10_ = _feature_node_index;
			_tmp11_ = _feature_node_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _feature_node_list;
			_tmp13_ = gee_list_get (_tmp12_, _feature_node_index);
			feature_node = (XmppStanzaNode*) _tmp13_;
			_tmp14_ = ret;
			_tmp15_ = feature_node;
			_tmp16_ = xmpp_stanza_node_get_attribute (_tmp15_, "var", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO);
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp16_);
			_xmpp_stanza_entry_unref0 (feature_node);
		}
		_g_object_unref0 (_feature_node_list);
	}
	result = (GeeList*) ret;
	return result;
}

void
xmpp_xep_service_discovery_info_result_set_features (XmppXepServiceDiscoveryInfoResult* self,
                                                     GeeList* value)
{
	g_return_if_fail (self != NULL);
	{
		GeeList* _feature_list = NULL;
		gint _feature_size = 0;
		GeeList* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _feature_index = 0;
		_feature_list = value;
		_tmp0_ = _feature_list;
		_tmp1_ = gee_collection_get_size ((GeeCollection*) _tmp0_);
		_tmp2_ = _tmp1_;
		_feature_size = _tmp2_;
		_feature_index = -1;
		while (TRUE) {
			gint _tmp3_;
			gint _tmp4_;
			gchar* feature = NULL;
			GeeList* _tmp5_;
			gpointer _tmp6_;
			const gchar* _tmp7_;
			_feature_index = _feature_index + 1;
			_tmp3_ = _feature_index;
			_tmp4_ = _feature_size;
			if (!(_tmp3_ < _tmp4_)) {
				break;
			}
			_tmp5_ = _feature_list;
			_tmp6_ = gee_list_get (_tmp5_, _feature_index);
			feature = (gchar*) _tmp6_;
			_tmp7_ = feature;
			xmpp_xep_service_discovery_info_result_add_feature (self, _tmp7_);
			_g_free0 (feature);
		}
	}
}

GeeSet*
xmpp_xep_service_discovery_info_result_get_identities (XmppXepServiceDiscoveryInfoResult* self)
{
	GeeSet* result;
	GeeHashSet* ret = NULL;
	GeeHashSet* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_hash_set_new (XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY, (GBoxedCopyFunc) xmpp_xep_service_discovery_identity_ref, (GDestroyNotify) xmpp_xep_service_discovery_identity_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	ret = _tmp0_;
	{
		GeeList* _feature_node_list = NULL;
		XmppIqStanza* _tmp1_;
		XmppStanzaNode* _tmp2_;
		XmppStanzaNode* _tmp3_;
		XmppStanzaNode* _tmp4_;
		GeeList* _tmp5_;
		GeeList* _tmp6_;
		gint _feature_node_size = 0;
		GeeList* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _feature_node_index = 0;
		_tmp1_ = self->priv->_iq;
		_tmp2_ = ((XmppStanza*) _tmp1_)->stanza;
		_tmp3_ = xmpp_stanza_node_get_subnode (_tmp2_, "query", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
		_tmp4_ = _tmp3_;
		_tmp5_ = xmpp_stanza_node_get_subnodes (_tmp4_, "identity", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO, FALSE);
		_tmp6_ = _tmp5_;
		_xmpp_stanza_entry_unref0 (_tmp4_);
		_feature_node_list = _tmp6_;
		_tmp7_ = _feature_node_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_feature_node_size = _tmp9_;
		_feature_node_index = -1;
		while (TRUE) {
			gint _tmp10_;
			gint _tmp11_;
			XmppStanzaNode* feature_node = NULL;
			GeeList* _tmp12_;
			gpointer _tmp13_;
			GeeHashSet* _tmp14_;
			XmppStanzaNode* _tmp15_;
			const gchar* _tmp16_;
			XmppStanzaNode* _tmp17_;
			const gchar* _tmp18_;
			XmppStanzaNode* _tmp19_;
			const gchar* _tmp20_;
			XmppXepServiceDiscoveryIdentity* _tmp21_;
			XmppXepServiceDiscoveryIdentity* _tmp22_;
			_feature_node_index = _feature_node_index + 1;
			_tmp10_ = _feature_node_index;
			_tmp11_ = _feature_node_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _feature_node_list;
			_tmp13_ = gee_list_get (_tmp12_, _feature_node_index);
			feature_node = (XmppStanzaNode*) _tmp13_;
			_tmp14_ = ret;
			_tmp15_ = feature_node;
			_tmp16_ = xmpp_stanza_node_get_attribute (_tmp15_, "category", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO);
			_tmp17_ = feature_node;
			_tmp18_ = xmpp_stanza_node_get_attribute (_tmp17_, "type", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO);
			_tmp19_ = feature_node;
			_tmp20_ = xmpp_stanza_node_get_attribute (_tmp19_, "name", XMPP_XEP_SERVICE_DISCOVERY_NS_URI_INFO);
			_tmp21_ = xmpp_xep_service_discovery_identity_new (_tmp16_, _tmp18_, _tmp20_);
			_tmp22_ = _tmp21_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp22_);
			_xmpp_xep_service_discovery_identity_unref0 (_tmp22_);
			_xmpp_stanza_entry_unref0 (feature_node);
		}
		_g_object_unref0 (_feature_node_list);
	}
	result = (GeeSet*) ret;
	return result;
}

void
xmpp_xep_service_discovery_info_result_set_identities (XmppXepServiceDiscoveryInfoResult* self,
                                                       GeeSet* value)
{
	g_return_if_fail (self != NULL);
	{
		GeeIterator* _identity_it = NULL;
		GeeIterator* _tmp0_;
		_tmp0_ = gee_iterable_iterator ((GeeIterable*) value);
		_identity_it = _tmp0_;
		while (TRUE) {
			GeeIterator* _tmp1_;
			XmppXepServiceDiscoveryIdentity* identity = NULL;
			GeeIterator* _tmp2_;
			gpointer _tmp3_;
			XmppXepServiceDiscoveryIdentity* _tmp4_;
			_tmp1_ = _identity_it;
			if (!gee_iterator_next (_tmp1_)) {
				break;
			}
			_tmp2_ = _identity_it;
			_tmp3_ = gee_iterator_get (_tmp2_);
			identity = (XmppXepServiceDiscoveryIdentity*) _tmp3_;
			_tmp4_ = identity;
			xmpp_xep_service_discovery_info_result_add_identity (self, _tmp4_);
			_xmpp_xep_service_discovery_identity_unref0 (identity);
		}
		_g_object_unref0 (_identity_it);
	}
}

static void
xmpp_xep_service_discovery_value_info_result_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xep_service_discovery_value_info_result_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xep_service_discovery_info_result_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xep_service_discovery_value_info_result_copy_value (const GValue* src_value,
                                                         GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xep_service_discovery_info_result_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xep_service_discovery_value_info_result_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xep_service_discovery_value_info_result_collect_value (GValue* value,
                                                            guint n_collect_values,
                                                            GTypeCValue* collect_values,
                                                            guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXepServiceDiscoveryInfoResult * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xep_service_discovery_info_result_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xep_service_discovery_value_info_result_lcopy_value (const GValue* value,
                                                          guint n_collect_values,
                                                          GTypeCValue* collect_values,
                                                          guint collect_flags)
{
	XmppXepServiceDiscoveryInfoResult ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xep_service_discovery_info_result_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_xep_service_discovery_param_spec_info_result (const gchar* name,
                                                   const gchar* nick,
                                                   const gchar* blurb,
                                                   GType object_type,
                                                   GParamFlags flags)
{
	XmppXepServiceDiscoveryParamSpecInfoResult* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_xep_service_discovery_value_get_info_result (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_xep_service_discovery_value_set_info_result (GValue* value,
                                                  gpointer v_object)
{
	XmppXepServiceDiscoveryInfoResult * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xep_service_discovery_info_result_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_service_discovery_info_result_unref (old);
	}
}

void
xmpp_xep_service_discovery_value_take_info_result (GValue* value,
                                                   gpointer v_object)
{
	XmppXepServiceDiscoveryInfoResult * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_service_discovery_info_result_unref (old);
	}
}

static void
xmpp_xep_service_discovery_info_result_class_init (XmppXepServiceDiscoveryInfoResultClass * klass,
                                                   gpointer klass_data)
{
	xmpp_xep_service_discovery_info_result_parent_class = g_type_class_peek_parent (klass);
	((XmppXepServiceDiscoveryInfoResultClass *) klass)->finalize = xmpp_xep_service_discovery_info_result_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXepServiceDiscoveryInfoResult_private_offset);
}

static void
xmpp_xep_service_discovery_info_result_instance_init (XmppXepServiceDiscoveryInfoResult * self,
                                                      gpointer klass)
{
	self->priv = xmpp_xep_service_discovery_info_result_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xep_service_discovery_info_result_finalize (XmppXepServiceDiscoveryInfoResult * obj)
{
	XmppXepServiceDiscoveryInfoResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_SERVICE_DISCOVERY_TYPE_INFO_RESULT, XmppXepServiceDiscoveryInfoResult);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_iq);
}

static GType
xmpp_xep_service_discovery_info_result_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_service_discovery_value_info_result_init, xmpp_xep_service_discovery_value_info_result_free_value, xmpp_xep_service_discovery_value_info_result_copy_value, xmpp_xep_service_discovery_value_info_result_peek_pointer, "p", xmpp_xep_service_discovery_value_info_result_collect_value, "p", xmpp_xep_service_discovery_value_info_result_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepServiceDiscoveryInfoResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_service_discovery_info_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepServiceDiscoveryInfoResult), 0, (GInstanceInitFunc) xmpp_xep_service_discovery_info_result_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xep_service_discovery_info_result_type_id;
	xmpp_xep_service_discovery_info_result_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepServiceDiscoveryInfoResult", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXepServiceDiscoveryInfoResult_private_offset = g_type_add_instance_private (xmpp_xep_service_discovery_info_result_type_id, sizeof (XmppXepServiceDiscoveryInfoResultPrivate));
	return xmpp_xep_service_discovery_info_result_type_id;
}

GType
xmpp_xep_service_discovery_info_result_get_type (void)
{
	static volatile gsize xmpp_xep_service_discovery_info_result_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_service_discovery_info_result_type_id__once)) {
		GType xmpp_xep_service_discovery_info_result_type_id;
		xmpp_xep_service_discovery_info_result_type_id = xmpp_xep_service_discovery_info_result_get_type_once ();
		g_once_init_leave (&xmpp_xep_service_discovery_info_result_type_id__once, xmpp_xep_service_discovery_info_result_type_id);
	}
	return xmpp_xep_service_discovery_info_result_type_id__once;
}

gpointer
xmpp_xep_service_discovery_info_result_ref (gpointer instance)
{
	XmppXepServiceDiscoveryInfoResult * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xep_service_discovery_info_result_unref (gpointer instance)
{
	XmppXepServiceDiscoveryInfoResult * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_SERVICE_DISCOVERY_INFO_RESULT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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;
}

