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

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "xmpp-vala.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <gee.h>

#define XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI "urn:xmpp:http:upload"
#define XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI_0 "urn:xmpp:http:upload:0"
#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

enum  {
	XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_0_PROPERTY,
	XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_http_file_upload_module_properties[XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block16Data Block16Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _XmppXepHttpFileUploadModuleRequestSlotData XmppXepHttpFileUploadModuleRequestSlotData;
#define _xmpp_xep_service_discovery_items_result_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_service_discovery_items_result_unref (var), NULL)))
#define _xmpp_xep_service_discovery_info_result_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_service_discovery_info_result_unref (var), NULL)))
#define _xmpp_xep_service_discovery_item_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_service_discovery_item_unref (var), NULL)))
typedef struct _XmppXepHttpFileUploadModuleQueryAvailabilityData XmppXepHttpFileUploadModuleQueryAvailabilityData;
enum  {
	XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_FEATURE_AVAILABLE_SIGNAL,
	XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_RECEIVED_URL_SIGNAL,
	XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_NUM_SIGNALS
};
static guint xmpp_xep_http_file_upload_module_signals[XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_NUM_SIGNALS] = {0};
enum  {
	XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_0_PROPERTY,
	XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY,
	XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY,
	XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_http_file_upload_received_pipeline_listener_properties[XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_NUM_PROPERTIES];
typedef struct _XmppXepHttpFileUploadReceivedPipelineListenerRunData XmppXepHttpFileUploadReceivedPipelineListenerRunData;
enum  {
	XMPP_XEP_HTTP_FILE_UPLOAD_FLAG_0_PROPERTY,
	XMPP_XEP_HTTP_FILE_UPLOAD_FLAG_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_http_file_upload_flag_properties[XMPP_XEP_HTTP_FILE_UPLOAD_FLAG_NUM_PROPERTIES];

struct _Block16Data {
	int _ref_count_;
	XmppXepHttpFileUploadModule* self;
	XmppXepHttpFileUploadFlag* flag;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	XmppXepHttpFileUploadModuleSlotResult slot_result;
	GError* e;
	gpointer _async_data_;
};

struct _XmppXepHttpFileUploadModuleRequestSlotData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepHttpFileUploadModule* self;
	XmppXmppStream* stream;
	gchar* filename;
	gint64 file_size;
	gchar* content_type;
	XmppXepHttpFileUploadModuleSlotResult result;
	Block16Data* _data16_;
	XmppFlagIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepHttpFileUploadFlag* _tmp2_;
	GError* _tmp3_;
	XmppStanzaNode* request_node;
	XmppXepHttpFileUploadFlag* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	GQuark _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppStanzaNode* _tmp23_;
	XmppStanzaNode* _tmp24_;
	XmppStanzaNode* _tmp25_;
	XmppStanzaNode* _tmp26_;
	XmppStanzaNode* _tmp27_;
	XmppStanzaNode* _tmp28_;
	XmppStanzaNode* _tmp29_;
	XmppStanzaNode* _tmp30_;
	XmppStanzaNode* _tmp31_;
	XmppStanzaNode* _tmp32_;
	XmppStanzaNode* _tmp33_;
	XmppStanzaNode* _tmp34_;
	XmppStanzaNode* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	XmppStanzaNode* _tmp38_;
	XmppStanzaNode* _tmp39_;
	XmppStanzaNode* _tmp40_;
	XmppStanzaNode* _tmp41_;
	XmppStanzaNode* _tmp42_;
	XmppStanzaNode* _tmp43_;
	XmppStanzaNode* _tmp44_;
	XmppStanzaNode* _tmp45_;
	XmppStanzaNode* _tmp46_;
	XmppStanzaNode* _tmp47_;
	XmppStanzaNode* _tmp48_;
	XmppStanzaNode* _tmp49_;
	XmppStanzaNode* _tmp50_;
	XmppStanzaNode* _tmp51_;
	XmppIqStanza* iq;
	XmppStanzaNode* _tmp52_;
	XmppXepHttpFileUploadFlag* _tmp53_;
	XmppJid* _tmp54_;
	XmppJid* _tmp55_;
	XmppIqStanza* _tmp56_;
	XmppModuleIdentity* _tmp57_;
	gpointer _tmp58_;
	XmppIqModule* _tmp59_;
	XmppIqStanza* _tmp60_;
	GError* _tmp61_;
	GError* _tmp62_;
	GError* _tmp63_;
	XmppXepHttpFileUploadModuleSlotResult _tmp64_;
	XmppXepHttpFileUploadModuleSlotResult _tmp65_;
	XmppXepHttpFileUploadModuleSlotResult _tmp66_;
	GError* _inner_error0_;
};

struct _XmppXepHttpFileUploadModuleQueryAvailabilityData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepHttpFileUploadModule* self;
	XmppXmppStream* stream;
	XmppXepServiceDiscoveryInfoResult* info_result;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppJid* _tmp3_;
	XmppXepServiceDiscoveryInfoResult* _tmp4_;
	XmppXepServiceDiscoveryInfoResult* _tmp5_;
	gboolean available;
	XmppJid* _tmp6_;
	XmppXepServiceDiscoveryInfoResult* _tmp7_;
	XmppXepServiceDiscoveryItemsResult* items_result;
	XmppModuleIdentity* _tmp8_;
	gpointer _tmp9_;
	XmppXepServiceDiscoveryModule* _tmp10_;
	XmppJid* _tmp11_;
	XmppXepServiceDiscoveryItemsResult* _tmp12_;
	XmppXepServiceDiscoveryItemsResult* _tmp13_;
	XmppXepServiceDiscoveryItemsResult* _tmp14_;
	gint i;
	gboolean _tmp15_;
	gint _tmp16_;
	GeeArrayList* _item_list;
	XmppXepServiceDiscoveryItemsResult* _tmp17_;
	GeeArrayList* _tmp18_;
	GeeArrayList* _tmp19_;
	gint _item_size;
	GeeArrayList* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	gint _item_index;
	gint _tmp23_;
	gint _tmp24_;
	XmppXepServiceDiscoveryItem* item;
	GeeArrayList* _tmp25_;
	gpointer _tmp26_;
	gboolean promising_upload_item;
	XmppXepServiceDiscoveryItem* _tmp27_;
	XmppJid* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gboolean _tmp31_;
	gboolean _tmp32_;
	gboolean _tmp33_;
	gboolean _tmp34_;
	XmppXepServiceDiscoveryInfoResult* info_result2;
	XmppModuleIdentity* _tmp35_;
	gpointer _tmp36_;
	XmppXepServiceDiscoveryModule* _tmp37_;
	XmppXepServiceDiscoveryItem* _tmp38_;
	XmppJid* _tmp39_;
	XmppXepServiceDiscoveryInfoResult* _tmp40_;
	XmppXepServiceDiscoveryInfoResult* _tmp41_;
	gboolean available2;
	XmppXepServiceDiscoveryItem* _tmp42_;
	XmppJid* _tmp43_;
	XmppXepServiceDiscoveryInfoResult* _tmp44_;
};

struct _XmppXepHttpFileUploadReceivedPipelineListenerPrivate {
	gchar** after_actions_const;
	gint after_actions_const_length1;
	gint _after_actions_const_size_;
};

struct _XmppXepHttpFileUploadReceivedPipelineListenerRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepHttpFileUploadReceivedPipelineListener* self;
	XmppXmppStream* stream;
	XmppMessageStanza* message;
	gboolean result;
	gchar* oob_url;
	gchar* _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppXepHttpFileUploadModule* _tmp8_;
};

static gpointer xmpp_xep_http_file_upload_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_http_file_upload_module_IDENTITY = NULL;
static gint XmppXepHttpFileUploadReceivedPipelineListener_private_offset;
static gpointer xmpp_xep_http_file_upload_received_pipeline_listener_parent_class = NULL;
static gpointer xmpp_xep_http_file_upload_flag_parent_class = NULL;
XmppFlagIdentity* xmpp_xep_http_file_upload_flag_IDENTITY = NULL;

static void xmpp_xep_http_file_upload_module_request_slot_data_free (gpointer _data);
static gboolean xmpp_xep_http_file_upload_module_request_slot_co (XmppXepHttpFileUploadModuleRequestSlotData* _data_);
static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
static gboolean _xmpp_xep_http_file_upload_module_request_slot_co_gsource_func (gpointer self);
static void __lambda33_ (Block16Data* _data16_,
                  XmppXmppStream* stream,
                  XmppIqStanza* iq);
static void ___lambda33__xmpp_iq_module_on_result (XmppXmppStream* stream,
                                            XmppIqStanza* iq,
                                            gpointer self);
static void xmpp_xep_http_file_upload_module_real_attach (XmppXmppStreamModule* base,
                                                   XmppXmppStream* stream);
static void xmpp_xep_http_file_upload_module_query_availability (XmppXepHttpFileUploadModule* self,
                                                          XmppXmppStream* stream,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static void xmpp_xep_http_file_upload_module_query_availability_finish (XmppXepHttpFileUploadModule* self,
                                                                 GAsyncResult* _res_);
static void _xmpp_xep_http_file_upload_module_query_availability_xmpp_xmpp_stream_stream_negotiated (XmppXmppStream* _sender,
                                                                                              XmppXmppStream* stream,
                                                                                              gpointer self);
static void xmpp_xep_http_file_upload_module_real_detach (XmppXmppStreamModule* base,
                                                   XmppXmppStream* stream);
static gchar* xmpp_xep_http_file_upload_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_http_file_upload_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_http_file_upload_module_query_availability_data_free (gpointer _data);
static gboolean xmpp_xep_http_file_upload_module_query_availability_co (XmppXepHttpFileUploadModuleQueryAvailabilityData* _data_);
static void xmpp_xep_http_file_upload_module_query_availability_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_);
static gboolean xmpp_xep_http_file_upload_module_check_ns_in_info (XmppXepHttpFileUploadModule* self,
                                                            XmppXmppStream* stream,
                                                            XmppJid* jid,
                                                            XmppXepServiceDiscoveryInfoResult* info_result);
static glong xmpp_xep_http_file_upload_module_extract_max_file_size (XmppXepHttpFileUploadModule* self,
                                                              XmppXepServiceDiscoveryInfoResult* info_result);
static void g_cclosure_user_marshal_VOID__OBJECT_LONG (GClosure * closure,
                                                GValue * return_value,
                                                guint n_param_values,
                                                const GValue * param_values,
                                                gpointer invocation_hint,
                                                gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void xmpp_xep_http_file_upload_module_finalize (GObject * obj);
static GType xmpp_xep_http_file_upload_module_get_type_once (void);
static void xmpp_xep_http_file_upload_received_pipeline_listener_real_run_data_free (gpointer _data);
static void xmpp_xep_http_file_upload_received_pipeline_listener_real_run (XmppStanzaListener* base,
                                                                    XmppXmppStream* stream,
                                                                    XmppMessageStanza* message,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_);
static gboolean xmpp_xep_http_file_upload_received_pipeline_listener_real_run_co (XmppXepHttpFileUploadReceivedPipelineListenerRunData* _data_);
static void xmpp_xep_http_file_upload_received_pipeline_listener_finalize (GObject * obj);
static GType xmpp_xep_http_file_upload_received_pipeline_listener_get_type_once (void);
static void _vala_xmpp_xep_http_file_upload_received_pipeline_listener_get_property (GObject * object,
                                                                              guint property_id,
                                                                              GValue * value,
                                                                              GParamSpec * pspec);
static gchar* xmpp_xep_http_file_upload_flag_real_get_ns (XmppXmppStreamFlag* base);
static gchar* xmpp_xep_http_file_upload_flag_real_get_id (XmppXmppStreamFlag* base);
static void xmpp_xep_http_file_upload_flag_finalize (GObject * obj);
static GType xmpp_xep_http_file_upload_flag_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GQuark
xmpp_xep_http_file_upload_http_file_transfer_error_quark (void)
{
	return g_quark_from_static_string ("xmpp-xep-http-file-upload-http-file-transfer-error-quark");
}

static GType
xmpp_xep_http_file_upload_http_file_transfer_error_get_type_once (void)
{
	static const GEnumValue values[] = {{XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR_SLOT_REQUEST, "XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR_SLOT_REQUEST", "slot-request"}, {0, NULL, NULL}};
	GType xmpp_xep_http_file_upload_http_file_transfer_error_type_id;
	xmpp_xep_http_file_upload_http_file_transfer_error_type_id = g_enum_register_static ("XmppXepHttpFileUploadHttpFileTransferError", values);
	return xmpp_xep_http_file_upload_http_file_transfer_error_type_id;
}

GType
xmpp_xep_http_file_upload_http_file_transfer_error_get_type (void)
{
	static volatile gsize xmpp_xep_http_file_upload_http_file_transfer_error_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_http_file_upload_http_file_transfer_error_type_id__once)) {
		GType xmpp_xep_http_file_upload_http_file_transfer_error_type_id;
		xmpp_xep_http_file_upload_http_file_transfer_error_type_id = xmpp_xep_http_file_upload_http_file_transfer_error_get_type_once ();
		g_once_init_leave (&xmpp_xep_http_file_upload_http_file_transfer_error_type_id__once, xmpp_xep_http_file_upload_http_file_transfer_error_type_id);
	}
	return xmpp_xep_http_file_upload_http_file_transfer_error_type_id__once;
}

static void
xmpp_xep_http_file_upload_module_request_slot_data_free (gpointer _data)
{
	XmppXepHttpFileUploadModuleRequestSlotData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_free0 (_data_->filename);
	_g_free0 (_data_->content_type);
	xmpp_xep_http_file_upload_module_slot_result_destroy (&_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepHttpFileUploadModuleRequestSlotData, _data_);
}

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

void
xmpp_xep_http_file_upload_module_request_slot (XmppXepHttpFileUploadModule* self,
                                               XmppXmppStream* stream,
                                               const gchar* filename,
                                               gint64 file_size,
                                               const gchar* content_type,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	XmppXepHttpFileUploadModuleRequestSlotData* _data_;
	XmppXepHttpFileUploadModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (filename != NULL);
	_data_ = g_slice_new0 (XmppXepHttpFileUploadModuleRequestSlotData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_http_file_upload_module_request_slot_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = g_strdup (filename);
	_g_free0 (_data_->filename);
	_data_->filename = _tmp2_;
	_data_->file_size = file_size;
	_tmp3_ = g_strdup (content_type);
	_g_free0 (_data_->content_type);
	_data_->content_type = _tmp3_;
	xmpp_xep_http_file_upload_module_request_slot_co (_data_);
}

void
xmpp_xep_http_file_upload_module_request_slot_finish (XmppXepHttpFileUploadModule* self,
                                                      GAsyncResult* _res_,
                                                      XmppXepHttpFileUploadModuleSlotResult* result,
                                                      GError** error)
{
	XmppXepHttpFileUploadModuleRequestSlotData* _data_;
	XmppXepHttpFileUploadModuleSlotResult _tmp0_;
	XmppXepHttpFileUploadModuleSlotResult _tmp1_ = {0};
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
	_tmp0_ = _data_->result;
	xmpp_xep_http_file_upload_module_slot_result_copy (&_tmp0_, &_tmp1_);
	*result = _tmp1_;
}

static Block16Data*
block16_data_ref (Block16Data* _data16_)
{
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}

static void
block16_data_unref (void * _userdata_)
{
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		XmppXepHttpFileUploadModule* self;
		self = _data16_->self;
		_g_error_free0 (_data16_->e);
		xmpp_xep_http_file_upload_module_slot_result_destroy (&_data16_->slot_result);
		(_data16_->callback_target_destroy_notify == NULL) ? NULL : (_data16_->callback_target_destroy_notify (_data16_->callback_target), NULL);
		_data16_->callback = NULL;
		_data16_->callback_target = NULL;
		_data16_->callback_target_destroy_notify = NULL;
		_g_object_unref0 (_data16_->flag);
		_g_object_unref0 (self);
		g_slice_free (Block16Data, _data16_);
	}
}

static gboolean
_xmpp_xep_http_file_upload_module_request_slot_co_gsource_func (gpointer self)
{
	gboolean result;
	result = xmpp_xep_http_file_upload_module_request_slot_co (self);
	return result;
}

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
__lambda33_ (Block16Data* _data16_,
             XmppXmppStream* stream,
             XmppIqStanza* iq)
{
	XmppXepHttpFileUploadModule* self;
	gchar* url_get = NULL;
	gchar* url_put = NULL;
	XmppStanzaNode* _tmp2_;
	XmppXepHttpFileUploadFlag* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	XmppXepHttpFileUploadFlag* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	XmppXepHttpFileUploadFlag* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppXepHttpFileUploadFlag* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	XmppXepHttpFileUploadFlag* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	XmppXepHttpFileUploadFlag* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gboolean _tmp32_ = FALSE;
	const gchar* _tmp33_;
	gboolean _tmp57_ = FALSE;
	const gchar* _tmp58_;
	gboolean _tmp67_ = FALSE;
	const gchar* _tmp68_;
	gchar* _tmp69_;
	gchar* _tmp70_;
	gboolean _tmp71_;
	GeeHashMap* _tmp77_;
	GeeHashMap* _tmp78_;
	const gchar* _tmp126_;
	const gchar* _tmp127_;
	GSourceFunc _tmp128_;
	gpointer _tmp128__target;
	GDestroyNotify _tmp128__target_destroy_notify;
	self = _data16_->self;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	if (xmpp_stanza_is_error ((XmppStanza*) iq)) {
		GError* _tmp0_;
		GSourceFunc _tmp1_;
		gpointer _tmp1__target;
		GDestroyNotify _tmp1__target_destroy_notify;
		_tmp0_ = g_error_new_literal (XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR, XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR_SLOT_REQUEST, "Error getting upload/download url (Error Iq)");
		_g_error_free0 (_data16_->e);
		_data16_->e = _tmp0_;
		_tmp1_ = _data16_->callback;
		_tmp1__target = _data16_->callback_target;
		_tmp1__target_destroy_notify = _data16_->callback_target_destroy_notify;
		_data16_->callback = NULL;
		_data16_->callback_target = NULL;
		_data16_->callback_target_destroy_notify = NULL;
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp1_, _tmp1__target, _tmp1__target_destroy_notify);
		return;
	}
	url_get = NULL;
	url_put = NULL;
	_tmp2_ = ((XmppStanza*) iq)->stanza;
	_tmp3_ = _data16_->flag;
	_tmp4_ = _tmp3_->ns_ver;
	_tmp5_ = g_strconcat (_tmp4_, ":slot", NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = _data16_->flag;
	_tmp8_ = _tmp7_->ns_ver;
	_tmp9_ = g_strconcat (_tmp8_, ":get", NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = _data16_->flag;
	_tmp12_ = _tmp11_->ns_ver;
	_tmp13_ = g_strconcat (_tmp12_, ":url", NULL);
	_tmp14_ = _tmp13_;
	_tmp15_ = xmpp_stanza_node_get_deep_attribute (_tmp2_, _tmp6_, _tmp10_, _tmp14_, NULL);
	_tmp16_ = g_strdup (_tmp15_);
	_g_free0 (url_get);
	url_get = _tmp16_;
	_g_free0 (_tmp14_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp6_);
	_tmp17_ = ((XmppStanza*) iq)->stanza;
	_tmp18_ = _data16_->flag;
	_tmp19_ = _tmp18_->ns_ver;
	_tmp20_ = g_strconcat (_tmp19_, ":slot", NULL);
	_tmp21_ = _tmp20_;
	_tmp22_ = _data16_->flag;
	_tmp23_ = _tmp22_->ns_ver;
	_tmp24_ = g_strconcat (_tmp23_, ":put", NULL);
	_tmp25_ = _tmp24_;
	_tmp26_ = _data16_->flag;
	_tmp27_ = _tmp26_->ns_ver;
	_tmp28_ = g_strconcat (_tmp27_, ":url", NULL);
	_tmp29_ = _tmp28_;
	_tmp30_ = xmpp_stanza_node_get_deep_attribute (_tmp17_, _tmp21_, _tmp25_, _tmp29_, NULL);
	_tmp31_ = g_strdup (_tmp30_);
	_g_free0 (url_put);
	url_put = _tmp31_;
	_g_free0 (_tmp29_);
	_g_free0 (_tmp25_);
	_g_free0 (_tmp21_);
	_tmp33_ = url_get;
	if (_tmp33_ == NULL) {
		const gchar* _tmp34_;
		_tmp34_ = url_put;
		_tmp32_ = _tmp34_ == NULL;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		XmppStanzaNode* _tmp35_;
		XmppXepHttpFileUploadFlag* _tmp36_;
		const gchar* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		XmppXepHttpFileUploadFlag* _tmp40_;
		const gchar* _tmp41_;
		gchar* _tmp42_;
		gchar* _tmp43_;
		const gchar* _tmp44_;
		gchar* _tmp45_;
		XmppStanzaNode* _tmp46_;
		XmppXepHttpFileUploadFlag* _tmp47_;
		const gchar* _tmp48_;
		gchar* _tmp49_;
		gchar* _tmp50_;
		XmppXepHttpFileUploadFlag* _tmp51_;
		const gchar* _tmp52_;
		gchar* _tmp53_;
		gchar* _tmp54_;
		const gchar* _tmp55_;
		gchar* _tmp56_;
		_tmp35_ = ((XmppStanza*) iq)->stanza;
		_tmp36_ = _data16_->flag;
		_tmp37_ = _tmp36_->ns_ver;
		_tmp38_ = g_strconcat (_tmp37_, ":slot", NULL);
		_tmp39_ = _tmp38_;
		_tmp40_ = _data16_->flag;
		_tmp41_ = _tmp40_->ns_ver;
		_tmp42_ = g_strconcat (_tmp41_, ":get", NULL);
		_tmp43_ = _tmp42_;
		_tmp44_ = xmpp_stanza_node_get_deep_string_content (_tmp35_, _tmp39_, _tmp43_, NULL);
		_tmp45_ = g_strdup (_tmp44_);
		_g_free0 (url_get);
		url_get = _tmp45_;
		_g_free0 (_tmp43_);
		_g_free0 (_tmp39_);
		_tmp46_ = ((XmppStanza*) iq)->stanza;
		_tmp47_ = _data16_->flag;
		_tmp48_ = _tmp47_->ns_ver;
		_tmp49_ = g_strconcat (_tmp48_, ":slot", NULL);
		_tmp50_ = _tmp49_;
		_tmp51_ = _data16_->flag;
		_tmp52_ = _tmp51_->ns_ver;
		_tmp53_ = g_strconcat (_tmp52_, ":put", NULL);
		_tmp54_ = _tmp53_;
		_tmp55_ = xmpp_stanza_node_get_deep_string_content (_tmp46_, _tmp50_, _tmp54_, NULL);
		_tmp56_ = g_strdup (_tmp55_);
		_g_free0 (url_put);
		url_put = _tmp56_;
		_g_free0 (_tmp54_);
		_g_free0 (_tmp50_);
	}
	_tmp58_ = url_get;
	if (_tmp58_ == NULL) {
		_tmp57_ = TRUE;
	} else {
		const gchar* _tmp59_;
		_tmp59_ = url_put;
		_tmp57_ = _tmp59_ == NULL;
	}
	if (_tmp57_) {
		XmppStanzaNode* _tmp60_;
		gchar* _tmp61_;
		gchar* _tmp62_;
		gchar* _tmp63_;
		gchar* _tmp64_;
		GError* _tmp65_;
		GSourceFunc _tmp66_;
		gpointer _tmp66__target;
		GDestroyNotify _tmp66__target_destroy_notify;
		_tmp60_ = ((XmppStanza*) iq)->stanza;
		_tmp61_ = xmpp_stanza_entry_to_string ((XmppStanzaEntry*) _tmp60_, 0);
		_tmp62_ = _tmp61_;
		_tmp63_ = g_strdup_printf ("Error getting upload/download url: %s", _tmp62_);
		_tmp64_ = _tmp63_;
		_tmp65_ = g_error_new_literal (XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR, XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR_SLOT_REQUEST, _tmp64_);
		_g_error_free0 (_data16_->e);
		_data16_->e = _tmp65_;
		_g_free0 (_tmp64_);
		_g_free0 (_tmp62_);
		_tmp66_ = _data16_->callback;
		_tmp66__target = _data16_->callback_target;
		_tmp66__target_destroy_notify = _data16_->callback_target_destroy_notify;
		_data16_->callback = NULL;
		_data16_->callback_target = NULL;
		_data16_->callback_target_destroy_notify = NULL;
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp66_, _tmp66__target, _tmp66__target_destroy_notify);
		_g_free0 (url_put);
		_g_free0 (url_get);
		return;
	}
	_tmp68_ = url_get;
	_tmp69_ = g_utf8_strdown (_tmp68_, (gssize) -1);
	_tmp70_ = _tmp69_;
	_tmp71_ = !g_str_has_prefix (_tmp70_, "https://");
	_g_free0 (_tmp70_);
	if (_tmp71_) {
		_tmp67_ = TRUE;
	} else {
		const gchar* _tmp72_;
		gchar* _tmp73_;
		gchar* _tmp74_;
		_tmp72_ = url_put;
		_tmp73_ = g_utf8_strdown (_tmp72_, (gssize) -1);
		_tmp74_ = _tmp73_;
		_tmp67_ = !g_str_has_prefix (_tmp74_, "https://");
		_g_free0 (_tmp74_);
	}
	if (_tmp67_) {
		GError* _tmp75_;
		GSourceFunc _tmp76_;
		gpointer _tmp76__target;
		GDestroyNotify _tmp76__target_destroy_notify;
		_tmp75_ = g_error_new_literal (XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR, XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR_SLOT_REQUEST, "Error getting upload/download url: Received non-https URL from server");
		_g_error_free0 (_data16_->e);
		_data16_->e = _tmp75_;
		_tmp76_ = _data16_->callback;
		_tmp76__target = _data16_->callback_target;
		_tmp76__target_destroy_notify = _data16_->callback_target_destroy_notify;
		_data16_->callback = NULL;
		_data16_->callback_target = NULL;
		_data16_->callback_target_destroy_notify = NULL;
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp76_, _tmp76__target, _tmp76__target_destroy_notify);
		_g_free0 (url_put);
		_g_free0 (url_get);
		return;
	}
	_tmp77_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_tmp78_ = _tmp77_;
	xmpp_xep_http_file_upload_module_slot_result_set_headers (&_data16_->slot_result, _tmp78_);
	_g_object_unref0 (_tmp78_);
	{
		GeeList* _node_list = NULL;
		XmppStanzaNode* _tmp79_;
		XmppXepHttpFileUploadFlag* _tmp80_;
		const gchar* _tmp81_;
		gchar* _tmp82_;
		gchar* _tmp83_;
		XmppXepHttpFileUploadFlag* _tmp84_;
		const gchar* _tmp85_;
		gchar* _tmp86_;
		gchar* _tmp87_;
		XmppXepHttpFileUploadFlag* _tmp88_;
		const gchar* _tmp89_;
		gchar* _tmp90_;
		gchar* _tmp91_;
		GeeList* _tmp92_;
		GeeList* _tmp93_;
		gint _node_size = 0;
		GeeList* _tmp94_;
		gint _tmp95_;
		gint _tmp96_;
		gint _node_index = 0;
		_tmp79_ = ((XmppStanza*) iq)->stanza;
		_tmp80_ = _data16_->flag;
		_tmp81_ = _tmp80_->ns_ver;
		_tmp82_ = g_strconcat (_tmp81_, ":slot", NULL);
		_tmp83_ = _tmp82_;
		_tmp84_ = _data16_->flag;
		_tmp85_ = _tmp84_->ns_ver;
		_tmp86_ = g_strconcat (_tmp85_, ":put", NULL);
		_tmp87_ = _tmp86_;
		_tmp88_ = _data16_->flag;
		_tmp89_ = _tmp88_->ns_ver;
		_tmp90_ = g_strconcat (_tmp89_, ":header", NULL);
		_tmp91_ = _tmp90_;
		_tmp92_ = xmpp_stanza_node_get_deep_subnodes (_tmp79_, _tmp83_, _tmp87_, _tmp91_, NULL);
		_tmp93_ = _tmp92_;
		_g_free0 (_tmp91_);
		_g_free0 (_tmp87_);
		_g_free0 (_tmp83_);
		_node_list = _tmp93_;
		_tmp94_ = _node_list;
		_tmp95_ = gee_collection_get_size ((GeeCollection*) _tmp94_);
		_tmp96_ = _tmp95_;
		_node_size = _tmp96_;
		_node_index = -1;
		while (TRUE) {
			gint _tmp97_;
			gint _tmp98_;
			XmppStanzaNode* node = NULL;
			GeeList* _tmp99_;
			gpointer _tmp100_;
			gchar* header_name = NULL;
			XmppStanzaNode* _tmp101_;
			const gchar* _tmp102_;
			gchar* _tmp103_;
			gboolean _tmp104_ = FALSE;
			gboolean _tmp105_ = FALSE;
			const gchar* _tmp106_;
			_node_index = _node_index + 1;
			_tmp97_ = _node_index;
			_tmp98_ = _node_size;
			if (!(_tmp97_ < _tmp98_)) {
				break;
			}
			_tmp99_ = _node_list;
			_tmp100_ = gee_list_get (_tmp99_, _node_index);
			node = (XmppStanzaNode*) _tmp100_;
			_tmp101_ = node;
			_tmp102_ = xmpp_stanza_node_get_attribute (_tmp101_, "name", NULL);
			_tmp103_ = g_strdup (_tmp102_);
			header_name = _tmp103_;
			_tmp106_ = header_name;
			if (g_strcmp0 (_tmp106_, "Authorization") == 0) {
				_tmp105_ = TRUE;
			} else {
				const gchar* _tmp107_;
				_tmp107_ = header_name;
				_tmp105_ = g_strcmp0 (_tmp107_, "Cookie") == 0;
			}
			if (_tmp105_) {
				_tmp104_ = TRUE;
			} else {
				const gchar* _tmp108_;
				_tmp108_ = header_name;
				_tmp104_ = g_strcmp0 (_tmp108_, "Expires") == 0;
			}
			if (_tmp104_) {
				gchar* header_val = NULL;
				XmppStanzaNode* _tmp109_;
				const gchar* _tmp110_;
				gchar* _tmp111_;
				gboolean _tmp112_ = FALSE;
				const gchar* _tmp113_;
				_tmp109_ = node;
				_tmp110_ = xmpp_stanza_entry_get_string_content ((XmppStanzaEntry*) _tmp109_);
				_tmp111_ = g_strdup (_tmp110_);
				header_val = _tmp111_;
				_tmp113_ = header_val;
				if (_tmp113_ != NULL) {
					const gchar* _tmp114_;
					gint _tmp115_;
					gint _tmp116_;
					_tmp114_ = header_val;
					_tmp115_ = strlen (_tmp114_);
					_tmp116_ = _tmp115_;
					_tmp112_ = _tmp116_ < 8192;
				} else {
					_tmp112_ = FALSE;
				}
				if (_tmp112_) {
					const gchar* _tmp117_;
					gchar* _tmp118_;
					gchar* _tmp119_;
					gchar* _tmp120_;
					XmppXepHttpFileUploadModuleSlotResult _tmp121_;
					GeeHashMap* _tmp122_;
					GeeHashMap* _tmp123_;
					const gchar* _tmp124_;
					const gchar* _tmp125_;
					_tmp117_ = header_val;
					_tmp118_ = string_replace (_tmp117_, "\n", "");
					_tmp119_ = _tmp118_;
					_tmp120_ = string_replace (_tmp119_, "\r", "");
					_g_free0 (header_val);
					header_val = _tmp120_;
					_g_free0 (_tmp119_);
					_tmp121_ = _data16_->slot_result;
					_tmp122_ = xmpp_xep_http_file_upload_module_slot_result_get_headers (&_tmp121_);
					_tmp123_ = _tmp122_;
					_tmp124_ = header_name;
					_tmp125_ = header_val;
					gee_abstract_map_set ((GeeAbstractMap*) _tmp123_, _tmp124_, _tmp125_);
				}
				_g_free0 (header_val);
			}
			_g_free0 (header_name);
			_xmpp_stanza_entry_unref0 (node);
		}
		_g_object_unref0 (_node_list);
	}
	_tmp126_ = url_get;
	xmpp_xep_http_file_upload_module_slot_result_set_url_get (&_data16_->slot_result, _tmp126_);
	_tmp127_ = url_put;
	xmpp_xep_http_file_upload_module_slot_result_set_url_put (&_data16_->slot_result, _tmp127_);
	_tmp128_ = _data16_->callback;
	_tmp128__target = _data16_->callback_target;
	_tmp128__target_destroy_notify = _data16_->callback_target_destroy_notify;
	_data16_->callback = NULL;
	_data16_->callback_target = NULL;
	_data16_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp128_, _tmp128__target, _tmp128__target_destroy_notify);
	_g_free0 (url_put);
	_g_free0 (url_get);
}

static void
___lambda33__xmpp_iq_module_on_result (XmppXmppStream* stream,
                                       XmppIqStanza* iq,
                                       gpointer self)
{
	__lambda33_ (self, stream, iq);
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gboolean
xmpp_xep_http_file_upload_module_request_slot_co (XmppXepHttpFileUploadModuleRequestSlotData* _data_)
{
	static GQuark _tmp7_label0 = 0;
	static GQuark _tmp7_label1 = 0;
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data16_ = g_slice_new0 (Block16Data);
	_data_->_data16_->_ref_count_ = 1;
	_data_->_data16_->self = g_object_ref (_data_->self);
	_data_->_data16_->_async_data_ = _data_;
	_data_->_tmp0_ = xmpp_xep_http_file_upload_flag_IDENTITY;
	_data_->_tmp1_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp0_);
	_data_->_data16_->flag = (XmppXepHttpFileUploadFlag*) _data_->_tmp1_;
	_data_->_tmp2_ = _data_->_data16_->flag;
	if (_data_->_tmp2_ == NULL) {
		_data_->_tmp3_ = g_error_new_literal (XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR, XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR_SLOT_REQUEST, "No flag");
		_data_->_inner_error0_ = _data_->_tmp3_;
		if (_data_->_inner_error0_->domain == XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block16_data_unref (_data_->_data16_);
			_data_->_data16_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			block16_data_unref (_data_->_data16_);
			_data_->_data16_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->request_node = NULL;
	_data_->_tmp4_ = _data_->_data16_->flag;
	_data_->_tmp5_ = _data_->_tmp4_->ns_ver;
	_data_->_tmp8_ = 0U;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp8_ = (NULL == _data_->_tmp6_) ? 0 : g_quark_from_string (_data_->_tmp6_);
	if (_data_->_tmp8_ == ((0 != _tmp7_label0) ? _tmp7_label0 : (_tmp7_label0 = g_quark_from_static_string (XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI_0)))) {
		switch (0) {
			default:
			{
				_data_->_tmp9_ = xmpp_stanza_node_new_build ("request", XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI_0, NULL, NULL);
				_data_->_tmp10_ = _data_->_tmp9_;
				_data_->_tmp11_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp10_);
				_xmpp_stanza_entry_unref0 (_data_->request_node);
				_data_->request_node = _data_->_tmp11_;
				_xmpp_stanza_entry_unref0 (_data_->_tmp10_);
				_data_->_tmp12_ = _data_->request_node;
				_data_->_tmp13_ = xmpp_stanza_node_put_attribute (_data_->_tmp12_, "filename", _data_->filename, NULL);
				_data_->_tmp14_ = _data_->_tmp13_;
				_data_->_tmp15_ = g_strdup_printf ("%" G_GINT64_FORMAT, _data_->file_size);
				_data_->_tmp16_ = _data_->_tmp15_;
				_data_->_tmp17_ = xmpp_stanza_node_put_attribute (_data_->_tmp14_, "size", _data_->_tmp16_, NULL);
				_data_->_tmp18_ = _data_->_tmp17_;
				_xmpp_stanza_entry_unref0 (_data_->_tmp18_);
				_g_free0 (_data_->_tmp16_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp14_);
				if (_data_->content_type != NULL) {
					_data_->_tmp19_ = _data_->request_node;
					_data_->_tmp20_ = xmpp_stanza_node_put_attribute (_data_->_tmp19_, "content-type", _data_->content_type, NULL);
					_data_->_tmp21_ = _data_->_tmp20_;
					_xmpp_stanza_entry_unref0 (_data_->_tmp21_);
				}
				break;
			}
		}
	} else if (_data_->_tmp8_ == ((0 != _tmp7_label1) ? _tmp7_label1 : (_tmp7_label1 = g_quark_from_static_string (XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI)))) {
		switch (0) {
			default:
			{
				_data_->_tmp22_ = xmpp_stanza_node_new_build ("request", XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI, NULL, NULL);
				_data_->_tmp23_ = _data_->_tmp22_;
				_data_->_tmp24_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp23_);
				_data_->_tmp25_ = _data_->_tmp24_;
				_data_->_tmp26_ = xmpp_stanza_node_new_build ("filename", XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI, NULL, NULL);
				_data_->_tmp27_ = _data_->_tmp26_;
				_data_->_tmp28_ = xmpp_stanza_node_new_text (_data_->filename);
				_data_->_tmp29_ = _data_->_tmp28_;
				_data_->_tmp30_ = xmpp_stanza_node_put_node (_data_->_tmp27_, _data_->_tmp29_);
				_data_->_tmp31_ = _data_->_tmp30_;
				_data_->_tmp32_ = xmpp_stanza_node_put_node (_data_->_tmp25_, _data_->_tmp31_);
				_data_->_tmp33_ = _data_->_tmp32_;
				_data_->_tmp34_ = xmpp_stanza_node_new_build ("size", XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI, NULL, NULL);
				_data_->_tmp35_ = _data_->_tmp34_;
				_data_->_tmp36_ = g_strdup_printf ("%" G_GINT64_FORMAT, _data_->file_size);
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp38_ = xmpp_stanza_node_new_text (_data_->_tmp37_);
				_data_->_tmp39_ = _data_->_tmp38_;
				_data_->_tmp40_ = xmpp_stanza_node_put_node (_data_->_tmp35_, _data_->_tmp39_);
				_data_->_tmp41_ = _data_->_tmp40_;
				_data_->_tmp42_ = xmpp_stanza_node_put_node (_data_->_tmp33_, _data_->_tmp41_);
				_xmpp_stanza_entry_unref0 (_data_->request_node);
				_data_->request_node = _data_->_tmp42_;
				_xmpp_stanza_entry_unref0 (_data_->_tmp41_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp39_);
				_g_free0 (_data_->_tmp37_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp35_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp33_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp31_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp29_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp27_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp25_);
				_xmpp_stanza_entry_unref0 (_data_->_tmp23_);
				if (_data_->content_type != NULL) {
					_data_->_tmp43_ = _data_->request_node;
					_data_->_tmp44_ = xmpp_stanza_node_new_build ("content-type", XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI, NULL, NULL);
					_data_->_tmp45_ = _data_->_tmp44_;
					_data_->_tmp46_ = xmpp_stanza_node_new_text (_data_->content_type);
					_data_->_tmp47_ = _data_->_tmp46_;
					_data_->_tmp48_ = xmpp_stanza_node_put_node (_data_->_tmp45_, _data_->_tmp47_);
					_data_->_tmp49_ = _data_->_tmp48_;
					_data_->_tmp50_ = xmpp_stanza_node_put_node (_data_->_tmp43_, _data_->_tmp49_);
					_data_->_tmp51_ = _data_->_tmp50_;
					_xmpp_stanza_entry_unref0 (_data_->_tmp51_);
					_xmpp_stanza_entry_unref0 (_data_->_tmp49_);
					_xmpp_stanza_entry_unref0 (_data_->_tmp47_);
					_xmpp_stanza_entry_unref0 (_data_->_tmp45_);
				}
				break;
			}
		}
	}
	_data_->_data16_->callback = _xmpp_xep_http_file_upload_module_request_slot_co_gsource_func;
	_data_->_data16_->callback_target = _data_;
	_data_->_data16_->callback_target_destroy_notify = NULL;
	memset (&_data_->_data16_->slot_result, 0, sizeof (XmppXepHttpFileUploadModuleSlotResult));
	_data_->_tmp52_ = _data_->request_node;
	_data_->_tmp53_ = _data_->_data16_->flag;
	_data_->_tmp54_ = _data_->_tmp53_->file_store_jid;
	_data_->_tmp55_ = _xmpp_jid_ref0 (_data_->_tmp54_);
	_data_->_tmp56_ = NULL;
	_data_->_tmp56_ = xmpp_iq_stanza_new_get (_data_->_tmp52_, NULL);
	xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp56_, _data_->_tmp55_);
	_xmpp_jid_unref0 (_data_->_tmp55_);
	_data_->iq = _data_->_tmp56_;
	_data_->_data16_->e = NULL;
	_data_->_tmp57_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp58_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp57_);
	_data_->_tmp59_ = (XmppIqModule*) _data_->_tmp58_;
	_data_->_tmp60_ = _data_->iq;
	xmpp_iq_module_send_iq (_data_->_tmp59_, _data_->stream, _data_->_tmp60_, ___lambda33__xmpp_iq_module_on_result, block16_data_ref (_data_->_data16_), block16_data_unref, G_PRIORITY_DEFAULT);
	_g_object_unref0 (_data_->_tmp59_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp61_ = _data_->_data16_->e;
	if (_data_->_tmp61_ != NULL) {
		_data_->_tmp62_ = _data_->_data16_->e;
		_data_->_tmp63_ = _g_error_copy0 (_data_->_tmp62_);
		_data_->_inner_error0_ = _data_->_tmp63_;
		if (_data_->_inner_error0_->domain == XMPP_XEP_HTTP_FILE_UPLOAD_HTTP_FILE_TRANSFER_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->iq);
			_xmpp_stanza_entry_unref0 (_data_->request_node);
			block16_data_unref (_data_->_data16_);
			_data_->_data16_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->iq);
			_xmpp_stanza_entry_unref0 (_data_->request_node);
			block16_data_unref (_data_->_data16_);
			_data_->_data16_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp64_ = _data_->_data16_->slot_result;
	_data_->_tmp65_ = _data_->_tmp64_;
	memset (&_data_->_tmp66_, 0, sizeof (XmppXepHttpFileUploadModuleSlotResult));
	xmpp_xep_http_file_upload_module_slot_result_copy (&_data_->_tmp65_, &_data_->_tmp66_);
	_data_->result = _data_->_tmp66_;
	_g_object_unref0 (_data_->iq);
	_xmpp_stanza_entry_unref0 (_data_->request_node);
	block16_data_unref (_data_->_data16_);
	_data_->_data16_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_xmpp_xep_http_file_upload_module_query_availability_xmpp_xmpp_stream_stream_negotiated (XmppXmppStream* _sender,
                                                                                         XmppXmppStream* stream,
                                                                                         gpointer self)
{
	xmpp_xep_http_file_upload_module_query_availability ((XmppXepHttpFileUploadModule*) self, stream, NULL, NULL);
}

static void
xmpp_xep_http_file_upload_module_real_attach (XmppXmppStreamModule* base,
                                              XmppXmppStream* stream)
{
	XmppXepHttpFileUploadModule * self;
	self = (XmppXepHttpFileUploadModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_connect_object (stream, "stream-negotiated", (GCallback) _xmpp_xep_http_file_upload_module_query_availability_xmpp_xmpp_stream_stream_negotiated, self, 0);
}

static void
xmpp_xep_http_file_upload_module_real_detach (XmppXmppStreamModule* base,
                                              XmppXmppStream* stream)
{
	XmppXepHttpFileUploadModule * self;
	guint _tmp0_;
	self = (XmppXepHttpFileUploadModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_parse_name ("stream-negotiated", XMPP_TYPE_XMPP_STREAM, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (stream, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _xmpp_xep_http_file_upload_module_query_availability_xmpp_xmpp_stream_stream_negotiated, self);
}

static gchar*
xmpp_xep_http_file_upload_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepHttpFileUploadModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepHttpFileUploadModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_http_file_upload_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepHttpFileUploadModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepHttpFileUploadModule*) base;
	_tmp0_ = xmpp_xep_http_file_upload_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_xep_http_file_upload_module_query_availability_data_free (gpointer _data)
{
	XmppXepHttpFileUploadModuleQueryAvailabilityData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepHttpFileUploadModuleQueryAvailabilityData, _data_);
}

static void
xmpp_xep_http_file_upload_module_query_availability (XmppXepHttpFileUploadModule* self,
                                                     XmppXmppStream* stream,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	XmppXepHttpFileUploadModuleQueryAvailabilityData* _data_;
	XmppXepHttpFileUploadModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (XmppXepHttpFileUploadModuleQueryAvailabilityData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_http_file_upload_module_query_availability_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	xmpp_xep_http_file_upload_module_query_availability_co (_data_);
}

static void
xmpp_xep_http_file_upload_module_query_availability_finish (XmppXepHttpFileUploadModule* self,
                                                            GAsyncResult* _res_)
{
	XmppXepHttpFileUploadModuleQueryAvailabilityData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_xep_http_file_upload_module_query_availability_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_)
{
	XmppXepHttpFileUploadModuleQueryAvailabilityData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_http_file_upload_module_query_availability_co (_data_);
}

static gboolean
xmpp_xep_http_file_upload_module_query_availability_co (XmppXepHttpFileUploadModuleQueryAvailabilityData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_data_->_tmp1_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp0_);
	_data_->_tmp2_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp1_;
	_data_->_tmp3_ = _data_->stream->remote_name;
	_data_->_state_ = 1;
	xmpp_xep_service_discovery_module_request_info (_data_->_tmp2_, _data_->stream, _data_->_tmp3_, xmpp_xep_http_file_upload_module_query_availability_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = xmpp_xep_service_discovery_module_request_info_finish (_data_->_tmp2_, _data_->_res_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->info_result = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->stream->remote_name;
	_data_->_tmp7_ = _data_->info_result;
	_data_->available = xmpp_xep_http_file_upload_module_check_ns_in_info (_data_->self, _data_->stream, _data_->_tmp6_, _data_->_tmp7_);
	if (!_data_->available) {
		_data_->_tmp8_ = xmpp_xep_service_discovery_module_IDENTITY;
		_data_->_tmp9_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp8_);
		_data_->_tmp10_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp9_;
		_data_->_tmp11_ = _data_->stream->remote_name;
		_data_->_state_ = 2;
		xmpp_xep_service_discovery_module_request_items (_data_->_tmp10_, _data_->stream, _data_->_tmp11_, xmpp_xep_http_file_upload_module_query_availability_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp12_ = xmpp_xep_service_discovery_module_request_items_finish (_data_->_tmp10_, _data_->_res_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_g_object_unref0 (_data_->_tmp10_);
		_data_->items_result = _data_->_tmp13_;
		_data_->_tmp14_ = _data_->items_result;
		if (_data_->_tmp14_ == NULL) {
			_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
			_xmpp_xep_service_discovery_info_result_unref0 (_data_->info_result);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		{
			_data_->i = 0;
			{
				_data_->_tmp15_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp15_) {
						_data_->_tmp16_ = _data_->i;
						_data_->i = _data_->_tmp16_ + 1;
					}
					_data_->_tmp15_ = FALSE;
					if (!(_data_->i < 2)) {
						break;
					}
					{
						_data_->_tmp17_ = _data_->items_result;
						_data_->_tmp18_ = xmpp_xep_service_discovery_items_result_get_items (_data_->_tmp17_);
						_data_->_tmp19_ = _data_->_tmp18_;
						_data_->_item_list = _data_->_tmp19_;
						_data_->_tmp20_ = _data_->_item_list;
						_data_->_tmp21_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp20_);
						_data_->_tmp22_ = _data_->_tmp21_;
						_data_->_item_size = _data_->_tmp22_;
						_data_->_item_index = -1;
						while (TRUE) {
							_data_->_item_index = _data_->_item_index + 1;
							_data_->_tmp23_ = _data_->_item_index;
							_data_->_tmp24_ = _data_->_item_size;
							if (!(_data_->_tmp23_ < _data_->_tmp24_)) {
								break;
							}
							_data_->_tmp25_ = _data_->_item_list;
							_data_->_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp25_, _data_->_item_index);
							_data_->item = (XmppXepServiceDiscoveryItem*) _data_->_tmp26_;
							_data_->_tmp27_ = _data_->item;
							_data_->_tmp28_ = _data_->_tmp27_->jid;
							_data_->_tmp29_ = xmpp_jid_to_string (_data_->_tmp28_);
							_data_->_tmp30_ = _data_->_tmp29_;
							_data_->_tmp31_ = g_str_has_prefix (_data_->_tmp30_, "upload");
							_g_free0 (_data_->_tmp30_);
							_data_->promising_upload_item = _data_->_tmp31_;
							if (_data_->i == 0) {
								_data_->_tmp33_ = !_data_->promising_upload_item;
							} else {
								_data_->_tmp33_ = FALSE;
							}
							if (_data_->_tmp33_) {
								_data_->_tmp32_ = TRUE;
							} else {
								if (_data_->i == 1) {
									_data_->_tmp34_ = _data_->promising_upload_item;
								} else {
									_data_->_tmp34_ = FALSE;
								}
								_data_->_tmp32_ = _data_->_tmp34_;
							}
							if (_data_->_tmp32_) {
								_xmpp_xep_service_discovery_item_unref0 (_data_->item);
								continue;
							}
							_data_->_tmp35_ = xmpp_xep_service_discovery_module_IDENTITY;
							_data_->_tmp36_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp35_);
							_data_->_tmp37_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp36_;
							_data_->_tmp38_ = _data_->item;
							_data_->_tmp39_ = _data_->_tmp38_->jid;
							_data_->_state_ = 3;
							xmpp_xep_service_discovery_module_request_info (_data_->_tmp37_, _data_->stream, _data_->_tmp39_, xmpp_xep_http_file_upload_module_query_availability_ready, _data_);
							return FALSE;
							_state_3:
							_data_->_tmp40_ = xmpp_xep_service_discovery_module_request_info_finish (_data_->_tmp37_, _data_->_res_);
							_data_->_tmp41_ = _data_->_tmp40_;
							_g_object_unref0 (_data_->_tmp37_);
							_data_->info_result2 = _data_->_tmp41_;
							_data_->_tmp42_ = _data_->item;
							_data_->_tmp43_ = _data_->_tmp42_->jid;
							_data_->_tmp44_ = _data_->info_result2;
							_data_->available2 = xmpp_xep_http_file_upload_module_check_ns_in_info (_data_->self, _data_->stream, _data_->_tmp43_, _data_->_tmp44_);
							if (_data_->available2) {
								_xmpp_xep_service_discovery_info_result_unref0 (_data_->info_result2);
								_xmpp_xep_service_discovery_item_unref0 (_data_->item);
								_g_object_unref0 (_data_->_item_list);
								_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
								_xmpp_xep_service_discovery_info_result_unref0 (_data_->info_result);
								g_task_return_pointer (_data_->_async_result, _data_, NULL);
								if (_data_->_state_ != 0) {
									while (!g_task_get_completed (_data_->_async_result)) {
										g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
									}
								}
								g_object_unref (_data_->_async_result);
								return FALSE;
							}
							_xmpp_xep_service_discovery_info_result_unref0 (_data_->info_result2);
							_xmpp_xep_service_discovery_item_unref0 (_data_->item);
						}
						_g_object_unref0 (_data_->_item_list);
					}
				}
			}
		}
		_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
	}
	_xmpp_xep_service_discovery_info_result_unref0 (_data_->info_result);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
xmpp_xep_http_file_upload_module_check_ns_in_info (XmppXepHttpFileUploadModule* self,
                                                   XmppXmppStream* stream,
                                                   XmppJid* jid,
                                                   XmppXepServiceDiscoveryInfoResult* info_result)
{
	gboolean ver_available = FALSE;
	gboolean ver_0_available = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (stream != NULL, FALSE);
	g_return_val_if_fail (jid != NULL, FALSE);
	if (info_result == NULL) {
		result = FALSE;
		return result;
	}
	ver_available = FALSE;
	ver_0_available = FALSE;
	{
		GeeList* _feature_list = NULL;
		GeeList* _tmp0_;
		GeeList* _tmp1_;
		gint _feature_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _feature_index = 0;
		_tmp0_ = xmpp_xep_service_discovery_info_result_get_features (info_result);
		_tmp1_ = _tmp0_;
		_feature_list = _tmp1_;
		_tmp2_ = _feature_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_feature_size = _tmp4_;
		_feature_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gchar* feature = NULL;
			GeeList* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp9_;
			_feature_index = _feature_index + 1;
			_tmp5_ = _feature_index;
			_tmp6_ = _feature_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _feature_list;
			_tmp8_ = gee_list_get (_tmp7_, _feature_index);
			feature = (gchar*) _tmp8_;
			_tmp9_ = feature;
			if (g_strcmp0 (_tmp9_, XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI_0) == 0) {
				ver_0_available = TRUE;
				_g_free0 (feature);
				break;
			} else {
				const gchar* _tmp10_;
				_tmp10_ = feature;
				if (g_strcmp0 (_tmp10_, XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI) == 0) {
					ver_available = TRUE;
				}
			}
			_g_free0 (feature);
		}
		_g_object_unref0 (_feature_list);
	}
	if (ver_available) {
		_tmp11_ = TRUE;
	} else {
		_tmp11_ = ver_0_available;
	}
	if (_tmp11_) {
		glong max_file_size = 0L;
		max_file_size = xmpp_xep_http_file_upload_module_extract_max_file_size (self, info_result);
		if (ver_0_available) {
			XmppXepHttpFileUploadFlag* _tmp12_;
			XmppXepHttpFileUploadFlag* _tmp13_;
			_tmp12_ = xmpp_xep_http_file_upload_flag_new (jid, XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI_0);
			_tmp13_ = _tmp12_;
			xmpp_xmpp_stream_add_flag (stream, (XmppXmppStreamFlag*) _tmp13_);
			_g_object_unref0 (_tmp13_);
		} else {
			if (ver_available) {
				XmppXepHttpFileUploadFlag* _tmp14_;
				XmppXepHttpFileUploadFlag* _tmp15_;
				_tmp14_ = xmpp_xep_http_file_upload_flag_new (jid, XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI);
				_tmp15_ = _tmp14_;
				xmpp_xmpp_stream_add_flag (stream, (XmppXmppStreamFlag*) _tmp15_);
				_g_object_unref0 (_tmp15_);
			}
		}
		g_signal_emit (self, xmpp_xep_http_file_upload_module_signals[XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_FEATURE_AVAILABLE_SIGNAL], 0, stream, max_file_size);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static glong
long_parse (const gchar* str,
            guint _base)
{
	glong result;
	g_return_val_if_fail (str != NULL, -1L);
	result = strtol (str, NULL, (gint) _base);
	return result;
}

static glong
xmpp_xep_http_file_upload_module_extract_max_file_size (XmppXepHttpFileUploadModule* self,
                                                        XmppXepServiceDiscoveryInfoResult* info_result)
{
	gchar* max_file_size_str = NULL;
	GeeList* x_nodes = NULL;
	XmppIqStanza* _tmp0_;
	XmppIqStanza* _tmp1_;
	XmppStanzaNode* _tmp2_;
	GeeList* _tmp3_;
	const gchar* _tmp31_;
	glong result;
	g_return_val_if_fail (self != NULL, -1L);
	g_return_val_if_fail (info_result != NULL, -1L);
	max_file_size_str = NULL;
	_tmp0_ = xmpp_xep_service_discovery_info_result_get_iq (info_result);
	_tmp1_ = _tmp0_;
	_tmp2_ = ((XmppStanza*) _tmp1_)->stanza;
	_tmp3_ = xmpp_stanza_node_get_deep_subnodes (_tmp2_, "http://jabber.org/protocol/disco#info:query", "jabber:x:data:x", NULL);
	x_nodes = _tmp3_;
	{
		GeeList* _x_node_list = NULL;
		GeeList* _tmp4_;
		gint _x_node_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _x_node_index = 0;
		_tmp4_ = x_nodes;
		_x_node_list = _tmp4_;
		_tmp5_ = _x_node_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_x_node_size = _tmp7_;
		_x_node_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			XmppStanzaNode* x_node = NULL;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			GeeList* field_nodes = NULL;
			XmppStanzaNode* _tmp12_;
			GeeList* _tmp13_;
			_x_node_index = _x_node_index + 1;
			_tmp8_ = _x_node_index;
			_tmp9_ = _x_node_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _x_node_list;
			_tmp11_ = gee_list_get (_tmp10_, _x_node_index);
			x_node = (XmppStanzaNode*) _tmp11_;
			_tmp12_ = x_node;
			_tmp13_ = xmpp_stanza_node_get_subnodes (_tmp12_, "field", "jabber:x:data", FALSE);
			field_nodes = _tmp13_;
			{
				GeeList* _node_list = NULL;
				GeeList* _tmp14_;
				gint _node_size = 0;
				GeeList* _tmp15_;
				gint _tmp16_;
				gint _tmp17_;
				gint _node_index = 0;
				_tmp14_ = field_nodes;
				_node_list = _tmp14_;
				_tmp15_ = _node_list;
				_tmp16_ = gee_collection_get_size ((GeeCollection*) _tmp15_);
				_tmp17_ = _tmp16_;
				_node_size = _tmp17_;
				_node_index = -1;
				while (TRUE) {
					gint _tmp18_;
					gint _tmp19_;
					XmppStanzaNode* node = NULL;
					GeeList* _tmp20_;
					gpointer _tmp21_;
					gchar* var_attr = NULL;
					XmppStanzaNode* _tmp22_;
					const gchar* _tmp23_;
					gchar* _tmp24_;
					const gchar* _tmp25_;
					_node_index = _node_index + 1;
					_tmp18_ = _node_index;
					_tmp19_ = _node_size;
					if (!(_tmp18_ < _tmp19_)) {
						break;
					}
					_tmp20_ = _node_list;
					_tmp21_ = gee_list_get (_tmp20_, _node_index);
					node = (XmppStanzaNode*) _tmp21_;
					_tmp22_ = node;
					_tmp23_ = xmpp_stanza_node_get_attribute (_tmp22_, "var", NULL);
					_tmp24_ = g_strdup (_tmp23_);
					var_attr = _tmp24_;
					_tmp25_ = var_attr;
					if (g_strcmp0 (_tmp25_, "max-file-size") == 0) {
						XmppStanzaNode* value_node = NULL;
						XmppStanzaNode* _tmp26_;
						XmppStanzaNode* _tmp27_;
						XmppStanzaNode* _tmp28_;
						const gchar* _tmp29_;
						gchar* _tmp30_;
						_tmp26_ = node;
						_tmp27_ = xmpp_stanza_node_get_subnode (_tmp26_, "value", "jabber:x:data", FALSE);
						value_node = _tmp27_;
						_tmp28_ = value_node;
						_tmp29_ = xmpp_stanza_entry_get_string_content ((XmppStanzaEntry*) _tmp28_);
						_tmp30_ = g_strdup (_tmp29_);
						_g_free0 (max_file_size_str);
						max_file_size_str = _tmp30_;
						_xmpp_stanza_entry_unref0 (value_node);
						_g_free0 (var_attr);
						_xmpp_stanza_entry_unref0 (node);
						break;
					}
					_g_free0 (var_attr);
					_xmpp_stanza_entry_unref0 (node);
				}
			}
			_g_object_unref0 (field_nodes);
			_xmpp_stanza_entry_unref0 (x_node);
		}
	}
	_tmp31_ = max_file_size_str;
	if (_tmp31_ != NULL) {
		const gchar* _tmp32_;
		_tmp32_ = max_file_size_str;
		result = long_parse (_tmp32_, (guint) 0);
		_g_object_unref0 (x_nodes);
		_g_free0 (max_file_size_str);
		return result;
	}
	result = G_MAXLONG;
	_g_object_unref0 (x_nodes);
	_g_free0 (max_file_size_str);
	return result;
}

XmppXepHttpFileUploadModule*
xmpp_xep_http_file_upload_module_construct (GType object_type)
{
	XmppXepHttpFileUploadModule * self = NULL;
	self = (XmppXepHttpFileUploadModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepHttpFileUploadModule*
xmpp_xep_http_file_upload_module_new (void)
{
	return xmpp_xep_http_file_upload_module_construct (XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_LONG (GClosure * closure,
                                           GValue * return_value,
                                           guint n_param_values,
                                           const GValue * param_values,
                                           gpointer invocation_hint,
                                           gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_LONG) (gpointer data1, gpointer arg_1, glong arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_LONG callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_LONG) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_long (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

const gchar*
xmpp_xep_http_file_upload_module_slot_result_get_url_get (XmppXepHttpFileUploadModuleSlotResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (*self)._url_get;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_http_file_upload_module_slot_result_set_url_get (XmppXepHttpFileUploadModuleSlotResult* self,
                                                          const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 ((*self)._url_get);
	(*self)._url_get = _tmp0_;
}

const gchar*
xmpp_xep_http_file_upload_module_slot_result_get_url_put (XmppXepHttpFileUploadModuleSlotResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (*self)._url_put;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_http_file_upload_module_slot_result_set_url_put (XmppXepHttpFileUploadModuleSlotResult* self,
                                                          const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 ((*self)._url_put);
	(*self)._url_put = _tmp0_;
}

GeeHashMap*
xmpp_xep_http_file_upload_module_slot_result_get_headers (XmppXepHttpFileUploadModuleSlotResult* self)
{
	GeeHashMap* result;
	GeeHashMap* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (*self)._headers;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_http_file_upload_module_slot_result_set_headers (XmppXepHttpFileUploadModuleSlotResult* self,
                                                          GeeHashMap* value)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 ((*self)._headers);
	(*self)._headers = _tmp0_;
}

void
xmpp_xep_http_file_upload_module_slot_result_copy (const XmppXepHttpFileUploadModuleSlotResult* self,
                                                   XmppXepHttpFileUploadModuleSlotResult* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GeeHashMap* _tmp4_;
	GeeHashMap* _tmp5_;
	_tmp0_ = (*self)._url_get;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest)._url_get);
	(*dest)._url_get = _tmp1_;
	_tmp2_ = (*self)._url_put;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest)._url_put);
	(*dest)._url_put = _tmp3_;
	_tmp4_ = (*self)._headers;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 ((*dest)._headers);
	(*dest)._headers = _tmp5_;
}

void
xmpp_xep_http_file_upload_module_slot_result_destroy (XmppXepHttpFileUploadModuleSlotResult* self)
{
	_g_free0 ((*self)._url_get);
	_g_free0 ((*self)._url_put);
	_g_object_unref0 ((*self)._headers);
}

XmppXepHttpFileUploadModuleSlotResult*
xmpp_xep_http_file_upload_module_slot_result_dup (const XmppXepHttpFileUploadModuleSlotResult* self)
{
	XmppXepHttpFileUploadModuleSlotResult* dup;
	dup = g_new0 (XmppXepHttpFileUploadModuleSlotResult, 1);
	xmpp_xep_http_file_upload_module_slot_result_copy (self, dup);
	return dup;
}

void
xmpp_xep_http_file_upload_module_slot_result_free (XmppXepHttpFileUploadModuleSlotResult* self)
{
	xmpp_xep_http_file_upload_module_slot_result_destroy (self);
	g_free (self);
}

static GType
xmpp_xep_http_file_upload_module_slot_result_get_type_once (void)
{
	GType xmpp_xep_http_file_upload_module_slot_result_type_id;
	xmpp_xep_http_file_upload_module_slot_result_type_id = g_boxed_type_register_static ("XmppXepHttpFileUploadModuleSlotResult", (GBoxedCopyFunc) xmpp_xep_http_file_upload_module_slot_result_dup, (GBoxedFreeFunc) xmpp_xep_http_file_upload_module_slot_result_free);
	return xmpp_xep_http_file_upload_module_slot_result_type_id;
}

GType
xmpp_xep_http_file_upload_module_slot_result_get_type (void)
{
	static volatile gsize xmpp_xep_http_file_upload_module_slot_result_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_http_file_upload_module_slot_result_type_id__once)) {
		GType xmpp_xep_http_file_upload_module_slot_result_type_id;
		xmpp_xep_http_file_upload_module_slot_result_type_id = xmpp_xep_http_file_upload_module_slot_result_get_type_once ();
		g_once_init_leave (&xmpp_xep_http_file_upload_module_slot_result_type_id__once, xmpp_xep_http_file_upload_module_slot_result_type_id);
	}
	return xmpp_xep_http_file_upload_module_slot_result_type_id__once;
}

static void
xmpp_xep_http_file_upload_module_class_init (XmppXepHttpFileUploadModuleClass * klass,
                                             gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_http_file_upload_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_http_file_upload_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_http_file_upload_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_http_file_upload_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_http_file_upload_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_http_file_upload_module_finalize;
	xmpp_xep_http_file_upload_module_signals[XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_FEATURE_AVAILABLE_SIGNAL] = g_signal_new ("feature-available", XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_LONG, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, G_TYPE_LONG);
	xmpp_xep_http_file_upload_module_signals[XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_RECEIVED_URL_SIGNAL] = g_signal_new ("received-url", XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_MESSAGE_STANZA);
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI, "0363_http_file_upload");
	xmpp_xep_http_file_upload_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_http_file_upload_module_instance_init (XmppXepHttpFileUploadModule * self,
                                                gpointer klass)
{
}

static void
xmpp_xep_http_file_upload_module_finalize (GObject * obj)
{
	XmppXepHttpFileUploadModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_MODULE, XmppXepHttpFileUploadModule);
	G_OBJECT_CLASS (xmpp_xep_http_file_upload_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_http_file_upload_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepHttpFileUploadModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_http_file_upload_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepHttpFileUploadModule), 0, (GInstanceInitFunc) xmpp_xep_http_file_upload_module_instance_init, NULL };
	GType xmpp_xep_http_file_upload_module_type_id;
	xmpp_xep_http_file_upload_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepHttpFileUploadModule", &g_define_type_info, 0);
	return xmpp_xep_http_file_upload_module_type_id;
}

GType
xmpp_xep_http_file_upload_module_get_type (void)
{
	static volatile gsize xmpp_xep_http_file_upload_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_http_file_upload_module_type_id__once)) {
		GType xmpp_xep_http_file_upload_module_type_id;
		xmpp_xep_http_file_upload_module_type_id = xmpp_xep_http_file_upload_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_http_file_upload_module_type_id__once, xmpp_xep_http_file_upload_module_type_id);
	}
	return xmpp_xep_http_file_upload_module_type_id__once;
}

static inline gpointer
xmpp_xep_http_file_upload_received_pipeline_listener_get_instance_private (XmppXepHttpFileUploadReceivedPipelineListener* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepHttpFileUploadReceivedPipelineListener_private_offset);
}

static void
xmpp_xep_http_file_upload_received_pipeline_listener_real_run_data_free (gpointer _data)
{
	XmppXepHttpFileUploadReceivedPipelineListenerRunData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepHttpFileUploadReceivedPipelineListenerRunData, _data_);
}

static void
xmpp_xep_http_file_upload_received_pipeline_listener_real_run (XmppStanzaListener* base,
                                                               XmppXmppStream* stream,
                                                               XmppMessageStanza* message,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_)
{
	XmppXepHttpFileUploadReceivedPipelineListener * self;
	XmppXepHttpFileUploadReceivedPipelineListenerRunData* _data_;
	XmppXepHttpFileUploadReceivedPipelineListener* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppMessageStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	self = (XmppXepHttpFileUploadReceivedPipelineListener*) base;
	_data_ = g_slice_new0 (XmppXepHttpFileUploadReceivedPipelineListenerRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_http_file_upload_received_pipeline_listener_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _g_object_ref0 (message);
	_g_object_unref0 (_data_->message);
	_data_->message = _tmp2_;
	xmpp_xep_http_file_upload_received_pipeline_listener_real_run_co (_data_);
}

static gboolean
xmpp_xep_http_file_upload_received_pipeline_listener_run_finish (XmppStanzaListener* base,
                                                                 GAsyncResult* _res_)
{
	gboolean result;
	XmppXepHttpFileUploadReceivedPipelineListenerRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static gboolean
xmpp_xep_http_file_upload_received_pipeline_listener_real_run_co (XmppXepHttpFileUploadReceivedPipelineListenerRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_out_of_band_data_get_url_from_message (_data_->message);
	_data_->oob_url = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->oob_url;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->oob_url;
		_data_->_tmp4_ = xmpp_message_stanza_get_body (_data_->message);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp1_ = g_strcmp0 (_data_->_tmp3_, _data_->_tmp5_) == 0;
	} else {
		_data_->_tmp1_ = FALSE;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp6_ = xmpp_xep_http_file_upload_module_IDENTITY;
		_data_->_tmp7_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp6_);
		_data_->_tmp8_ = (XmppXepHttpFileUploadModule*) _data_->_tmp7_;
		g_signal_emit (_data_->_tmp8_, xmpp_xep_http_file_upload_module_signals[XMPP_XEP_HTTP_FILE_UPLOAD_MODULE_RECEIVED_URL_SIGNAL], 0, _data_->stream, _data_->message);
		_g_object_unref0 (_data_->_tmp8_);
	}
	_data_->result = FALSE;
	_g_free0 (_data_->oob_url);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

XmppXepHttpFileUploadReceivedPipelineListener*
xmpp_xep_http_file_upload_received_pipeline_listener_construct (GType object_type)
{
	XmppXepHttpFileUploadReceivedPipelineListener * self = NULL;
	self = (XmppXepHttpFileUploadReceivedPipelineListener*) xmpp_stanza_listener_construct (object_type, XMPP_TYPE_MESSAGE_STANZA, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	return self;
}

XmppXepHttpFileUploadReceivedPipelineListener*
xmpp_xep_http_file_upload_received_pipeline_listener_new (void)
{
	return xmpp_xep_http_file_upload_received_pipeline_listener_construct (XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_RECEIVED_PIPELINE_LISTENER);
}

static const gchar*
xmpp_xep_http_file_upload_received_pipeline_listener_real_get_action_group (XmppOrderedListener* base)
{
	const gchar* result;
	XmppXepHttpFileUploadReceivedPipelineListener* self;
	self = (XmppXepHttpFileUploadReceivedPipelineListener*) base;
	result = "EXTRACT_MESSAGE_2";
	return result;
}

static gchar**
xmpp_xep_http_file_upload_received_pipeline_listener_real_get_after_actions (XmppOrderedListener* base,
                                                                             gint* result_length1)
{
	gchar** result;
	XmppXepHttpFileUploadReceivedPipelineListener* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	self = (XmppXepHttpFileUploadReceivedPipelineListener*) base;
	_tmp0_ = self->priv->after_actions_const;
	_tmp0__length1 = self->priv->after_actions_const_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static void
xmpp_xep_http_file_upload_received_pipeline_listener_class_init (XmppXepHttpFileUploadReceivedPipelineListenerClass * klass,
                                                                 gpointer klass_data)
{
	xmpp_xep_http_file_upload_received_pipeline_listener_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepHttpFileUploadReceivedPipelineListener_private_offset);
	((XmppStanzaListenerClass *) klass)->run = (void (*) (XmppStanzaListener*, XmppXmppStream*, gconstpointer, GAsyncReadyCallback, gpointer)) xmpp_xep_http_file_upload_received_pipeline_listener_real_run;
	((XmppStanzaListenerClass *) klass)->run_finish = (gboolean (*) (XmppStanzaListener*, GAsyncResult*)) xmpp_xep_http_file_upload_received_pipeline_listener_run_finish;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_action_group = (const gchar* (*) (XmppOrderedListener*)) xmpp_xep_http_file_upload_received_pipeline_listener_real_get_action_group;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_after_actions = (gchar** (*) (XmppOrderedListener*, gint*)) xmpp_xep_http_file_upload_received_pipeline_listener_real_get_after_actions;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_http_file_upload_received_pipeline_listener_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_http_file_upload_received_pipeline_listener_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY, xmpp_xep_http_file_upload_received_pipeline_listener_properties[XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY] = g_param_spec_string ("action-group", "action-group", "action-group", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY, xmpp_xep_http_file_upload_received_pipeline_listener_properties[XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY] = g_param_spec_boxed ("after-actions", "after-actions", "after-actions", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_http_file_upload_received_pipeline_listener_instance_init (XmppXepHttpFileUploadReceivedPipelineListener * self,
                                                                    gpointer klass)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	self->priv = xmpp_xep_http_file_upload_received_pipeline_listener_get_instance_private (self);
	_tmp0_ = g_strdup ("EXTRACT_MESSAGE_2");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	self->priv->after_actions_const = _tmp1_;
	self->priv->after_actions_const_length1 = 1;
	self->priv->_after_actions_const_size_ = self->priv->after_actions_const_length1;
}

static void
xmpp_xep_http_file_upload_received_pipeline_listener_finalize (GObject * obj)
{
	XmppXepHttpFileUploadReceivedPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_RECEIVED_PIPELINE_LISTENER, XmppXepHttpFileUploadReceivedPipelineListener);
	self->priv->after_actions_const = (_vala_array_free (self->priv->after_actions_const, self->priv->after_actions_const_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (xmpp_xep_http_file_upload_received_pipeline_listener_parent_class)->finalize (obj);
}

static GType
xmpp_xep_http_file_upload_received_pipeline_listener_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepHttpFileUploadReceivedPipelineListenerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_http_file_upload_received_pipeline_listener_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepHttpFileUploadReceivedPipelineListener), 0, (GInstanceInitFunc) xmpp_xep_http_file_upload_received_pipeline_listener_instance_init, NULL };
	GType xmpp_xep_http_file_upload_received_pipeline_listener_type_id;
	xmpp_xep_http_file_upload_received_pipeline_listener_type_id = g_type_register_static (XMPP_TYPE_STANZA_LISTENER, "XmppXepHttpFileUploadReceivedPipelineListener", &g_define_type_info, 0);
	XmppXepHttpFileUploadReceivedPipelineListener_private_offset = g_type_add_instance_private (xmpp_xep_http_file_upload_received_pipeline_listener_type_id, sizeof (XmppXepHttpFileUploadReceivedPipelineListenerPrivate));
	return xmpp_xep_http_file_upload_received_pipeline_listener_type_id;
}

GType
xmpp_xep_http_file_upload_received_pipeline_listener_get_type (void)
{
	static volatile gsize xmpp_xep_http_file_upload_received_pipeline_listener_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_http_file_upload_received_pipeline_listener_type_id__once)) {
		GType xmpp_xep_http_file_upload_received_pipeline_listener_type_id;
		xmpp_xep_http_file_upload_received_pipeline_listener_type_id = xmpp_xep_http_file_upload_received_pipeline_listener_get_type_once ();
		g_once_init_leave (&xmpp_xep_http_file_upload_received_pipeline_listener_type_id__once, xmpp_xep_http_file_upload_received_pipeline_listener_type_id);
	}
	return xmpp_xep_http_file_upload_received_pipeline_listener_type_id__once;
}

static void
_vala_xmpp_xep_http_file_upload_received_pipeline_listener_get_property (GObject * object,
                                                                         guint property_id,
                                                                         GValue * value,
                                                                         GParamSpec * pspec)
{
	XmppXepHttpFileUploadReceivedPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_RECEIVED_PIPELINE_LISTENER, XmppXepHttpFileUploadReceivedPipelineListener);
	switch (property_id) {
		case XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY:
		g_value_set_string (value, xmpp_ordered_listener_get_action_group ((XmppOrderedListener*) self));
		break;
		case XMPP_XEP_HTTP_FILE_UPLOAD_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, xmpp_ordered_listener_get_after_actions ((XmppOrderedListener*) self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

XmppXepHttpFileUploadFlag*
xmpp_xep_http_file_upload_flag_construct (GType object_type,
                                          XmppJid* file_store_jid,
                                          const gchar* ns_ver)
{
	XmppXepHttpFileUploadFlag * self = NULL;
	XmppJid* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (file_store_jid != NULL, NULL);
	g_return_val_if_fail (ns_ver != NULL, NULL);
	self = (XmppXepHttpFileUploadFlag*) xmpp_xmpp_stream_flag_construct (object_type);
	_tmp0_ = _xmpp_jid_ref0 (file_store_jid);
	_xmpp_jid_unref0 (self->file_store_jid);
	self->file_store_jid = _tmp0_;
	_tmp1_ = g_strdup (ns_ver);
	_g_free0 (self->ns_ver);
	self->ns_ver = _tmp1_;
	return self;
}

XmppXepHttpFileUploadFlag*
xmpp_xep_http_file_upload_flag_new (XmppJid* file_store_jid,
                                    const gchar* ns_ver)
{
	return xmpp_xep_http_file_upload_flag_construct (XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_FLAG, file_store_jid, ns_ver);
}

static gchar*
xmpp_xep_http_file_upload_flag_real_get_ns (XmppXmppStreamFlag* base)
{
	XmppXepHttpFileUploadFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepHttpFileUploadFlag*) base;
	_tmp0_ = g_strdup (XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_http_file_upload_flag_real_get_id (XmppXmppStreamFlag* base)
{
	XmppXepHttpFileUploadFlag * self;
	XmppFlagIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepHttpFileUploadFlag*) base;
	_tmp0_ = xmpp_xep_http_file_upload_flag_IDENTITY;
	_tmp1_ = xmpp_flag_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_xep_http_file_upload_flag_class_init (XmppXepHttpFileUploadFlagClass * klass,
                                           gpointer klass_data)
{
	XmppFlagIdentity* _tmp0_;
	xmpp_xep_http_file_upload_flag_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamFlagClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_xep_http_file_upload_flag_real_get_ns;
	((XmppXmppStreamFlagClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_xep_http_file_upload_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_http_file_upload_flag_finalize;
	_tmp0_ = xmpp_flag_identity_new (XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_HTTP_FILE_UPLOAD_NS_URI, "http_file_upload");
	xmpp_xep_http_file_upload_flag_IDENTITY = _tmp0_;
}

static void
xmpp_xep_http_file_upload_flag_instance_init (XmppXepHttpFileUploadFlag * self,
                                              gpointer klass)
{
}

static void
xmpp_xep_http_file_upload_flag_finalize (GObject * obj)
{
	XmppXepHttpFileUploadFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_HTTP_FILE_UPLOAD_TYPE_FLAG, XmppXepHttpFileUploadFlag);
	_xmpp_jid_unref0 (self->file_store_jid);
	_g_free0 (self->ns_ver);
	_g_free0 (self->max_file_size);
	G_OBJECT_CLASS (xmpp_xep_http_file_upload_flag_parent_class)->finalize (obj);
}

static GType
xmpp_xep_http_file_upload_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepHttpFileUploadFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_http_file_upload_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepHttpFileUploadFlag), 0, (GInstanceInitFunc) xmpp_xep_http_file_upload_flag_instance_init, NULL };
	GType xmpp_xep_http_file_upload_flag_type_id;
	xmpp_xep_http_file_upload_flag_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_FLAG, "XmppXepHttpFileUploadFlag", &g_define_type_info, 0);
	return xmpp_xep_http_file_upload_flag_type_id;
}

GType
xmpp_xep_http_file_upload_flag_get_type (void)
{
	static volatile gsize xmpp_xep_http_file_upload_flag_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_http_file_upload_flag_type_id__once)) {
		GType xmpp_xep_http_file_upload_flag_type_id;
		xmpp_xep_http_file_upload_flag_type_id = xmpp_xep_http_file_upload_flag_get_type_once ();
		g_once_init_leave (&xmpp_xep_http_file_upload_flag_type_id__once, xmpp_xep_http_file_upload_flag_type_id);
	}
	return xmpp_xep_http_file_upload_flag_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

