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

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

#define XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI "urn:xmpp:receipts"
#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_MESSAGE_DELIVERY_RECEIPTS_MODULE_0_PROPERTY,
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_message_delivery_receipts_module_properties[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#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)))
enum  {
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_RECEIPT_RECEIVED_SIGNAL,
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_NUM_SIGNALS
};
static guint xmpp_xep_message_delivery_receipts_module_signals[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_NUM_SIGNALS] = {0};
enum  {
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_0_PROPERTY,
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY,
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY,
	XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_message_delivery_receipts_send_pipeline_listener_properties[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_NUM_PROPERTIES];
typedef struct _XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData;

struct _XmppXepMessageDeliveryReceiptsModulePrivate {
	XmppXepMessageDeliveryReceiptsSendPipelineListener* send_pipeline_listener;
};

struct _XmppXepMessageDeliveryReceiptsSendPipelineListenerPrivate {
	gchar** after_actions_const;
	gint after_actions_const_length1;
	gint _after_actions_const_size_;
};

struct _XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepMessageDeliveryReceiptsSendPipelineListener* self;
	XmppXmppStream* stream;
	XmppMessageStanza* message;
	gboolean result;
	XmppStanzaNode* received_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
};

static gint XmppXepMessageDeliveryReceiptsModule_private_offset;
static gpointer xmpp_xep_message_delivery_receipts_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_message_delivery_receipts_module_IDENTITY = NULL;
static gint XmppXepMessageDeliveryReceiptsSendPipelineListener_private_offset;
static gpointer xmpp_xep_message_delivery_receipts_send_pipeline_listener_parent_class = NULL;

static void xmpp_xep_message_delivery_receipts_module_real_attach (XmppXmppStreamModule* base,
                                                            XmppXmppStream* stream);
static void xmpp_xep_message_delivery_receipts_module_received_message (XmppXepMessageDeliveryReceiptsModule* self,
                                                                 XmppXmppStream* stream,
                                                                 XmppMessageStanza* message);
static void _xmpp_xep_message_delivery_receipts_module_received_message_xmpp_message_module_received_message (XmppMessageModule* _sender,
                                                                                                       XmppXmppStream* stream,
                                                                                                       XmppMessageStanza* message,
                                                                                                       gpointer self);
static void xmpp_xep_message_delivery_receipts_module_real_detach (XmppXmppStreamModule* base,
                                                            XmppXmppStream* stream);
static gchar* xmpp_xep_message_delivery_receipts_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_message_delivery_receipts_module_real_get_id (XmppXmppStreamModule* base);
static void g_cclosure_user_marshal_VOID__OBJECT_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 xmpp_xep_message_delivery_receipts_module_finalize (GObject * obj);
static GType xmpp_xep_message_delivery_receipts_module_get_type_once (void);
static void xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run_data_free (gpointer _data);
static void xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run (XmppStanzaListener* base,
                                                                         XmppXmppStream* stream,
                                                                         XmppMessageStanza* message,
                                                                         GAsyncReadyCallback _callback_,
                                                                         gpointer _user_data_);
static gboolean xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run_co (XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData* _data_);
static void xmpp_xep_message_delivery_receipts_send_pipeline_listener_finalize (GObject * obj);
static GType xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_type_once (void);
static void _vala_xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_property (GObject * object,
                                                                                   guint property_id,
                                                                                   GValue * value,
                                                                                   GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_message_delivery_receipts_module_get_instance_private (XmppXepMessageDeliveryReceiptsModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepMessageDeliveryReceiptsModule_private_offset);
}

void
xmpp_xep_message_delivery_receipts_module_send_received (XmppXepMessageDeliveryReceiptsModule* self,
                                                         XmppXmppStream* stream,
                                                         XmppJid* from,
                                                         const gchar* message_id)
{
	XmppMessageStanza* received_message = NULL;
	XmppMessageStanza* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppModuleIdentity* _tmp10_;
	gpointer _tmp11_;
	XmppMessageModule* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (from != NULL);
	g_return_if_fail (message_id != NULL);
	_tmp0_ = xmpp_message_stanza_new (NULL);
	received_message = _tmp0_;
	xmpp_stanza_set_to ((XmppStanza*) received_message, from);
	_tmp1_ = ((XmppStanza*) received_message)->stanza;
	_tmp2_ = xmpp_stanza_node_new_build ("received", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI, NULL, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_add_self_xmlns (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp5_, "id", message_id, NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_put_node (_tmp1_, _tmp7_);
	_tmp9_ = _tmp8_;
	_xmpp_stanza_entry_unref0 (_tmp9_);
	_xmpp_stanza_entry_unref0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp5_);
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_tmp10_ = xmpp_message_module_IDENTITY;
	_tmp11_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp10_);
	_tmp12_ = (XmppMessageModule*) _tmp11_;
	xmpp_message_module_send_message (_tmp12_, stream, received_message, NULL, NULL);
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (received_message);
}

gboolean
xmpp_xep_message_delivery_receipts_module_requests_receipt (XmppMessageStanza* message)
{
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (message != NULL, FALSE);
	_tmp0_ = ((XmppStanza*) message)->stanza;
	_tmp1_ = xmpp_stanza_node_get_subnode (_tmp0_, "request", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI, FALSE);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_xmpp_stanza_entry_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
_xmpp_xep_message_delivery_receipts_module_received_message_xmpp_message_module_received_message (XmppMessageModule* _sender,
                                                                                                  XmppXmppStream* stream,
                                                                                                  XmppMessageStanza* message,
                                                                                                  gpointer self)
{
	xmpp_xep_message_delivery_receipts_module_received_message ((XmppXepMessageDeliveryReceiptsModule*) self, stream, message);
}

static void
xmpp_xep_message_delivery_receipts_module_real_attach (XmppXmppStreamModule* base,
                                                       XmppXmppStream* stream)
{
	XmppXepMessageDeliveryReceiptsModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppMessageModule* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppMessageModule* _tmp8_;
	XmppStanzaListenerHolder* _tmp9_;
	XmppXepMessageDeliveryReceiptsSendPipelineListener* _tmp10_;
	self = (XmppXepMessageDeliveryReceiptsModule*) 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_MESSAGE_DELIVERY_RECEIPTS_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_message_delivery_receipts_module_received_message_xmpp_message_module_received_message, self, 0);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = xmpp_message_module_IDENTITY;
	_tmp7_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp6_);
	_tmp8_ = (XmppMessageModule*) _tmp7_;
	_tmp9_ = _tmp8_->send_pipeline;
	_tmp10_ = self->priv->send_pipeline_listener;
	xmpp_listener_holder_connect ((XmppListenerHolder*) _tmp9_, (XmppOrderedListener*) _tmp10_);
	_g_object_unref0 (_tmp8_);
}

static void
xmpp_xep_message_delivery_receipts_module_real_detach (XmppXmppStreamModule* base,
                                                       XmppXmppStream* stream)
{
	XmppXepMessageDeliveryReceiptsModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppMessageModule* _tmp5_;
	guint _tmp6_;
	XmppModuleIdentity* _tmp7_;
	gpointer _tmp8_;
	XmppMessageModule* _tmp9_;
	XmppStanzaListenerHolder* _tmp10_;
	XmppXepMessageDeliveryReceiptsSendPipelineListener* _tmp11_;
	self = (XmppXepMessageDeliveryReceiptsModule*) 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_MESSAGE_DELIVERY_RECEIPTS_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_message_delivery_receipts_module_received_message_xmpp_message_module_received_message, self);
	_g_object_unref0 (_tmp5_);
	_tmp7_ = xmpp_message_module_IDENTITY;
	_tmp8_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp7_);
	_tmp9_ = (XmppMessageModule*) _tmp8_;
	_tmp10_ = _tmp9_->send_pipeline;
	_tmp11_ = self->priv->send_pipeline_listener;
	xmpp_listener_holder_disconnect ((XmppListenerHolder*) _tmp10_, (XmppOrderedListener*) _tmp11_);
	_g_object_unref0 (_tmp9_);
}

static gchar*
xmpp_xep_message_delivery_receipts_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepMessageDeliveryReceiptsModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepMessageDeliveryReceiptsModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_message_delivery_receipts_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepMessageDeliveryReceiptsModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepMessageDeliveryReceiptsModule*) base;
	_tmp0_ = xmpp_xep_message_delivery_receipts_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_xep_message_delivery_receipts_module_received_message (XmppXepMessageDeliveryReceiptsModule* self,
                                                            XmppXmppStream* stream,
                                                            XmppMessageStanza* message)
{
	XmppStanzaNode* received_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = ((XmppStanza*) message)->stanza;
	_tmp1_ = xmpp_stanza_node_get_subnode (_tmp0_, "received", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI, FALSE);
	received_node = _tmp1_;
	_tmp2_ = received_node;
	if (_tmp2_ != NULL) {
		XmppJid* _tmp3_;
		XmppJid* _tmp4_;
		XmppJid* _tmp5_;
		XmppStanzaNode* _tmp6_;
		const gchar* _tmp7_;
		_tmp3_ = xmpp_stanza_get_from ((XmppStanza*) message);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = received_node;
		_tmp7_ = xmpp_stanza_node_get_attribute (_tmp6_, "id", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI);
		g_signal_emit (self, xmpp_xep_message_delivery_receipts_module_signals[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_RECEIPT_RECEIVED_SIGNAL], 0, stream, _tmp5_, _tmp7_, message);
		_xmpp_jid_unref0 (_tmp5_);
	}
	_xmpp_stanza_entry_unref0 (received_node);
}

XmppXepMessageDeliveryReceiptsModule*
xmpp_xep_message_delivery_receipts_module_construct (GType object_type)
{
	XmppXepMessageDeliveryReceiptsModule * self = NULL;
	self = (XmppXepMessageDeliveryReceiptsModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepMessageDeliveryReceiptsModule*
xmpp_xep_message_delivery_receipts_module_new (void)
{
	return xmpp_xep_message_delivery_receipts_module_construct (XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_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__OBJECT_XMPP_JID_STRING_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, gpointer arg_4, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_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__OBJECT_XMPP_JID_STRING_OBJECT) (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), g_value_get_object (param_values + 4), data2);
}

static void
xmpp_xep_message_delivery_receipts_module_class_init (XmppXepMessageDeliveryReceiptsModuleClass * klass,
                                                      gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_message_delivery_receipts_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepMessageDeliveryReceiptsModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_message_delivery_receipts_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_message_delivery_receipts_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_message_delivery_receipts_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_message_delivery_receipts_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_message_delivery_receipts_module_finalize;
	xmpp_xep_message_delivery_receipts_module_signals[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_MODULE_RECEIPT_RECEIVED_SIGNAL] = g_signal_new ("receipt-received", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_STRING_OBJECT, G_TYPE_NONE, 4, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID, G_TYPE_STRING, XMPP_TYPE_MESSAGE_STANZA);
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI, "0184_message_delivery_receipts");
	xmpp_xep_message_delivery_receipts_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_message_delivery_receipts_module_instance_init (XmppXepMessageDeliveryReceiptsModule * self,
                                                         gpointer klass)
{
	XmppXepMessageDeliveryReceiptsSendPipelineListener* _tmp0_;
	self->priv = xmpp_xep_message_delivery_receipts_module_get_instance_private (self);
	_tmp0_ = xmpp_xep_message_delivery_receipts_send_pipeline_listener_new ();
	self->priv->send_pipeline_listener = _tmp0_;
}

static void
xmpp_xep_message_delivery_receipts_module_finalize (GObject * obj)
{
	XmppXepMessageDeliveryReceiptsModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_MODULE, XmppXepMessageDeliveryReceiptsModule);
	_g_object_unref0 (self->priv->send_pipeline_listener);
	G_OBJECT_CLASS (xmpp_xep_message_delivery_receipts_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_message_delivery_receipts_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepMessageDeliveryReceiptsModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_message_delivery_receipts_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepMessageDeliveryReceiptsModule), 0, (GInstanceInitFunc) xmpp_xep_message_delivery_receipts_module_instance_init, NULL };
	GType xmpp_xep_message_delivery_receipts_module_type_id;
	xmpp_xep_message_delivery_receipts_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepMessageDeliveryReceiptsModule", &g_define_type_info, 0);
	XmppXepMessageDeliveryReceiptsModule_private_offset = g_type_add_instance_private (xmpp_xep_message_delivery_receipts_module_type_id, sizeof (XmppXepMessageDeliveryReceiptsModulePrivate));
	return xmpp_xep_message_delivery_receipts_module_type_id;
}

GType
xmpp_xep_message_delivery_receipts_module_get_type (void)
{
	static volatile gsize xmpp_xep_message_delivery_receipts_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_message_delivery_receipts_module_type_id__once)) {
		GType xmpp_xep_message_delivery_receipts_module_type_id;
		xmpp_xep_message_delivery_receipts_module_type_id = xmpp_xep_message_delivery_receipts_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_message_delivery_receipts_module_type_id__once, xmpp_xep_message_delivery_receipts_module_type_id);
	}
	return xmpp_xep_message_delivery_receipts_module_type_id__once;
}

static inline gpointer
xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_instance_private (XmppXepMessageDeliveryReceiptsSendPipelineListener* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepMessageDeliveryReceiptsSendPipelineListener_private_offset);
}

static void
xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run_data_free (gpointer _data)
{
	XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->message);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData, _data_);
}

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

static void
xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run (XmppStanzaListener* base,
                                                                    XmppXmppStream* stream,
                                                                    XmppMessageStanza* message,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_)
{
	XmppXepMessageDeliveryReceiptsSendPipelineListener * self;
	XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData* _data_;
	XmppXepMessageDeliveryReceiptsSendPipelineListener* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppMessageStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	self = (XmppXepMessageDeliveryReceiptsSendPipelineListener*) base;
	_data_ = g_slice_new0 (XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _g_object_ref0 (message);
	_g_object_unref0 (_data_->message);
	_data_->message = _tmp2_;
	xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run_co (_data_);
}

static gboolean
xmpp_xep_message_delivery_receipts_send_pipeline_listener_run_finish (XmppStanzaListener* base,
                                                                      GAsyncResult* _res_)
{
	gboolean result;
	XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static gboolean
xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run_co (XmppXepMessageDeliveryReceiptsSendPipelineListenerRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((XmppStanza*) _data_->message)->stanza;
	_data_->_tmp1_ = xmpp_stanza_node_get_subnode (_data_->_tmp0_, "received", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI, FALSE);
	_data_->received_node = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->received_node;
	if (_data_->_tmp2_ != NULL) {
		_data_->result = FALSE;
		_xmpp_stanza_entry_unref0 (_data_->received_node);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = xmpp_message_stanza_get_body (_data_->message);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (_data_->_tmp4_ == NULL) {
		_data_->result = FALSE;
		_xmpp_stanza_entry_unref0 (_data_->received_node);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = xmpp_stanza_get_type_ ((XmppStanza*) _data_->message);
	_data_->_tmp6_ = _data_->_tmp5_;
	if (g_strcmp0 (_data_->_tmp6_, XMPP_MESSAGE_STANZA_TYPE_GROUPCHAT) == 0) {
		_data_->result = FALSE;
		_xmpp_stanza_entry_unref0 (_data_->received_node);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp7_ = ((XmppStanza*) _data_->message)->stanza;
	_data_->_tmp8_ = xmpp_stanza_node_new_build ("request", XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_NS_URI, NULL, NULL);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = xmpp_stanza_node_put_node (_data_->_tmp7_, _data_->_tmp11_);
	_data_->_tmp13_ = _data_->_tmp12_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp13_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp11_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp9_);
	_data_->result = FALSE;
	_xmpp_stanza_entry_unref0 (_data_->received_node);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

XmppXepMessageDeliveryReceiptsSendPipelineListener*
xmpp_xep_message_delivery_receipts_send_pipeline_listener_construct (GType object_type)
{
	XmppXepMessageDeliveryReceiptsSendPipelineListener * self = NULL;
	self = (XmppXepMessageDeliveryReceiptsSendPipelineListener*) xmpp_stanza_listener_construct (object_type, XMPP_TYPE_MESSAGE_STANZA, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	return self;
}

XmppXepMessageDeliveryReceiptsSendPipelineListener*
xmpp_xep_message_delivery_receipts_send_pipeline_listener_new (void)
{
	return xmpp_xep_message_delivery_receipts_send_pipeline_listener_construct (XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_SEND_PIPELINE_LISTENER);
}

static const gchar*
xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_get_action_group (XmppOrderedListener* base)
{
	const gchar* result;
	XmppXepMessageDeliveryReceiptsSendPipelineListener* self;
	self = (XmppXepMessageDeliveryReceiptsSendPipelineListener*) base;
	result = "ADD_NODES";
	return result;
}

static gchar**
xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_get_after_actions (XmppOrderedListener* base,
                                                                                  gint* result_length1)
{
	gchar** result;
	XmppXepMessageDeliveryReceiptsSendPipelineListener* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	self = (XmppXepMessageDeliveryReceiptsSendPipelineListener*) base;
	_tmp0_ = self->priv->after_actions_const;
	_tmp0__length1 = self->priv->after_actions_const_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static void
xmpp_xep_message_delivery_receipts_send_pipeline_listener_class_init (XmppXepMessageDeliveryReceiptsSendPipelineListenerClass * klass,
                                                                      gpointer klass_data)
{
	xmpp_xep_message_delivery_receipts_send_pipeline_listener_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepMessageDeliveryReceiptsSendPipelineListener_private_offset);
	((XmppStanzaListenerClass *) klass)->run = (void (*) (XmppStanzaListener*, XmppXmppStream*, gconstpointer, GAsyncReadyCallback, gpointer)) xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_run;
	((XmppStanzaListenerClass *) klass)->run_finish = (gboolean (*) (XmppStanzaListener*, GAsyncResult*)) xmpp_xep_message_delivery_receipts_send_pipeline_listener_run_finish;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_action_group = (const gchar* (*) (XmppOrderedListener*)) xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_get_action_group;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_after_actions = (gchar** (*) (XmppOrderedListener*, gint*)) xmpp_xep_message_delivery_receipts_send_pipeline_listener_real_get_after_actions;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_message_delivery_receipts_send_pipeline_listener_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY, xmpp_xep_message_delivery_receipts_send_pipeline_listener_properties[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY] = g_param_spec_string ("action-group", "action-group", "action-group", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY, xmpp_xep_message_delivery_receipts_send_pipeline_listener_properties[XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY] = g_param_spec_boxed ("after-actions", "after-actions", "after-actions", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_message_delivery_receipts_send_pipeline_listener_instance_init (XmppXepMessageDeliveryReceiptsSendPipelineListener * self,
                                                                         gpointer klass)
{
	gchar** _tmp0_;
	self->priv = xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_instance_private (self);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	self->priv->after_actions_const = _tmp0_;
	self->priv->after_actions_const_length1 = 0;
	self->priv->_after_actions_const_size_ = self->priv->after_actions_const_length1;
}

static void
xmpp_xep_message_delivery_receipts_send_pipeline_listener_finalize (GObject * obj)
{
	XmppXepMessageDeliveryReceiptsSendPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_SEND_PIPELINE_LISTENER, XmppXepMessageDeliveryReceiptsSendPipelineListener);
	self->priv->after_actions_const = (_vala_array_free (self->priv->after_actions_const, self->priv->after_actions_const_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (xmpp_xep_message_delivery_receipts_send_pipeline_listener_parent_class)->finalize (obj);
}

static GType
xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepMessageDeliveryReceiptsSendPipelineListenerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_message_delivery_receipts_send_pipeline_listener_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepMessageDeliveryReceiptsSendPipelineListener), 0, (GInstanceInitFunc) xmpp_xep_message_delivery_receipts_send_pipeline_listener_instance_init, NULL };
	GType xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id;
	xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id = g_type_register_static (XMPP_TYPE_STANZA_LISTENER, "XmppXepMessageDeliveryReceiptsSendPipelineListener", &g_define_type_info, 0);
	XmppXepMessageDeliveryReceiptsSendPipelineListener_private_offset = g_type_add_instance_private (xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id, sizeof (XmppXepMessageDeliveryReceiptsSendPipelineListenerPrivate));
	return xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id;
}

GType
xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_type (void)
{
	static volatile gsize xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id__once)) {
		GType xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id;
		xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id = xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_type_once ();
		g_once_init_leave (&xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id__once, xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id);
	}
	return xmpp_xep_message_delivery_receipts_send_pipeline_listener_type_id__once;
}

static void
_vala_xmpp_xep_message_delivery_receipts_send_pipeline_listener_get_property (GObject * object,
                                                                              guint property_id,
                                                                              GValue * value,
                                                                              GParamSpec * pspec)
{
	XmppXepMessageDeliveryReceiptsSendPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_TYPE_SEND_PIPELINE_LISTENER, XmppXepMessageDeliveryReceiptsSendPipelineListener);
	switch (property_id) {
		case XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY:
		g_value_set_string (value, xmpp_ordered_listener_get_action_group ((XmppOrderedListener*) self));
		break;
		case XMPP_XEP_MESSAGE_DELIVERY_RECEIPTS_SEND_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, xmpp_ordered_listener_get_after_actions ((XmppOrderedListener*) self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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;
}

