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

#include "xmpp-vala.h"
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.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_xep_file_metadata_element_file_metadata_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_file_metadata_element_file_metadata_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_xep_fallback_indication_fallback_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_fallback_indication_fallback_unref (var), NULL)))
enum  {
	XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_0_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_ID_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_METADATA_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_SOURCES_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_NUM_PROPERTIES];
enum  {
	XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_0_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_MESSAGE_ID_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_FILE_TRANSFER_ID_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_SOURCES_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_NUM_PROPERTIES];
enum  {
	XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_0_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_URL_PROPERTY,
	XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_stateless_file_sharing_http_source_properties[XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_NUM_PROPERTIES];

struct _XmppXepStatelessFileSharingFileSharePrivate {
	gchar* _id;
	XmppXepFileMetadataElementFileMetadata* _metadata;
	GeeList* _sources;
};

struct _XmppXepStatelessFileSharingSourceAttachmentPrivate {
	gchar* _to_message_id;
	gchar* _to_file_transfer_id;
	GeeList* _sources;
};

struct _XmppXepStatelessFileSharingHttpSourcePrivate {
	gchar* _url;
};

static gint XmppXepStatelessFileSharingFileShare_private_offset;
static gpointer xmpp_xep_stateless_file_sharing_file_share_parent_class = NULL;
static gint XmppXepStatelessFileSharingSourceAttachment_private_offset;
static gpointer xmpp_xep_stateless_file_sharing_source_attachment_parent_class = NULL;
static gint XmppXepStatelessFileSharingHttpSource_private_offset;
static gpointer xmpp_xep_stateless_file_sharing_http_source_parent_class = NULL;
static XmppXepStatelessFileSharingSourceIface * xmpp_xep_stateless_file_sharing_http_source_xmpp_xep_stateless_file_sharing_source_parent_iface = NULL;

VALA_EXTERN GeeList* xmpp_xep_stateless_file_sharing_get_sources (XmppStanzaNode* sources_node);
static gboolean _____lambda34_ (XmppXepFallbackIndicationFallbackLocation* it);
static gboolean ______lambda34__gee_predicate (gconstpointer g,
                                        gpointer self);
VALA_EXTERN XmppStanzaNode* xmpp_xep_stateless_file_sharing_create_sources_node (const gchar* file_sharing_id,
                                                                     GeeList* sources);
static void xmpp_xep_stateless_file_sharing_file_share_finalize (GObject * obj);
static GType xmpp_xep_stateless_file_sharing_file_share_get_type_once (void);
static void _vala_xmpp_xep_stateless_file_sharing_file_share_get_property (GObject * object,
                                                                    guint property_id,
                                                                    GValue * value,
                                                                    GParamSpec * pspec);
static void _vala_xmpp_xep_stateless_file_sharing_file_share_set_property (GObject * object,
                                                                    guint property_id,
                                                                    const GValue * value,
                                                                    GParamSpec * pspec);
static void xmpp_xep_stateless_file_sharing_source_attachment_finalize (GObject * obj);
static GType xmpp_xep_stateless_file_sharing_source_attachment_get_type_once (void);
static void _vala_xmpp_xep_stateless_file_sharing_source_attachment_get_property (GObject * object,
                                                                           guint property_id,
                                                                           GValue * value,
                                                                           GParamSpec * pspec);
static void _vala_xmpp_xep_stateless_file_sharing_source_attachment_set_property (GObject * object,
                                                                           guint property_id,
                                                                           const GValue * value,
                                                                           GParamSpec * pspec);
static GType xmpp_xep_stateless_file_sharing_source_get_type_once (void);
static gchar* xmpp_xep_stateless_file_sharing_http_source_real_type (XmppXepStatelessFileSharingSource* base);
static XmppStanzaNode* xmpp_xep_stateless_file_sharing_http_source_real_to_stanza_node (XmppXepStatelessFileSharingSource* base);
static gboolean xmpp_xep_stateless_file_sharing_http_source_real_equals (XmppXepStatelessFileSharingSource* base,
                                                                  XmppXepStatelessFileSharingSource* source);
static void xmpp_xep_stateless_file_sharing_http_source_finalize (GObject * obj);
static GType xmpp_xep_stateless_file_sharing_http_source_get_type_once (void);
static void _vala_xmpp_xep_stateless_file_sharing_http_source_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec);
static void _vala_xmpp_xep_stateless_file_sharing_http_source_set_property (GObject * object,
                                                                     guint property_id,
                                                                     const GValue * value,
                                                                     GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GeeList*
xmpp_xep_stateless_file_sharing_get_file_shares (XmppMessageStanza* message)
{
	GeeArrayList* ret = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	GeeList* result;
	g_return_val_if_fail (message != NULL, NULL);
	_tmp0_ = gee_array_list_new (XMPP_XEP_STATELESS_FILE_SHARING_TYPE_FILE_SHARE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	ret = _tmp0_;
	{
		GeeList* _file_sharing_node_list = NULL;
		XmppStanzaNode* _tmp1_;
		GeeList* _tmp2_;
		gint _file_sharing_node_size = 0;
		GeeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _file_sharing_node_index = 0;
		_tmp1_ = ((XmppStanza*) message)->stanza;
		_tmp2_ = xmpp_stanza_node_get_subnodes (_tmp1_, "file-sharing", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI, FALSE);
		_file_sharing_node_list = _tmp2_;
		_tmp3_ = _file_sharing_node_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_file_sharing_node_size = _tmp5_;
		_file_sharing_node_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			XmppStanzaNode* file_sharing_node = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			XmppXepFileMetadataElementFileMetadata* metadata = NULL;
			XmppStanzaNode* _tmp10_;
			XmppXepFileMetadataElementFileMetadata* _tmp11_;
			XmppXepFileMetadataElementFileMetadata* _tmp12_;
			XmppStanzaNode* sources_node = NULL;
			XmppStanzaNode* _tmp13_;
			XmppStanzaNode* _tmp14_;
			GeeList* _tmp15_ = NULL;
			XmppStanzaNode* _tmp16_;
			GeeArrayList* _tmp19_;
			XmppStanzaNode* _tmp20_;
			const gchar* _tmp21_;
			gchar* _tmp22_;
			XmppStanzaNode* _tmp23_;
			XmppXepFileMetadataElementFileMetadata* _tmp24_;
			GeeList* _tmp25_;
			XmppXepStatelessFileSharingFileShare* _tmp26_ = NULL;
			XmppXepStatelessFileSharingFileShare* _tmp27_;
			_file_sharing_node_index = _file_sharing_node_index + 1;
			_tmp6_ = _file_sharing_node_index;
			_tmp7_ = _file_sharing_node_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _file_sharing_node_list;
			_tmp9_ = gee_list_get (_tmp8_, _file_sharing_node_index);
			file_sharing_node = (XmppStanzaNode*) _tmp9_;
			_tmp10_ = file_sharing_node;
			_tmp11_ = xmpp_xep_file_metadata_element_get_file_metadata (_tmp10_);
			metadata = _tmp11_;
			_tmp12_ = metadata;
			if (_tmp12_ == NULL) {
				_xmpp_xep_file_metadata_element_file_metadata_unref0 (metadata);
				_xmpp_stanza_entry_unref0 (file_sharing_node);
				continue;
			}
			_tmp13_ = file_sharing_node;
			_tmp14_ = xmpp_stanza_node_get_subnode (_tmp13_, "sources", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI, FALSE);
			sources_node = _tmp14_;
			_tmp16_ = sources_node;
			if (_tmp16_ != NULL) {
				XmppStanzaNode* _tmp17_;
				GeeList* _tmp18_;
				_tmp17_ = sources_node;
				_tmp18_ = xmpp_xep_stateless_file_sharing_get_sources (_tmp17_);
				_g_object_unref0 (_tmp15_);
				_tmp15_ = _tmp18_;
			} else {
				_g_object_unref0 (_tmp15_);
				_tmp15_ = NULL;
			}
			_tmp19_ = ret;
			_tmp20_ = file_sharing_node;
			_tmp21_ = xmpp_stanza_node_get_attribute (_tmp20_, "id", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI);
			_tmp22_ = g_strdup (_tmp21_);
			_tmp23_ = file_sharing_node;
			_tmp24_ = xmpp_xep_file_metadata_element_get_file_metadata (_tmp23_);
			_tmp25_ = _tmp15_;
			_tmp15_ = NULL;
			_tmp26_ = xmpp_xep_stateless_file_sharing_file_share_new ();
			xmpp_xep_stateless_file_sharing_file_share_set_id (_tmp26_, _tmp22_);
			_g_free0 (_tmp22_);
			xmpp_xep_stateless_file_sharing_file_share_set_metadata (_tmp26_, _tmp24_);
			_xmpp_xep_file_metadata_element_file_metadata_unref0 (_tmp24_);
			xmpp_xep_stateless_file_sharing_file_share_set_sources (_tmp26_, _tmp25_);
			_g_object_unref0 (_tmp25_);
			_tmp27_ = _tmp26_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp27_);
			_g_object_unref0 (_tmp27_);
			_g_object_unref0 (_tmp15_);
			_xmpp_stanza_entry_unref0 (sources_node);
			_xmpp_xep_file_metadata_element_file_metadata_unref0 (metadata);
			_xmpp_stanza_entry_unref0 (file_sharing_node);
		}
		_g_object_unref0 (_file_sharing_node_list);
	}
	_tmp28_ = ret;
	_tmp29_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp28_);
	_tmp30_ = _tmp29_;
	if (_tmp30_ == 0) {
		result = NULL;
		_g_object_unref0 (ret);
		return result;
	}
	result = (GeeList*) ret;
	return result;
}

GeeList*
xmpp_xep_stateless_file_sharing_get_source_attachments (XmppMessageStanza* message)
{
	GeeList* sources_nodes = NULL;
	XmppStanzaNode* _tmp0_;
	GeeList* _tmp1_;
	GeeList* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	gchar* attach_to_id = NULL;
	XmppStanzaNode* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	GeeArrayList* ret = NULL;
	GeeArrayList* _tmp8_;
	GeeList* result;
	g_return_val_if_fail (message != NULL, NULL);
	_tmp0_ = ((XmppStanza*) message)->stanza;
	_tmp1_ = xmpp_stanza_node_get_subnodes (_tmp0_, "sources", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI, FALSE);
	sources_nodes = _tmp1_;
	_tmp2_ = sources_nodes;
	_tmp3_ = gee_collection_get_is_empty ((GeeCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		result = NULL;
		_g_object_unref0 (sources_nodes);
		return result;
	}
	_tmp5_ = ((XmppStanza*) message)->stanza;
	_tmp6_ = xmpp_xep_message_attaching_get_attach_to (_tmp5_);
	attach_to_id = _tmp6_;
	_tmp7_ = attach_to_id;
	if (_tmp7_ == NULL) {
		result = NULL;
		_g_free0 (attach_to_id);
		_g_object_unref0 (sources_nodes);
		return result;
	}
	_tmp8_ = gee_array_list_new (XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE_ATTACHMENT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	ret = _tmp8_;
	{
		GeeList* _sources_node_list = NULL;
		GeeList* _tmp9_;
		gint _sources_node_size = 0;
		GeeList* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gint _sources_node_index = 0;
		_tmp9_ = sources_nodes;
		_sources_node_list = _tmp9_;
		_tmp10_ = _sources_node_list;
		_tmp11_ = gee_collection_get_size ((GeeCollection*) _tmp10_);
		_tmp12_ = _tmp11_;
		_sources_node_size = _tmp12_;
		_sources_node_index = -1;
		while (TRUE) {
			gint _tmp13_;
			gint _tmp14_;
			XmppStanzaNode* sources_node = NULL;
			GeeList* _tmp15_;
			gpointer _tmp16_;
			GeeArrayList* _tmp17_;
			const gchar* _tmp18_;
			gchar* _tmp19_;
			XmppStanzaNode* _tmp20_;
			const gchar* _tmp21_;
			gchar* _tmp22_;
			XmppStanzaNode* _tmp23_;
			GeeList* _tmp24_;
			XmppXepStatelessFileSharingSourceAttachment* _tmp25_ = NULL;
			XmppXepStatelessFileSharingSourceAttachment* _tmp26_;
			_sources_node_index = _sources_node_index + 1;
			_tmp13_ = _sources_node_index;
			_tmp14_ = _sources_node_size;
			if (!(_tmp13_ < _tmp14_)) {
				break;
			}
			_tmp15_ = _sources_node_list;
			_tmp16_ = gee_list_get (_tmp15_, _sources_node_index);
			sources_node = (XmppStanzaNode*) _tmp16_;
			_tmp17_ = ret;
			_tmp18_ = attach_to_id;
			_tmp19_ = g_strdup (_tmp18_);
			_tmp20_ = sources_node;
			_tmp21_ = xmpp_stanza_node_get_attribute (_tmp20_, "id", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI);
			_tmp22_ = g_strdup (_tmp21_);
			_tmp23_ = sources_node;
			_tmp24_ = xmpp_xep_stateless_file_sharing_get_sources (_tmp23_);
			_tmp25_ = xmpp_xep_stateless_file_sharing_source_attachment_new ();
			xmpp_xep_stateless_file_sharing_source_attachment_set_to_message_id (_tmp25_, _tmp19_);
			_g_free0 (_tmp19_);
			xmpp_xep_stateless_file_sharing_source_attachment_set_to_file_transfer_id (_tmp25_, _tmp22_);
			_g_free0 (_tmp22_);
			xmpp_xep_stateless_file_sharing_source_attachment_set_sources (_tmp25_, _tmp24_);
			_g_object_unref0 (_tmp24_);
			_tmp26_ = _tmp25_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp17_, _tmp26_);
			_g_object_unref0 (_tmp26_);
			_xmpp_stanza_entry_unref0 (sources_node);
		}
	}
	result = (GeeList*) ret;
	_g_free0 (attach_to_id);
	_g_object_unref0 (sources_nodes);
	return result;
}

static gboolean
_____lambda34_ (XmppXepFallbackIndicationFallbackLocation* it)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean result;
	g_return_val_if_fail (it != NULL, FALSE);
	_tmp0_ = xmpp_xep_fallback_indication_fallback_location_get_is_whole (it);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static gboolean
______lambda34__gee_predicate (gconstpointer g,
                               gpointer self)
{
	gboolean result;
	result = _____lambda34_ ((XmppXepFallbackIndicationFallbackLocation*) g);
	return result;
}

gboolean
xmpp_xep_stateless_file_sharing_is_sfs_fallback_message (XmppMessageStanza* message)
{
	GeeList* fallbacks = NULL;
	GeeList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (message != NULL, FALSE);
	_tmp0_ = xmpp_xep_fallback_indication_get_fallbacks (message);
	fallbacks = _tmp0_;
	{
		GeeList* _fallback_list = NULL;
		GeeList* _tmp1_;
		gint _fallback_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _fallback_index = 0;
		_tmp1_ = fallbacks;
		_fallback_list = _tmp1_;
		_tmp2_ = _fallback_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_fallback_size = _tmp4_;
		_fallback_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			XmppXepFallbackIndicationFallback* fallback = NULL;
			GeeList* _tmp7_;
			gpointer _tmp8_;
			gboolean _tmp9_ = FALSE;
			XmppXepFallbackIndicationFallback* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			_fallback_index = _fallback_index + 1;
			_tmp5_ = _fallback_index;
			_tmp6_ = _fallback_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _fallback_list;
			_tmp8_ = gee_list_get (_tmp7_, _fallback_index);
			fallback = (XmppXepFallbackIndicationFallback*) _tmp8_;
			_tmp10_ = fallback;
			_tmp11_ = xmpp_xep_fallback_indication_fallback_get_ns_uri (_tmp10_);
			_tmp12_ = _tmp11_;
			if (g_strcmp0 (_tmp12_, XMPP_XEP_STATELESS_FILE_SHARING_NS_URI) == 0) {
				XmppXepFallbackIndicationFallback* _tmp13_;
				GeeList* _tmp14_;
				_tmp13_ = fallback;
				_tmp14_ = _tmp13_->locations;
				_tmp9_ = gee_traversable_any_match ((GeeTraversable*) _tmp14_, ______lambda34__gee_predicate, NULL, NULL);
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				result = TRUE;
				_xmpp_xep_fallback_indication_fallback_unref0 (fallback);
				_g_object_unref0 (fallbacks);
				return result;
			}
			_xmpp_xep_fallback_indication_fallback_unref0 (fallback);
		}
	}
	result = FALSE;
	_g_object_unref0 (fallbacks);
	return result;
}

GeeList*
xmpp_xep_stateless_file_sharing_get_sources (XmppStanzaNode* sources_node)
{
	gchar* url = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	XmppXepStatelessFileSharingHttpSource* http_source = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	XmppXepStatelessFileSharingHttpSource* _tmp4_ = NULL;
	GeeArrayList* sources = NULL;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	XmppXepStatelessFileSharingHttpSource* _tmp7_;
	GeeList* result;
	g_return_val_if_fail (sources_node != NULL, NULL);
	_tmp0_ = xmpp_xep_http_scheme_for_url_data_get_url (sources_node);
	url = _tmp0_;
	_tmp1_ = url;
	if (_tmp1_ == NULL) {
		result = NULL;
		_g_free0 (url);
		return result;
	}
	_tmp2_ = url;
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = xmpp_xep_stateless_file_sharing_http_source_new ();
	xmpp_xep_stateless_file_sharing_http_source_set_url (_tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	http_source = _tmp4_;
	_tmp5_ = gee_array_list_new (XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	sources = _tmp5_;
	_tmp6_ = sources;
	_tmp7_ = http_source;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, (XmppXepStatelessFileSharingSource*) _tmp7_);
	result = (GeeList*) sources;
	_g_object_unref0 (http_source);
	_g_free0 (url);
	return result;
}

void
xmpp_xep_stateless_file_sharing_set_sfs_element (XmppMessageStanza* message,
                                                 const gchar* file_sharing_id,
                                                 XmppXepFileMetadataElementFileMetadata* metadata,
                                                 GeeList* sources)
{
	XmppStanzaNode* file_sharing_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	gboolean _tmp10_ = FALSE;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	g_return_if_fail (message != NULL);
	g_return_if_fail (file_sharing_id != NULL);
	g_return_if_fail (metadata != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("file-sharing", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_put_attribute (_tmp3_, "id", file_sharing_id, XMPP_XEP_STATELESS_FILE_SHARING_NS_URI);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_xep_file_metadata_element_file_metadata_to_stanza_node (metadata);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_put_node (_tmp5_, _tmp7_);
	_tmp9_ = _tmp8_;
	_xmpp_stanza_entry_unref0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp5_);
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	file_sharing_node = _tmp9_;
	if (sources != NULL) {
		gboolean _tmp11_;
		gboolean _tmp12_;
		_tmp11_ = gee_collection_get_is_empty ((GeeCollection*) sources);
		_tmp12_ = _tmp11_;
		_tmp10_ = !_tmp12_;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		XmppStanzaNode* _tmp13_;
		XmppStanzaNode* _tmp14_;
		XmppStanzaNode* _tmp15_;
		XmppStanzaNode* _tmp16_;
		XmppStanzaNode* _tmp17_;
		_tmp13_ = file_sharing_node;
		_tmp14_ = xmpp_xep_stateless_file_sharing_create_sources_node (file_sharing_id, sources);
		_tmp15_ = _tmp14_;
		_tmp16_ = xmpp_stanza_node_put_node (_tmp13_, _tmp15_);
		_tmp17_ = _tmp16_;
		_xmpp_stanza_entry_unref0 (_tmp17_);
		_xmpp_stanza_entry_unref0 (_tmp15_);
	}
	_tmp18_ = ((XmppStanza*) message)->stanza;
	_tmp19_ = file_sharing_node;
	_tmp20_ = xmpp_stanza_node_put_node (_tmp18_, _tmp19_);
	_tmp21_ = _tmp20_;
	_xmpp_stanza_entry_unref0 (_tmp21_);
	_xmpp_stanza_entry_unref0 (file_sharing_node);
}

void
xmpp_xep_stateless_file_sharing_set_sfs_attachment (XmppMessageStanza* message,
                                                    const gchar* attach_to_id,
                                                    const gchar* attach_to_file_id,
                                                    GeeList* sources)
{
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	g_return_if_fail (message != NULL);
	g_return_if_fail (attach_to_id != NULL);
	g_return_if_fail (attach_to_file_id != NULL);
	g_return_if_fail (sources != NULL);
	_tmp0_ = ((XmppStanza*) message)->stanza;
	_tmp1_ = xmpp_xep_message_attaching_to_stanza_node (attach_to_id);
	_tmp2_ = _tmp1_;
	_tmp3_ = xmpp_stanza_node_put_node (_tmp0_, _tmp2_);
	_tmp4_ = _tmp3_;
	_xmpp_stanza_entry_unref0 (_tmp4_);
	_xmpp_stanza_entry_unref0 (_tmp2_);
	_tmp5_ = ((XmppStanza*) message)->stanza;
	_tmp6_ = xmpp_xep_stateless_file_sharing_create_sources_node (attach_to_file_id, sources);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_add_self_xmlns (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = xmpp_stanza_node_put_node (_tmp5_, _tmp9_);
	_tmp11_ = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp11_);
	_xmpp_stanza_entry_unref0 (_tmp9_);
	_xmpp_stanza_entry_unref0 (_tmp7_);
}

XmppStanzaNode*
xmpp_xep_stateless_file_sharing_create_sources_node (const gchar* file_sharing_id,
                                                     GeeList* sources)
{
	XmppStanzaNode* sources_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* result;
	g_return_val_if_fail (file_sharing_id != NULL, NULL);
	g_return_val_if_fail (sources != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("sources", XMPP_XEP_STATELESS_FILE_SHARING_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_put_attribute (_tmp1_, "id", file_sharing_id, XMPP_XEP_STATELESS_FILE_SHARING_NS_URI);
	_tmp3_ = _tmp2_;
	_xmpp_stanza_entry_unref0 (_tmp1_);
	sources_node = _tmp3_;
	{
		GeeList* _source_list = NULL;
		gint _source_size = 0;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _source_index = 0;
		_source_list = sources;
		_tmp4_ = _source_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_source_size = _tmp6_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			XmppXepStatelessFileSharingSource* source = NULL;
			GeeList* _tmp9_;
			gpointer _tmp10_;
			XmppStanzaNode* _tmp11_;
			XmppXepStatelessFileSharingSource* _tmp12_;
			XmppStanzaNode* _tmp13_;
			XmppStanzaNode* _tmp14_;
			XmppStanzaNode* _tmp15_;
			XmppStanzaNode* _tmp16_;
			_source_index = _source_index + 1;
			_tmp7_ = _source_index;
			_tmp8_ = _source_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _source_list;
			_tmp10_ = gee_list_get (_tmp9_, _source_index);
			source = (XmppXepStatelessFileSharingSource*) _tmp10_;
			_tmp11_ = sources_node;
			_tmp12_ = source;
			_tmp13_ = xmpp_xep_stateless_file_sharing_source_to_stanza_node (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = xmpp_stanza_node_put_node (_tmp11_, _tmp14_);
			_tmp16_ = _tmp15_;
			_xmpp_stanza_entry_unref0 (_tmp16_);
			_xmpp_stanza_entry_unref0 (_tmp14_);
			_g_object_unref0 (source);
		}
	}
	result = sources_node;
	return result;
}

static inline gpointer
xmpp_xep_stateless_file_sharing_file_share_get_instance_private (XmppXepStatelessFileSharingFileShare* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepStatelessFileSharingFileShare_private_offset);
}

XmppXepStatelessFileSharingFileShare*
xmpp_xep_stateless_file_sharing_file_share_construct (GType object_type)
{
	XmppXepStatelessFileSharingFileShare * self = NULL;
	self = (XmppXepStatelessFileSharingFileShare*) g_object_new (object_type, NULL);
	return self;
}

XmppXepStatelessFileSharingFileShare*
xmpp_xep_stateless_file_sharing_file_share_new (void)
{
	return xmpp_xep_stateless_file_sharing_file_share_construct (XMPP_XEP_STATELESS_FILE_SHARING_TYPE_FILE_SHARE);
}

const gchar*
xmpp_xep_stateless_file_sharing_file_share_get_id (XmppXepStatelessFileSharingFileShare* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_id;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_stateless_file_sharing_file_share_set_id (XmppXepStatelessFileSharingFileShare* self,
                                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_file_share_get_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_id);
		self->priv->_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_ID_PROPERTY]);
	}
}

XmppXepFileMetadataElementFileMetadata*
xmpp_xep_stateless_file_sharing_file_share_get_metadata (XmppXepStatelessFileSharingFileShare* self)
{
	XmppXepFileMetadataElementFileMetadata* result;
	XmppXepFileMetadataElementFileMetadata* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_metadata;
	result = _tmp0_;
	return result;
}

static gpointer
_xmpp_xep_file_metadata_element_file_metadata_ref0 (gpointer self)
{
	return self ? xmpp_xep_file_metadata_element_file_metadata_ref (self) : NULL;
}

void
xmpp_xep_stateless_file_sharing_file_share_set_metadata (XmppXepStatelessFileSharingFileShare* self,
                                                         XmppXepFileMetadataElementFileMetadata* value)
{
	XmppXepFileMetadataElementFileMetadata* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_file_share_get_metadata (self);
	if (old_value != value) {
		XmppXepFileMetadataElementFileMetadata* _tmp0_;
		_tmp0_ = _xmpp_xep_file_metadata_element_file_metadata_ref0 (value);
		_xmpp_xep_file_metadata_element_file_metadata_unref0 (self->priv->_metadata);
		self->priv->_metadata = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_METADATA_PROPERTY]);
	}
}

GeeList*
xmpp_xep_stateless_file_sharing_file_share_get_sources (XmppXepStatelessFileSharingFileShare* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sources;
	result = _tmp0_;
	return result;
}

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

void
xmpp_xep_stateless_file_sharing_file_share_set_sources (XmppXepStatelessFileSharingFileShare* self,
                                                        GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_file_share_get_sources (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sources);
		self->priv->_sources = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_SOURCES_PROPERTY]);
	}
}

static void
xmpp_xep_stateless_file_sharing_file_share_class_init (XmppXepStatelessFileSharingFileShareClass * klass,
                                                       gpointer klass_data)
{
	xmpp_xep_stateless_file_sharing_file_share_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepStatelessFileSharingFileShare_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_stateless_file_sharing_file_share_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_stateless_file_sharing_file_share_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_stateless_file_sharing_file_share_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_ID_PROPERTY, xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_METADATA_PROPERTY, xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_METADATA_PROPERTY] = xmpp_xep_file_metadata_element_param_spec_file_metadata ("metadata", "metadata", "metadata", XMPP_XEP_FILE_METADATA_ELEMENT_TYPE_FILE_METADATA, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_SOURCES_PROPERTY, xmpp_xep_stateless_file_sharing_file_share_properties[XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_SOURCES_PROPERTY] = g_param_spec_object ("sources", "sources", "sources", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
xmpp_xep_stateless_file_sharing_file_share_instance_init (XmppXepStatelessFileSharingFileShare * self,
                                                          gpointer klass)
{
	self->priv = xmpp_xep_stateless_file_sharing_file_share_get_instance_private (self);
}

static void
xmpp_xep_stateless_file_sharing_file_share_finalize (GObject * obj)
{
	XmppXepStatelessFileSharingFileShare * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_FILE_SHARE, XmppXepStatelessFileSharingFileShare);
	_g_free0 (self->priv->_id);
	_xmpp_xep_file_metadata_element_file_metadata_unref0 (self->priv->_metadata);
	_g_object_unref0 (self->priv->_sources);
	G_OBJECT_CLASS (xmpp_xep_stateless_file_sharing_file_share_parent_class)->finalize (obj);
}

static GType
xmpp_xep_stateless_file_sharing_file_share_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepStatelessFileSharingFileShareClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_stateless_file_sharing_file_share_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepStatelessFileSharingFileShare), 0, (GInstanceInitFunc) xmpp_xep_stateless_file_sharing_file_share_instance_init, NULL };
	GType xmpp_xep_stateless_file_sharing_file_share_type_id;
	xmpp_xep_stateless_file_sharing_file_share_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepStatelessFileSharingFileShare", &g_define_type_info, 0);
	XmppXepStatelessFileSharingFileShare_private_offset = g_type_add_instance_private (xmpp_xep_stateless_file_sharing_file_share_type_id, sizeof (XmppXepStatelessFileSharingFileSharePrivate));
	return xmpp_xep_stateless_file_sharing_file_share_type_id;
}

GType
xmpp_xep_stateless_file_sharing_file_share_get_type (void)
{
	static volatile gsize xmpp_xep_stateless_file_sharing_file_share_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_stateless_file_sharing_file_share_type_id__once)) {
		GType xmpp_xep_stateless_file_sharing_file_share_type_id;
		xmpp_xep_stateless_file_sharing_file_share_type_id = xmpp_xep_stateless_file_sharing_file_share_get_type_once ();
		g_once_init_leave (&xmpp_xep_stateless_file_sharing_file_share_type_id__once, xmpp_xep_stateless_file_sharing_file_share_type_id);
	}
	return xmpp_xep_stateless_file_sharing_file_share_type_id__once;
}

static void
_vala_xmpp_xep_stateless_file_sharing_file_share_get_property (GObject * object,
                                                               guint property_id,
                                                               GValue * value,
                                                               GParamSpec * pspec)
{
	XmppXepStatelessFileSharingFileShare * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_FILE_SHARE, XmppXepStatelessFileSharingFileShare);
	switch (property_id) {
		case XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_ID_PROPERTY:
		g_value_set_string (value, xmpp_xep_stateless_file_sharing_file_share_get_id (self));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_METADATA_PROPERTY:
		xmpp_xep_file_metadata_element_value_set_file_metadata (value, xmpp_xep_stateless_file_sharing_file_share_get_metadata (self));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_SOURCES_PROPERTY:
		g_value_set_object (value, xmpp_xep_stateless_file_sharing_file_share_get_sources (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_stateless_file_sharing_file_share_set_property (GObject * object,
                                                               guint property_id,
                                                               const GValue * value,
                                                               GParamSpec * pspec)
{
	XmppXepStatelessFileSharingFileShare * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_FILE_SHARE, XmppXepStatelessFileSharingFileShare);
	switch (property_id) {
		case XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_ID_PROPERTY:
		xmpp_xep_stateless_file_sharing_file_share_set_id (self, g_value_get_string (value));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_METADATA_PROPERTY:
		xmpp_xep_stateless_file_sharing_file_share_set_metadata (self, xmpp_xep_file_metadata_element_value_get_file_metadata (value));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_FILE_SHARE_SOURCES_PROPERTY:
		xmpp_xep_stateless_file_sharing_file_share_set_sources (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
xmpp_xep_stateless_file_sharing_source_attachment_get_instance_private (XmppXepStatelessFileSharingSourceAttachment* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepStatelessFileSharingSourceAttachment_private_offset);
}

XmppXepStatelessFileSharingSourceAttachment*
xmpp_xep_stateless_file_sharing_source_attachment_construct (GType object_type)
{
	XmppXepStatelessFileSharingSourceAttachment * self = NULL;
	self = (XmppXepStatelessFileSharingSourceAttachment*) g_object_new (object_type, NULL);
	return self;
}

XmppXepStatelessFileSharingSourceAttachment*
xmpp_xep_stateless_file_sharing_source_attachment_new (void)
{
	return xmpp_xep_stateless_file_sharing_source_attachment_construct (XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE_ATTACHMENT);
}

const gchar*
xmpp_xep_stateless_file_sharing_source_attachment_get_to_message_id (XmppXepStatelessFileSharingSourceAttachment* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_to_message_id;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_stateless_file_sharing_source_attachment_set_to_message_id (XmppXepStatelessFileSharingSourceAttachment* self,
                                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_source_attachment_get_to_message_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_to_message_id);
		self->priv->_to_message_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_MESSAGE_ID_PROPERTY]);
	}
}

const gchar*
xmpp_xep_stateless_file_sharing_source_attachment_get_to_file_transfer_id (XmppXepStatelessFileSharingSourceAttachment* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_to_file_transfer_id;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_stateless_file_sharing_source_attachment_set_to_file_transfer_id (XmppXepStatelessFileSharingSourceAttachment* self,
                                                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_source_attachment_get_to_file_transfer_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_to_file_transfer_id);
		self->priv->_to_file_transfer_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_FILE_TRANSFER_ID_PROPERTY]);
	}
}

GeeList*
xmpp_xep_stateless_file_sharing_source_attachment_get_sources (XmppXepStatelessFileSharingSourceAttachment* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sources;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_stateless_file_sharing_source_attachment_set_sources (XmppXepStatelessFileSharingSourceAttachment* self,
                                                               GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_source_attachment_get_sources (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sources);
		self->priv->_sources = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_SOURCES_PROPERTY]);
	}
}

static void
xmpp_xep_stateless_file_sharing_source_attachment_class_init (XmppXepStatelessFileSharingSourceAttachmentClass * klass,
                                                              gpointer klass_data)
{
	xmpp_xep_stateless_file_sharing_source_attachment_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepStatelessFileSharingSourceAttachment_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_stateless_file_sharing_source_attachment_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_stateless_file_sharing_source_attachment_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_stateless_file_sharing_source_attachment_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_MESSAGE_ID_PROPERTY, xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_MESSAGE_ID_PROPERTY] = g_param_spec_string ("to-message-id", "to-message-id", "to-message-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_FILE_TRANSFER_ID_PROPERTY, xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_FILE_TRANSFER_ID_PROPERTY] = g_param_spec_string ("to-file-transfer-id", "to-file-transfer-id", "to-file-transfer-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_SOURCES_PROPERTY, xmpp_xep_stateless_file_sharing_source_attachment_properties[XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_SOURCES_PROPERTY] = g_param_spec_object ("sources", "sources", "sources", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
xmpp_xep_stateless_file_sharing_source_attachment_instance_init (XmppXepStatelessFileSharingSourceAttachment * self,
                                                                 gpointer klass)
{
	self->priv = xmpp_xep_stateless_file_sharing_source_attachment_get_instance_private (self);
}

static void
xmpp_xep_stateless_file_sharing_source_attachment_finalize (GObject * obj)
{
	XmppXepStatelessFileSharingSourceAttachment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE_ATTACHMENT, XmppXepStatelessFileSharingSourceAttachment);
	_g_free0 (self->priv->_to_message_id);
	_g_free0 (self->priv->_to_file_transfer_id);
	_g_object_unref0 (self->priv->_sources);
	G_OBJECT_CLASS (xmpp_xep_stateless_file_sharing_source_attachment_parent_class)->finalize (obj);
}

static GType
xmpp_xep_stateless_file_sharing_source_attachment_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepStatelessFileSharingSourceAttachmentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_stateless_file_sharing_source_attachment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepStatelessFileSharingSourceAttachment), 0, (GInstanceInitFunc) xmpp_xep_stateless_file_sharing_source_attachment_instance_init, NULL };
	GType xmpp_xep_stateless_file_sharing_source_attachment_type_id;
	xmpp_xep_stateless_file_sharing_source_attachment_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepStatelessFileSharingSourceAttachment", &g_define_type_info, 0);
	XmppXepStatelessFileSharingSourceAttachment_private_offset = g_type_add_instance_private (xmpp_xep_stateless_file_sharing_source_attachment_type_id, sizeof (XmppXepStatelessFileSharingSourceAttachmentPrivate));
	return xmpp_xep_stateless_file_sharing_source_attachment_type_id;
}

GType
xmpp_xep_stateless_file_sharing_source_attachment_get_type (void)
{
	static volatile gsize xmpp_xep_stateless_file_sharing_source_attachment_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_stateless_file_sharing_source_attachment_type_id__once)) {
		GType xmpp_xep_stateless_file_sharing_source_attachment_type_id;
		xmpp_xep_stateless_file_sharing_source_attachment_type_id = xmpp_xep_stateless_file_sharing_source_attachment_get_type_once ();
		g_once_init_leave (&xmpp_xep_stateless_file_sharing_source_attachment_type_id__once, xmpp_xep_stateless_file_sharing_source_attachment_type_id);
	}
	return xmpp_xep_stateless_file_sharing_source_attachment_type_id__once;
}

static void
_vala_xmpp_xep_stateless_file_sharing_source_attachment_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec)
{
	XmppXepStatelessFileSharingSourceAttachment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE_ATTACHMENT, XmppXepStatelessFileSharingSourceAttachment);
	switch (property_id) {
		case XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_MESSAGE_ID_PROPERTY:
		g_value_set_string (value, xmpp_xep_stateless_file_sharing_source_attachment_get_to_message_id (self));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_FILE_TRANSFER_ID_PROPERTY:
		g_value_set_string (value, xmpp_xep_stateless_file_sharing_source_attachment_get_to_file_transfer_id (self));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_SOURCES_PROPERTY:
		g_value_set_object (value, xmpp_xep_stateless_file_sharing_source_attachment_get_sources (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_stateless_file_sharing_source_attachment_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec)
{
	XmppXepStatelessFileSharingSourceAttachment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE_ATTACHMENT, XmppXepStatelessFileSharingSourceAttachment);
	switch (property_id) {
		case XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_MESSAGE_ID_PROPERTY:
		xmpp_xep_stateless_file_sharing_source_attachment_set_to_message_id (self, g_value_get_string (value));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_TO_FILE_TRANSFER_ID_PROPERTY:
		xmpp_xep_stateless_file_sharing_source_attachment_set_to_file_transfer_id (self, g_value_get_string (value));
		break;
		case XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_ATTACHMENT_SOURCES_PROPERTY:
		xmpp_xep_stateless_file_sharing_source_attachment_set_sources (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

gchar*
xmpp_xep_stateless_file_sharing_source_type (XmppXepStatelessFileSharingSource* self)
{
	XmppXepStatelessFileSharingSourceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_GET_INTERFACE (self);
	if (_iface_->type) {
		return _iface_->type (self);
	}
	return NULL;
}

XmppStanzaNode*
xmpp_xep_stateless_file_sharing_source_to_stanza_node (XmppXepStatelessFileSharingSource* self)
{
	XmppXepStatelessFileSharingSourceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_GET_INTERFACE (self);
	if (_iface_->to_stanza_node) {
		return _iface_->to_stanza_node (self);
	}
	return NULL;
}

gboolean
xmpp_xep_stateless_file_sharing_source_equals (XmppXepStatelessFileSharingSource* self,
                                               XmppXepStatelessFileSharingSource* source)
{
	XmppXepStatelessFileSharingSourceIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = XMPP_XEP_STATELESS_FILE_SHARING_SOURCE_GET_INTERFACE (self);
	if (_iface_->equals) {
		return _iface_->equals (self, source);
	}
	return FALSE;
}

gboolean
xmpp_xep_stateless_file_sharing_source_equals_func (XmppXepStatelessFileSharingSource* s1,
                                                    XmppXepStatelessFileSharingSource* s2)
{
	gboolean result;
	g_return_val_if_fail (s1 != NULL, FALSE);
	g_return_val_if_fail (s2 != NULL, FALSE);
	result = xmpp_xep_stateless_file_sharing_source_equals (s1, s2);
	return result;
}

static void
xmpp_xep_stateless_file_sharing_source_default_init (XmppXepStatelessFileSharingSourceIface * iface,
                                                     gpointer iface_data)
{
}

static GType
xmpp_xep_stateless_file_sharing_source_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepStatelessFileSharingSourceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_stateless_file_sharing_source_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType xmpp_xep_stateless_file_sharing_source_type_id;
	xmpp_xep_stateless_file_sharing_source_type_id = g_type_register_static (G_TYPE_INTERFACE, "XmppXepStatelessFileSharingSource", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (xmpp_xep_stateless_file_sharing_source_type_id, G_TYPE_OBJECT);
	return xmpp_xep_stateless_file_sharing_source_type_id;
}

GType
xmpp_xep_stateless_file_sharing_source_get_type (void)
{
	static volatile gsize xmpp_xep_stateless_file_sharing_source_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_stateless_file_sharing_source_type_id__once)) {
		GType xmpp_xep_stateless_file_sharing_source_type_id;
		xmpp_xep_stateless_file_sharing_source_type_id = xmpp_xep_stateless_file_sharing_source_get_type_once ();
		g_once_init_leave (&xmpp_xep_stateless_file_sharing_source_type_id__once, xmpp_xep_stateless_file_sharing_source_type_id);
	}
	return xmpp_xep_stateless_file_sharing_source_type_id__once;
}

static inline gpointer
xmpp_xep_stateless_file_sharing_http_source_get_instance_private (XmppXepStatelessFileSharingHttpSource* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepStatelessFileSharingHttpSource_private_offset);
}

static gchar*
xmpp_xep_stateless_file_sharing_http_source_real_type (XmppXepStatelessFileSharingSource* base)
{
	XmppXepStatelessFileSharingHttpSource * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepStatelessFileSharingHttpSource*) base;
	_tmp0_ = g_strdup ("http");
	result = _tmp0_;
	return result;
}

static XmppStanzaNode*
xmpp_xep_stateless_file_sharing_http_source_real_to_stanza_node (XmppXepStatelessFileSharingSource* base)
{
	XmppXepStatelessFileSharingHttpSource * self;
	const gchar* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* result;
	self = (XmppXepStatelessFileSharingHttpSource*) base;
	_tmp0_ = self->priv->_url;
	_tmp1_ = xmpp_xep_http_scheme_for_url_data_to_stanza_node (_tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
xmpp_xep_stateless_file_sharing_http_source_real_equals (XmppXepStatelessFileSharingSource* base,
                                                         XmppXepStatelessFileSharingSource* source)
{
	XmppXepStatelessFileSharingHttpSource * self;
	XmppXepStatelessFileSharingHttpSource* http_source = NULL;
	XmppXepStatelessFileSharingHttpSource* _tmp0_;
	XmppXepStatelessFileSharingHttpSource* _tmp1_;
	XmppXepStatelessFileSharingHttpSource* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean result;
	self = (XmppXepStatelessFileSharingHttpSource*) base;
	g_return_val_if_fail (source != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (XMPP_XEP_STATELESS_FILE_SHARING_IS_HTTP_SOURCE (source) ? ((XmppXepStatelessFileSharingHttpSource*) source) : NULL);
	http_source = _tmp0_;
	_tmp1_ = http_source;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_object_unref0 (http_source);
		return result;
	}
	_tmp2_ = http_source;
	_tmp3_ = _tmp2_->priv->_url;
	_tmp4_ = self->priv->_url;
	result = g_strcmp0 (_tmp3_, _tmp4_) == 0;
	_g_object_unref0 (http_source);
	return result;
}

XmppXepStatelessFileSharingHttpSource*
xmpp_xep_stateless_file_sharing_http_source_construct (GType object_type)
{
	XmppXepStatelessFileSharingHttpSource * self = NULL;
	self = (XmppXepStatelessFileSharingHttpSource*) g_object_new (object_type, NULL);
	return self;
}

XmppXepStatelessFileSharingHttpSource*
xmpp_xep_stateless_file_sharing_http_source_new (void)
{
	return xmpp_xep_stateless_file_sharing_http_source_construct (XMPP_XEP_STATELESS_FILE_SHARING_TYPE_HTTP_SOURCE);
}

const gchar*
xmpp_xep_stateless_file_sharing_http_source_get_url (XmppXepStatelessFileSharingHttpSource* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_url;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_stateless_file_sharing_http_source_set_url (XmppXepStatelessFileSharingHttpSource* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_stateless_file_sharing_http_source_get_url (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_url);
		self->priv->_url = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_stateless_file_sharing_http_source_properties[XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_URL_PROPERTY]);
	}
}

static void
xmpp_xep_stateless_file_sharing_http_source_class_init (XmppXepStatelessFileSharingHttpSourceClass * klass,
                                                        gpointer klass_data)
{
	xmpp_xep_stateless_file_sharing_http_source_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepStatelessFileSharingHttpSource_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_stateless_file_sharing_http_source_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_stateless_file_sharing_http_source_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_stateless_file_sharing_http_source_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_URL_PROPERTY, xmpp_xep_stateless_file_sharing_http_source_properties[XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
xmpp_xep_stateless_file_sharing_http_source_xmpp_xep_stateless_file_sharing_source_interface_init (XmppXepStatelessFileSharingSourceIface * iface,
                                                                                                   gpointer iface_data)
{
	xmpp_xep_stateless_file_sharing_http_source_xmpp_xep_stateless_file_sharing_source_parent_iface = g_type_interface_peek_parent (iface);
	iface->type = (gchar* (*) (XmppXepStatelessFileSharingSource*)) xmpp_xep_stateless_file_sharing_http_source_real_type;
	iface->to_stanza_node = (XmppStanzaNode* (*) (XmppXepStatelessFileSharingSource*)) xmpp_xep_stateless_file_sharing_http_source_real_to_stanza_node;
	iface->equals = (gboolean (*) (XmppXepStatelessFileSharingSource*, XmppXepStatelessFileSharingSource*)) xmpp_xep_stateless_file_sharing_http_source_real_equals;
}

static void
xmpp_xep_stateless_file_sharing_http_source_instance_init (XmppXepStatelessFileSharingHttpSource * self,
                                                           gpointer klass)
{
	self->priv = xmpp_xep_stateless_file_sharing_http_source_get_instance_private (self);
}

static void
xmpp_xep_stateless_file_sharing_http_source_finalize (GObject * obj)
{
	XmppXepStatelessFileSharingHttpSource * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_HTTP_SOURCE, XmppXepStatelessFileSharingHttpSource);
	_g_free0 (self->priv->_url);
	G_OBJECT_CLASS (xmpp_xep_stateless_file_sharing_http_source_parent_class)->finalize (obj);
}

static GType
xmpp_xep_stateless_file_sharing_http_source_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepStatelessFileSharingHttpSourceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_stateless_file_sharing_http_source_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepStatelessFileSharingHttpSource), 0, (GInstanceInitFunc) xmpp_xep_stateless_file_sharing_http_source_instance_init, NULL };
	static const GInterfaceInfo xmpp_xep_stateless_file_sharing_source_info = { (GInterfaceInitFunc) xmpp_xep_stateless_file_sharing_http_source_xmpp_xep_stateless_file_sharing_source_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType xmpp_xep_stateless_file_sharing_http_source_type_id;
	xmpp_xep_stateless_file_sharing_http_source_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepStatelessFileSharingHttpSource", &g_define_type_info, 0);
	g_type_add_interface_static (xmpp_xep_stateless_file_sharing_http_source_type_id, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_SOURCE, &xmpp_xep_stateless_file_sharing_source_info);
	XmppXepStatelessFileSharingHttpSource_private_offset = g_type_add_instance_private (xmpp_xep_stateless_file_sharing_http_source_type_id, sizeof (XmppXepStatelessFileSharingHttpSourcePrivate));
	return xmpp_xep_stateless_file_sharing_http_source_type_id;
}

GType
xmpp_xep_stateless_file_sharing_http_source_get_type (void)
{
	static volatile gsize xmpp_xep_stateless_file_sharing_http_source_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_stateless_file_sharing_http_source_type_id__once)) {
		GType xmpp_xep_stateless_file_sharing_http_source_type_id;
		xmpp_xep_stateless_file_sharing_http_source_type_id = xmpp_xep_stateless_file_sharing_http_source_get_type_once ();
		g_once_init_leave (&xmpp_xep_stateless_file_sharing_http_source_type_id__once, xmpp_xep_stateless_file_sharing_http_source_type_id);
	}
	return xmpp_xep_stateless_file_sharing_http_source_type_id__once;
}

static void
_vala_xmpp_xep_stateless_file_sharing_http_source_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec)
{
	XmppXepStatelessFileSharingHttpSource * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_HTTP_SOURCE, XmppXepStatelessFileSharingHttpSource);
	switch (property_id) {
		case XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_URL_PROPERTY:
		g_value_set_string (value, xmpp_xep_stateless_file_sharing_http_source_get_url (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_stateless_file_sharing_http_source_set_property (GObject * object,
                                                                guint property_id,
                                                                const GValue * value,
                                                                GParamSpec * pspec)
{
	XmppXepStatelessFileSharingHttpSource * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_STATELESS_FILE_SHARING_TYPE_HTTP_SOURCE, XmppXepStatelessFileSharingHttpSource);
	switch (property_id) {
		case XMPP_XEP_STATELESS_FILE_SHARING_HTTP_SOURCE_URL_PROPERTY:
		xmpp_xep_stateless_file_sharing_http_source_set_url (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

