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

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

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

enum  {
	XMPP_PRESENCE_MODULE_0_PROPERTY,
	XMPP_PRESENCE_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_presence_module_properties[XMPP_PRESENCE_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
enum  {
	XMPP_PRESENCE_MODULE_RECEIVED_PRESENCE_SIGNAL,
	XMPP_PRESENCE_MODULE_PRE_SEND_PRESENCE_STANZA_SIGNAL,
	XMPP_PRESENCE_MODULE_INITIAL_PRESENCE_SENT_SIGNAL,
	XMPP_PRESENCE_MODULE_RECEIVED_AVAILABLE_SIGNAL,
	XMPP_PRESENCE_MODULE_RECEIVED_AVAILABLE_SHOW_SIGNAL,
	XMPP_PRESENCE_MODULE_RECEIVED_UNAVAILABLE_SIGNAL,
	XMPP_PRESENCE_MODULE_RECEIVED_SUBSCRIPTION_REQUEST_SIGNAL,
	XMPP_PRESENCE_MODULE_RECEIVED_SUBSCRIPTION_APPROVAL_SIGNAL,
	XMPP_PRESENCE_MODULE_RECEIVED_UNSUBSCRIPTION_SIGNAL,
	XMPP_PRESENCE_MODULE_NUM_SIGNALS
};
static guint xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_NUM_SIGNALS] = {0};

static gpointer xmpp_presence_module_parent_class = NULL;
XmppModuleIdentity* xmpp_presence_module_IDENTITY = NULL;

static void xmpp_presence_module_real_attach (XmppXmppStreamModule* base,
                                       XmppXmppStream* stream);
static void xmpp_presence_module_on_received_presence_stanza (XmppPresenceModule* self,
                                                       XmppXmppStream* stream,
                                                       XmppStanzaNode* node);
static void _xmpp_presence_module_on_received_presence_stanza_xmpp_xmpp_stream_received_presence_stanza (XmppXmppStream* _sender,
                                                                                                  XmppXmppStream* stream,
                                                                                                  XmppStanzaNode* node,
                                                                                                  gpointer self);
static void xmpp_presence_module_on_stream_negotiated (XmppPresenceModule* self,
                                                XmppXmppStream* stream);
static void _xmpp_presence_module_on_stream_negotiated_xmpp_xmpp_stream_stream_negotiated (XmppXmppStream* _sender,
                                                                                    XmppXmppStream* stream,
                                                                                    gpointer self);
static void xmpp_presence_module_real_detach (XmppXmppStreamModule* base,
                                       XmppXmppStream* stream);
static gchar* xmpp_presence_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_presence_module_real_get_id (XmppXmppStreamModule* base);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_STRING (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__OBJECT_XMPP_JID (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data);
static void xmpp_presence_module_finalize (GObject * obj);
static GType xmpp_presence_module_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
xmpp_presence_module_request_subscription (XmppPresenceModule* self,
                                           XmppXmppStream* stream,
                                           XmppJid* bare_jid)
{
	XmppPresenceStanza* presence = NULL;
	XmppPresenceStanza* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (bare_jid != NULL);
	_tmp0_ = xmpp_presence_stanza_new (NULL);
	presence = _tmp0_;
	xmpp_stanza_set_to ((XmppStanza*) presence, bare_jid);
	xmpp_stanza_set_type_ ((XmppStanza*) presence, XMPP_PRESENCE_STANZA_TYPE_SUBSCRIBE);
	xmpp_presence_module_send_presence (self, stream, presence);
	_g_object_unref0 (presence);
}

void
xmpp_presence_module_approve_subscription (XmppPresenceModule* self,
                                           XmppXmppStream* stream,
                                           XmppJid* bare_jid)
{
	XmppPresenceStanza* presence = NULL;
	XmppPresenceStanza* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (bare_jid != NULL);
	_tmp0_ = xmpp_presence_stanza_new (NULL);
	presence = _tmp0_;
	xmpp_stanza_set_to ((XmppStanza*) presence, bare_jid);
	xmpp_stanza_set_type_ ((XmppStanza*) presence, XMPP_PRESENCE_STANZA_TYPE_SUBSCRIBED);
	xmpp_presence_module_send_presence (self, stream, presence);
	_g_object_unref0 (presence);
}

void
xmpp_presence_module_deny_subscription (XmppPresenceModule* self,
                                        XmppXmppStream* stream,
                                        XmppJid* bare_jid)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (bare_jid != NULL);
	xmpp_presence_module_cancel_subscription (self, stream, bare_jid);
}

void
xmpp_presence_module_cancel_subscription (XmppPresenceModule* self,
                                          XmppXmppStream* stream,
                                          XmppJid* bare_jid)
{
	XmppPresenceStanza* presence = NULL;
	XmppPresenceStanza* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (bare_jid != NULL);
	_tmp0_ = xmpp_presence_stanza_new (NULL);
	presence = _tmp0_;
	xmpp_stanza_set_to ((XmppStanza*) presence, bare_jid);
	xmpp_stanza_set_type_ ((XmppStanza*) presence, XMPP_PRESENCE_STANZA_TYPE_UNSUBSCRIBED);
	xmpp_presence_module_send_presence (self, stream, presence);
	_g_object_unref0 (presence);
}

void
xmpp_presence_module_unsubscribe (XmppPresenceModule* self,
                                  XmppXmppStream* stream,
                                  XmppJid* bare_jid)
{
	XmppPresenceStanza* presence = NULL;
	XmppPresenceStanza* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (bare_jid != NULL);
	_tmp0_ = xmpp_presence_stanza_new (NULL);
	presence = _tmp0_;
	xmpp_stanza_set_to ((XmppStanza*) presence, bare_jid);
	xmpp_stanza_set_type_ ((XmppStanza*) presence, XMPP_PRESENCE_STANZA_TYPE_UNSUBSCRIBE);
	xmpp_presence_module_send_presence (self, stream, presence);
	_g_object_unref0 (presence);
}

void
xmpp_presence_module_send_presence (XmppPresenceModule* self,
                                    XmppXmppStream* stream,
                                    XmppPresenceStanza* presence)
{
	XmppStanzaNode* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (presence != NULL);
	g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_PRE_SEND_PRESENCE_STANZA_SIGNAL], 0, stream, presence);
	_tmp0_ = ((XmppStanza*) presence)->stanza;
	xmpp_xmpp_stream_write (stream, _tmp0_, G_PRIORITY_DEFAULT);
}

static void
_xmpp_presence_module_on_received_presence_stanza_xmpp_xmpp_stream_received_presence_stanza (XmppXmppStream* _sender,
                                                                                             XmppXmppStream* stream,
                                                                                             XmppStanzaNode* node,
                                                                                             gpointer self)
{
	xmpp_presence_module_on_received_presence_stanza ((XmppPresenceModule*) self, stream, node);
}

static void
_xmpp_presence_module_on_stream_negotiated_xmpp_xmpp_stream_stream_negotiated (XmppXmppStream* _sender,
                                                                               XmppXmppStream* stream,
                                                                               gpointer self)
{
	xmpp_presence_module_on_stream_negotiated ((XmppPresenceModule*) self, stream);
}

static void
xmpp_presence_module_real_attach (XmppXmppStreamModule* base,
                                  XmppXmppStream* stream)
{
	XmppPresenceModule * self;
	XmppPresenceFlag* _tmp0_;
	XmppPresenceFlag* _tmp1_;
	self = (XmppPresenceModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_presence_flag_new ();
	_tmp1_ = _tmp0_;
	xmpp_xmpp_stream_add_flag (stream, (XmppXmppStreamFlag*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	g_signal_connect_object (stream, "received-presence-stanza", (GCallback) _xmpp_presence_module_on_received_presence_stanza_xmpp_xmpp_stream_received_presence_stanza, self, 0);
	g_signal_connect_object (stream, "stream-negotiated", (GCallback) _xmpp_presence_module_on_stream_negotiated_xmpp_xmpp_stream_stream_negotiated, self, 0);
}

static void
xmpp_presence_module_real_detach (XmppXmppStreamModule* base,
                                  XmppXmppStream* stream)
{
	XmppPresenceModule * self;
	guint _tmp0_;
	guint _tmp1_;
	self = (XmppPresenceModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_parse_name ("received-presence-stanza", XMPP_TYPE_XMPP_STREAM, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (stream, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _xmpp_presence_module_on_received_presence_stanza_xmpp_xmpp_stream_received_presence_stanza, self);
	g_signal_parse_name ("stream-negotiated", XMPP_TYPE_XMPP_STREAM, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (stream, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _xmpp_presence_module_on_stream_negotiated_xmpp_xmpp_stream_stream_negotiated, self);
}

static void
xmpp_presence_module_on_received_presence_stanza (XmppPresenceModule* self,
                                                  XmppXmppStream* stream,
                                                  XmppStanzaNode* node)
{
	XmppPresenceStanza* presence = NULL;
	XmppFlagIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppBindFlag* _tmp2_;
	XmppJid* _tmp3_;
	XmppPresenceStanza* _tmp4_;
	XmppPresenceStanza* _tmp5_;
	XmppPresenceStanza* _tmp6_;
	XmppPresenceStanza* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GQuark _tmp12_ = 0U;
	static GQuark _tmp11_label0 = 0;
	static GQuark _tmp11_label1 = 0;
	static GQuark _tmp11_label2 = 0;
	static GQuark _tmp11_label3 = 0;
	static GQuark _tmp11_label4 = 0;
	static GQuark _tmp11_label5 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = xmpp_bind_flag_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_flag (stream, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppBindFlag*) _tmp1_;
	_tmp3_ = _tmp2_->my_jid;
	_tmp4_ = xmpp_presence_stanza_new_from_stanza (node, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	presence = _tmp5_;
	_tmp6_ = presence;
	g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_PRESENCE_SIGNAL], 0, stream, _tmp6_);
	_tmp7_ = presence;
	_tmp8_ = xmpp_stanza_get_type_ ((XmppStanza*) _tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp12_ = (NULL == _tmp10_) ? 0 : g_quark_from_string (_tmp10_);
	if (_tmp12_ == ((0 != _tmp11_label0) ? _tmp11_label0 : (_tmp11_label0 = g_quark_from_static_string (XMPP_PRESENCE_STANZA_TYPE_AVAILABLE)))) {
		switch (0) {
			default:
			{
				XmppFlagIdentity* _tmp13_;
				gpointer _tmp14_;
				XmppPresenceFlag* _tmp15_;
				XmppPresenceStanza* _tmp16_;
				XmppPresenceStanza* _tmp17_;
				XmppPresenceStanza* _tmp18_;
				XmppJid* _tmp19_;
				XmppJid* _tmp20_;
				XmppJid* _tmp21_;
				XmppPresenceStanza* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				_tmp13_ = xmpp_presence_flag_IDENTITY;
				_tmp14_ = xmpp_xmpp_stream_get_flag (stream, XMPP_PRESENCE_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp13_);
				_tmp15_ = (XmppPresenceFlag*) _tmp14_;
				_tmp16_ = presence;
				xmpp_presence_flag_add_presence (_tmp15_, _tmp16_);
				_g_object_unref0 (_tmp15_);
				_tmp17_ = presence;
				g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_AVAILABLE_SIGNAL], 0, stream, _tmp17_);
				_tmp18_ = presence;
				_tmp19_ = xmpp_stanza_get_from ((XmppStanza*) _tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = _tmp20_;
				_tmp22_ = presence;
				_tmp23_ = xmpp_presence_stanza_get_show (_tmp22_);
				_tmp24_ = _tmp23_;
				g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_AVAILABLE_SHOW_SIGNAL], 0, stream, _tmp21_, _tmp24_);
				_xmpp_jid_unref0 (_tmp21_);
				break;
			}
		}
	} else if (_tmp12_ == ((0 != _tmp11_label1) ? _tmp11_label1 : (_tmp11_label1 = g_quark_from_static_string (XMPP_PRESENCE_STANZA_TYPE_UNAVAILABLE)))) {
		switch (0) {
			default:
			{
				XmppFlagIdentity* _tmp25_;
				gpointer _tmp26_;
				XmppPresenceFlag* _tmp27_;
				XmppPresenceStanza* _tmp28_;
				XmppJid* _tmp29_;
				XmppJid* _tmp30_;
				XmppJid* _tmp31_;
				XmppPresenceStanza* _tmp32_;
				_tmp25_ = xmpp_presence_flag_IDENTITY;
				_tmp26_ = xmpp_xmpp_stream_get_flag (stream, XMPP_PRESENCE_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp25_);
				_tmp27_ = (XmppPresenceFlag*) _tmp26_;
				_tmp28_ = presence;
				_tmp29_ = xmpp_stanza_get_from ((XmppStanza*) _tmp28_);
				_tmp30_ = _tmp29_;
				_tmp31_ = _tmp30_;
				xmpp_presence_flag_remove_presence (_tmp27_, _tmp31_);
				_xmpp_jid_unref0 (_tmp31_);
				_g_object_unref0 (_tmp27_);
				_tmp32_ = presence;
				g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_UNAVAILABLE_SIGNAL], 0, stream, _tmp32_);
				break;
			}
		}
	} else if (_tmp12_ == ((0 != _tmp11_label2) ? _tmp11_label2 : (_tmp11_label2 = g_quark_from_static_string (XMPP_PRESENCE_STANZA_TYPE_SUBSCRIBE)))) {
		switch (0) {
			default:
			{
				XmppPresenceStanza* _tmp33_;
				XmppJid* _tmp34_;
				XmppJid* _tmp35_;
				XmppJid* _tmp36_;
				_tmp33_ = presence;
				_tmp34_ = xmpp_stanza_get_from ((XmppStanza*) _tmp33_);
				_tmp35_ = _tmp34_;
				_tmp36_ = _tmp35_;
				g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_SUBSCRIPTION_REQUEST_SIGNAL], 0, stream, _tmp36_);
				_xmpp_jid_unref0 (_tmp36_);
				break;
			}
		}
	} else if (_tmp12_ == ((0 != _tmp11_label3) ? _tmp11_label3 : (_tmp11_label3 = g_quark_from_static_string (XMPP_PRESENCE_STANZA_TYPE_SUBSCRIBED)))) {
		switch (0) {
			default:
			{
				XmppPresenceStanza* _tmp37_;
				XmppJid* _tmp38_;
				XmppJid* _tmp39_;
				XmppJid* _tmp40_;
				_tmp37_ = presence;
				_tmp38_ = xmpp_stanza_get_from ((XmppStanza*) _tmp37_);
				_tmp39_ = _tmp38_;
				_tmp40_ = _tmp39_;
				g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_SUBSCRIPTION_APPROVAL_SIGNAL], 0, stream, _tmp40_);
				_xmpp_jid_unref0 (_tmp40_);
				break;
			}
		}
	} else if (_tmp12_ == ((0 != _tmp11_label4) ? _tmp11_label4 : (_tmp11_label4 = g_quark_from_static_string (XMPP_PRESENCE_STANZA_TYPE_UNSUBSCRIBE)))) {
		switch (0) {
			default:
			{
				XmppFlagIdentity* _tmp41_;
				gpointer _tmp42_;
				XmppPresenceFlag* _tmp43_;
				XmppPresenceStanza* _tmp44_;
				XmppJid* _tmp45_;
				XmppJid* _tmp46_;
				XmppJid* _tmp47_;
				XmppPresenceStanza* _tmp48_;
				XmppJid* _tmp49_;
				XmppJid* _tmp50_;
				XmppJid* _tmp51_;
				_tmp41_ = xmpp_presence_flag_IDENTITY;
				_tmp42_ = xmpp_xmpp_stream_get_flag (stream, XMPP_PRESENCE_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp41_);
				_tmp43_ = (XmppPresenceFlag*) _tmp42_;
				_tmp44_ = presence;
				_tmp45_ = xmpp_stanza_get_from ((XmppStanza*) _tmp44_);
				_tmp46_ = _tmp45_;
				_tmp47_ = _tmp46_;
				xmpp_presence_flag_remove_presence (_tmp43_, _tmp47_);
				_xmpp_jid_unref0 (_tmp47_);
				_g_object_unref0 (_tmp43_);
				_tmp48_ = presence;
				_tmp49_ = xmpp_stanza_get_from ((XmppStanza*) _tmp48_);
				_tmp50_ = _tmp49_;
				_tmp51_ = _tmp50_;
				g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_UNSUBSCRIPTION_SIGNAL], 0, stream, _tmp51_);
				_xmpp_jid_unref0 (_tmp51_);
				break;
			}
		}
	} else if (_tmp12_ == ((0 != _tmp11_label5) ? _tmp11_label5 : (_tmp11_label5 = g_quark_from_static_string (XMPP_PRESENCE_STANZA_TYPE_UNSUBSCRIBED)))) {
		switch (0) {
			default:
			{
				break;
			}
		}
	}
	_g_object_unref0 (presence);
}

static void
xmpp_presence_module_on_stream_negotiated (XmppPresenceModule* self,
                                           XmppXmppStream* stream)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	if (self->available_resource) {
		XmppPresenceStanza* presence = NULL;
		XmppPresenceStanza* _tmp0_;
		XmppPresenceStanza* _tmp1_;
		XmppPresenceStanza* _tmp2_;
		_tmp0_ = xmpp_presence_stanza_new (NULL);
		presence = _tmp0_;
		_tmp1_ = presence;
		xmpp_presence_module_send_presence (self, stream, _tmp1_);
		_tmp2_ = presence;
		g_signal_emit (self, xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_INITIAL_PRESENCE_SENT_SIGNAL], 0, stream, _tmp2_);
		_g_object_unref0 (presence);
	}
}

static gchar*
xmpp_presence_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppPresenceModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppPresenceModule*) base;
	_tmp0_ = g_strdup (XMPP_PRESENCE_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_presence_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppPresenceModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppPresenceModule*) base;
	_tmp0_ = xmpp_presence_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppPresenceModule*
xmpp_presence_module_construct (GType object_type)
{
	XmppPresenceModule * self = NULL;
	self = (XmppPresenceModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppPresenceModule*
xmpp_presence_module_new (void)
{
	return xmpp_presence_module_construct (XMPP_PRESENCE_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_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__OBJECT_XMPP_JID_STRING) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_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__OBJECT_XMPP_JID_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), xmpp_value_get_jid (param_values + 2), g_value_get_string (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_XMPP_JID) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_XMPP_JID callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_XMPP_JID) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), xmpp_value_get_jid (param_values + 2), data2);
}

static void
xmpp_presence_module_class_init (XmppPresenceModuleClass * klass,
                                 gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_presence_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_presence_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_presence_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_presence_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_presence_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_presence_module_finalize;
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_PRESENCE_SIGNAL] = g_signal_new ("received-presence", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_PRESENCE_TYPE_STANZA);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_PRE_SEND_PRESENCE_STANZA_SIGNAL] = g_signal_new ("pre-send-presence-stanza", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_PRESENCE_TYPE_STANZA);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_INITIAL_PRESENCE_SENT_SIGNAL] = g_signal_new ("initial-presence-sent", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_PRESENCE_TYPE_STANZA);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_AVAILABLE_SIGNAL] = g_signal_new ("received-available", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_PRESENCE_TYPE_STANZA);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_AVAILABLE_SHOW_SIGNAL] = g_signal_new ("received-available-show", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_STRING, G_TYPE_NONE, 3, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID, G_TYPE_STRING);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_UNAVAILABLE_SIGNAL] = g_signal_new ("received-unavailable", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_PRESENCE_TYPE_STANZA);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_SUBSCRIPTION_REQUEST_SIGNAL] = g_signal_new ("received-subscription-request", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_SUBSCRIPTION_APPROVAL_SIGNAL] = g_signal_new ("received-subscription-approval", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID);
	xmpp_presence_module_signals[XMPP_PRESENCE_MODULE_RECEIVED_UNSUBSCRIPTION_SIGNAL] = g_signal_new ("received-unsubscription", XMPP_PRESENCE_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID);
	_tmp0_ = xmpp_module_identity_new (XMPP_PRESENCE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_PRESENCE_NS_URI, "presence_module");
	xmpp_presence_module_IDENTITY = _tmp0_;
}

static void
xmpp_presence_module_instance_init (XmppPresenceModule * self,
                                    gpointer klass)
{
	self->available_resource = TRUE;
}

static void
xmpp_presence_module_finalize (GObject * obj)
{
	XmppPresenceModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_PRESENCE_TYPE_MODULE, XmppPresenceModule);
	G_OBJECT_CLASS (xmpp_presence_module_parent_class)->finalize (obj);
}

static GType
xmpp_presence_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppPresenceModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_presence_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppPresenceModule), 0, (GInstanceInitFunc) xmpp_presence_module_instance_init, NULL };
	GType xmpp_presence_module_type_id;
	xmpp_presence_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppPresenceModule", &g_define_type_info, 0);
	return xmpp_presence_module_type_id;
}

GType
xmpp_presence_module_get_type (void)
{
	static volatile gsize xmpp_presence_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_presence_module_type_id__once)) {
		GType xmpp_presence_module_type_id;
		xmpp_presence_module_type_id = xmpp_presence_module_get_type_once ();
		g_once_init_leave (&xmpp_presence_module_type_id__once, xmpp_presence_module_type_id);
	}
	return xmpp_presence_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;
}

