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

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

#define XMPP_STREAM_ERROR_NS_URI "jabber:client"
#define XMPP_STREAM_ERROR_NS_ERROR "urn:ietf:params:xml:ns:xmpp-streams"
#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_STREAM_ERROR_MODULE_0_PROPERTY,
	XMPP_STREAM_ERROR_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_stream_error_module_properties[XMPP_STREAM_ERROR_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))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
enum  {
	XMPP_STREAM_ERROR_FLAG_0_PROPERTY,
	XMPP_STREAM_ERROR_FLAG_NUM_PROPERTIES
};
static GParamSpec* xmpp_stream_error_flag_properties[XMPP_STREAM_ERROR_FLAG_NUM_PROPERTIES];

static gpointer xmpp_stream_error_module_parent_class = NULL;
XmppModuleIdentity* xmpp_stream_error_module_IDENTITY = NULL;
static gpointer xmpp_stream_error_flag_parent_class = NULL;
XmppFlagIdentity* xmpp_stream_error_flag_IDENTITY = NULL;

static void xmpp_stream_error_module_real_attach (XmppXmppStreamModule* base,
                                           XmppXmppStream* stream);
static void xmpp_stream_error_module_on_received_nonstanza (XmppStreamErrorModule* self,
                                                     XmppXmppStream* stream,
                                                     XmppStanzaNode* node);
static void _xmpp_stream_error_module_on_received_nonstanza_xmpp_xmpp_stream_received_nonza (XmppXmppStream* _sender,
                                                                                      XmppXmppStream* stream,
                                                                                      XmppStanzaNode* node,
                                                                                      gpointer self);
static void xmpp_stream_error_module_real_detach (XmppXmppStreamModule* base,
                                           XmppXmppStream* stream);
static gchar* xmpp_stream_error_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_stream_error_module_real_get_id (XmppXmppStreamModule* base);
static XmppStreamErrorFlag* xmpp_stream_error_module_generate_error_flag (XmppStreamErrorModule* self,
                                                                   XmppStanzaNode* node);
static void xmpp_stream_error_module_finalize (GObject * obj);
static GType xmpp_stream_error_module_get_type_once (void);
static gchar* xmpp_stream_error_flag_real_get_ns (XmppXmppStreamFlag* base);
static gchar* xmpp_stream_error_flag_real_get_id (XmppXmppStreamFlag* base);
static void xmpp_stream_error_flag_finalize (GObject * obj);
static GType xmpp_stream_error_flag_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
_xmpp_stream_error_module_on_received_nonstanza_xmpp_xmpp_stream_received_nonza (XmppXmppStream* _sender,
                                                                                 XmppXmppStream* stream,
                                                                                 XmppStanzaNode* node,
                                                                                 gpointer self)
{
	xmpp_stream_error_module_on_received_nonstanza ((XmppStreamErrorModule*) self, stream, node);
}

static void
xmpp_stream_error_module_real_attach (XmppXmppStreamModule* base,
                                      XmppXmppStream* stream)
{
	XmppStreamErrorModule * self;
	self = (XmppStreamErrorModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_connect_object (stream, "received-nonza", (GCallback) _xmpp_stream_error_module_on_received_nonstanza_xmpp_xmpp_stream_received_nonza, self, 0);
}

static void
xmpp_stream_error_module_real_detach (XmppXmppStreamModule* base,
                                      XmppXmppStream* stream)
{
	XmppStreamErrorModule * self;
	guint _tmp0_;
	self = (XmppStreamErrorModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_parse_name ("received-nonza", 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_stream_error_module_on_received_nonstanza_xmpp_xmpp_stream_received_nonza, self);
}

void
xmpp_stream_error_module_require (XmppXmppStream* stream)
{
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppStreamErrorModule* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_stream_error_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_STREAM_ERROR_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppStreamErrorModule*) _tmp1_;
	_tmp3_ = _tmp2_ == NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		XmppStreamErrorModule* _tmp4_;
		XmppStreamErrorModule* _tmp5_;
		XmppXmppStream* _tmp6_;
		XmppXmppStream* _tmp7_;
		_tmp4_ = xmpp_stream_error_module_new ();
		_tmp5_ = _tmp4_;
		_tmp6_ = xmpp_xmpp_stream_add_module (stream, (XmppXmppStreamModule*) _tmp5_);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp7_);
		_g_object_unref0 (_tmp5_);
	}
}

static gchar*
xmpp_stream_error_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppStreamErrorModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppStreamErrorModule*) base;
	_tmp0_ = g_strdup (XMPP_STREAM_ERROR_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_stream_error_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppStreamErrorModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppStreamErrorModule*) base;
	_tmp0_ = xmpp_stream_error_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_stream_error_module_on_received_nonstanza (XmppStreamErrorModule* self,
                                                XmppXmppStream* stream,
                                                XmppStanzaNode* node)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (node != NULL);
	_tmp1_ = ((XmppStanzaEntry*) node)->name;
	if (g_strcmp0 (_tmp1_, "error") == 0) {
		const gchar* _tmp2_;
		_tmp2_ = ((XmppStanzaEntry*) node)->ns_uri;
		_tmp0_ = g_strcmp0 (_tmp2_, "http://etherx.jabber.org/streams") == 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		XmppStreamErrorFlag* _tmp3_;
		XmppStreamErrorFlag* _tmp4_;
		_tmp3_ = xmpp_stream_error_module_generate_error_flag (self, node);
		_tmp4_ = _tmp3_;
		xmpp_xmpp_stream_add_flag (stream, (XmppXmppStreamFlag*) _tmp4_);
		_g_object_unref0 (_tmp4_);
	}
}

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

static XmppStreamErrorFlag*
xmpp_stream_error_module_generate_error_flag (XmppStreamErrorModule* self,
                                              XmppStanzaNode* node)
{
	gchar* subnode_name = NULL;
	GeeList* subnodes = NULL;
	GeeList* _tmp0_;
	GeeList* _tmp1_;
	XmppStreamErrorFlag* flag = NULL;
	XmppStreamErrorFlag* _tmp18_;
	XmppStreamErrorFlag* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GQuark _tmp25_ = 0U;
	static GQuark _tmp24_label0 = 0;
	static GQuark _tmp24_label1 = 0;
	static GQuark _tmp24_label2 = 0;
	static GQuark _tmp24_label3 = 0;
	static GQuark _tmp24_label4 = 0;
	static GQuark _tmp24_label5 = 0;
	static GQuark _tmp24_label6 = 0;
	static GQuark _tmp24_label7 = 0;
	static GQuark _tmp24_label8 = 0;
	static GQuark _tmp24_label9 = 0;
	static GQuark _tmp24_label10 = 0;
	static GQuark _tmp24_label11 = 0;
	static GQuark _tmp24_label12 = 0;
	static GQuark _tmp24_label13 = 0;
	static GQuark _tmp24_label14 = 0;
	static GQuark _tmp24_label15 = 0;
	static GQuark _tmp24_label16 = 0;
	static GQuark _tmp24_label17 = 0;
	static GQuark _tmp24_label18 = 0;
	static GQuark _tmp24_label19 = 0;
	static GQuark _tmp24_label20 = 0;
	static GQuark _tmp24_label21 = 0;
	static GQuark _tmp24_label22 = 0;
	static GQuark _tmp24_label23 = 0;
	static GQuark _tmp24_label24 = 0;
	const gchar* _tmp33_;
	XmppStreamErrorFlag* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	subnode_name = NULL;
	_tmp0_ = node->sub_nodes;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	subnodes = _tmp1_;
	{
		GeeList* _subnode_list = NULL;
		GeeList* _tmp2_;
		gint _subnode_size = 0;
		GeeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _subnode_index = 0;
		_tmp2_ = subnodes;
		_subnode_list = _tmp2_;
		_tmp3_ = _subnode_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_subnode_size = _tmp5_;
		_subnode_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			XmppStanzaNode* subnode = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			gboolean _tmp10_ = FALSE;
			XmppStanzaNode* _tmp11_;
			const gchar* _tmp12_;
			_subnode_index = _subnode_index + 1;
			_tmp6_ = _subnode_index;
			_tmp7_ = _subnode_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _subnode_list;
			_tmp9_ = gee_list_get (_tmp8_, _subnode_index);
			subnode = (XmppStanzaNode*) _tmp9_;
			_tmp11_ = subnode;
			_tmp12_ = ((XmppStanzaEntry*) _tmp11_)->ns_uri;
			if (g_strcmp0 (_tmp12_, "urn:ietf:params:xml:ns:xmpp-streams") == 0) {
				XmppStanzaNode* _tmp13_;
				const gchar* _tmp14_;
				_tmp13_ = subnode;
				_tmp14_ = ((XmppStanzaEntry*) _tmp13_)->name;
				_tmp10_ = g_strcmp0 (_tmp14_, "text") != 0;
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				XmppStanzaNode* _tmp15_;
				const gchar* _tmp16_;
				gchar* _tmp17_;
				_tmp15_ = subnode;
				_tmp16_ = ((XmppStanzaEntry*) _tmp15_)->name;
				_tmp17_ = g_strdup (_tmp16_);
				_g_free0 (subnode_name);
				subnode_name = _tmp17_;
			}
			_xmpp_stanza_entry_unref0 (subnode);
		}
	}
	_tmp18_ = xmpp_stream_error_flag_new ();
	flag = _tmp18_;
	_tmp19_ = flag;
	_tmp20_ = subnode_name;
	_tmp21_ = g_strdup (_tmp20_);
	_g_free0 (_tmp19_->error_type);
	_tmp19_->error_type = _tmp21_;
	_tmp22_ = subnode_name;
	_tmp23_ = _tmp22_;
	_tmp25_ = (NULL == _tmp23_) ? 0 : g_quark_from_string (_tmp23_);
	if ((((_tmp25_ == ((0 != _tmp24_label0) ? _tmp24_label0 : (_tmp24_label0 = g_quark_from_static_string ("bad-format")))) || (_tmp25_ == ((0 != _tmp24_label1) ? _tmp24_label1 : (_tmp24_label1 = g_quark_from_static_string ("conflict"))))) || (_tmp25_ == ((0 != _tmp24_label2) ? _tmp24_label2 : (_tmp24_label2 = g_quark_from_static_string ("connection-timeout"))))) || (_tmp25_ == ((0 != _tmp24_label3) ? _tmp24_label3 : (_tmp24_label3 = g_quark_from_static_string ("bad-namespace-prefix"))))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp26_;
				_tmp26_ = flag;
				_tmp26_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_NOW;
				break;
			}
		}
	} else if ((_tmp25_ == ((0 != _tmp24_label4) ? _tmp24_label4 : (_tmp24_label4 = g_quark_from_static_string ("host-gone")))) || (_tmp25_ == ((0 != _tmp24_label5) ? _tmp24_label5 : (_tmp24_label5 = g_quark_from_static_string ("host-unknown"))))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp27_;
				_tmp27_ = flag;
				_tmp27_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_LATER;
				break;
			}
		}
	} else if ((((((((((_tmp25_ == ((0 != _tmp24_label6) ? _tmp24_label6 : (_tmp24_label6 = g_quark_from_static_string ("improper-addressing")))) || (_tmp25_ == ((0 != _tmp24_label7) ? _tmp24_label7 : (_tmp24_label7 = g_quark_from_static_string ("internal-server-error"))))) || (_tmp25_ == ((0 != _tmp24_label8) ? _tmp24_label8 : (_tmp24_label8 = g_quark_from_static_string ("invalid-from"))))) || (_tmp25_ == ((0 != _tmp24_label9) ? _tmp24_label9 : (_tmp24_label9 = g_quark_from_static_string ("invalid-namespace"))))) || (_tmp25_ == ((0 != _tmp24_label10) ? _tmp24_label10 : (_tmp24_label10 = g_quark_from_static_string ("invalid-xml"))))) || (_tmp25_ == ((0 != _tmp24_label11) ? _tmp24_label11 : (_tmp24_label11 = g_quark_from_static_string ("not-authorized"))))) || (_tmp25_ == ((0 != _tmp24_label12) ? _tmp24_label12 : (_tmp24_label12 = g_quark_from_static_string ("not-well-formed"))))) || (_tmp25_ == ((0 != _tmp24_label13) ? _tmp24_label13 : (_tmp24_label13 = g_quark_from_static_string ("policy-violation"))))) || (_tmp25_ == ((0 != _tmp24_label14) ? _tmp24_label14 : (_tmp24_label14 = g_quark_from_static_string ("remote-connection-failed"))))) || (_tmp25_ == ((0 != _tmp24_label15) ? _tmp24_label15 : (_tmp24_label15 = g_quark_from_static_string ("reset"))))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp28_;
				_tmp28_ = flag;
				_tmp28_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_NOW;
				break;
			}
		}
	} else if (_tmp25_ == ((0 != _tmp24_label16) ? _tmp24_label16 : (_tmp24_label16 = g_quark_from_static_string ("resource-constraint")))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp29_;
				_tmp29_ = flag;
				_tmp29_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_LATER;
				break;
			}
		}
	} else if (_tmp25_ == ((0 != _tmp24_label17) ? _tmp24_label17 : (_tmp24_label17 = g_quark_from_static_string ("restricted-xml")))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp30_;
				_tmp30_ = flag;
				_tmp30_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_NOW;
				break;
			}
		}
	} else if ((_tmp25_ == ((0 != _tmp24_label18) ? _tmp24_label18 : (_tmp24_label18 = g_quark_from_static_string ("see-other-host")))) || (_tmp25_ == ((0 != _tmp24_label19) ? _tmp24_label19 : (_tmp24_label19 = g_quark_from_static_string ("system-shutdown"))))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp31_;
				_tmp31_ = flag;
				_tmp31_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_LATER;
				break;
			}
		}
	} else if (((((_tmp25_ == ((0 != _tmp24_label20) ? _tmp24_label20 : (_tmp24_label20 = g_quark_from_static_string ("undefined-condition")))) || (_tmp25_ == ((0 != _tmp24_label21) ? _tmp24_label21 : (_tmp24_label21 = g_quark_from_static_string ("unsupported-encoding"))))) || (_tmp25_ == ((0 != _tmp24_label22) ? _tmp24_label22 : (_tmp24_label22 = g_quark_from_static_string ("unsupported-feature"))))) || (_tmp25_ == ((0 != _tmp24_label23) ? _tmp24_label23 : (_tmp24_label23 = g_quark_from_static_string ("unsupported-stanza-type"))))) || (_tmp25_ == ((0 != _tmp24_label24) ? _tmp24_label24 : (_tmp24_label24 = g_quark_from_static_string ("unsupported-version"))))) {
		switch (0) {
			default:
			{
				XmppStreamErrorFlag* _tmp32_;
				_tmp32_ = flag;
				_tmp32_->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_NOW;
				break;
			}
		}
	}
	_tmp33_ = subnode_name;
	if (g_strcmp0 (_tmp33_, "conflict") == 0) {
		XmppStreamErrorFlag* _tmp34_;
		_tmp34_ = flag;
		_tmp34_->resource_rejected = TRUE;
	}
	result = flag;
	_g_object_unref0 (subnodes);
	_g_free0 (subnode_name);
	return result;
}

XmppStreamErrorModule*
xmpp_stream_error_module_construct (GType object_type)
{
	XmppStreamErrorModule * self = NULL;
	self = (XmppStreamErrorModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppStreamErrorModule*
xmpp_stream_error_module_new (void)
{
	return xmpp_stream_error_module_construct (XMPP_STREAM_ERROR_TYPE_MODULE);
}

static void
xmpp_stream_error_module_class_init (XmppStreamErrorModuleClass * klass,
                                     gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_stream_error_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_stream_error_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_stream_error_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_stream_error_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_stream_error_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_stream_error_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_STREAM_ERROR_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_STREAM_ERROR_NS_URI, "stream_error_module");
	xmpp_stream_error_module_IDENTITY = _tmp0_;
}

static void
xmpp_stream_error_module_instance_init (XmppStreamErrorModule * self,
                                        gpointer klass)
{
}

static void
xmpp_stream_error_module_finalize (GObject * obj)
{
	XmppStreamErrorModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_STREAM_ERROR_TYPE_MODULE, XmppStreamErrorModule);
	G_OBJECT_CLASS (xmpp_stream_error_module_parent_class)->finalize (obj);
}

static GType
xmpp_stream_error_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppStreamErrorModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_stream_error_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppStreamErrorModule), 0, (GInstanceInitFunc) xmpp_stream_error_module_instance_init, NULL };
	GType xmpp_stream_error_module_type_id;
	xmpp_stream_error_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppStreamErrorModule", &g_define_type_info, 0);
	return xmpp_stream_error_module_type_id;
}

GType
xmpp_stream_error_module_get_type (void)
{
	static volatile gsize xmpp_stream_error_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_stream_error_module_type_id__once)) {
		GType xmpp_stream_error_module_type_id;
		xmpp_stream_error_module_type_id = xmpp_stream_error_module_get_type_once ();
		g_once_init_leave (&xmpp_stream_error_module_type_id__once, xmpp_stream_error_module_type_id);
	}
	return xmpp_stream_error_module_type_id__once;
}

static GType
xmpp_stream_error_flag_reconnect_get_type_once (void)
{
	static const GEnumValue values[] = {{XMPP_STREAM_ERROR_FLAG_RECONNECT_UNKNOWN, "XMPP_STREAM_ERROR_FLAG_RECONNECT_UNKNOWN", "unknown"}, {XMPP_STREAM_ERROR_FLAG_RECONNECT_NOW, "XMPP_STREAM_ERROR_FLAG_RECONNECT_NOW", "now"}, {XMPP_STREAM_ERROR_FLAG_RECONNECT_LATER, "XMPP_STREAM_ERROR_FLAG_RECONNECT_LATER", "later"}, {XMPP_STREAM_ERROR_FLAG_RECONNECT_NEVER, "XMPP_STREAM_ERROR_FLAG_RECONNECT_NEVER", "never"}, {0, NULL, NULL}};
	GType xmpp_stream_error_flag_reconnect_type_id;
	xmpp_stream_error_flag_reconnect_type_id = g_enum_register_static ("XmppStreamErrorFlagReconnect", values);
	return xmpp_stream_error_flag_reconnect_type_id;
}

GType
xmpp_stream_error_flag_reconnect_get_type (void)
{
	static volatile gsize xmpp_stream_error_flag_reconnect_type_id__once = 0;
	if (g_once_init_enter (&xmpp_stream_error_flag_reconnect_type_id__once)) {
		GType xmpp_stream_error_flag_reconnect_type_id;
		xmpp_stream_error_flag_reconnect_type_id = xmpp_stream_error_flag_reconnect_get_type_once ();
		g_once_init_leave (&xmpp_stream_error_flag_reconnect_type_id__once, xmpp_stream_error_flag_reconnect_type_id);
	}
	return xmpp_stream_error_flag_reconnect_type_id__once;
}

static gchar*
xmpp_stream_error_flag_real_get_ns (XmppXmppStreamFlag* base)
{
	XmppStreamErrorFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppStreamErrorFlag*) base;
	_tmp0_ = g_strdup (XMPP_STREAM_ERROR_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_stream_error_flag_real_get_id (XmppXmppStreamFlag* base)
{
	XmppStreamErrorFlag * self;
	XmppFlagIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppStreamErrorFlag*) base;
	_tmp0_ = xmpp_stream_error_flag_IDENTITY;
	_tmp1_ = xmpp_flag_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppStreamErrorFlag*
xmpp_stream_error_flag_construct (GType object_type)
{
	XmppStreamErrorFlag * self = NULL;
	self = (XmppStreamErrorFlag*) xmpp_xmpp_stream_flag_construct (object_type);
	return self;
}

XmppStreamErrorFlag*
xmpp_stream_error_flag_new (void)
{
	return xmpp_stream_error_flag_construct (XMPP_STREAM_ERROR_TYPE_FLAG);
}

static void
xmpp_stream_error_flag_class_init (XmppStreamErrorFlagClass * klass,
                                   gpointer klass_data)
{
	XmppFlagIdentity* _tmp0_;
	xmpp_stream_error_flag_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamFlagClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_stream_error_flag_real_get_ns;
	((XmppXmppStreamFlagClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_stream_error_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_stream_error_flag_finalize;
	_tmp0_ = xmpp_flag_identity_new (XMPP_STREAM_ERROR_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_STREAM_ERROR_NS_URI, "stream_error");
	xmpp_stream_error_flag_IDENTITY = _tmp0_;
}

static void
xmpp_stream_error_flag_instance_init (XmppStreamErrorFlag * self,
                                      gpointer klass)
{
	self->reconnection_recomendation = XMPP_STREAM_ERROR_FLAG_RECONNECT_UNKNOWN;
	self->resource_rejected = FALSE;
}

static void
xmpp_stream_error_flag_finalize (GObject * obj)
{
	XmppStreamErrorFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_STREAM_ERROR_TYPE_FLAG, XmppStreamErrorFlag);
	_g_free0 (self->error_type);
	G_OBJECT_CLASS (xmpp_stream_error_flag_parent_class)->finalize (obj);
}

static GType
xmpp_stream_error_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppStreamErrorFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_stream_error_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppStreamErrorFlag), 0, (GInstanceInitFunc) xmpp_stream_error_flag_instance_init, NULL };
	GType xmpp_stream_error_flag_type_id;
	xmpp_stream_error_flag_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_FLAG, "XmppStreamErrorFlag", &g_define_type_info, 0);
	return xmpp_stream_error_flag_type_id;
}

GType
xmpp_stream_error_flag_get_type (void)
{
	static volatile gsize xmpp_stream_error_flag_type_id__once = 0;
	if (g_once_init_enter (&xmpp_stream_error_flag_type_id__once)) {
		GType xmpp_stream_error_flag_type_id;
		xmpp_stream_error_flag_type_id = xmpp_stream_error_flag_get_type_once ();
		g_once_init_leave (&xmpp_stream_error_flag_type_id__once, xmpp_stream_error_flag_type_id);
	}
	return xmpp_stream_error_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;
}

