/* 0482_call_invites.c generated by valac 0.56.19, the Vala compiler
 * generated from 0482_call_invites.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_CALL_INVITES_MODULE_0_PROPERTY,
	XMPP_XEP_CALL_INVITES_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_call_invites_module_properties[XMPP_XEP_CALL_INVITES_MODULE_NUM_PROPERTIES];
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	XMPP_XEP_CALL_INVITES_MODULE_CALL_PROPOSED_SIGNAL,
	XMPP_XEP_CALL_INVITES_MODULE_CALL_RETRACTED_SIGNAL,
	XMPP_XEP_CALL_INVITES_MODULE_CALL_ACCEPTED_SIGNAL,
	XMPP_XEP_CALL_INVITES_MODULE_CALL_REJECTED_SIGNAL,
	XMPP_XEP_CALL_INVITES_MODULE_CALL_LEFT_SIGNAL,
	XMPP_XEP_CALL_INVITES_MODULE_NUM_SIGNALS
};
static guint xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_NUM_SIGNALS] = {0};

static gpointer xmpp_xep_call_invites_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_call_invites_module_IDENTITY = NULL;

static void xmpp_xep_call_invites_module_send_message (XmppXepCallInvitesModule* self,
                                                XmppXmppStream* stream,
                                                XmppJid* to,
                                                const gchar* call_id,
                                                const gchar* action,
                                                const gchar* message_type);
static void xmpp_xep_call_invites_module_on_received_message (XmppXepCallInvitesModule* self,
                                                       XmppXmppStream* stream,
                                                       XmppMessageStanza* message);
static void xmpp_xep_call_invites_module_real_attach (XmppXmppStreamModule* base,
                                               XmppXmppStream* stream);
static void _xmpp_xep_call_invites_module_on_received_message_xmpp_message_module_received_message (XmppMessageModule* _sender,
                                                                                             XmppXmppStream* stream,
                                                                                             XmppMessageStanza* message,
                                                                                             gpointer self);
static void xmpp_xep_call_invites_module_real_detach (XmppXmppStreamModule* base,
                                               XmppXmppStream* stream);
static gchar* xmpp_xep_call_invites_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_call_invites_module_real_get_id (XmppXmppStreamModule* base);
static void g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_BOOLEAN_OBJECT_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_STRING (GClosure * closure,
                                                                    GValue * return_value,
                                                                    guint n_param_values,
                                                                    const GValue * param_values,
                                                                    gpointer invocation_hint,
                                                                    gpointer marshal_data);
static void xmpp_xep_call_invites_module_finalize (GObject * obj);
static GType xmpp_xep_call_invites_module_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
xmpp_xep_call_invites_module_send_jingle_propose (XmppXepCallInvitesModule* self,
                                                  XmppXmppStream* stream,
                                                  const gchar* call_id,
                                                  XmppJid* invitee,
                                                  const gchar* sid,
                                                  gboolean video,
                                                  const gchar* message_type)
{
	XmppStanzaNode* method = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* legacy_method = NULL;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (invitee != NULL);
	g_return_if_fail (sid != NULL);
	g_return_if_fail (message_type != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("jingle", XMPP_XEP_CALL_INVITES_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_put_attribute (_tmp1_, "sid", sid, NULL);
	_tmp3_ = _tmp2_;
	_xmpp_stanza_entry_unref0 (_tmp1_);
	method = _tmp3_;
	_tmp4_ = xmpp_stanza_node_new_build ("jingle", XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM, NULL, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp5_, "sid", sid, NULL);
	_tmp7_ = _tmp6_;
	_xmpp_stanza_entry_unref0 (_tmp5_);
	legacy_method = _tmp7_;
	xmpp_xep_call_invites_module_send_propose (self, stream, call_id, invitee, video, FALSE, message_type, method, legacy_method);
	_xmpp_stanza_entry_unref0 (legacy_method);
	_xmpp_stanza_entry_unref0 (method);
}

void
xmpp_xep_call_invites_module_send_muji_propose (XmppXepCallInvitesModule* self,
                                                XmppXmppStream* stream,
                                                const gchar* call_id,
                                                XmppJid* invitee,
                                                XmppJid* muc_jid,
                                                gboolean video,
                                                const gchar* message_type)
{
	XmppStanzaNode* method = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (invitee != NULL);
	g_return_if_fail (muc_jid != NULL);
	g_return_if_fail (message_type != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("muji", XMPP_XEP_MUJI_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_jid_to_string (muc_jid);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp3_, "room", _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	method = _tmp7_;
	xmpp_xep_call_invites_module_send_propose (self, stream, call_id, invitee, video, TRUE, message_type, method, method);
	_xmpp_stanza_entry_unref0 (method);
}

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

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

void
xmpp_xep_call_invites_module_send_propose (XmppXepCallInvitesModule* self,
                                           XmppXmppStream* stream,
                                           const gchar* call_id,
                                           XmppJid* invitee,
                                           gboolean video,
                                           gboolean multi,
                                           const gchar* message_type,
                                           XmppStanzaNode* method,
                                           XmppStanzaNode* legacy_method)
{
	XmppMessageStanza* invite_message = NULL;
	XmppJid* _tmp0_;
	gchar* _tmp1_;
	XmppMessageStanza* _tmp2_ = NULL;
	XmppMessageStanza* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppMessageStanza* _tmp43_;
	XmppModuleIdentity* _tmp44_;
	gpointer _tmp45_;
	XmppMessageModule* _tmp46_;
	XmppMessageStanza* _tmp47_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (invitee != NULL);
	g_return_if_fail (message_type != NULL);
	g_return_if_fail (method != NULL);
	_tmp0_ = _xmpp_jid_ref0 (invitee);
	_tmp1_ = g_strdup (message_type);
	_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_);
	invite_message = _tmp2_;
	_tmp3_ = invite_message;
	_tmp4_ = ((XmppStanza*) _tmp3_)->stanza;
	_tmp5_ = xmpp_stanza_node_new_build ("invite", XMPP_XEP_CALL_INVITES_NS_URI, NULL, NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_node_add_self_xmlns (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = xmpp_stanza_node_put_attribute (_tmp8_, "id", call_id, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = bool_to_string (video);
	_tmp12_ = _tmp11_;
	_tmp13_ = xmpp_stanza_node_put_attribute (_tmp10_, "video", _tmp12_, NULL);
	_tmp14_ = _tmp13_;
	_tmp15_ = bool_to_string (multi);
	_tmp16_ = _tmp15_;
	_tmp17_ = xmpp_stanza_node_put_attribute (_tmp14_, "multi", _tmp16_, NULL);
	_tmp18_ = _tmp17_;
	_tmp19_ = xmpp_stanza_node_put_node (_tmp18_, method);
	_tmp20_ = _tmp19_;
	_tmp21_ = xmpp_stanza_node_put_node (_tmp4_, _tmp20_);
	_tmp22_ = _tmp21_;
	_xmpp_stanza_entry_unref0 (_tmp22_);
	_xmpp_stanza_entry_unref0 (_tmp20_);
	_xmpp_stanza_entry_unref0 (_tmp18_);
	_g_free0 (_tmp16_);
	_xmpp_stanza_entry_unref0 (_tmp14_);
	_g_free0 (_tmp12_);
	_xmpp_stanza_entry_unref0 (_tmp10_);
	_xmpp_stanza_entry_unref0 (_tmp8_);
	_xmpp_stanza_entry_unref0 (_tmp6_);
	if (legacy_method != NULL) {
		XmppMessageStanza* _tmp23_;
		XmppStanzaNode* _tmp24_;
		XmppStanzaNode* _tmp25_;
		XmppStanzaNode* _tmp26_;
		XmppStanzaNode* _tmp27_;
		XmppStanzaNode* _tmp28_;
		XmppStanzaNode* _tmp29_;
		XmppStanzaNode* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		XmppStanzaNode* _tmp33_;
		XmppStanzaNode* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		XmppStanzaNode* _tmp37_;
		XmppStanzaNode* _tmp38_;
		XmppStanzaNode* _tmp39_;
		XmppStanzaNode* _tmp40_;
		XmppStanzaNode* _tmp41_;
		XmppStanzaNode* _tmp42_;
		_tmp23_ = invite_message;
		_tmp24_ = ((XmppStanza*) _tmp23_)->stanza;
		_tmp25_ = xmpp_stanza_node_new_build ("propose", XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM, NULL, NULL);
		_tmp26_ = _tmp25_;
		_tmp27_ = xmpp_stanza_node_add_self_xmlns (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = xmpp_stanza_node_put_attribute (_tmp28_, "id", call_id, NULL);
		_tmp30_ = _tmp29_;
		_tmp31_ = bool_to_string (video);
		_tmp32_ = _tmp31_;
		_tmp33_ = xmpp_stanza_node_put_attribute (_tmp30_, "video", _tmp32_, NULL);
		_tmp34_ = _tmp33_;
		_tmp35_ = bool_to_string (multi);
		_tmp36_ = _tmp35_;
		_tmp37_ = xmpp_stanza_node_put_attribute (_tmp34_, "multi", _tmp36_, NULL);
		_tmp38_ = _tmp37_;
		_tmp39_ = xmpp_stanza_node_put_node (_tmp38_, legacy_method);
		_tmp40_ = _tmp39_;
		_tmp41_ = xmpp_stanza_node_put_node (_tmp24_, _tmp40_);
		_tmp42_ = _tmp41_;
		_xmpp_stanza_entry_unref0 (_tmp42_);
		_xmpp_stanza_entry_unref0 (_tmp40_);
		_xmpp_stanza_entry_unref0 (_tmp38_);
		_g_free0 (_tmp36_);
		_xmpp_stanza_entry_unref0 (_tmp34_);
		_g_free0 (_tmp32_);
		_xmpp_stanza_entry_unref0 (_tmp30_);
		_xmpp_stanza_entry_unref0 (_tmp28_);
		_xmpp_stanza_entry_unref0 (_tmp26_);
	}
	_tmp43_ = invite_message;
	xmpp_xep_message_processing_hints_set_message_hint (_tmp43_, XMPP_XEP_MESSAGE_PROCESSING_HINTS_HINT_STORE);
	_tmp44_ = xmpp_message_module_IDENTITY;
	_tmp45_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp44_);
	_tmp46_ = (XmppMessageModule*) _tmp45_;
	_tmp47_ = invite_message;
	xmpp_message_module_send_message (_tmp46_, stream, _tmp47_, NULL, NULL);
	_g_object_unref0 (_tmp46_);
	_g_object_unref0 (invite_message);
}

void
xmpp_xep_call_invites_module_send_jingle_accept (XmppXepCallInvitesModule* self,
                                                 XmppXmppStream* stream,
                                                 XmppJid* inviter,
                                                 const gchar* call_id,
                                                 const gchar* sid,
                                                 const gchar* message_type)
{
	XmppStanzaNode* method = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* legacy_method = NULL;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (inviter != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (sid != NULL);
	g_return_if_fail (message_type != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("jingle", XMPP_XEP_CALL_INVITES_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_put_attribute (_tmp1_, "sid", sid, NULL);
	_tmp3_ = _tmp2_;
	_xmpp_stanza_entry_unref0 (_tmp1_);
	method = _tmp3_;
	_tmp4_ = xmpp_stanza_node_new_build ("jingle", XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM, NULL, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp5_, "sid", sid, NULL);
	_tmp7_ = _tmp6_;
	_xmpp_stanza_entry_unref0 (_tmp5_);
	legacy_method = _tmp7_;
	xmpp_xep_call_invites_module_send_accept (self, stream, inviter, call_id, message_type, method, legacy_method);
	_xmpp_stanza_entry_unref0 (legacy_method);
	_xmpp_stanza_entry_unref0 (method);
}

void
xmpp_xep_call_invites_module_send_muji_accept (XmppXepCallInvitesModule* self,
                                               XmppXmppStream* stream,
                                               XmppJid* inviter,
                                               const gchar* call_id,
                                               XmppJid* room,
                                               const gchar* message_type)
{
	XmppStanzaNode* method = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (inviter != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (room != NULL);
	g_return_if_fail (message_type != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("muji", XMPP_XEP_MUJI_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_jid_to_string (room);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp3_, "room", _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	method = _tmp7_;
	xmpp_xep_call_invites_module_send_accept (self, stream, inviter, call_id, message_type, method, method);
	_xmpp_stanza_entry_unref0 (method);
}

void
xmpp_xep_call_invites_module_send_accept (XmppXepCallInvitesModule* self,
                                          XmppXmppStream* stream,
                                          XmppJid* inviter,
                                          const gchar* call_id,
                                          const gchar* message_type,
                                          XmppStanzaNode* method,
                                          XmppStanzaNode* legacy_method)
{
	XmppMessageStanza* invite_message = NULL;
	XmppJid* _tmp0_;
	gchar* _tmp1_;
	XmppMessageStanza* _tmp2_ = NULL;
	XmppMessageStanza* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	XmppMessageStanza* _tmp27_;
	XmppModuleIdentity* _tmp28_;
	gpointer _tmp29_;
	XmppMessageModule* _tmp30_;
	XmppMessageStanza* _tmp31_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (inviter != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (message_type != NULL);
	g_return_if_fail (method != NULL);
	_tmp0_ = _xmpp_jid_ref0 (inviter);
	_tmp1_ = g_strdup (message_type);
	_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_);
	invite_message = _tmp2_;
	_tmp3_ = invite_message;
	_tmp4_ = ((XmppStanza*) _tmp3_)->stanza;
	_tmp5_ = xmpp_stanza_node_new_build ("accept", XMPP_XEP_CALL_INVITES_NS_URI, NULL, NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_node_add_self_xmlns (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = xmpp_stanza_node_put_attribute (_tmp8_, "id", call_id, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = xmpp_stanza_node_put_node (_tmp10_, method);
	_tmp12_ = _tmp11_;
	_tmp13_ = xmpp_stanza_node_put_node (_tmp4_, _tmp12_);
	_tmp14_ = _tmp13_;
	_xmpp_stanza_entry_unref0 (_tmp14_);
	_xmpp_stanza_entry_unref0 (_tmp12_);
	_xmpp_stanza_entry_unref0 (_tmp10_);
	_xmpp_stanza_entry_unref0 (_tmp8_);
	_xmpp_stanza_entry_unref0 (_tmp6_);
	if (legacy_method != NULL) {
		XmppMessageStanza* _tmp15_;
		XmppStanzaNode* _tmp16_;
		XmppStanzaNode* _tmp17_;
		XmppStanzaNode* _tmp18_;
		XmppStanzaNode* _tmp19_;
		XmppStanzaNode* _tmp20_;
		XmppStanzaNode* _tmp21_;
		XmppStanzaNode* _tmp22_;
		XmppStanzaNode* _tmp23_;
		XmppStanzaNode* _tmp24_;
		XmppStanzaNode* _tmp25_;
		XmppStanzaNode* _tmp26_;
		_tmp15_ = invite_message;
		_tmp16_ = ((XmppStanza*) _tmp15_)->stanza;
		_tmp17_ = xmpp_stanza_node_new_build ("accept", XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM, NULL, NULL);
		_tmp18_ = _tmp17_;
		_tmp19_ = xmpp_stanza_node_add_self_xmlns (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = xmpp_stanza_node_put_attribute (_tmp20_, "id", call_id, NULL);
		_tmp22_ = _tmp21_;
		_tmp23_ = xmpp_stanza_node_put_node (_tmp22_, legacy_method);
		_tmp24_ = _tmp23_;
		_tmp25_ = xmpp_stanza_node_put_node (_tmp16_, _tmp24_);
		_tmp26_ = _tmp25_;
		_xmpp_stanza_entry_unref0 (_tmp26_);
		_xmpp_stanza_entry_unref0 (_tmp24_);
		_xmpp_stanza_entry_unref0 (_tmp22_);
		_xmpp_stanza_entry_unref0 (_tmp20_);
		_xmpp_stanza_entry_unref0 (_tmp18_);
	}
	_tmp27_ = invite_message;
	xmpp_xep_message_processing_hints_set_message_hint (_tmp27_, XMPP_XEP_MESSAGE_PROCESSING_HINTS_HINT_STORE);
	_tmp28_ = xmpp_message_module_IDENTITY;
	_tmp29_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp28_);
	_tmp30_ = (XmppMessageModule*) _tmp29_;
	_tmp31_ = invite_message;
	xmpp_message_module_send_message (_tmp30_, stream, _tmp31_, NULL, NULL);
	_g_object_unref0 (_tmp30_);
	_g_object_unref0 (invite_message);
}

void
xmpp_xep_call_invites_module_send_retract (XmppXepCallInvitesModule* self,
                                           XmppXmppStream* stream,
                                           XmppJid* to,
                                           const gchar* call_id,
                                           const gchar* message_type)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (message_type != NULL);
	xmpp_xep_call_invites_module_send_message (self, stream, to, call_id, "retract", message_type);
}

void
xmpp_xep_call_invites_module_send_reject (XmppXepCallInvitesModule* self,
                                          XmppXmppStream* stream,
                                          XmppJid* to,
                                          const gchar* call_id,
                                          const gchar* message_type)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (message_type != NULL);
	xmpp_xep_call_invites_module_send_message (self, stream, to, call_id, "reject", message_type);
}

void
xmpp_xep_call_invites_module_send_left (XmppXepCallInvitesModule* self,
                                        XmppXmppStream* stream,
                                        XmppJid* to,
                                        const gchar* call_id,
                                        const gchar* message_type)
{
	XmppMessageStanza* message = NULL;
	XmppJid* _tmp0_;
	gchar* _tmp1_;
	XmppMessageStanza* _tmp2_ = NULL;
	XmppStanzaNode* inner_node = NULL;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* custom_node = NULL;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	XmppStanzaNode* _tmp15_;
	XmppStanzaNode* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppModuleIdentity* _tmp21_;
	gpointer _tmp22_;
	XmppMessageModule* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (message_type != NULL);
	_tmp0_ = _xmpp_jid_ref0 (to);
	_tmp1_ = g_strdup (message_type);
	_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_);
	message = _tmp2_;
	_tmp3_ = xmpp_stanza_node_new_build ("left", XMPP_XEP_CALL_INVITES_NS_URI, NULL, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmpp_stanza_node_add_self_xmlns (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_node_put_attribute (_tmp6_, "id", call_id, NULL);
	_tmp8_ = _tmp7_;
	_xmpp_stanza_entry_unref0 (_tmp6_);
	_xmpp_stanza_entry_unref0 (_tmp4_);
	inner_node = _tmp8_;
	_tmp9_ = ((XmppStanza*) message)->stanza;
	_tmp10_ = xmpp_stanza_node_put_node (_tmp9_, inner_node);
	_tmp11_ = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp11_);
	_tmp12_ = xmpp_stanza_node_new_build ("finish", XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM, NULL, NULL);
	_tmp13_ = _tmp12_;
	_tmp14_ = xmpp_stanza_node_add_self_xmlns (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = xmpp_stanza_node_put_attribute (_tmp15_, "id", call_id, NULL);
	_tmp17_ = _tmp16_;
	_xmpp_stanza_entry_unref0 (_tmp15_);
	_xmpp_stanza_entry_unref0 (_tmp13_);
	custom_node = _tmp17_;
	_tmp18_ = ((XmppStanza*) message)->stanza;
	_tmp19_ = xmpp_stanza_node_put_node (_tmp18_, custom_node);
	_tmp20_ = _tmp19_;
	_xmpp_stanza_entry_unref0 (_tmp20_);
	xmpp_xep_message_processing_hints_set_message_hint (message, XMPP_XEP_MESSAGE_PROCESSING_HINTS_HINT_STORE);
	_tmp21_ = xmpp_message_module_IDENTITY;
	_tmp22_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp21_);
	_tmp23_ = (XmppMessageModule*) _tmp22_;
	xmpp_message_module_send_message (_tmp23_, stream, message, NULL, NULL);
	_g_object_unref0 (_tmp23_);
	_xmpp_stanza_entry_unref0 (custom_node);
	_xmpp_stanza_entry_unref0 (inner_node);
	_g_object_unref0 (message);
}

static void
xmpp_xep_call_invites_module_send_message (XmppXepCallInvitesModule* self,
                                           XmppXmppStream* stream,
                                           XmppJid* to,
                                           const gchar* call_id,
                                           const gchar* action,
                                           const gchar* message_type)
{
	XmppMessageStanza* message = NULL;
	XmppJid* _tmp0_;
	gchar* _tmp1_;
	XmppMessageStanza* _tmp2_ = NULL;
	XmppStanzaNode* inner_node = NULL;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* custom_node = NULL;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	XmppStanzaNode* _tmp15_;
	XmppStanzaNode* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppModuleIdentity* _tmp21_;
	gpointer _tmp22_;
	XmppMessageModule* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (to != NULL);
	g_return_if_fail (call_id != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (message_type != NULL);
	_tmp0_ = _xmpp_jid_ref0 (to);
	_tmp1_ = g_strdup (message_type);
	_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_);
	message = _tmp2_;
	_tmp3_ = xmpp_stanza_node_new_build (action, XMPP_XEP_CALL_INVITES_NS_URI, NULL, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmpp_stanza_node_add_self_xmlns (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_node_put_attribute (_tmp6_, "id", call_id, NULL);
	_tmp8_ = _tmp7_;
	_xmpp_stanza_entry_unref0 (_tmp6_);
	_xmpp_stanza_entry_unref0 (_tmp4_);
	inner_node = _tmp8_;
	_tmp9_ = ((XmppStanza*) message)->stanza;
	_tmp10_ = xmpp_stanza_node_put_node (_tmp9_, inner_node);
	_tmp11_ = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp11_);
	_tmp12_ = xmpp_stanza_node_new_build (action, XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM, NULL, NULL);
	_tmp13_ = _tmp12_;
	_tmp14_ = xmpp_stanza_node_add_self_xmlns (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = xmpp_stanza_node_put_attribute (_tmp15_, "id", call_id, NULL);
	_tmp17_ = _tmp16_;
	_xmpp_stanza_entry_unref0 (_tmp15_);
	_xmpp_stanza_entry_unref0 (_tmp13_);
	custom_node = _tmp17_;
	_tmp18_ = ((XmppStanza*) message)->stanza;
	_tmp19_ = xmpp_stanza_node_put_node (_tmp18_, custom_node);
	_tmp20_ = _tmp19_;
	_xmpp_stanza_entry_unref0 (_tmp20_);
	xmpp_xep_message_processing_hints_set_message_hint (message, XMPP_XEP_MESSAGE_PROCESSING_HINTS_HINT_STORE);
	_tmp21_ = xmpp_message_module_IDENTITY;
	_tmp22_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp21_);
	_tmp23_ = (XmppMessageModule*) _tmp22_;
	xmpp_message_module_send_message (_tmp23_, stream, message, NULL, NULL);
	_g_object_unref0 (_tmp23_);
	_xmpp_stanza_entry_unref0 (custom_node);
	_xmpp_stanza_entry_unref0 (inner_node);
	_g_object_unref0 (message);
}

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

static void
xmpp_xep_call_invites_module_on_received_message (XmppXepCallInvitesModule* self,
                                                  XmppXmppStream* stream,
                                                  XmppMessageStanza* message)
{
	XmppMessageArchiveManagementMessageFlag* mam_flag = NULL;
	XmppMessageArchiveManagementMessageFlag* _tmp0_;
	XmppMessageArchiveManagementMessageFlag* _tmp1_;
	XmppStanzaNode* relevant_node = NULL;
	XmppStanzaNode* _tmp15_;
	XmppStanzaNode* _tmp29_;
	gchar* call_id = NULL;
	XmppStanzaNode* _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	const gchar* _tmp33_;
	gboolean _tmp34_ = FALSE;
	XmppStanzaNode* _tmp35_;
	const gchar* _tmp36_;
	XmppStanzaNode* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	GQuark _tmp68_ = 0U;
	static GQuark _tmp67_label0 = 0;
	static GQuark _tmp67_label1 = 0;
	static GQuark _tmp67_label2 = 0;
	static GQuark _tmp67_label3 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = xmpp_message_archive_management_message_flag_get_flag (message);
	mam_flag = _tmp0_;
	_tmp1_ = mam_flag;
	if (_tmp1_ != NULL) {
		_g_object_unref0 (mam_flag);
		return;
	}
	relevant_node = NULL;
	{
		GeeList* _node_list = NULL;
		XmppStanzaNode* _tmp2_;
		GeeList* _tmp3_;
		gint _node_size = 0;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _node_index = 0;
		_tmp2_ = ((XmppStanza*) message)->stanza;
		_tmp3_ = _tmp2_->sub_nodes;
		_node_list = _tmp3_;
		_tmp4_ = _node_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_node_size = _tmp6_;
		_node_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			XmppStanzaNode* node = NULL;
			GeeList* _tmp9_;
			gpointer _tmp10_;
			XmppStanzaNode* _tmp11_;
			const gchar* _tmp12_;
			_node_index = _node_index + 1;
			_tmp7_ = _node_index;
			_tmp8_ = _node_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _node_list;
			_tmp10_ = gee_list_get (_tmp9_, _node_index);
			node = (XmppStanzaNode*) _tmp10_;
			_tmp11_ = node;
			_tmp12_ = ((XmppStanzaEntry*) _tmp11_)->ns_uri;
			if (g_strcmp0 (_tmp12_, XMPP_XEP_CALL_INVITES_NS_URI) == 0) {
				XmppStanzaNode* _tmp13_;
				XmppStanzaNode* _tmp14_;
				_tmp13_ = node;
				_tmp14_ = _xmpp_stanza_entry_ref0 (_tmp13_);
				_xmpp_stanza_entry_unref0 (relevant_node);
				relevant_node = _tmp14_;
				_xmpp_stanza_entry_unref0 (node);
				break;
			}
			_xmpp_stanza_entry_unref0 (node);
		}
	}
	_tmp15_ = relevant_node;
	if (_tmp15_ == NULL) {
		{
			GeeList* _node_list = NULL;
			XmppStanzaNode* _tmp16_;
			GeeList* _tmp17_;
			gint _node_size = 0;
			GeeList* _tmp18_;
			gint _tmp19_;
			gint _tmp20_;
			gint _node_index = 0;
			_tmp16_ = ((XmppStanza*) message)->stanza;
			_tmp17_ = _tmp16_->sub_nodes;
			_node_list = _tmp17_;
			_tmp18_ = _node_list;
			_tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_);
			_tmp20_ = _tmp19_;
			_node_size = _tmp20_;
			_node_index = -1;
			while (TRUE) {
				gint _tmp21_;
				gint _tmp22_;
				XmppStanzaNode* node = NULL;
				GeeList* _tmp23_;
				gpointer _tmp24_;
				XmppStanzaNode* _tmp25_;
				const gchar* _tmp26_;
				_node_index = _node_index + 1;
				_tmp21_ = _node_index;
				_tmp22_ = _node_size;
				if (!(_tmp21_ < _tmp22_)) {
					break;
				}
				_tmp23_ = _node_list;
				_tmp24_ = gee_list_get (_tmp23_, _node_index);
				node = (XmppStanzaNode*) _tmp24_;
				_tmp25_ = node;
				_tmp26_ = ((XmppStanzaEntry*) _tmp25_)->ns_uri;
				if (g_strcmp0 (_tmp26_, XMPP_XEP_CALL_INVITES_NS_URI_CUSTOM) == 0) {
					XmppStanzaNode* _tmp27_;
					XmppStanzaNode* _tmp28_;
					_tmp27_ = node;
					_tmp28_ = _xmpp_stanza_entry_ref0 (_tmp27_);
					_xmpp_stanza_entry_unref0 (relevant_node);
					relevant_node = _tmp28_;
					_xmpp_stanza_entry_unref0 (node);
					break;
				}
				_xmpp_stanza_entry_unref0 (node);
			}
		}
	}
	_tmp29_ = relevant_node;
	if (_tmp29_ == NULL) {
		_xmpp_stanza_entry_unref0 (relevant_node);
		_g_object_unref0 (mam_flag);
		return;
	}
	_tmp30_ = relevant_node;
	_tmp31_ = xmpp_stanza_node_get_attribute (_tmp30_, "id", NULL);
	_tmp32_ = g_strdup (_tmp31_);
	call_id = _tmp32_;
	_tmp33_ = call_id;
	if (_tmp33_ == NULL) {
		_g_free0 (call_id);
		_xmpp_stanza_entry_unref0 (relevant_node);
		_g_object_unref0 (mam_flag);
		return;
	}
	_tmp35_ = relevant_node;
	_tmp36_ = ((XmppStanzaEntry*) _tmp35_)->name;
	if (g_strcmp0 (_tmp36_, "invite") == 0) {
		_tmp34_ = TRUE;
	} else {
		XmppStanzaNode* _tmp37_;
		const gchar* _tmp38_;
		_tmp37_ = relevant_node;
		_tmp38_ = ((XmppStanzaEntry*) _tmp37_)->name;
		_tmp34_ = g_strcmp0 (_tmp38_, "propose") == 0;
	}
	if (_tmp34_) {
		XmppStanzaNode* _tmp39_;
		GeeList* _tmp40_;
		gboolean _tmp41_;
		gboolean _tmp42_;
		gboolean video = FALSE;
		XmppStanzaNode* _tmp54_;
		XmppJid* _tmp55_;
		XmppJid* _tmp56_;
		XmppJid* _tmp57_;
		XmppJid* _tmp58_;
		XmppJid* _tmp59_;
		XmppJid* _tmp60_;
		const gchar* _tmp61_;
		XmppStanzaNode* _tmp62_;
		GeeList* _tmp63_;
		_tmp39_ = relevant_node;
		_tmp40_ = _tmp39_->sub_nodes;
		_tmp41_ = gee_collection_get_is_empty ((GeeCollection*) _tmp40_);
		_tmp42_ = _tmp41_;
		if (_tmp42_) {
			_g_free0 (call_id);
			_xmpp_stanza_entry_unref0 (relevant_node);
			_g_object_unref0 (mam_flag);
			return;
		}
		{
			GeeList* _node_list = NULL;
			XmppStanzaNode* _tmp43_;
			GeeList* _tmp44_;
			gint _node_size = 0;
			GeeList* _tmp45_;
			gint _tmp46_;
			gint _tmp47_;
			gint _node_index = 0;
			_tmp43_ = ((XmppStanza*) message)->stanza;
			_tmp44_ = _tmp43_->sub_nodes;
			_node_list = _tmp44_;
			_tmp45_ = _node_list;
			_tmp46_ = gee_collection_get_size ((GeeCollection*) _tmp45_);
			_tmp47_ = _tmp46_;
			_node_size = _tmp47_;
			_node_index = -1;
			while (TRUE) {
				gint _tmp48_;
				gint _tmp49_;
				XmppStanzaNode* node = NULL;
				GeeList* _tmp50_;
				gpointer _tmp51_;
				XmppStanzaNode* _tmp52_;
				const gchar* _tmp53_;
				_node_index = _node_index + 1;
				_tmp48_ = _node_index;
				_tmp49_ = _node_size;
				if (!(_tmp48_ < _tmp49_)) {
					break;
				}
				_tmp50_ = _node_list;
				_tmp51_ = gee_list_get (_tmp50_, _node_index);
				node = (XmppStanzaNode*) _tmp51_;
				_tmp52_ = node;
				_tmp53_ = ((XmppStanzaEntry*) _tmp52_)->ns_uri;
				if (g_strcmp0 (_tmp53_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_NS_URI) == 0) {
					_xmpp_stanza_entry_unref0 (node);
					_g_free0 (call_id);
					_xmpp_stanza_entry_unref0 (relevant_node);
					_g_object_unref0 (mam_flag);
					return;
				}
				_xmpp_stanza_entry_unref0 (node);
			}
		}
		_tmp54_ = relevant_node;
		video = xmpp_stanza_node_get_attribute_bool (_tmp54_, "video", FALSE, NULL);
		_tmp55_ = xmpp_stanza_get_from ((XmppStanza*) message);
		_tmp56_ = _tmp55_;
		_tmp57_ = _tmp56_;
		_tmp58_ = xmpp_stanza_get_to ((XmppStanza*) message);
		_tmp59_ = _tmp58_;
		_tmp60_ = _tmp59_;
		_tmp61_ = call_id;
		_tmp62_ = relevant_node;
		_tmp63_ = _tmp62_->sub_nodes;
		g_signal_emit (self, xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_PROPOSED_SIGNAL], 0, _tmp57_, _tmp60_, _tmp61_, video, _tmp63_, message);
		_xmpp_jid_unref0 (_tmp60_);
		_xmpp_jid_unref0 (_tmp57_);
		_g_free0 (call_id);
		_xmpp_stanza_entry_unref0 (relevant_node);
		_g_object_unref0 (mam_flag);
		return;
	}
	_tmp64_ = relevant_node;
	_tmp65_ = ((XmppStanzaEntry*) _tmp64_)->name;
	_tmp66_ = _tmp65_;
	_tmp68_ = (NULL == _tmp66_) ? 0 : g_quark_from_string (_tmp66_);
	if (_tmp68_ == ((0 != _tmp67_label0) ? _tmp67_label0 : (_tmp67_label0 = g_quark_from_static_string ("accept")))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp69_;
				XmppJid* _tmp70_;
				XmppJid* _tmp71_;
				XmppJid* _tmp72_;
				XmppJid* _tmp73_;
				XmppJid* _tmp74_;
				const gchar* _tmp75_;
				const gchar* _tmp76_;
				const gchar* _tmp77_;
				_tmp69_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp70_ = _tmp69_;
				_tmp71_ = _tmp70_;
				_tmp72_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp73_ = _tmp72_;
				_tmp74_ = _tmp73_;
				_tmp75_ = call_id;
				_tmp76_ = xmpp_stanza_get_type_ ((XmppStanza*) message);
				_tmp77_ = _tmp76_;
				g_signal_emit (self, xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_ACCEPTED_SIGNAL], 0, _tmp71_, _tmp74_, _tmp75_, _tmp77_);
				_xmpp_jid_unref0 (_tmp74_);
				_xmpp_jid_unref0 (_tmp71_);
				break;
			}
		}
	} else if (_tmp68_ == ((0 != _tmp67_label1) ? _tmp67_label1 : (_tmp67_label1 = g_quark_from_static_string ("retract")))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp78_;
				XmppJid* _tmp79_;
				XmppJid* _tmp80_;
				XmppJid* _tmp81_;
				XmppJid* _tmp82_;
				XmppJid* _tmp83_;
				const gchar* _tmp84_;
				const gchar* _tmp85_;
				const gchar* _tmp86_;
				_tmp78_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp79_ = _tmp78_;
				_tmp80_ = _tmp79_;
				_tmp81_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp82_ = _tmp81_;
				_tmp83_ = _tmp82_;
				_tmp84_ = call_id;
				_tmp85_ = xmpp_stanza_get_type_ ((XmppStanza*) message);
				_tmp86_ = _tmp85_;
				g_signal_emit (self, xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_RETRACTED_SIGNAL], 0, _tmp80_, _tmp83_, _tmp84_, _tmp86_);
				_xmpp_jid_unref0 (_tmp83_);
				_xmpp_jid_unref0 (_tmp80_);
				break;
			}
		}
	} else if (_tmp68_ == ((0 != _tmp67_label2) ? _tmp67_label2 : (_tmp67_label2 = g_quark_from_static_string ("reject")))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp87_;
				XmppJid* _tmp88_;
				XmppJid* _tmp89_;
				XmppJid* _tmp90_;
				XmppJid* _tmp91_;
				XmppJid* _tmp92_;
				const gchar* _tmp93_;
				const gchar* _tmp94_;
				const gchar* _tmp95_;
				_tmp87_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp88_ = _tmp87_;
				_tmp89_ = _tmp88_;
				_tmp90_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp91_ = _tmp90_;
				_tmp92_ = _tmp91_;
				_tmp93_ = call_id;
				_tmp94_ = xmpp_stanza_get_type_ ((XmppStanza*) message);
				_tmp95_ = _tmp94_;
				g_signal_emit (self, xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_REJECTED_SIGNAL], 0, _tmp89_, _tmp92_, _tmp93_, _tmp95_);
				_xmpp_jid_unref0 (_tmp92_);
				_xmpp_jid_unref0 (_tmp89_);
				break;
			}
		}
	} else if (_tmp68_ == ((0 != _tmp67_label3) ? _tmp67_label3 : (_tmp67_label3 = g_quark_from_static_string ("finish")))) {
		switch (0) {
			default:
			{
				XmppJid* _tmp96_;
				XmppJid* _tmp97_;
				XmppJid* _tmp98_;
				XmppJid* _tmp99_;
				XmppJid* _tmp100_;
				XmppJid* _tmp101_;
				const gchar* _tmp102_;
				const gchar* _tmp103_;
				const gchar* _tmp104_;
				_tmp96_ = xmpp_stanza_get_from ((XmppStanza*) message);
				_tmp97_ = _tmp96_;
				_tmp98_ = _tmp97_;
				_tmp99_ = xmpp_stanza_get_to ((XmppStanza*) message);
				_tmp100_ = _tmp99_;
				_tmp101_ = _tmp100_;
				_tmp102_ = call_id;
				_tmp103_ = xmpp_stanza_get_type_ ((XmppStanza*) message);
				_tmp104_ = _tmp103_;
				g_signal_emit (self, xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_LEFT_SIGNAL], 0, _tmp98_, _tmp101_, _tmp102_, _tmp104_);
				_xmpp_jid_unref0 (_tmp101_);
				_xmpp_jid_unref0 (_tmp98_);
				break;
			}
		}
	}
	_g_free0 (call_id);
	_xmpp_stanza_entry_unref0 (relevant_node);
	_g_object_unref0 (mam_flag);
}

static void
_xmpp_xep_call_invites_module_on_received_message_xmpp_message_module_received_message (XmppMessageModule* _sender,
                                                                                        XmppXmppStream* stream,
                                                                                        XmppMessageStanza* message,
                                                                                        gpointer self)
{
	xmpp_xep_call_invites_module_on_received_message ((XmppXepCallInvitesModule*) self, stream, message);
}

static void
xmpp_xep_call_invites_module_real_attach (XmppXmppStreamModule* base,
                                          XmppXmppStream* stream)
{
	XmppXepCallInvitesModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppMessageModule* _tmp2_;
	self = (XmppXepCallInvitesModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_message_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppMessageModule*) _tmp1_;
	g_signal_connect_object (_tmp2_, "received-message", (GCallback) _xmpp_xep_call_invites_module_on_received_message_xmpp_message_module_received_message, self, 0);
	_g_object_unref0 (_tmp2_);
}

static void
xmpp_xep_call_invites_module_real_detach (XmppXmppStreamModule* base,
                                          XmppXmppStream* stream)
{
	XmppXepCallInvitesModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppMessageModule* _tmp2_;
	guint _tmp3_;
	self = (XmppXepCallInvitesModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_message_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppMessageModule*) _tmp1_;
	g_signal_parse_name ("received-message", XMPP_TYPE_MESSAGE_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_xep_call_invites_module_on_received_message_xmpp_message_module_received_message, self);
	_g_object_unref0 (_tmp2_);
}

static gchar*
xmpp_xep_call_invites_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepCallInvitesModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepCallInvitesModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_CALL_INVITES_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_call_invites_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepCallInvitesModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepCallInvitesModule*) base;
	_tmp0_ = xmpp_xep_call_invites_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepCallInvitesModule*
xmpp_xep_call_invites_module_construct (GType object_type)
{
	XmppXepCallInvitesModule * self = NULL;
	self = (XmppXepCallInvitesModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepCallInvitesModule*
xmpp_xep_call_invites_module_new (void)
{
	return xmpp_xep_call_invites_module_construct (XMPP_XEP_CALL_INVITES_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_BOOLEAN_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__XMPP_JID_XMPP_JID_STRING_BOOLEAN_OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, gboolean arg_4, gpointer arg_5, gpointer arg_6, gpointer data2);
	register GMarshalFunc_VOID__XMPP_JID_XMPP_JID_STRING_BOOLEAN_OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 7);
	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_BOOLEAN_OBJECT_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_boolean (param_values + 4), g_value_get_object (param_values + 5), g_value_get_object (param_values + 6), data2);
}

static void
g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_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_STRING) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, const char* arg_4, gpointer data2);
	register GMarshalFunc_VOID__XMPP_JID_XMPP_JID_STRING_STRING 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_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), g_value_get_string (param_values + 4), data2);
}

static void
xmpp_xep_call_invites_module_class_init (XmppXepCallInvitesModuleClass * klass,
                                         gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_call_invites_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_call_invites_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_call_invites_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_call_invites_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_call_invites_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_call_invites_module_finalize;
	xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_PROPOSED_SIGNAL] = g_signal_new ("call-proposed", XMPP_XEP_CALL_INVITES_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_BOOLEAN_OBJECT_OBJECT, G_TYPE_NONE, 6, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING, G_TYPE_BOOLEAN, GEE_TYPE_LIST, XMPP_TYPE_MESSAGE_STANZA);
	xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_RETRACTED_SIGNAL] = g_signal_new ("call-retracted", XMPP_XEP_CALL_INVITES_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_STRING, G_TYPE_NONE, 4, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING, G_TYPE_STRING);
	xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_ACCEPTED_SIGNAL] = g_signal_new ("call-accepted", XMPP_XEP_CALL_INVITES_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_STRING, G_TYPE_NONE, 4, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING, G_TYPE_STRING);
	xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_REJECTED_SIGNAL] = g_signal_new ("call-rejected", XMPP_XEP_CALL_INVITES_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_STRING, G_TYPE_NONE, 4, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING, G_TYPE_STRING);
	xmpp_xep_call_invites_module_signals[XMPP_XEP_CALL_INVITES_MODULE_CALL_LEFT_SIGNAL] = g_signal_new ("call-left", XMPP_XEP_CALL_INVITES_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__XMPP_JID_XMPP_JID_STRING_STRING, G_TYPE_NONE, 4, XMPP_TYPE_JID, XMPP_TYPE_JID, G_TYPE_STRING, G_TYPE_STRING);
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_CALL_INVITES_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_CALL_INVITES_NS_URI, "call_invites");
	xmpp_xep_call_invites_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_call_invites_module_instance_init (XmppXepCallInvitesModule * self,
                                            gpointer klass)
{
}

static void
xmpp_xep_call_invites_module_finalize (GObject * obj)
{
	XmppXepCallInvitesModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_CALL_INVITES_TYPE_MODULE, XmppXepCallInvitesModule);
	G_OBJECT_CLASS (xmpp_xep_call_invites_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_call_invites_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepCallInvitesModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_call_invites_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepCallInvitesModule), 0, (GInstanceInitFunc) xmpp_xep_call_invites_module_instance_init, NULL };
	GType xmpp_xep_call_invites_module_type_id;
	xmpp_xep_call_invites_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepCallInvitesModule", &g_define_type_info, 0);
	return xmpp_xep_call_invites_module_type_id;
}

GType
xmpp_xep_call_invites_module_get_type (void)
{
	static volatile gsize xmpp_xep_call_invites_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_call_invites_module_type_id__once)) {
		GType xmpp_xep_call_invites_module_type_id;
		xmpp_xep_call_invites_module_type_id = xmpp_xep_call_invites_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_call_invites_module_type_id__once, xmpp_xep_call_invites_module_type_id);
	}
	return xmpp_xep_call_invites_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;
}

