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

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_0_PROPERTY,
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jingle_message_initiation_module_properties[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_NUM_PROPERTIES];
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_PROPOSED_SIGNAL,
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_RETRACTED_SIGNAL,
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_ACCEPTED_SIGNAL,
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_REJECTED_SIGNAL,
	XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_NUM_SIGNALS
};
static guint xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_NUM_SIGNALS] = {0};

static gpointer xmpp_xep_jingle_message_initiation_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_jingle_message_initiation_module_IDENTITY = NULL;

static void xmpp_xep_jingle_message_initiation_module_send_jmi_message (XmppXepJingleMessageInitiationModule* self,
                                                                 XmppXmppStream* stream,
                                                                 const gchar* name,
                                                                 XmppJid* to,
                                                                 const gchar* sid);
static void xmpp_xep_jingle_message_initiation_module_on_received_message (XmppXepJingleMessageInitiationModule* self,
                                                                    XmppXmppStream* stream,
                                                                    XmppMessageStanza* message);
static void xmpp_xep_jingle_message_initiation_module_real_attach (XmppXmppStreamModule* base,
                                                            XmppXmppStream* stream);
static void _xmpp_xep_jingle_message_initiation_module_on_received_message_xmpp_message_module_received_message (XmppMessageModule* _sender,
                                                                                                          XmppXmppStream* stream,
                                                                                                          XmppMessageStanza* message,
                                                                                                          gpointer self);
static void xmpp_xep_jingle_message_initiation_module_real_detach (XmppXmppStreamModule* base,
                                                            XmppXmppStream* stream);
static gchar* xmpp_xep_jingle_message_initiation_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_jingle_message_initiation_module_real_get_id (XmppXmppStreamModule* base);
static void g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_OBJECT (GClosure * closure,
                                                                    GValue * return_value,
                                                                    guint n_param_values,
                                                                    const GValue * param_values,
                                                                    gpointer invocation_hint,
                                                                    gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING (GClosure * closure,
                                                             GValue * return_value,
                                                             guint n_param_values,
                                                             const GValue * param_values,
                                                             gpointer invocation_hint,
                                                             gpointer marshal_data);
static void xmpp_xep_jingle_message_initiation_module_finalize (GObject * obj);
static GType xmpp_xep_jingle_message_initiation_module_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

void
xmpp_xep_jingle_message_initiation_module_send_session_propose_to_peer (XmppXepJingleMessageInitiationModule* self,
                                                                        XmppXmppStream* stream,
                                                                        XmppJid* to,
                                                                        const gchar* sid,
                                                                        GeeList* descriptions)
{
	XmppStanzaNode* propose_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppMessageStanza* propose_message = NULL;
	XmppJid* _tmp17_;
	gchar* _tmp18_;
	XmppMessageStanza* _tmp19_ = NULL;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppStanzaNode* _tmp23_;
	XmppModuleIdentity* _tmp24_;
	gpointer _tmp25_;
	XmppMessageModule* _tmp26_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (sid != NULL);
	g_return_if_fail (descriptions != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("propose", XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_put_attribute (_tmp3_, "id", sid, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI);
	_tmp5_ = _tmp4_;
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	propose_node = _tmp5_;
	{
		GeeList* _desc_node_list = NULL;
		gint _desc_node_size = 0;
		GeeList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _desc_node_index = 0;
		_desc_node_list = descriptions;
		_tmp6_ = _desc_node_list;
		_tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_desc_node_size = _tmp8_;
		_desc_node_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			XmppStanzaNode* desc_node = NULL;
			GeeList* _tmp11_;
			gpointer _tmp12_;
			XmppStanzaNode* _tmp13_;
			XmppStanzaNode* _tmp14_;
			XmppStanzaNode* _tmp15_;
			XmppStanzaNode* _tmp16_;
			_desc_node_index = _desc_node_index + 1;
			_tmp9_ = _desc_node_index;
			_tmp10_ = _desc_node_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _desc_node_list;
			_tmp12_ = gee_list_get (_tmp11_, _desc_node_index);
			desc_node = (XmppStanzaNode*) _tmp12_;
			_tmp13_ = propose_node;
			_tmp14_ = desc_node;
			_tmp15_ = xmpp_stanza_node_put_node (_tmp13_, _tmp14_);
			_tmp16_ = _tmp15_;
			_xmpp_stanza_entry_unref0 (_tmp16_);
			_xmpp_stanza_entry_unref0 (desc_node);
		}
	}
	_tmp17_ = _xmpp_jid_ref0 (to);
	_tmp18_ = g_strdup (XMPP_MESSAGE_STANZA_TYPE_CHAT);
	_tmp19_ = xmpp_message_stanza_new (NULL);
	xmpp_stanza_set_to ((XmppStanza*) _tmp19_, _tmp17_);
	_xmpp_jid_unref0 (_tmp17_);
	xmpp_stanza_set_type_ ((XmppStanza*) _tmp19_, _tmp18_);
	_g_free0 (_tmp18_);
	propose_message = _tmp19_;
	_tmp20_ = ((XmppStanza*) propose_message)->stanza;
	_tmp21_ = propose_node;
	_tmp22_ = xmpp_stanza_node_put_node (_tmp20_, _tmp21_);
	_tmp23_ = _tmp22_;
	_xmpp_stanza_entry_unref0 (_tmp23_);
	_tmp24_ = xmpp_message_module_IDENTITY;
	_tmp25_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp24_);
	_tmp26_ = (XmppMessageModule*) _tmp25_;
	xmpp_message_module_send_message (_tmp26_, stream, propose_message, NULL, NULL);
	_g_object_unref0 (_tmp26_);
	_g_object_unref0 (propose_message);
	_xmpp_stanza_entry_unref0 (propose_node);
}

void
xmpp_xep_jingle_message_initiation_module_send_session_retract_to_peer (XmppXepJingleMessageInitiationModule* self,
                                                                        XmppXmppStream* stream,
                                                                        XmppJid* to,
                                                                        const gchar* sid)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (sid != NULL);
	xmpp_xep_jingle_message_initiation_module_send_jmi_message (self, stream, "retract", to, sid);
}

void
xmpp_xep_jingle_message_initiation_module_send_session_accept_to_self (XmppXepJingleMessageInitiationModule* self,
                                                                       XmppXmppStream* stream,
                                                                       const gchar* sid)
{
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	XmppJid* _tmp2_;
	XmppJid* _tmp3_;
	XmppJid* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (sid != NULL);
	_tmp0_ = xmpp_bind_flag_get_my_jid (stream);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_jid_get_bare_jid (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	xmpp_xep_jingle_message_initiation_module_send_jmi_message (self, stream, "accept", _tmp4_, sid);
	_xmpp_jid_unref0 (_tmp4_);
	_xmpp_jid_unref0 (_tmp1_);
}

void
xmpp_xep_jingle_message_initiation_module_send_session_reject_to_self (XmppXepJingleMessageInitiationModule* self,
                                                                       XmppXmppStream* stream,
                                                                       const gchar* sid)
{
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	XmppJid* _tmp2_;
	XmppJid* _tmp3_;
	XmppJid* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (sid != NULL);
	_tmp0_ = xmpp_bind_flag_get_my_jid (stream);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_jid_get_bare_jid (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	xmpp_xep_jingle_message_initiation_module_send_jmi_message (self, stream, "reject", _tmp4_, sid);
	_xmpp_jid_unref0 (_tmp4_);
	_xmpp_jid_unref0 (_tmp1_);
}

void
xmpp_xep_jingle_message_initiation_module_send_session_proceed_to_peer (XmppXepJingleMessageInitiationModule* self,
                                                                        XmppXmppStream* stream,
                                                                        XmppJid* to,
                                                                        const gchar* sid)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (sid != NULL);
	xmpp_xep_jingle_message_initiation_module_send_jmi_message (self, stream, "proceed", to, sid);
}

void
xmpp_xep_jingle_message_initiation_module_send_session_reject_to_peer (XmppXepJingleMessageInitiationModule* self,
                                                                       XmppXmppStream* stream,
                                                                       XmppJid* to,
                                                                       const gchar* sid)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (sid != NULL);
	xmpp_xep_jingle_message_initiation_module_send_jmi_message (self, stream, "reject", to, sid);
}

static void
xmpp_xep_jingle_message_initiation_module_send_jmi_message (XmppXepJingleMessageInitiationModule* self,
                                                            XmppXmppStream* stream,
                                                            const gchar* name,
                                                            XmppJid* to,
                                                            const gchar* sid)
{
	XmppMessageStanza* accepted_message = NULL;
	XmppJid* _tmp0_;
	gchar* _tmp1_;
	XmppMessageStanza* _tmp2_ = NULL;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppModuleIdentity* _tmp12_;
	gpointer _tmp13_;
	XmppMessageModule* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (sid != NULL);
	_tmp0_ = _xmpp_jid_ref0 (to);
	_tmp1_ = g_strdup (XMPP_MESSAGE_STANZA_TYPE_CHAT);
	_tmp2_ = xmpp_message_stanza_new (NULL);
	xmpp_stanza_set_to ((XmppStanza*) _tmp2_, _tmp0_);
	_xmpp_jid_unref0 (_tmp0_);
	xmpp_stanza_set_type_ ((XmppStanza*) _tmp2_, _tmp1_);
	_g_free0 (_tmp1_);
	accepted_message = _tmp2_;
	_tmp3_ = ((XmppStanza*) accepted_message)->stanza;
	_tmp4_ = xmpp_stanza_node_new_build (name, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI, NULL, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_add_self_xmlns (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_put_attribute (_tmp7_, "id", sid, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI);
	_tmp9_ = _tmp8_;
	_tmp10_ = xmpp_stanza_node_put_node (_tmp3_, _tmp9_);
	_tmp11_ = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp11_);
	_xmpp_stanza_entry_unref0 (_tmp9_);
	_xmpp_stanza_entry_unref0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp5_);
	_tmp12_ = xmpp_message_module_IDENTITY;
	_tmp13_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp12_);
	_tmp14_ = (XmppMessageModule*) _tmp13_;
	xmpp_message_module_send_message (_tmp14_, stream, accepted_message, NULL, NULL);
	_g_object_unref0 (_tmp14_);
	_g_object_unref0 (accepted_message);
}

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

static void
xmpp_xep_jingle_message_initiation_module_on_received_message (XmppXepJingleMessageInitiationModule* self,
                                                               XmppXmppStream* stream,
                                                               XmppMessageStanza* message)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	XmppMessageArchiveManagementMessageFlag* mam_flag = NULL;
	XmppMessageArchiveManagementMessageFlag* _tmp2_;
	XmppMessageArchiveManagementMessageFlag* _tmp3_;
	XmppStanzaNode* mi_node = NULL;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	GQuark _tmp22_ = 0U;
	static GQuark _tmp21_label0 = 0;
	static GQuark _tmp21_label1 = 0;
	static GQuark _tmp21_label2 = 0;
	static GQuark _tmp21_label3 = 0;
	static GQuark _tmp21_label4 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = xmpp_stanza_get_type_ ((XmppStanza*) message);
	_tmp1_ = _tmp0_;
	if (g_strcmp0 (_tmp1_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		return;
	}
	_tmp2_ = xmpp_message_archive_management_message_flag_get_flag (message);
	mam_flag = _tmp2_;
	_tmp3_ = mam_flag;
	if (_tmp3_ != NULL) {
		_g_object_unref0 (mam_flag);
		return;
	}
	mi_node = NULL;
	{
		GeeList* _node_list = NULL;
		XmppStanzaNode* _tmp4_;
		GeeList* _tmp5_;
		gint _node_size = 0;
		GeeList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _node_index = 0;
		_tmp4_ = ((XmppStanza*) message)->stanza;
		_tmp5_ = _tmp4_->sub_nodes;
		_node_list = _tmp5_;
		_tmp6_ = _node_list;
		_tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_node_size = _tmp8_;
		_node_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			XmppStanzaNode* node = NULL;
			GeeList* _tmp11_;
			gpointer _tmp12_;
			XmppStanzaNode* _tmp13_;
			const gchar* _tmp14_;
			_node_index = _node_index + 1;
			_tmp9_ = _node_index;
			_tmp10_ = _node_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _node_list;
			_tmp12_ = gee_list_get (_tmp11_, _node_index);
			node = (XmppStanzaNode*) _tmp12_;
			_tmp13_ = node;
			_tmp14_ = ((XmppStanzaEntry*) _tmp13_)->ns_uri;
			if (g_strcmp0 (_tmp14_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI) == 0) {
				XmppStanzaNode* _tmp15_;
				XmppStanzaNode* _tmp16_;
				_tmp15_ = node;
				_tmp16_ = _xmpp_stanza_entry_ref0 (_tmp15_);
				_xmpp_stanza_entry_unref0 (mi_node);
				mi_node = _tmp16_;
			}
			_xmpp_stanza_entry_unref0 (node);
		}
	}
	_tmp17_ = mi_node;
	if (_tmp17_ == NULL) {
		_xmpp_stanza_entry_unref0 (mi_node);
		_g_object_unref0 (mam_flag);
		return;
	}
	_tmp18_ = mi_node;
	_tmp19_ = ((XmppStanzaEntry*) _tmp18_)->name;
	_tmp20_ = _tmp19_;
	_tmp22_ = (NULL == _tmp20_) ? 0 : g_quark_from_string (_tmp20_);
	if ((_tmp22_ == ((0 != _tmp21_label0) ? _tmp21_label0 : (_tmp21_label0 = g_quark_from_static_string ("accept")))) || (_tmp22_ == ((0 != _tmp21_label1) ? _tmp21_label1 : (_tmp21_label1 = g_quark_from_static_string ("proceed"))))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp23_;
				XmppJid* _tmp24_;
				XmppJid* _tmp25_;
				XmppJid* _tmp26_;
				XmppJid* _tmp27_;
				XmppJid* _tmp28_;
				XmppStanzaNode* _tmp29_;
				const gchar* _tmp30_;
				_tmp23_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp24_ = _tmp23_;
				_tmp25_ = _tmp24_;
				_tmp26_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp27_ = _tmp26_;
				_tmp28_ = _tmp27_;
				_tmp29_ = mi_node;
				_tmp30_ = xmpp_stanza_node_get_attribute (_tmp29_, "id", NULL);
				g_signal_emit (self, xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_ACCEPTED_SIGNAL], 0, _tmp25_, _tmp28_, _tmp30_);
				_xmpp_jid_unref0 (_tmp28_);
				_xmpp_jid_unref0 (_tmp25_);
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label2) ? _tmp21_label2 : (_tmp21_label2 = g_quark_from_static_string ("propose")))) {
		switch (0) {
			default:
			{
				GeeArrayList* descriptions = NULL;
				GeeArrayList* _tmp31_;
				GeeArrayList* _tmp45_;
				gint _tmp46_;
				gint _tmp47_;
				_tmp31_ = gee_array_list_new (XMPP_TYPE_STANZA_NODE, (GBoxedCopyFunc) xmpp_stanza_entry_ref, (GDestroyNotify) xmpp_stanza_entry_unref, NULL, NULL, NULL);
				descriptions = _tmp31_;
				{
					GeeList* _node_list = NULL;
					XmppStanzaNode* _tmp32_;
					GeeList* _tmp33_;
					gint _node_size = 0;
					GeeList* _tmp34_;
					gint _tmp35_;
					gint _tmp36_;
					gint _node_index = 0;
					_tmp32_ = mi_node;
					_tmp33_ = _tmp32_->sub_nodes;
					_node_list = _tmp33_;
					_tmp34_ = _node_list;
					_tmp35_ = gee_collection_get_size ((GeeCollection*) _tmp34_);
					_tmp36_ = _tmp35_;
					_node_size = _tmp36_;
					_node_index = -1;
					while (TRUE) {
						gint _tmp37_;
						gint _tmp38_;
						XmppStanzaNode* node = NULL;
						GeeList* _tmp39_;
						gpointer _tmp40_;
						XmppStanzaNode* _tmp41_;
						const gchar* _tmp42_;
						GeeArrayList* _tmp43_;
						XmppStanzaNode* _tmp44_;
						_node_index = _node_index + 1;
						_tmp37_ = _node_index;
						_tmp38_ = _node_size;
						if (!(_tmp37_ < _tmp38_)) {
							break;
						}
						_tmp39_ = _node_list;
						_tmp40_ = gee_list_get (_tmp39_, _node_index);
						node = (XmppStanzaNode*) _tmp40_;
						_tmp41_ = node;
						_tmp42_ = ((XmppStanzaEntry*) _tmp41_)->name;
						if (g_strcmp0 (_tmp42_, "description") != 0) {
							_xmpp_stanza_entry_unref0 (node);
							continue;
						}
						_tmp43_ = descriptions;
						_tmp44_ = node;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp43_, _tmp44_);
						_xmpp_stanza_entry_unref0 (node);
					}
				}
				_tmp45_ = descriptions;
				_tmp46_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp45_);
				_tmp47_ = _tmp46_;
				if (_tmp47_ > 0) {
					XmppJid* _tmp48_;
					XmppJid* _tmp49_;
					XmppJid* _tmp50_;
					XmppJid* _tmp51_;
					XmppJid* _tmp52_;
					XmppJid* _tmp53_;
					XmppStanzaNode* _tmp54_;
					const gchar* _tmp55_;
					GeeArrayList* _tmp56_;
					_tmp48_ = xmpp_stanza_get_from ((XmppStanza*) message);
					_tmp49_ = _tmp48_;
					_tmp50_ = _tmp49_;
					_tmp51_ = xmpp_stanza_get_to ((XmppStanza*) message);
					_tmp52_ = _tmp51_;
					_tmp53_ = _tmp52_;
					_tmp54_ = mi_node;
					_tmp55_ = xmpp_stanza_node_get_attribute (_tmp54_, "id", NULL);
					_tmp56_ = descriptions;
					g_signal_emit (self, xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_PROPOSED_SIGNAL], 0, _tmp50_, _tmp53_, _tmp55_, (GeeList*) _tmp56_);
					_xmpp_jid_unref0 (_tmp53_);
					_xmpp_jid_unref0 (_tmp50_);
				}
				_g_object_unref0 (descriptions);
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label3) ? _tmp21_label3 : (_tmp21_label3 = g_quark_from_static_string ("retract")))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp57_;
				XmppJid* _tmp58_;
				XmppJid* _tmp59_;
				XmppJid* _tmp60_;
				XmppJid* _tmp61_;
				XmppJid* _tmp62_;
				XmppStanzaNode* _tmp63_;
				const gchar* _tmp64_;
				_tmp57_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp58_ = _tmp57_;
				_tmp59_ = _tmp58_;
				_tmp60_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp61_ = _tmp60_;
				_tmp62_ = _tmp61_;
				_tmp63_ = mi_node;
				_tmp64_ = xmpp_stanza_node_get_attribute (_tmp63_, "id", NULL);
				g_signal_emit (self, xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_RETRACTED_SIGNAL], 0, _tmp59_, _tmp62_, _tmp64_);
				_xmpp_jid_unref0 (_tmp62_);
				_xmpp_jid_unref0 (_tmp59_);
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label4) ? _tmp21_label4 : (_tmp21_label4 = g_quark_from_static_string ("reject")))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp65_;
				XmppJid* _tmp66_;
				XmppJid* _tmp67_;
				XmppJid* _tmp68_;
				XmppJid* _tmp69_;
				XmppJid* _tmp70_;
				XmppStanzaNode* _tmp71_;
				const gchar* _tmp72_;
				_tmp65_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp66_ = _tmp65_;
				_tmp67_ = _tmp66_;
				_tmp68_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp69_ = _tmp68_;
				_tmp70_ = _tmp69_;
				_tmp71_ = mi_node;
				_tmp72_ = xmpp_stanza_node_get_attribute (_tmp71_, "id", NULL);
				g_signal_emit (self, xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_REJECTED_SIGNAL], 0, _tmp67_, _tmp70_, _tmp72_);
				_xmpp_jid_unref0 (_tmp70_);
				_xmpp_jid_unref0 (_tmp67_);
				break;
			}
		}
	}
	_xmpp_stanza_entry_unref0 (mi_node);
	_g_object_unref0 (mam_flag);
}

static void
_xmpp_xep_jingle_message_initiation_module_on_received_message_xmpp_message_module_received_message (XmppMessageModule* _sender,
                                                                                                     XmppXmppStream* stream,
                                                                                                     XmppMessageStanza* message,
                                                                                                     gpointer self)
{
	xmpp_xep_jingle_message_initiation_module_on_received_message ((XmppXepJingleMessageInitiationModule*) self, stream, message);
}

static void
xmpp_xep_jingle_message_initiation_module_real_attach (XmppXmppStreamModule* base,
                                                       XmppXmppStream* stream)
{
	XmppXepJingleMessageInitiationModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppMessageModule* _tmp5_;
	self = (XmppXepJingleMessageInitiationModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepServiceDiscoveryModule*) _tmp1_;
	xmpp_xep_service_discovery_module_add_feature (_tmp2_, stream, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_message_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppMessageModule*) _tmp4_;
	g_signal_connect_object (_tmp5_, "received-message", (GCallback) _xmpp_xep_jingle_message_initiation_module_on_received_message_xmpp_message_module_received_message, self, 0);
	_g_object_unref0 (_tmp5_);
}

static void
xmpp_xep_jingle_message_initiation_module_real_detach (XmppXmppStreamModule* base,
                                                       XmppXmppStream* stream)
{
	XmppXepJingleMessageInitiationModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppMessageModule* _tmp5_;
	guint _tmp6_;
	self = (XmppXepJingleMessageInitiationModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepServiceDiscoveryModule*) _tmp1_;
	xmpp_xep_service_discovery_module_remove_feature (_tmp2_, stream, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_message_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppMessageModule*) _tmp4_;
	g_signal_parse_name ("received-message", XMPP_TYPE_MESSAGE_MODULE, &_tmp6_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) _xmpp_xep_jingle_message_initiation_module_on_received_message_xmpp_message_module_received_message, self);
	_g_object_unref0 (_tmp5_);
}

static gchar*
xmpp_xep_jingle_message_initiation_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepJingleMessageInitiationModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepJingleMessageInitiationModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_jingle_message_initiation_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepJingleMessageInitiationModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepJingleMessageInitiationModule*) base;
	_tmp0_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepJingleMessageInitiationModule*
xmpp_xep_jingle_message_initiation_module_construct (GType object_type)
{
	XmppXepJingleMessageInitiationModule * self = NULL;
	self = (XmppXepJingleMessageInitiationModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepJingleMessageInitiationModule*
xmpp_xep_jingle_message_initiation_module_new (void)
{
	return xmpp_xep_jingle_message_initiation_module_construct (XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_OBJECT (GClosure * closure,
                                                               GValue * return_value,
                                                               guint n_param_values,
                                                               const GValue * param_values,
                                                               gpointer invocation_hint,
                                                               gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__XMPP_JID_XMPP_JID_STRING_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, gpointer arg_4, gpointer data2);
	register GMarshalFunc_VOID__XMPP_JID_XMPP_JID_STRING_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	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__XMPP_JID_XMPP_JID_STRING_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, xmpp_value_get_jid (param_values + 1), xmpp_value_get_jid (param_values + 2), g_value_get_string (param_values + 3), g_value_get_object (param_values + 4), data2);
}

static void
g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING (GClosure * closure,
                                                        GValue * return_value,
                                                        guint n_param_values,
                                                        const GValue * param_values,
                                                        gpointer invocation_hint,
                                                        gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__XMPP_JID_XMPP_JID_STRING) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, gpointer data2);
	register GMarshalFunc_VOID__XMPP_JID_XMPP_JID_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	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__XMPP_JID_XMPP_JID_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, xmpp_value_get_jid (param_values + 1), xmpp_value_get_jid (param_values + 2), g_value_get_string (param_values + 3), data2);
}

static void
xmpp_xep_jingle_message_initiation_module_class_init (XmppXepJingleMessageInitiationModuleClass * klass,
                                                      gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_jingle_message_initiation_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_jingle_message_initiation_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_jingle_message_initiation_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_jingle_message_initiation_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_jingle_message_initiation_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jingle_message_initiation_module_finalize;
	xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_PROPOSED_SIGNAL] = g_signal_new ("session-proposed", XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_OBJECT, G_TYPE_NONE, 4, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING, GEE_TYPE_LIST);
	xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_RETRACTED_SIGNAL] = g_signal_new ("session-retracted", XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING, G_TYPE_NONE, 3, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING);
	xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_ACCEPTED_SIGNAL] = g_signal_new ("session-accepted", XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING, G_TYPE_NONE, 3, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING);
	xmpp_xep_jingle_message_initiation_module_signals[XMPP_XEP_JINGLE_MESSAGE_INITIATION_MODULE_SESSION_REJECTED_SIGNAL] = g_signal_new ("session-rejected", XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING, G_TYPE_NONE, 3, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING);
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI, "0353_jingle_message_initiation");
	xmpp_xep_jingle_message_initiation_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_jingle_message_initiation_module_instance_init (XmppXepJingleMessageInitiationModule * self,
                                                         gpointer klass)
{
}

static void
xmpp_xep_jingle_message_initiation_module_finalize (GObject * obj)
{
	XmppXepJingleMessageInitiationModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, XmppXepJingleMessageInitiationModule);
	G_OBJECT_CLASS (xmpp_xep_jingle_message_initiation_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jingle_message_initiation_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleMessageInitiationModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_message_initiation_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleMessageInitiationModule), 0, (GInstanceInitFunc) xmpp_xep_jingle_message_initiation_module_instance_init, NULL };
	GType xmpp_xep_jingle_message_initiation_module_type_id;
	xmpp_xep_jingle_message_initiation_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepJingleMessageInitiationModule", &g_define_type_info, 0);
	return xmpp_xep_jingle_message_initiation_module_type_id;
}

GType
xmpp_xep_jingle_message_initiation_module_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_message_initiation_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_message_initiation_module_type_id__once)) {
		GType xmpp_xep_jingle_message_initiation_module_type_id;
		xmpp_xep_jingle_message_initiation_module_type_id = xmpp_xep_jingle_message_initiation_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_message_initiation_module_type_id__once, xmpp_xep_jingle_message_initiation_module_type_id);
	}
	return xmpp_xep_jingle_message_initiation_module_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;
}

