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

/* Legacy. RFC 3921 3*/

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

#define XMPP_SESSION_NS_URI "urn:ietf:params:xml:ns:xmpp-session"
#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_SESSION_MODULE_0_PROPERTY,
	XMPP_SESSION_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_session_module_properties[XMPP_SESSION_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppSessionModuleOnBoundResourceData XmppSessionModuleOnBoundResourceData;
enum  {
	XMPP_SESSION_FLAG_0_PROPERTY,
	XMPP_SESSION_FLAG_NUM_PROPERTIES
};
static GParamSpec* xmpp_session_flag_properties[XMPP_SESSION_FLAG_NUM_PROPERTIES];

struct _XmppSessionModuleOnBoundResourceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppSessionModule* self;
	XmppXmppStream* stream;
	XmppJid* my_jid;
	XmppStanzaNode* session_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	gboolean _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppSessionFlag* _tmp8_;
	XmppSessionFlag* _tmp9_;
	XmppIqStanza* iq;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppJid* _tmp14_;
	XmppJid* _tmp15_;
	XmppIqStanza* _tmp16_;
	XmppIqStanza* _tmp17_;
	XmppIqStanza* result_iq;
	XmppModuleIdentity* _tmp18_;
	gpointer _tmp19_;
	XmppIqModule* _tmp20_;
	XmppIqStanza* _tmp21_;
	XmppIqStanza* _tmp22_;
	XmppIqStanza* _tmp23_;
	XmppIqStanza* _tmp24_;
	XmppFlagIdentity* _tmp25_;
	gpointer _tmp26_;
	XmppSessionFlag* _tmp27_;
	GError* _inner_error0_;
};

static gpointer xmpp_session_module_parent_class = NULL;
XmppModuleIdentity* xmpp_session_module_IDENTITY = NULL;
static gpointer xmpp_session_flag_parent_class = NULL;
XmppFlagIdentity* xmpp_session_flag_IDENTITY = NULL;

static void xmpp_session_module_real_attach (XmppXmppStreamModule* base,
                                      XmppXmppStream* stream);
static void xmpp_session_module_on_bound_resource (XmppSessionModule* self,
                                            XmppXmppStream* stream,
                                            XmppJid* my_jid,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void xmpp_session_module_on_bound_resource_finish (XmppSessionModule* self,
                                                   GAsyncResult* _res_);
static void _xmpp_session_module_on_bound_resource_xmpp_bind_module_bound_to_resource (XmppBindModule* _sender,
                                                                                XmppXmppStream* stream,
                                                                                XmppJid* my_jid,
                                                                                gpointer self);
static void xmpp_session_module_real_detach (XmppXmppStreamModule* base,
                                      XmppXmppStream* stream);
static gboolean xmpp_session_module_real_mandatory_outstanding (XmppXmppStreamNegotiationModule* base,
                                                         XmppXmppStream* stream);
static gboolean xmpp_session_module_real_negotiation_active (XmppXmppStreamNegotiationModule* base,
                                                      XmppXmppStream* stream);
static gchar* xmpp_session_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_session_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_session_module_on_bound_resource_data_free (gpointer _data);
static gboolean xmpp_session_module_on_bound_resource_co (XmppSessionModuleOnBoundResourceData* _data_);
static void xmpp_session_module_on_bound_resource_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static void xmpp_session_module_finalize (GObject * obj);
static GType xmpp_session_module_get_type_once (void);
static gchar* xmpp_session_flag_real_get_ns (XmppXmppStreamFlag* base);
static gchar* xmpp_session_flag_real_get_id (XmppXmppStreamFlag* base);
static void xmpp_session_flag_finalize (GObject * obj);
static GType xmpp_session_flag_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
_xmpp_session_module_on_bound_resource_xmpp_bind_module_bound_to_resource (XmppBindModule* _sender,
                                                                           XmppXmppStream* stream,
                                                                           XmppJid* my_jid,
                                                                           gpointer self)
{
	xmpp_session_module_on_bound_resource ((XmppSessionModule*) self, stream, my_jid, NULL, NULL);
}

static void
xmpp_session_module_real_attach (XmppXmppStreamModule* base,
                                 XmppXmppStream* stream)
{
	XmppSessionModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppBindModule* _tmp2_;
	self = (XmppSessionModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_bind_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_BIND_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppBindModule*) _tmp1_;
	g_signal_connect_object (_tmp2_, "bound-to-resource", (GCallback) _xmpp_session_module_on_bound_resource_xmpp_bind_module_bound_to_resource, self, 0);
	_g_object_unref0 (_tmp2_);
}

static void
xmpp_session_module_real_detach (XmppXmppStreamModule* base,
                                 XmppXmppStream* stream)
{
	XmppSessionModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppBindModule* _tmp2_;
	guint _tmp3_;
	self = (XmppSessionModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_bind_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_BIND_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppBindModule*) _tmp1_;
	g_signal_parse_name ("bound-to-resource", XMPP_BIND_TYPE_MODULE, &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _xmpp_session_module_on_bound_resource_xmpp_bind_module_bound_to_resource, self);
	_g_object_unref0 (_tmp2_);
}

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

static gboolean
xmpp_session_module_real_negotiation_active (XmppXmppStreamNegotiationModule* base,
                                             XmppXmppStream* stream)
{
	XmppSessionModule * self;
	gboolean _tmp0_ = FALSE;
	XmppFlagIdentity* _tmp1_;
	gboolean result;
	self = (XmppSessionModule*) base;
	g_return_val_if_fail (stream != NULL, FALSE);
	_tmp1_ = xmpp_session_flag_IDENTITY;
	if (xmpp_xmpp_stream_has_flag (stream, XMPP_SESSION_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_)) {
		XmppFlagIdentity* _tmp2_;
		gpointer _tmp3_;
		XmppSessionFlag* _tmp4_;
		_tmp2_ = xmpp_session_flag_IDENTITY;
		_tmp3_ = xmpp_xmpp_stream_get_flag (stream, XMPP_SESSION_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
		_tmp4_ = (XmppSessionFlag*) _tmp3_;
		_tmp0_ = !_tmp4_->finished;
		_g_object_unref0 (_tmp4_);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_session_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppSessionModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppSessionModule*) base;
	_tmp0_ = g_strdup (XMPP_SESSION_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_session_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppSessionModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppSessionModule*) base;
	_tmp0_ = xmpp_session_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_session_module_on_bound_resource_data_free (gpointer _data)
{
	XmppSessionModuleOnBoundResourceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->my_jid);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppSessionModuleOnBoundResourceData, _data_);
}

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

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

static void
xmpp_session_module_on_bound_resource (XmppSessionModule* self,
                                       XmppXmppStream* stream,
                                       XmppJid* my_jid,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	XmppSessionModuleOnBoundResourceData* _data_;
	XmppSessionModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (my_jid != NULL);
	_data_ = g_slice_new0 (XmppSessionModuleOnBoundResourceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_session_module_on_bound_resource_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_jid_ref0 (my_jid);
	_xmpp_jid_unref0 (_data_->my_jid);
	_data_->my_jid = _tmp2_;
	xmpp_session_module_on_bound_resource_co (_data_);
}

static void
xmpp_session_module_on_bound_resource_finish (XmppSessionModule* self,
                                              GAsyncResult* _res_)
{
	XmppSessionModuleOnBoundResourceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_session_module_on_bound_resource_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	XmppSessionModuleOnBoundResourceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_session_module_on_bound_resource_co (_data_);
}

static gboolean
xmpp_session_module_on_bound_resource_co (XmppSessionModuleOnBoundResourceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xmpp_stream_get_features (_data_->stream);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_get_subnode (_data_->_tmp1_, "session", XMPP_SESSION_NS_URI, FALSE);
	_data_->session_node = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->session_node;
	if (_data_->_tmp4_ != NULL) {
		_data_->_tmp5_ = _data_->session_node;
		_data_->_tmp6_ = xmpp_stanza_node_get_subnode (_data_->_tmp5_, "optional", XMPP_SESSION_NS_URI, FALSE);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp3_ = _data_->_tmp7_ == NULL;
		_xmpp_stanza_entry_unref0 (_data_->_tmp7_);
	} else {
		_data_->_tmp3_ = FALSE;
	}
	if (_data_->_tmp3_) {
		_data_->_tmp8_ = xmpp_session_flag_new ();
		_data_->_tmp9_ = _data_->_tmp8_;
		xmpp_xmpp_stream_add_flag (_data_->stream, (XmppXmppStreamFlag*) _data_->_tmp9_);
		_g_object_unref0 (_data_->_tmp9_);
		_data_->_tmp10_ = xmpp_stanza_node_new_build ("session", XMPP_SESSION_NS_URI, NULL, NULL);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp12_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = _data_->stream->remote_name;
		_data_->_tmp15_ = _xmpp_jid_ref0 (_data_->_tmp14_);
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = xmpp_iq_stanza_new_set (_data_->_tmp13_, NULL);
		xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp16_, _data_->_tmp15_);
		_xmpp_jid_unref0 (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_xmpp_stanza_entry_unref0 (_data_->_tmp13_);
		_xmpp_stanza_entry_unref0 (_data_->_tmp11_);
		_data_->iq = _data_->_tmp17_;
		_data_->_tmp18_ = xmpp_iq_module_IDENTITY;
		_data_->_tmp19_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp18_);
		_data_->_tmp20_ = (XmppIqModule*) _data_->_tmp19_;
		_data_->_tmp21_ = _data_->iq;
		_data_->_state_ = 1;
		xmpp_iq_module_send_iq_async (_data_->_tmp20_, _data_->stream, _data_->_tmp21_, G_PRIORITY_DEFAULT, NULL, xmpp_session_module_on_bound_resource_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp22_ = xmpp_iq_module_send_iq_finish (_data_->_tmp20_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_g_object_unref0 (_data_->_tmp20_);
		_data_->result_iq = _data_->_tmp23_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->iq);
			_xmpp_stanza_entry_unref0 (_data_->session_node);
			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_->_tmp24_ = _data_->result_iq;
		if (!xmpp_stanza_is_error ((XmppStanza*) _data_->_tmp24_)) {
			_data_->_tmp25_ = xmpp_session_flag_IDENTITY;
			_data_->_tmp26_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_SESSION_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp25_);
			_data_->_tmp27_ = (XmppSessionFlag*) _data_->_tmp26_;
			_data_->_tmp27_->finished = TRUE;
			_g_object_unref0 (_data_->_tmp27_);
		}
		_g_object_unref0 (_data_->result_iq);
		_g_object_unref0 (_data_->iq);
	}
	_xmpp_stanza_entry_unref0 (_data_->session_node);
	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;
}

XmppSessionModule*
xmpp_session_module_construct (GType object_type)
{
	XmppSessionModule * self = NULL;
	self = (XmppSessionModule*) xmpp_xmpp_stream_negotiation_module_construct (object_type);
	return self;
}

XmppSessionModule*
xmpp_session_module_new (void)
{
	return xmpp_session_module_construct (XMPP_SESSION_TYPE_MODULE);
}

static void
xmpp_session_module_class_init (XmppSessionModuleClass * klass,
                                gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_session_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_session_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_session_module_real_detach;
	((XmppXmppStreamNegotiationModuleClass *) klass)->mandatory_outstanding = (gboolean (*) (XmppXmppStreamNegotiationModule*, XmppXmppStream*)) xmpp_session_module_real_mandatory_outstanding;
	((XmppXmppStreamNegotiationModuleClass *) klass)->negotiation_active = (gboolean (*) (XmppXmppStreamNegotiationModule*, XmppXmppStream*)) xmpp_session_module_real_negotiation_active;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_session_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_session_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_session_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_SESSION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_SESSION_NS_URI, "session");
	xmpp_session_module_IDENTITY = _tmp0_;
}

static void
xmpp_session_module_instance_init (XmppSessionModule * self,
                                   gpointer klass)
{
}

static void
xmpp_session_module_finalize (GObject * obj)
{
	XmppSessionModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_SESSION_TYPE_MODULE, XmppSessionModule);
	G_OBJECT_CLASS (xmpp_session_module_parent_class)->finalize (obj);
}

static GType
xmpp_session_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppSessionModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_session_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppSessionModule), 0, (GInstanceInitFunc) xmpp_session_module_instance_init, NULL };
	GType xmpp_session_module_type_id;
	xmpp_session_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_NEGOTIATION_MODULE, "XmppSessionModule", &g_define_type_info, 0);
	return xmpp_session_module_type_id;
}

GType
xmpp_session_module_get_type (void)
{
	static volatile gsize xmpp_session_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_session_module_type_id__once)) {
		GType xmpp_session_module_type_id;
		xmpp_session_module_type_id = xmpp_session_module_get_type_once ();
		g_once_init_leave (&xmpp_session_module_type_id__once, xmpp_session_module_type_id);
	}
	return xmpp_session_module_type_id__once;
}

static gchar*
xmpp_session_flag_real_get_ns (XmppXmppStreamFlag* base)
{
	XmppSessionFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppSessionFlag*) base;
	_tmp0_ = g_strdup (XMPP_SESSION_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_session_flag_real_get_id (XmppXmppStreamFlag* base)
{
	XmppSessionFlag * self;
	XmppFlagIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppSessionFlag*) base;
	_tmp0_ = xmpp_session_flag_IDENTITY;
	_tmp1_ = xmpp_flag_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppSessionFlag*
xmpp_session_flag_construct (GType object_type)
{
	XmppSessionFlag * self = NULL;
	self = (XmppSessionFlag*) xmpp_xmpp_stream_flag_construct (object_type);
	return self;
}

XmppSessionFlag*
xmpp_session_flag_new (void)
{
	return xmpp_session_flag_construct (XMPP_SESSION_TYPE_FLAG);
}

static void
xmpp_session_flag_class_init (XmppSessionFlagClass * klass,
                              gpointer klass_data)
{
	XmppFlagIdentity* _tmp0_;
	xmpp_session_flag_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamFlagClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_session_flag_real_get_ns;
	((XmppXmppStreamFlagClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_session_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_session_flag_finalize;
	_tmp0_ = xmpp_flag_identity_new (XMPP_SESSION_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_SESSION_NS_URI, "session");
	xmpp_session_flag_IDENTITY = _tmp0_;
}

static void
xmpp_session_flag_instance_init (XmppSessionFlag * self,
                                 gpointer klass)
{
	self->finished = FALSE;
}

static void
xmpp_session_flag_finalize (GObject * obj)
{
	XmppSessionFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_SESSION_TYPE_FLAG, XmppSessionFlag);
	G_OBJECT_CLASS (xmpp_session_flag_parent_class)->finalize (obj);
}

static GType
xmpp_session_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppSessionFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_session_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppSessionFlag), 0, (GInstanceInitFunc) xmpp_session_flag_instance_init, NULL };
	GType xmpp_session_flag_type_id;
	xmpp_session_flag_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_FLAG, "XmppSessionFlag", &g_define_type_info, 0);
	return xmpp_session_flag_type_id;
}

GType
xmpp_session_flag_get_type (void)
{
	static volatile gsize xmpp_session_flag_type_id__once = 0;
	if (g_once_init_enter (&xmpp_session_flag_type_id__once)) {
		GType xmpp_session_flag_type_id;
		xmpp_session_flag_type_id = xmpp_session_flag_get_type_once ();
		g_once_init_leave (&xmpp_session_flag_type_id__once, xmpp_session_flag_type_id);
	}
	return xmpp_session_flag_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;
}

