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

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

#define XMPP_IQ_NS_URI "jabber:client"
#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_IQ_MODULE_TYPE_RESPONSE_LISTENER (xmpp_iq_module_response_listener_get_type ())
#define XMPP_IQ_MODULE_RESPONSE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER, XmppIqModuleResponseListener))
#define XMPP_IQ_MODULE_RESPONSE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER, XmppIqModuleResponseListenerClass))
#define XMPP_IQ_MODULE_IS_RESPONSE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER))
#define XMPP_IQ_MODULE_IS_RESPONSE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER))
#define XMPP_IQ_MODULE_RESPONSE_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER, XmppIqModuleResponseListenerClass))

typedef struct _XmppIqModuleResponseListener XmppIqModuleResponseListener;
typedef struct _XmppIqModuleResponseListenerClass XmppIqModuleResponseListenerClass;
enum  {
	XMPP_IQ_MODULE_0_PROPERTY,
	XMPP_IQ_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_iq_module_properties[XMPP_IQ_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _xmpp_iq_module_response_listener_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_iq_module_response_listener_unref (var), NULL)))
typedef struct _XmppIqModuleSendIqAsyncData XmppIqModuleSendIqAsyncData;
#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 _xmpp_error_stanza_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_error_stanza_unref (var), NULL)))
typedef struct _XmppIqModuleOnReceivedIqStanzaData XmppIqModuleOnReceivedIqStanzaData;
typedef struct _XmppIqModuleResponseListenerPrivate XmppIqModuleResponseListenerPrivate;
typedef struct _XmppIqModuleParamSpecResponseListener XmppIqModuleParamSpecResponseListener;
enum  {
	XMPP_IQ_MODULE_PREPROCESS_INCOMING_IQ_SET_GET_SIGNAL,
	XMPP_IQ_MODULE_PREPROCESS_OUTGOING_IQ_SET_GET_SIGNAL,
	XMPP_IQ_MODULE_NUM_SIGNALS
};
static guint xmpp_iq_module_signals[XMPP_IQ_MODULE_NUM_SIGNALS] = {0};
typedef struct _XmppIqHandlerOnIqGetData XmppIqHandlerOnIqGetData;
typedef struct _XmppIqHandlerOnIqSetData XmppIqHandlerOnIqSetData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _XmppIqModulePrivate {
	GeeHashMap* responseListeners;
	GeeHashMap* namespaceRegistrants;
};

struct _Block2Data {
	int _ref_count_;
	XmppIqModule* self;
	XmppIqStanza* return_stanza;
	gpointer _async_data_;
};

struct _XmppIqModuleSendIqAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppIqModule* self;
	XmppXmppStream* stream;
	XmppIqStanza* iq;
	gint io_priority;
	GCancellable* cancellable;
	XmppIqStanza* result;
	Block2Data* _data2_;
	gboolean _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GeeHashMap* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	XmppIqModuleResponseListener* _tmp8_;
	XmppIqModuleResponseListener* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppIqStanza* _tmp11_;
	GError* _inner_error0_;
};

struct _XmppIqModuleOnReceivedIqStanzaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppIqModule* self;
	XmppXmppStream* stream;
	XmppStanzaNode* node;
	XmppJid* _tmp0_;
	XmppFlagIdentity* _tmp1_;
	XmppFlagIdentity* _tmp2_;
	gpointer _tmp3_;
	XmppBindFlag* _tmp4_;
	XmppJid* _tmp5_;
	XmppIqStanza* iq;
	XmppIqStanza* _tmp6_;
	gboolean _tmp7_;
	XmppIqStanza* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	XmppIqStanza* _tmp11_;
	GeeHashMap* _tmp12_;
	XmppIqStanza* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	XmppIqModuleResponseListener* listener;
	GeeHashMap* _tmp16_;
	XmppIqStanza* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gpointer _tmp20_;
	XmppIqModuleResponseListener* _tmp21_;
	XmppIqModuleResponseListener* _tmp22_;
	XmppIqModuleOnResult _tmp23_;
	gpointer _tmp23__target;
	XmppIqModuleOnResult _tmp24_;
	gpointer _tmp24__target;
	XmppIqStanza* _tmp25_;
	GeeHashMap* _tmp26_;
	XmppIqStanza* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	GeeList* children;
	GeeList* _tmp30_;
	gboolean _tmp31_;
	GeeList* _tmp32_;
	gint _tmp33_;
	gint _tmp34_;
	GeeHashMap* _tmp35_;
	GeeList* _tmp36_;
	gpointer _tmp37_;
	XmppStanzaNode* _tmp38_;
	const gchar* _tmp39_;
	XmppIqStanza* _tmp40_;
	GeeList* handlers;
	GeeHashMap* _tmp41_;
	GeeList* _tmp42_;
	gpointer _tmp43_;
	XmppStanzaNode* _tmp44_;
	const gchar* _tmp45_;
	gpointer _tmp46_;
	GeeList* _tmp47_;
	GeeList* _handler_list;
	GeeList* _tmp48_;
	gint _handler_size;
	GeeList* _tmp49_;
	gint _tmp50_;
	gint _tmp51_;
	gint _handler_index;
	gint _tmp52_;
	gint _tmp53_;
	XmppIqHandler* handler;
	GeeList* _tmp54_;
	gpointer _tmp55_;
	XmppIqStanza* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	XmppIqHandler* _tmp59_;
	XmppIqStanza* _tmp60_;
	XmppIqStanza* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	XmppIqHandler* _tmp64_;
	XmppIqStanza* _tmp65_;
	XmppIqStanza* unavailable_error;
	XmppIqStanza* _tmp66_;
	XmppErrorStanza* _tmp67_;
	XmppErrorStanza* _tmp68_;
	XmppIqStanza* _tmp69_;
	XmppJid* _tmp70_;
	XmppJid* _tmp71_;
	XmppIqStanza* _tmp72_;
	XmppIqStanza* _tmp73_;
	XmppIqStanza* _tmp74_;
};

struct _XmppIqModuleResponseListener {
	GTypeInstance parent_instance;
	volatile int ref_count;
	XmppIqModuleResponseListenerPrivate * priv;
};

struct _XmppIqModuleResponseListenerClass {
	GTypeClass parent_class;
	void (*finalize) (XmppIqModuleResponseListener *self);
};

struct _XmppIqModuleResponseListenerPrivate {
	XmppIqModuleOnResult _on_result;
	gpointer _on_result_target;
	GDestroyNotify _on_result_target_destroy_notify;
};

struct _XmppIqModuleParamSpecResponseListener {
	GParamSpec parent_instance;
};

struct _XmppIqHandlerOnIqGetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppIqHandler* self;
	XmppXmppStream* stream;
	XmppIqStanza* iq;
	XmppIqStanza* bad_request;
	XmppErrorStanza* _tmp0_;
	XmppErrorStanza* _tmp1_;
	XmppIqStanza* _tmp2_;
	XmppIqStanza* _tmp3_;
	XmppModuleIdentity* _tmp4_;
	gpointer _tmp5_;
	XmppIqModule* _tmp6_;
};

struct _XmppIqHandlerOnIqSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppIqHandler* self;
	XmppXmppStream* stream;
	XmppIqStanza* iq;
	XmppIqStanza* bad_request;
	XmppErrorStanza* _tmp0_;
	XmppErrorStanza* _tmp1_;
	XmppIqStanza* _tmp2_;
	XmppIqStanza* _tmp3_;
	XmppModuleIdentity* _tmp4_;
	gpointer _tmp5_;
	XmppIqModule* _tmp6_;
};

static gint XmppIqModule_private_offset;
static gpointer xmpp_iq_module_parent_class = NULL;
XmppModuleIdentity* xmpp_iq_module_IDENTITY = NULL;
static gint XmppIqModuleResponseListener_private_offset;
static gpointer xmpp_iq_module_response_listener_parent_class = NULL;

static gpointer xmpp_iq_module_response_listener_ref (gpointer instance);
static void xmpp_iq_module_response_listener_unref (gpointer instance);
static GParamSpec* xmpp_iq_module_param_spec_response_listener (const gchar* name,
                                                         const gchar* nick,
                                                         const gchar* blurb,
                                                         GType object_type,
                                                         GParamFlags flags) G_GNUC_UNUSED ;
static void xmpp_iq_module_value_set_response_listener (GValue* value,
                                                 gpointer v_object) G_GNUC_UNUSED ;
static void xmpp_iq_module_value_take_response_listener (GValue* value,
                                                  gpointer v_object) G_GNUC_UNUSED ;
static gpointer xmpp_iq_module_value_get_response_listener (const GValue* value) G_GNUC_UNUSED ;
static GType xmpp_iq_module_response_listener_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void xmpp_iq_module_send_iq_async_data_free (gpointer _data);
static gboolean xmpp_iq_module_send_iq_async_co (XmppIqModuleSendIqAsyncData* _data_);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void __lambda9_ (Block2Data* _data2_,
                 XmppXmppStream* _,
                 XmppIqStanza* result_iq);
static gboolean _xmpp_iq_module_send_iq_async_co_gsource_func (gpointer self);
static void ___lambda9__xmpp_iq_module_on_result (XmppXmppStream* stream,
                                           XmppIqStanza* iq,
                                           gpointer self);
static XmppIqModuleResponseListener* xmpp_iq_module_response_listener_new (XmppIqModuleOnResult on_result,
                                                                    gpointer on_result_target,
                                                                    GDestroyNotify on_result_target_destroy_notify);
static XmppIqModuleResponseListener* xmpp_iq_module_response_listener_construct (GType object_type,
                                                                          XmppIqModuleOnResult on_result,
                                                                          gpointer on_result_target,
                                                                          GDestroyNotify on_result_target_destroy_notify);
static void xmpp_iq_module_real_attach (XmppXmppStreamModule* base,
                                 XmppXmppStream* stream);
static void xmpp_iq_module_on_received_iq_stanza (XmppIqModule* self,
                                           XmppXmppStream* stream,
                                           XmppStanzaNode* node,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void xmpp_iq_module_on_received_iq_stanza_finish (XmppIqModule* self,
                                                  GAsyncResult* _res_);
static void _xmpp_iq_module_on_received_iq_stanza_xmpp_xmpp_stream_received_iq_stanza (XmppXmppStream* _sender,
                                                                                XmppXmppStream* stream,
                                                                                XmppStanzaNode* node,
                                                                                gpointer self);
static void xmpp_iq_module_real_detach (XmppXmppStreamModule* base,
                                 XmppXmppStream* stream);
static gboolean xmpp_iq_module_real_mandatory_outstanding (XmppXmppStreamNegotiationModule* base,
                                                    XmppXmppStream* stream);
static gboolean xmpp_iq_module_real_negotiation_active (XmppXmppStreamNegotiationModule* base,
                                                 XmppXmppStream* stream);
static gchar* xmpp_iq_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_iq_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_iq_module_on_received_iq_stanza_data_free (gpointer _data);
static gboolean xmpp_iq_module_on_received_iq_stanza_co (XmppIqModuleOnReceivedIqStanzaData* _data_);
static XmppIqModuleOnResult xmpp_iq_module_response_listener_get_on_result (XmppIqModuleResponseListener* self,
                                                                     gpointer* result_target);
static void xmpp_iq_module_on_received_iq_stanza_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_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_iq_module_response_listener_set_on_result (XmppIqModuleResponseListener* self,
                                                     XmppIqModuleOnResult value,
                                                     gpointer value_target,
                                                     GDestroyNotify value_target_destroy_notify);
static void xmpp_iq_module_response_listener_finalize (XmppIqModuleResponseListener * obj);
static GType xmpp_iq_module_response_listener_get_type_once (void);
static void xmpp_iq_module_finalize (GObject * obj);
static GType xmpp_iq_module_get_type_once (void);
static void xmpp_iq_handler_real_on_iq_get_data_free (gpointer _data);
static void xmpp_iq_handler_real_on_iq_get (XmppIqHandler* self,
                                     XmppXmppStream* stream,
                                     XmppIqStanza* iq,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static gboolean xmpp_iq_handler_real_on_iq_get_co (XmppIqHandlerOnIqGetData* _data_);
static void xmpp_iq_handler_real_on_iq_set_data_free (gpointer _data);
static void xmpp_iq_handler_real_on_iq_set (XmppIqHandler* self,
                                     XmppXmppStream* stream,
                                     XmppIqStanza* iq,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static gboolean xmpp_iq_handler_real_on_iq_set_co (XmppIqHandlerOnIqSetData* _data_);
static GType xmpp_iq_handler_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_iq_module_get_instance_private (XmppIqModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppIqModule_private_offset);
}

static void
xmpp_iq_module_send_iq_async_data_free (gpointer _data)
{
	XmppIqModuleSendIqAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->iq);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppIqModuleSendIqAsyncData, _data_);
}

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

void
xmpp_iq_module_send_iq_async (XmppIqModule* self,
                              XmppXmppStream* stream,
                              XmppIqStanza* iq,
                              gint io_priority,
                              GCancellable* cancellable,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	XmppIqModuleSendIqAsyncData* _data_;
	XmppIqModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppIqStanza* _tmp2_;
	GCancellable* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	_data_ = g_slice_new0 (XmppIqModuleSendIqAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_iq_module_send_iq_async_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 (iq);
	_g_object_unref0 (_data_->iq);
	_data_->iq = _tmp2_;
	_data_->io_priority = io_priority;
	_tmp3_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp3_;
	xmpp_iq_module_send_iq_async_co (_data_);
}

XmppIqStanza*
xmpp_iq_module_send_iq_finish (XmppIqModule* self,
                               GAsyncResult* _res_,
                               GError** error)
{
	XmppIqStanza* result;
	XmppIqModuleSendIqAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		XmppIqModule* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->return_stanza);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static gboolean
_xmpp_iq_module_send_iq_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = xmpp_iq_module_send_iq_async_co (self);
	return result;
}

static void
__lambda9_ (Block2Data* _data2_,
            XmppXmppStream* _,
            XmppIqStanza* result_iq)
{
	XmppIqModule* self;
	XmppIqStanza* _tmp0_;
	self = _data2_->self;
	g_return_if_fail (_ != NULL);
	g_return_if_fail (result_iq != NULL);
	_tmp0_ = _g_object_ref0 (result_iq);
	_g_object_unref0 (_data2_->return_stanza);
	_data2_->return_stanza = _tmp0_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _xmpp_iq_module_send_iq_async_co_gsource_func, _data2_->_async_data_, NULL);
}

static void
___lambda9__xmpp_iq_module_on_result (XmppXmppStream* stream,
                                      XmppIqStanza* iq,
                                      gpointer self)
{
	__lambda9_ (self, stream, iq);
}

static gboolean
xmpp_iq_module_send_iq_async_co (XmppIqModuleSendIqAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data2_ = g_slice_new0 (Block2Data);
	_data_->_data2_->_ref_count_ = 1;
	_data_->_data2_->self = g_object_ref (_data_->self);
	_data_->_data2_->_async_data_ = _data_;
	_data_->_tmp1_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->iq);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (g_strcmp0 (_data_->_tmp2_, XMPP_IQ_STANZA_TYPE_GET) == 0) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp3_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->iq);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp0_ = g_strcmp0 (_data_->_tmp4_, XMPP_IQ_STANZA_TYPE_SET) == 0;
	}
	_vala_assert (_data_->_tmp0_, "iq.type_ == Iq.Stanza.TYPE_GET || iq.type_ == Iq.Stanza.TYPE_SET");
	g_signal_emit (_data_->self, xmpp_iq_module_signals[XMPP_IQ_MODULE_PREPROCESS_OUTGOING_IQ_SET_GET_SIGNAL], 0, _data_->stream, _data_->iq);
	_data_->_data2_->return_stanza = NULL;
	_data_->_tmp5_ = _data_->self->priv->responseListeners;
	_data_->_tmp6_ = xmpp_stanza_get_id ((XmppStanza*) _data_->iq);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = xmpp_iq_module_response_listener_new (___lambda9__xmpp_iq_module_on_result, block2_data_ref (_data_->_data2_), block2_data_unref);
	_data_->_tmp9_ = _data_->_tmp8_;
	gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp5_, _data_->_tmp7_, _data_->_tmp9_);
	_xmpp_iq_module_response_listener_unref0 (_data_->_tmp9_);
	_data_->_tmp10_ = ((XmppStanza*) _data_->iq)->stanza;
	xmpp_xmpp_stream_write_async (_data_->stream, _data_->_tmp10_, _data_->io_priority, _data_->cancellable, NULL, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	g_cancellable_set_error_if_cancelled (_data_->cancellable, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == G_IO_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block2_data_unref (_data_->_data2_);
			_data_->_data2_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			block2_data_unref (_data_->_data2_);
			_data_->_data2_ = 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_->_tmp11_ = _g_object_ref0 (_data_->_data2_->return_stanza);
	_data_->result = _data_->_tmp11_;
	block2_data_unref (_data_->_data2_);
	_data_->_data2_ = 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;
}

void
xmpp_iq_module_send_iq (XmppIqModule* self,
                        XmppXmppStream* stream,
                        XmppIqStanza* iq,
                        XmppIqModuleOnResult listener,
                        gpointer listener_target,
                        GDestroyNotify listener_target_destroy_notify,
                        gint io_priority)
{
	XmppStanzaNode* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	g_signal_emit (self, xmpp_iq_module_signals[XMPP_IQ_MODULE_PREPROCESS_OUTGOING_IQ_SET_GET_SIGNAL], 0, stream, iq);
	_tmp0_ = ((XmppStanza*) iq)->stanza;
	xmpp_xmpp_stream_write (stream, _tmp0_, io_priority);
	if (listener != NULL) {
		GeeHashMap* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		XmppIqModuleOnResult _tmp4_;
		gpointer _tmp4__target;
		GDestroyNotify _tmp4__target_destroy_notify;
		XmppIqModuleResponseListener* _tmp5_;
		XmppIqModuleResponseListener* _tmp6_;
		_tmp1_ = self->priv->responseListeners;
		_tmp2_ = xmpp_stanza_get_id ((XmppStanza*) iq);
		_tmp3_ = _tmp2_;
		_tmp4_ = listener;
		_tmp4__target = listener_target;
		_tmp4__target_destroy_notify = listener_target_destroy_notify;
		listener = NULL;
		listener_target = NULL;
		listener_target_destroy_notify = NULL;
		_tmp5_ = xmpp_iq_module_response_listener_new (_tmp4_, _tmp4__target, _tmp4__target_destroy_notify);
		_tmp6_ = _tmp5_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, _tmp3_, _tmp6_);
		_xmpp_iq_module_response_listener_unref0 (_tmp6_);
	}
	(listener_target_destroy_notify == NULL) ? NULL : (listener_target_destroy_notify (listener_target), NULL);
	listener = NULL;
	listener_target = NULL;
	listener_target_destroy_notify = NULL;
}

void
xmpp_iq_module_register_for_namespace (XmppIqModule* self,
                                       const gchar* namespace,
                                       XmppIqHandler* module)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp4_;
	gpointer _tmp5_;
	GeeArrayList* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (namespace != NULL);
	g_return_if_fail (module != NULL);
	_tmp0_ = self->priv->namespaceRegistrants;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, namespace)) {
		GeeHashMap* _tmp1_;
		GeeArrayList* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = self->priv->namespaceRegistrants;
		_tmp2_ = gee_array_list_new (XMPP_IQ_TYPE_HANDLER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_tmp3_ = _tmp2_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, namespace, _tmp3_);
		_g_object_unref0 (_tmp3_);
	}
	_tmp4_ = self->priv->namespaceRegistrants;
	_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, namespace);
	_tmp6_ = (GeeArrayList*) _tmp5_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, module);
	_g_object_unref0 (_tmp6_);
}

void
xmpp_iq_module_unregister_from_namespace (XmppIqModule* self,
                                          const gchar* namespace,
                                          XmppIqHandler* module)
{
	GeeArrayList* handlers = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (namespace != NULL);
	g_return_if_fail (module != NULL);
	_tmp0_ = self->priv->namespaceRegistrants;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, namespace);
	handlers = (GeeArrayList*) _tmp1_;
	_tmp2_ = handlers;
	if (_tmp2_ != NULL) {
		GeeArrayList* _tmp3_;
		_tmp3_ = handlers;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp3_, module);
	}
	_g_object_unref0 (handlers);
}

static void
_xmpp_iq_module_on_received_iq_stanza_xmpp_xmpp_stream_received_iq_stanza (XmppXmppStream* _sender,
                                                                           XmppXmppStream* stream,
                                                                           XmppStanzaNode* node,
                                                                           gpointer self)
{
	xmpp_iq_module_on_received_iq_stanza ((XmppIqModule*) self, stream, node, NULL, NULL);
}

static void
xmpp_iq_module_real_attach (XmppXmppStreamModule* base,
                            XmppXmppStream* stream)
{
	XmppIqModule * self;
	self = (XmppIqModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_connect_object (stream, "received-iq-stanza", (GCallback) _xmpp_iq_module_on_received_iq_stanza_xmpp_xmpp_stream_received_iq_stanza, self, 0);
}

static void
xmpp_iq_module_real_detach (XmppXmppStreamModule* base,
                            XmppXmppStream* stream)
{
	XmppIqModule * self;
	guint _tmp0_;
	self = (XmppIqModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_parse_name ("received-iq-stanza", 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_iq_module_on_received_iq_stanza_xmpp_xmpp_stream_received_iq_stanza, self);
}

static gboolean
xmpp_iq_module_real_mandatory_outstanding (XmppXmppStreamNegotiationModule* base,
                                           XmppXmppStream* stream)
{
	XmppIqModule * self;
	gboolean result;
	self = (XmppIqModule*) base;
	g_return_val_if_fail (stream != NULL, FALSE);
	result = FALSE;
	return result;
}

static gboolean
xmpp_iq_module_real_negotiation_active (XmppXmppStreamNegotiationModule* base,
                                        XmppXmppStream* stream)
{
	XmppIqModule * self;
	gboolean result;
	self = (XmppIqModule*) base;
	g_return_val_if_fail (stream != NULL, FALSE);
	result = FALSE;
	return result;
}

static gchar*
xmpp_iq_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppIqModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppIqModule*) base;
	_tmp0_ = g_strdup (XMPP_IQ_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_iq_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppIqModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppIqModule*) base;
	_tmp0_ = xmpp_iq_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_iq_module_on_received_iq_stanza_data_free (gpointer _data)
{
	XmppIqModuleOnReceivedIqStanzaData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_stanza_entry_unref0 (_data_->node);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppIqModuleOnReceivedIqStanzaData, _data_);
}

static gpointer
_xmpp_stanza_entry_ref0 (gpointer self)
{
	return self ? xmpp_stanza_entry_ref (self) : NULL;
}

static void
xmpp_iq_module_on_received_iq_stanza (XmppIqModule* self,
                                      XmppXmppStream* stream,
                                      XmppStanzaNode* node,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	XmppIqModuleOnReceivedIqStanzaData* _data_;
	XmppIqModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppStanzaNode* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (node != NULL);
	_data_ = g_slice_new0 (XmppIqModuleOnReceivedIqStanzaData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_iq_module_on_received_iq_stanza_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_stanza_entry_ref0 (node);
	_xmpp_stanza_entry_unref0 (_data_->node);
	_data_->node = _tmp2_;
	xmpp_iq_module_on_received_iq_stanza_co (_data_);
}

static void
xmpp_iq_module_on_received_iq_stanza_finish (XmppIqModule* self,
                                             GAsyncResult* _res_)
{
	XmppIqModuleOnReceivedIqStanzaData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_iq_module_on_received_iq_stanza_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	XmppIqModuleOnReceivedIqStanzaData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_iq_module_on_received_iq_stanza_co (_data_);
}

static gboolean
xmpp_iq_module_on_received_iq_stanza_co (XmppIqModuleOnReceivedIqStanzaData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = xmpp_bind_flag_IDENTITY;
	if (xmpp_xmpp_stream_has_flag (_data_->stream, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp1_)) {
		_data_->_tmp2_ = xmpp_bind_flag_IDENTITY;
		_data_->_tmp3_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp2_);
		_data_->_tmp4_ = (XmppBindFlag*) _data_->_tmp3_;
		_data_->_tmp5_ = _data_->_tmp4_->my_jid;
		_data_->_tmp0_ = _data_->_tmp5_;
		_g_object_unref0 (_data_->_tmp4_);
	} else {
		_data_->_tmp0_ = NULL;
	}
	_data_->_tmp6_ = xmpp_iq_stanza_new_from_stanza (_data_->node, _data_->_tmp0_);
	_data_->iq = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->iq;
	_data_->_tmp9_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	if (g_strcmp0 (_data_->_tmp10_, XMPP_IQ_STANZA_TYPE_RESULT) == 0) {
		_data_->_tmp7_ = TRUE;
	} else {
		_data_->_tmp11_ = _data_->iq;
		_data_->_tmp7_ = xmpp_stanza_is_error ((XmppStanza*) _data_->_tmp11_);
	}
	if (_data_->_tmp7_) {
		_data_->_tmp12_ = _data_->self->priv->responseListeners;
		_data_->_tmp13_ = _data_->iq;
		_data_->_tmp14_ = xmpp_stanza_get_id ((XmppStanza*) _data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		if (gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp12_, _data_->_tmp15_)) {
			_data_->_tmp16_ = _data_->self->priv->responseListeners;
			_data_->_tmp17_ = _data_->iq;
			_data_->_tmp18_ = xmpp_stanza_get_id ((XmppStanza*) _data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp16_, _data_->_tmp19_);
			_data_->listener = (XmppIqModuleResponseListener*) _data_->_tmp20_;
			_data_->_tmp21_ = _data_->listener;
			if (_data_->_tmp21_ != NULL) {
				_data_->_tmp22_ = _data_->listener;
				_data_->_tmp23_ = NULL;
				_data_->_tmp23__target = NULL;
				_data_->_tmp23_ = xmpp_iq_module_response_listener_get_on_result (_data_->_tmp22_, &_data_->_tmp23__target);
				_data_->_tmp24_ = _data_->_tmp23_;
				_data_->_tmp24__target = _data_->_tmp23__target;
				_data_->_tmp25_ = _data_->iq;
				_data_->_tmp24_ (_data_->stream, _data_->_tmp25_, _data_->_tmp24__target);
			}
			_data_->_tmp26_ = _data_->self->priv->responseListeners;
			_data_->_tmp27_ = _data_->iq;
			_data_->_tmp28_ = xmpp_stanza_get_id ((XmppStanza*) _data_->_tmp27_);
			_data_->_tmp29_ = _data_->_tmp28_;
			gee_abstract_map_unset ((GeeAbstractMap*) _data_->_tmp26_, _data_->_tmp29_, NULL);
			_xmpp_iq_module_response_listener_unref0 (_data_->listener);
		}
	} else {
		_data_->_tmp30_ = xmpp_stanza_node_get_all_subnodes (_data_->node);
		_data_->children = _data_->_tmp30_;
		_data_->_tmp32_ = _data_->children;
		_data_->_tmp33_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp32_);
		_data_->_tmp34_ = _data_->_tmp33_;
		if (_data_->_tmp34_ == 1) {
			_data_->_tmp35_ = _data_->self->priv->namespaceRegistrants;
			_data_->_tmp36_ = _data_->children;
			_data_->_tmp37_ = gee_list_get (_data_->_tmp36_, 0);
			_data_->_tmp38_ = (XmppStanzaNode*) _data_->_tmp37_;
			_data_->_tmp39_ = ((XmppStanzaEntry*) _data_->_tmp38_)->ns_uri;
			_data_->_tmp31_ = gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp35_, _data_->_tmp39_);
			_xmpp_stanza_entry_unref0 (_data_->_tmp38_);
		} else {
			_data_->_tmp31_ = FALSE;
		}
		if (_data_->_tmp31_) {
			_data_->_tmp40_ = _data_->iq;
			g_signal_emit (_data_->self, xmpp_iq_module_signals[XMPP_IQ_MODULE_PREPROCESS_INCOMING_IQ_SET_GET_SIGNAL], 0, _data_->stream, _data_->_tmp40_);
			_data_->_tmp41_ = _data_->self->priv->namespaceRegistrants;
			_data_->_tmp42_ = _data_->children;
			_data_->_tmp43_ = gee_list_get (_data_->_tmp42_, 0);
			_data_->_tmp44_ = (XmppStanzaNode*) _data_->_tmp43_;
			_data_->_tmp45_ = ((XmppStanzaEntry*) _data_->_tmp44_)->ns_uri;
			_data_->_tmp46_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp41_, _data_->_tmp45_);
			_data_->_tmp47_ = (GeeList*) ((GeeArrayList*) _data_->_tmp46_);
			_xmpp_stanza_entry_unref0 (_data_->_tmp44_);
			_data_->handlers = _data_->_tmp47_;
			{
				_data_->_tmp48_ = _data_->handlers;
				_data_->_handler_list = _data_->_tmp48_;
				_data_->_tmp49_ = _data_->_handler_list;
				_data_->_tmp50_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp49_);
				_data_->_tmp51_ = _data_->_tmp50_;
				_data_->_handler_size = _data_->_tmp51_;
				_data_->_handler_index = -1;
				while (TRUE) {
					_data_->_handler_index = _data_->_handler_index + 1;
					_data_->_tmp52_ = _data_->_handler_index;
					_data_->_tmp53_ = _data_->_handler_size;
					if (!(_data_->_tmp52_ < _data_->_tmp53_)) {
						break;
					}
					_data_->_tmp54_ = _data_->_handler_list;
					_data_->_tmp55_ = gee_list_get (_data_->_tmp54_, _data_->_handler_index);
					_data_->handler = (XmppIqHandler*) _data_->_tmp55_;
					_data_->_tmp56_ = _data_->iq;
					_data_->_tmp57_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->_tmp56_);
					_data_->_tmp58_ = _data_->_tmp57_;
					if (g_strcmp0 (_data_->_tmp58_, XMPP_IQ_STANZA_TYPE_GET) == 0) {
						_data_->_tmp59_ = _data_->handler;
						_data_->_tmp60_ = _data_->iq;
						_data_->_state_ = 1;
						xmpp_iq_handler_on_iq_get (_data_->_tmp59_, _data_->stream, _data_->_tmp60_, xmpp_iq_module_on_received_iq_stanza_ready, _data_);
						return FALSE;
						_state_1:
						xmpp_iq_handler_on_iq_get_finish (_data_->_tmp59_, _data_->_res_);
					} else {
						_data_->_tmp61_ = _data_->iq;
						_data_->_tmp62_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->_tmp61_);
						_data_->_tmp63_ = _data_->_tmp62_;
						if (g_strcmp0 (_data_->_tmp63_, XMPP_IQ_STANZA_TYPE_SET) == 0) {
							_data_->_tmp64_ = _data_->handler;
							_data_->_tmp65_ = _data_->iq;
							_data_->_state_ = 2;
							xmpp_iq_handler_on_iq_set (_data_->_tmp64_, _data_->stream, _data_->_tmp65_, xmpp_iq_module_on_received_iq_stanza_ready, _data_);
							return FALSE;
							_state_2:
							xmpp_iq_handler_on_iq_set_finish (_data_->_tmp64_, _data_->_res_);
						}
					}
					_g_object_unref0 (_data_->handler);
				}
			}
			_g_object_unref0 (_data_->handlers);
		} else {
			_data_->_tmp66_ = _data_->iq;
			_data_->_tmp67_ = xmpp_error_stanza_new_service_unavailable ();
			_data_->_tmp68_ = _data_->_tmp67_;
			_data_->_tmp69_ = _data_->iq;
			_data_->_tmp70_ = xmpp_stanza_get_from ((XmppStanza*) _data_->_tmp69_);
			_data_->_tmp71_ = _data_->_tmp70_;
			_data_->_tmp72_ = NULL;
			_data_->_tmp72_ = xmpp_iq_stanza_new_error (_data_->_tmp66_, _data_->_tmp68_);
			xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp72_, _data_->_tmp71_);
			_xmpp_jid_unref0 (_data_->_tmp71_);
			_data_->_tmp73_ = _data_->_tmp72_;
			_xmpp_error_stanza_unref0 (_data_->_tmp68_);
			_data_->unavailable_error = _data_->_tmp73_;
			_data_->_tmp74_ = _data_->unavailable_error;
			xmpp_iq_module_send_iq (_data_->self, _data_->stream, _data_->_tmp74_, NULL, NULL, NULL, G_PRIORITY_DEFAULT);
			_g_object_unref0 (_data_->unavailable_error);
		}
		_g_object_unref0 (_data_->children);
	}
	_g_object_unref0 (_data_->iq);
	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;
}

XmppIqModule*
xmpp_iq_module_construct (GType object_type)
{
	XmppIqModule * self = NULL;
	self = (XmppIqModule*) xmpp_xmpp_stream_negotiation_module_construct (object_type);
	return self;
}

XmppIqModule*
xmpp_iq_module_new (void)
{
	return xmpp_iq_module_construct (XMPP_IQ_TYPE_MODULE);
}

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

static inline gpointer
xmpp_iq_module_response_listener_get_instance_private (XmppIqModuleResponseListener* self)
{
	return G_STRUCT_MEMBER_P (self, XmppIqModuleResponseListener_private_offset);
}

static XmppIqModuleResponseListener*
xmpp_iq_module_response_listener_construct (GType object_type,
                                            XmppIqModuleOnResult on_result,
                                            gpointer on_result_target,
                                            GDestroyNotify on_result_target_destroy_notify)
{
	XmppIqModuleResponseListener* self = NULL;
	XmppIqModuleOnResult _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	self = (XmppIqModuleResponseListener*) g_type_create_instance (object_type);
	_tmp0_ = on_result;
	_tmp0__target = on_result_target;
	_tmp0__target_destroy_notify = on_result_target_destroy_notify;
	on_result = NULL;
	on_result_target = NULL;
	on_result_target_destroy_notify = NULL;
	xmpp_iq_module_response_listener_set_on_result (self, _tmp0_, _tmp0__target, _tmp0__target_destroy_notify);
	(on_result_target_destroy_notify == NULL) ? NULL : (on_result_target_destroy_notify (on_result_target), NULL);
	on_result = NULL;
	on_result_target = NULL;
	on_result_target_destroy_notify = NULL;
	return self;
}

static XmppIqModuleResponseListener*
xmpp_iq_module_response_listener_new (XmppIqModuleOnResult on_result,
                                      gpointer on_result_target,
                                      GDestroyNotify on_result_target_destroy_notify)
{
	return xmpp_iq_module_response_listener_construct (XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER, on_result, on_result_target, on_result_target_destroy_notify);
}

static XmppIqModuleOnResult
xmpp_iq_module_response_listener_get_on_result (XmppIqModuleResponseListener* self,
                                                gpointer* result_target)
{
	XmppIqModuleOnResult result;
	XmppIqModuleOnResult _tmp0_;
	gpointer _tmp0__target;
	XmppIqModuleOnResult _tmp1_;
	gpointer _tmp1__target;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_on_result;
	_tmp0__target = self->priv->_on_result_target;
	_tmp1_ = _tmp0_;
	_tmp1__target = _tmp0__target;
	*result_target = _tmp1__target;
	result = _tmp1_;
	return result;
}

static void
xmpp_iq_module_response_listener_set_on_result (XmppIqModuleResponseListener* self,
                                                XmppIqModuleOnResult value,
                                                gpointer value_target,
                                                GDestroyNotify value_target_destroy_notify)
{
	XmppIqModuleOnResult _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp0__target = value_target;
	_tmp0__target_destroy_notify = value_target_destroy_notify;
	value = NULL;
	value_target = NULL;
	value_target_destroy_notify = NULL;
	(self->priv->_on_result_target_destroy_notify == NULL) ? NULL : (self->priv->_on_result_target_destroy_notify (self->priv->_on_result_target), NULL);
	self->priv->_on_result = NULL;
	self->priv->_on_result_target = NULL;
	self->priv->_on_result_target_destroy_notify = NULL;
	self->priv->_on_result = _tmp0_;
	self->priv->_on_result_target = _tmp0__target;
	self->priv->_on_result_target_destroy_notify = _tmp0__target_destroy_notify;
	(value_target_destroy_notify == NULL) ? NULL : (value_target_destroy_notify (value_target), NULL);
	value = NULL;
	value_target = NULL;
	value_target_destroy_notify = NULL;
}

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

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

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

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

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

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

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

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

static void
xmpp_iq_module_value_set_response_listener (GValue* value,
                                            gpointer v_object)
{
	XmppIqModuleResponseListener * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_iq_module_response_listener_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_iq_module_response_listener_unref (old);
	}
}

static void
xmpp_iq_module_value_take_response_listener (GValue* value,
                                             gpointer v_object)
{
	XmppIqModuleResponseListener * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_iq_module_response_listener_unref (old);
	}
}

static void
xmpp_iq_module_response_listener_class_init (XmppIqModuleResponseListenerClass * klass,
                                             gpointer klass_data)
{
	xmpp_iq_module_response_listener_parent_class = g_type_class_peek_parent (klass);
	((XmppIqModuleResponseListenerClass *) klass)->finalize = xmpp_iq_module_response_listener_finalize;
	g_type_class_adjust_private_offset (klass, &XmppIqModuleResponseListener_private_offset);
}

static void
xmpp_iq_module_response_listener_instance_init (XmppIqModuleResponseListener * self,
                                                gpointer klass)
{
	self->priv = xmpp_iq_module_response_listener_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_iq_module_response_listener_finalize (XmppIqModuleResponseListener * obj)
{
	XmppIqModuleResponseListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER, XmppIqModuleResponseListener);
	g_signal_handlers_destroy (self);
	(self->priv->_on_result_target_destroy_notify == NULL) ? NULL : (self->priv->_on_result_target_destroy_notify (self->priv->_on_result_target), NULL);
	self->priv->_on_result = NULL;
	self->priv->_on_result_target = NULL;
	self->priv->_on_result_target_destroy_notify = NULL;
}

static GType
xmpp_iq_module_response_listener_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_iq_module_value_response_listener_init, xmpp_iq_module_value_response_listener_free_value, xmpp_iq_module_value_response_listener_copy_value, xmpp_iq_module_value_response_listener_peek_pointer, "p", xmpp_iq_module_value_response_listener_collect_value, "p", xmpp_iq_module_value_response_listener_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppIqModuleResponseListenerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_iq_module_response_listener_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppIqModuleResponseListener), 0, (GInstanceInitFunc) xmpp_iq_module_response_listener_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_iq_module_response_listener_type_id;
	xmpp_iq_module_response_listener_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppIqModuleResponseListener", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppIqModuleResponseListener_private_offset = g_type_add_instance_private (xmpp_iq_module_response_listener_type_id, sizeof (XmppIqModuleResponseListenerPrivate));
	return xmpp_iq_module_response_listener_type_id;
}

static GType
xmpp_iq_module_response_listener_get_type (void)
{
	static volatile gsize xmpp_iq_module_response_listener_type_id__once = 0;
	if (g_once_init_enter (&xmpp_iq_module_response_listener_type_id__once)) {
		GType xmpp_iq_module_response_listener_type_id;
		xmpp_iq_module_response_listener_type_id = xmpp_iq_module_response_listener_get_type_once ();
		g_once_init_leave (&xmpp_iq_module_response_listener_type_id__once, xmpp_iq_module_response_listener_type_id);
	}
	return xmpp_iq_module_response_listener_type_id__once;
}

static gpointer
xmpp_iq_module_response_listener_ref (gpointer instance)
{
	XmppIqModuleResponseListener * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
xmpp_iq_module_response_listener_unref (gpointer instance)
{
	XmppIqModuleResponseListener * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_IQ_MODULE_RESPONSE_LISTENER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
xmpp_iq_module_class_init (XmppIqModuleClass * klass,
                           gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_iq_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppIqModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_iq_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_iq_module_real_detach;
	((XmppXmppStreamNegotiationModuleClass *) klass)->mandatory_outstanding = (gboolean (*) (XmppXmppStreamNegotiationModule*, XmppXmppStream*)) xmpp_iq_module_real_mandatory_outstanding;
	((XmppXmppStreamNegotiationModuleClass *) klass)->negotiation_active = (gboolean (*) (XmppXmppStreamNegotiationModule*, XmppXmppStream*)) xmpp_iq_module_real_negotiation_active;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_iq_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_iq_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_iq_module_finalize;
	xmpp_iq_module_signals[XMPP_IQ_MODULE_PREPROCESS_INCOMING_IQ_SET_GET_SIGNAL] = g_signal_new ("preprocess-incoming-iq-set-get", XMPP_IQ_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_IQ_TYPE_STANZA);
	xmpp_iq_module_signals[XMPP_IQ_MODULE_PREPROCESS_OUTGOING_IQ_SET_GET_SIGNAL] = g_signal_new ("preprocess-outgoing-iq-set-get", XMPP_IQ_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_IQ_TYPE_STANZA);
	_tmp0_ = xmpp_module_identity_new (XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_IQ_NS_URI, "iq_module");
	xmpp_iq_module_IDENTITY = _tmp0_;
}

static void
xmpp_iq_module_instance_init (XmppIqModule * self,
                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	self->priv = xmpp_iq_module_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, XMPP_IQ_MODULE_TYPE_RESPONSE_LISTENER, (GBoxedCopyFunc) xmpp_iq_module_response_listener_ref, (GDestroyNotify) xmpp_iq_module_response_listener_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->responseListeners = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->namespaceRegistrants = _tmp1_;
}

static void
xmpp_iq_module_finalize (GObject * obj)
{
	XmppIqModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_IQ_TYPE_MODULE, XmppIqModule);
	_g_object_unref0 (self->priv->responseListeners);
	_g_object_unref0 (self->priv->namespaceRegistrants);
	G_OBJECT_CLASS (xmpp_iq_module_parent_class)->finalize (obj);
}

static GType
xmpp_iq_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppIqModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_iq_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppIqModule), 0, (GInstanceInitFunc) xmpp_iq_module_instance_init, NULL };
	GType xmpp_iq_module_type_id;
	xmpp_iq_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_NEGOTIATION_MODULE, "XmppIqModule", &g_define_type_info, 0);
	XmppIqModule_private_offset = g_type_add_instance_private (xmpp_iq_module_type_id, sizeof (XmppIqModulePrivate));
	return xmpp_iq_module_type_id;
}

GType
xmpp_iq_module_get_type (void)
{
	static volatile gsize xmpp_iq_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_iq_module_type_id__once)) {
		GType xmpp_iq_module_type_id;
		xmpp_iq_module_type_id = xmpp_iq_module_get_type_once ();
		g_once_init_leave (&xmpp_iq_module_type_id__once, xmpp_iq_module_type_id);
	}
	return xmpp_iq_module_type_id__once;
}

static void
xmpp_iq_handler_real_on_iq_get_data_free (gpointer _data)
{
	XmppIqHandlerOnIqGetData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->iq);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppIqHandlerOnIqGetData, _data_);
}

static void
xmpp_iq_handler_real_on_iq_get (XmppIqHandler* self,
                                XmppXmppStream* stream,
                                XmppIqStanza* iq,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	XmppIqHandlerOnIqGetData* _data_;
	XmppIqHandler* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppIqStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	_data_ = g_slice_new0 (XmppIqHandlerOnIqGetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_iq_handler_real_on_iq_get_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 (iq);
	_g_object_unref0 (_data_->iq);
	_data_->iq = _tmp2_;
	xmpp_iq_handler_real_on_iq_get_co (_data_);
}

static void
xmpp_iq_handler_real_on_iq_get_finish (XmppIqHandler* self,
                                       GAsyncResult* _res_)
{
	XmppIqHandlerOnIqGetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
xmpp_iq_handler_real_on_iq_get_co (XmppIqHandlerOnIqGetData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_error_stanza_new_bad_request ("unexpected IQ get for this namespace");
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_iq_stanza_new_error (_data_->iq, _data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_xmpp_error_stanza_unref0 (_data_->_tmp1_);
	_data_->bad_request = _data_->_tmp3_;
	_data_->_tmp4_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp5_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp4_);
	_data_->_tmp6_ = (XmppIqModule*) _data_->_tmp5_;
	xmpp_iq_module_send_iq (_data_->_tmp6_, _data_->stream, _data_->bad_request, NULL, NULL, NULL, G_PRIORITY_DEFAULT);
	_g_object_unref0 (_data_->_tmp6_);
	_g_object_unref0 (_data_->bad_request);
	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;
}

void
xmpp_iq_handler_on_iq_get (XmppIqHandler* self,
                           XmppXmppStream* stream,
                           XmppIqStanza* iq,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	XmppIqHandlerIface* _iface_;
	_iface_ = XMPP_IQ_HANDLER_GET_INTERFACE (self);
	if (_iface_->on_iq_get) {
		_iface_->on_iq_get (self, stream, iq, _callback_, _user_data_);
	}
}

void
xmpp_iq_handler_on_iq_get_finish (XmppIqHandler* self,
                                  GAsyncResult* _res_)
{
	XmppIqHandlerIface* _iface_;
	_iface_ = XMPP_IQ_HANDLER_GET_INTERFACE (self);
	if (_iface_->on_iq_get_finish) {
		_iface_->on_iq_get_finish (self, _res_);
	}
}

static void
xmpp_iq_handler_real_on_iq_set_data_free (gpointer _data)
{
	XmppIqHandlerOnIqSetData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->iq);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppIqHandlerOnIqSetData, _data_);
}

static void
xmpp_iq_handler_real_on_iq_set (XmppIqHandler* self,
                                XmppXmppStream* stream,
                                XmppIqStanza* iq,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	XmppIqHandlerOnIqSetData* _data_;
	XmppIqHandler* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppIqStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	_data_ = g_slice_new0 (XmppIqHandlerOnIqSetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_iq_handler_real_on_iq_set_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 (iq);
	_g_object_unref0 (_data_->iq);
	_data_->iq = _tmp2_;
	xmpp_iq_handler_real_on_iq_set_co (_data_);
}

static void
xmpp_iq_handler_real_on_iq_set_finish (XmppIqHandler* self,
                                       GAsyncResult* _res_)
{
	XmppIqHandlerOnIqSetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
xmpp_iq_handler_real_on_iq_set_co (XmppIqHandlerOnIqSetData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_error_stanza_new_bad_request ("unexpected IQ set for this namespace");
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_iq_stanza_new_error (_data_->iq, _data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_xmpp_error_stanza_unref0 (_data_->_tmp1_);
	_data_->bad_request = _data_->_tmp3_;
	_data_->_tmp4_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp5_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp4_);
	_data_->_tmp6_ = (XmppIqModule*) _data_->_tmp5_;
	xmpp_iq_module_send_iq (_data_->_tmp6_, _data_->stream, _data_->bad_request, NULL, NULL, NULL, G_PRIORITY_DEFAULT);
	_g_object_unref0 (_data_->_tmp6_);
	_g_object_unref0 (_data_->bad_request);
	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;
}

void
xmpp_iq_handler_on_iq_set (XmppIqHandler* self,
                           XmppXmppStream* stream,
                           XmppIqStanza* iq,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	XmppIqHandlerIface* _iface_;
	_iface_ = XMPP_IQ_HANDLER_GET_INTERFACE (self);
	if (_iface_->on_iq_set) {
		_iface_->on_iq_set (self, stream, iq, _callback_, _user_data_);
	}
}

void
xmpp_iq_handler_on_iq_set_finish (XmppIqHandler* self,
                                  GAsyncResult* _res_)
{
	XmppIqHandlerIface* _iface_;
	_iface_ = XMPP_IQ_HANDLER_GET_INTERFACE (self);
	if (_iface_->on_iq_set_finish) {
		_iface_->on_iq_set_finish (self, _res_);
	}
}

static void
xmpp_iq_handler_default_init (XmppIqHandlerIface * iface,
                              gpointer iface_data)
{
	iface->on_iq_get = xmpp_iq_handler_real_on_iq_get;
	iface->on_iq_get_finish = xmpp_iq_handler_real_on_iq_get_finish;
	iface->on_iq_set = xmpp_iq_handler_real_on_iq_set;
	iface->on_iq_set_finish = xmpp_iq_handler_real_on_iq_set_finish;
}

static GType
xmpp_iq_handler_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppIqHandlerIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_iq_handler_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType xmpp_iq_handler_type_id;
	xmpp_iq_handler_type_id = g_type_register_static (G_TYPE_INTERFACE, "XmppIqHandler", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (xmpp_iq_handler_type_id, G_TYPE_OBJECT);
	return xmpp_iq_handler_type_id;
}

GType
xmpp_iq_handler_get_type (void)
{
	static volatile gsize xmpp_iq_handler_type_id__once = 0;
	if (g_once_init_enter (&xmpp_iq_handler_type_id__once)) {
		GType xmpp_iq_handler_type_id;
		xmpp_iq_handler_type_id = xmpp_iq_handler_get_type_once ();
		g_once_init_leave (&xmpp_iq_handler_type_id__once, xmpp_iq_handler_type_id);
	}
	return xmpp_iq_handler_type_id__once;
}

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

