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

#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.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_REACTIONS_MODULE_0_PROPERTY,
	XMPP_XEP_REACTIONS_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_reactions_module_properties[XMPP_XEP_REACTIONS_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)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppXepReactionsModuleSendReactionData XmppXepReactionsModuleSendReactionData;
enum  {
	XMPP_XEP_REACTIONS_MODULE_RECEIVED_REACTIONS_SIGNAL,
	XMPP_XEP_REACTIONS_MODULE_NUM_SIGNALS
};
static guint xmpp_xep_reactions_module_signals[XMPP_XEP_REACTIONS_MODULE_NUM_SIGNALS] = {0};
enum  {
	XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_0_PROPERTY,
	XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY,
	XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY,
	XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_reactions_received_pipeline_listener_properties[XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_NUM_PROPERTIES];
typedef struct _XmppXepReactionsReceivedPipelineListenerRunData XmppXepReactionsReceivedPipelineListenerRunData;

struct _XmppXepReactionsModulePrivate {
	XmppXepReactionsReceivedPipelineListener* received_pipeline_listener;
};

struct _XmppXepReactionsModuleSendReactionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepReactionsModule* self;
	XmppXmppStream* stream;
	XmppJid* jid;
	gchar* stanza_type;
	gchar* message_id;
	GeeList* reactions;
	XmppStanzaNode* reactions_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	GeeList* _reaction_list;
	gint _reaction_size;
	GeeList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint _reaction_index;
	gint _tmp10_;
	gint _tmp11_;
	gchar* reaction;
	GeeList* _tmp12_;
	gpointer _tmp13_;
	XmppStanzaNode* reaction_node;
	XmppStanzaNode* _tmp14_;
	XmppStanzaNode* _tmp15_;
	const gchar* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppStanzaNode* _tmp23_;
	XmppStanzaNode* _tmp24_;
	XmppMessageStanza* message;
	XmppJid* _tmp25_;
	gchar* _tmp26_;
	XmppMessageStanza* _tmp27_;
	XmppStanzaNode* _tmp28_;
	XmppStanzaNode* _tmp29_;
	XmppStanzaNode* _tmp30_;
	XmppStanzaNode* _tmp31_;
	XmppModuleIdentity* _tmp32_;
	gpointer _tmp33_;
	XmppMessageModule* _tmp34_;
	GError* _inner_error0_;
};

struct _XmppXepReactionsReceivedPipelineListenerRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepReactionsReceivedPipelineListener* self;
	XmppXmppStream* stream;
	XmppMessageStanza* message;
	gboolean result;
	XmppStanzaNode* reactions_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	gchar* id_attribute;
	XmppStanzaNode* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	GeeList* reactions;
	GeeArrayList* _tmp7_;
	GeeList* _reaction_node_list;
	XmppStanzaNode* _tmp8_;
	GeeList* _tmp9_;
	gint _reaction_node_size;
	GeeList* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint _reaction_node_index;
	gint _tmp13_;
	gint _tmp14_;
	XmppStanzaNode* reaction_node;
	GeeList* _tmp15_;
	gpointer _tmp16_;
	gchar* reaction;
	XmppStanzaNode* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	GeeList* _tmp21_;
	const gchar* _tmp22_;
	GeeList* _tmp23_;
	const gchar* _tmp24_;
	XmppModuleIdentity* _tmp25_;
	gpointer _tmp26_;
	XmppXepReactionsModule* _tmp27_;
	XmppJid* _tmp28_;
	XmppJid* _tmp29_;
	XmppJid* _tmp30_;
	const gchar* _tmp31_;
	GeeList* _tmp32_;
};

static gint XmppXepReactionsModule_private_offset;
static gpointer xmpp_xep_reactions_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_reactions_module_IDENTITY = NULL;
static gpointer xmpp_xep_reactions_received_pipeline_listener_parent_class = NULL;

static void xmpp_xep_reactions_module_send_reaction_data_free (gpointer _data);
static gboolean xmpp_xep_reactions_module_send_reaction_co (XmppXepReactionsModuleSendReactionData* _data_);
static void xmpp_xep_reactions_module_send_reaction_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void xmpp_xep_reactions_module_real_attach (XmppXmppStreamModule* base,
                                            XmppXmppStream* stream);
static void xmpp_xep_reactions_module_real_detach (XmppXmppStreamModule* base,
                                            XmppXmppStream* stream);
static gchar* xmpp_xep_reactions_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_reactions_module_real_get_id (XmppXmppStreamModule* base);
static void g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_STRING_OBJECT_OBJECT (GClosure * closure,
                                                                         GValue * return_value,
                                                                         guint n_param_values,
                                                                         const GValue * param_values,
                                                                         gpointer invocation_hint,
                                                                         gpointer marshal_data);
static void xmpp_xep_reactions_module_finalize (GObject * obj);
static GType xmpp_xep_reactions_module_get_type_once (void);
static void xmpp_xep_reactions_received_pipeline_listener_real_run_data_free (gpointer _data);
static void xmpp_xep_reactions_received_pipeline_listener_real_run (XmppStanzaListener* base,
                                                             XmppXmppStream* stream,
                                                             XmppMessageStanza* message,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean xmpp_xep_reactions_received_pipeline_listener_real_run_co (XmppXepReactionsReceivedPipelineListenerRunData* _data_);
static GType xmpp_xep_reactions_received_pipeline_listener_get_type_once (void);
static void _vala_xmpp_xep_reactions_received_pipeline_listener_get_property (GObject * object,
                                                                       guint property_id,
                                                                       GValue * value,
                                                                       GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const gchar* XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_after_actions_const[1] = {"EXTRACT_MESSAGE_2"};

static inline gpointer
xmpp_xep_reactions_module_get_instance_private (XmppXepReactionsModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepReactionsModule_private_offset);
}

static void
xmpp_xep_reactions_module_send_reaction_data_free (gpointer _data)
{
	XmppXepReactionsModuleSendReactionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->jid);
	_g_free0 (_data_->stanza_type);
	_g_free0 (_data_->message_id);
	_g_object_unref0 (_data_->reactions);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepReactionsModuleSendReactionData, _data_);
}

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

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

void
xmpp_xep_reactions_module_send_reaction (XmppXepReactionsModule* self,
                                         XmppXmppStream* stream,
                                         XmppJid* jid,
                                         const gchar* stanza_type,
                                         const gchar* message_id,
                                         GeeList* reactions,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	XmppXepReactionsModuleSendReactionData* _data_;
	XmppXepReactionsModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GeeList* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (stanza_type != NULL);
	g_return_if_fail (message_id != NULL);
	g_return_if_fail (reactions != NULL);
	_data_ = g_slice_new0 (XmppXepReactionsModuleSendReactionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_reactions_module_send_reaction_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (_data_->jid);
	_data_->jid = _tmp2_;
	_tmp3_ = g_strdup (stanza_type);
	_g_free0 (_data_->stanza_type);
	_data_->stanza_type = _tmp3_;
	_tmp4_ = g_strdup (message_id);
	_g_free0 (_data_->message_id);
	_data_->message_id = _tmp4_;
	_tmp5_ = _g_object_ref0 (reactions);
	_g_object_unref0 (_data_->reactions);
	_data_->reactions = _tmp5_;
	xmpp_xep_reactions_module_send_reaction_co (_data_);
}

void
xmpp_xep_reactions_module_send_reaction_finish (XmppXepReactionsModule* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	XmppXepReactionsModuleSendReactionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
xmpp_xep_reactions_module_send_reaction_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	XmppXepReactionsModuleSendReactionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_reactions_module_send_reaction_co (_data_);
}

static gboolean
xmpp_xep_reactions_module_send_reaction_co (XmppXepReactionsModuleSendReactionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_stanza_node_new_build ("reactions", XMPP_XEP_REACTIONS_NS_URI, NULL, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp1_);
	_data_->reactions_node = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->reactions_node;
	_data_->_tmp5_ = xmpp_stanza_node_put_attribute (_data_->_tmp4_, "id", _data_->message_id, NULL);
	_data_->_tmp6_ = _data_->_tmp5_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp6_);
	{
		_data_->_reaction_list = _data_->reactions;
		_data_->_tmp7_ = _data_->_reaction_list;
		_data_->_tmp8_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_reaction_size = _data_->_tmp9_;
		_data_->_reaction_index = -1;
		while (TRUE) {
			_data_->_reaction_index = _data_->_reaction_index + 1;
			_data_->_tmp10_ = _data_->_reaction_index;
			_data_->_tmp11_ = _data_->_reaction_size;
			if (!(_data_->_tmp10_ < _data_->_tmp11_)) {
				break;
			}
			_data_->_tmp12_ = _data_->_reaction_list;
			_data_->_tmp13_ = gee_list_get (_data_->_tmp12_, _data_->_reaction_index);
			_data_->reaction = (gchar*) _data_->_tmp13_;
			_data_->_tmp14_ = xmpp_stanza_node_new_build ("reaction", XMPP_XEP_REACTIONS_NS_URI, NULL, NULL);
			_data_->reaction_node = _data_->_tmp14_;
			_data_->_tmp15_ = _data_->reaction_node;
			_data_->_tmp16_ = _data_->reaction;
			_data_->_tmp17_ = xmpp_stanza_node_new_text (_data_->_tmp16_);
			_data_->_tmp18_ = _data_->_tmp17_;
			_data_->_tmp19_ = xmpp_stanza_node_put_node (_data_->_tmp15_, _data_->_tmp18_);
			_data_->_tmp20_ = _data_->_tmp19_;
			_xmpp_stanza_entry_unref0 (_data_->_tmp20_);
			_xmpp_stanza_entry_unref0 (_data_->_tmp18_);
			_data_->_tmp21_ = _data_->reactions_node;
			_data_->_tmp22_ = _data_->reaction_node;
			_data_->_tmp23_ = xmpp_stanza_node_put_node (_data_->_tmp21_, _data_->_tmp22_);
			_data_->_tmp24_ = _data_->_tmp23_;
			_xmpp_stanza_entry_unref0 (_data_->_tmp24_);
			_xmpp_stanza_entry_unref0 (_data_->reaction_node);
			_g_free0 (_data_->reaction);
		}
	}
	_data_->_tmp25_ = _xmpp_jid_ref0 (_data_->jid);
	_data_->_tmp26_ = g_strdup (_data_->stanza_type);
	_data_->_tmp27_ = NULL;
	_data_->_tmp27_ = xmpp_message_stanza_new (NULL);
	xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp27_, _data_->_tmp25_);
	_xmpp_jid_unref0 (_data_->_tmp25_);
	xmpp_stanza_set_type_ ((XmppStanza*) _data_->_tmp27_, _data_->_tmp26_);
	_g_free0 (_data_->_tmp26_);
	_data_->message = _data_->_tmp27_;
	_data_->_tmp28_ = ((XmppStanza*) _data_->message)->stanza;
	_data_->_tmp29_ = _data_->reactions_node;
	_data_->_tmp30_ = xmpp_stanza_node_put_node (_data_->_tmp28_, _data_->_tmp29_);
	_data_->_tmp31_ = _data_->_tmp30_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp31_);
	xmpp_xep_message_processing_hints_set_message_hint (_data_->message, XMPP_XEP_MESSAGE_PROCESSING_HINTS_HINT_STORE);
	_data_->_tmp32_ = xmpp_message_module_IDENTITY;
	_data_->_tmp33_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp32_);
	_data_->_tmp34_ = (XmppMessageModule*) _data_->_tmp33_;
	_data_->_state_ = 1;
	xmpp_message_module_send_message (_data_->_tmp34_, _data_->stream, _data_->message, xmpp_xep_reactions_module_send_reaction_ready, _data_);
	return FALSE;
	_state_1:
	xmpp_message_module_send_message_finish (_data_->_tmp34_, _data_->_res_, &_data_->_inner_error0_);
	_g_object_unref0 (_data_->_tmp34_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == G_IO_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->message);
			_xmpp_stanza_entry_unref0 (_data_->reactions_node);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->message);
			_xmpp_stanza_entry_unref0 (_data_->reactions_node);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_g_object_unref0 (_data_->message);
	_xmpp_stanza_entry_unref0 (_data_->reactions_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;
}

static void
xmpp_xep_reactions_module_real_attach (XmppXmppStreamModule* base,
                                       XmppXmppStream* stream)
{
	XmppXepReactionsModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppMessageModule* _tmp5_;
	XmppStanzaListenerHolder* _tmp6_;
	XmppXepReactionsReceivedPipelineListener* _tmp7_;
	self = (XmppXepReactionsModule*) 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_REACTIONS_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_;
	_tmp6_ = _tmp5_->received_pipeline;
	_tmp7_ = self->priv->received_pipeline_listener;
	xmpp_listener_holder_connect ((XmppListenerHolder*) _tmp6_, (XmppOrderedListener*) _tmp7_);
	_g_object_unref0 (_tmp5_);
}

static void
xmpp_xep_reactions_module_real_detach (XmppXmppStreamModule* base,
                                       XmppXmppStream* stream)
{
	XmppXepReactionsModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppMessageModule* _tmp5_;
	XmppStanzaListenerHolder* _tmp6_;
	XmppXepReactionsReceivedPipelineListener* _tmp7_;
	self = (XmppXepReactionsModule*) 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_REACTIONS_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_;
	_tmp6_ = _tmp5_->received_pipeline;
	_tmp7_ = self->priv->received_pipeline_listener;
	xmpp_listener_holder_disconnect ((XmppListenerHolder*) _tmp6_, (XmppOrderedListener*) _tmp7_);
	_g_object_unref0 (_tmp5_);
}

static gchar*
xmpp_xep_reactions_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepReactionsModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepReactionsModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_REACTIONS_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_reactions_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepReactionsModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepReactionsModule*) base;
	_tmp0_ = xmpp_xep_reactions_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepReactionsModule*
xmpp_xep_reactions_module_construct (GType object_type)
{
	XmppXepReactionsModule * self = NULL;
	self = (XmppXepReactionsModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepReactionsModule*
xmpp_xep_reactions_module_new (void)
{
	return xmpp_xep_reactions_module_construct (XMPP_XEP_REACTIONS_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_STRING_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_XMPP_JID_STRING_OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, const char* arg_3, gpointer arg_4, gpointer arg_5, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_XMPP_JID_STRING_OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 6);
	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_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), g_value_get_object (param_values + 5), data2);
}

static void
xmpp_xep_reactions_module_class_init (XmppXepReactionsModuleClass * klass,
                                      gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_reactions_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepReactionsModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_reactions_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_reactions_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_reactions_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_reactions_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_reactions_module_finalize;
	xmpp_xep_reactions_module_signals[XMPP_XEP_REACTIONS_MODULE_RECEIVED_REACTIONS_SIGNAL] = g_signal_new ("received-reactions", XMPP_XEP_REACTIONS_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID_STRING_OBJECT_OBJECT, G_TYPE_NONE, 5, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID, G_TYPE_STRING, GEE_TYPE_LIST, XMPP_TYPE_MESSAGE_STANZA);
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_REACTIONS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_REACTIONS_NS_URI, "reactions");
	xmpp_xep_reactions_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_reactions_module_instance_init (XmppXepReactionsModule * self,
                                         gpointer klass)
{
	XmppXepReactionsReceivedPipelineListener* _tmp0_;
	self->priv = xmpp_xep_reactions_module_get_instance_private (self);
	_tmp0_ = xmpp_xep_reactions_received_pipeline_listener_new ();
	self->priv->received_pipeline_listener = _tmp0_;
}

static void
xmpp_xep_reactions_module_finalize (GObject * obj)
{
	XmppXepReactionsModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_REACTIONS_TYPE_MODULE, XmppXepReactionsModule);
	_g_object_unref0 (self->priv->received_pipeline_listener);
	G_OBJECT_CLASS (xmpp_xep_reactions_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_reactions_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepReactionsModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_reactions_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepReactionsModule), 0, (GInstanceInitFunc) xmpp_xep_reactions_module_instance_init, NULL };
	GType xmpp_xep_reactions_module_type_id;
	xmpp_xep_reactions_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepReactionsModule", &g_define_type_info, 0);
	XmppXepReactionsModule_private_offset = g_type_add_instance_private (xmpp_xep_reactions_module_type_id, sizeof (XmppXepReactionsModulePrivate));
	return xmpp_xep_reactions_module_type_id;
}

GType
xmpp_xep_reactions_module_get_type (void)
{
	static volatile gsize xmpp_xep_reactions_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_reactions_module_type_id__once)) {
		GType xmpp_xep_reactions_module_type_id;
		xmpp_xep_reactions_module_type_id = xmpp_xep_reactions_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_reactions_module_type_id__once, xmpp_xep_reactions_module_type_id);
	}
	return xmpp_xep_reactions_module_type_id__once;
}

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

static void
xmpp_xep_reactions_received_pipeline_listener_real_run (XmppStanzaListener* base,
                                                        XmppXmppStream* stream,
                                                        XmppMessageStanza* message,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	XmppXepReactionsReceivedPipelineListener * self;
	XmppXepReactionsReceivedPipelineListenerRunData* _data_;
	XmppXepReactionsReceivedPipelineListener* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppMessageStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	self = (XmppXepReactionsReceivedPipelineListener*) base;
	_data_ = g_slice_new0 (XmppXepReactionsReceivedPipelineListenerRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_reactions_received_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_reactions_received_pipeline_listener_real_run_co (_data_);
}

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

static gboolean
xmpp_xep_reactions_received_pipeline_listener_real_run_co (XmppXepReactionsReceivedPipelineListenerRunData* _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_, "reactions", XMPP_XEP_REACTIONS_NS_URI, FALSE);
	_data_->reactions_node = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->reactions_node;
	if (_data_->_tmp2_ == NULL) {
		_data_->result = FALSE;
		_xmpp_stanza_entry_unref0 (_data_->reactions_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_ = _data_->reactions_node;
	_data_->_tmp4_ = xmpp_stanza_node_get_attribute (_data_->_tmp3_, "id", NULL);
	_data_->_tmp5_ = g_strdup (_data_->_tmp4_);
	_data_->id_attribute = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->id_attribute;
	if (_data_->_tmp6_ == NULL) {
		_data_->result = FALSE;
		_g_free0 (_data_->id_attribute);
		_xmpp_stanza_entry_unref0 (_data_->reactions_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_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_data_->reactions = (GeeList*) _data_->_tmp7_;
	{
		_data_->_tmp8_ = _data_->reactions_node;
		_data_->_tmp9_ = xmpp_stanza_node_get_subnodes (_data_->_tmp8_, "reaction", XMPP_XEP_REACTIONS_NS_URI, FALSE);
		_data_->_reaction_node_list = _data_->_tmp9_;
		_data_->_tmp10_ = _data_->_reaction_node_list;
		_data_->_tmp11_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_reaction_node_size = _data_->_tmp12_;
		_data_->_reaction_node_index = -1;
		while (TRUE) {
			_data_->_reaction_node_index = _data_->_reaction_node_index + 1;
			_data_->_tmp13_ = _data_->_reaction_node_index;
			_data_->_tmp14_ = _data_->_reaction_node_size;
			if (!(_data_->_tmp13_ < _data_->_tmp14_)) {
				break;
			}
			_data_->_tmp15_ = _data_->_reaction_node_list;
			_data_->_tmp16_ = gee_list_get (_data_->_tmp15_, _data_->_reaction_node_index);
			_data_->reaction_node = (XmppStanzaNode*) _data_->_tmp16_;
			_data_->_tmp17_ = _data_->reaction_node;
			_data_->_tmp18_ = xmpp_stanza_entry_get_string_content ((XmppStanzaEntry*) _data_->_tmp17_);
			_data_->_tmp19_ = g_strdup (_data_->_tmp18_);
			_data_->reaction = _data_->_tmp19_;
			_data_->_tmp20_ = _data_->reaction;
			if (_data_->_tmp20_ == NULL) {
				_data_->result = FALSE;
				_g_free0 (_data_->reaction);
				_xmpp_stanza_entry_unref0 (_data_->reaction_node);
				_g_object_unref0 (_data_->_reaction_node_list);
				_g_object_unref0 (_data_->reactions);
				_g_free0 (_data_->id_attribute);
				_xmpp_stanza_entry_unref0 (_data_->reactions_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_->_tmp21_ = _data_->reactions;
			_data_->_tmp22_ = _data_->reaction;
			if (!gee_collection_contains ((GeeCollection*) _data_->_tmp21_, _data_->_tmp22_)) {
				_data_->_tmp23_ = _data_->reactions;
				_data_->_tmp24_ = _data_->reaction;
				gee_collection_add ((GeeCollection*) _data_->_tmp23_, _data_->_tmp24_);
			}
			_g_free0 (_data_->reaction);
			_xmpp_stanza_entry_unref0 (_data_->reaction_node);
		}
		_g_object_unref0 (_data_->_reaction_node_list);
	}
	_data_->_tmp25_ = xmpp_xep_reactions_module_IDENTITY;
	_data_->_tmp26_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_REACTIONS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp25_);
	_data_->_tmp27_ = (XmppXepReactionsModule*) _data_->_tmp26_;
	_data_->_tmp28_ = xmpp_stanza_get_from ((XmppStanza*) _data_->message);
	_data_->_tmp29_ = _data_->_tmp28_;
	_data_->_tmp30_ = _data_->_tmp29_;
	_data_->_tmp31_ = _data_->id_attribute;
	_data_->_tmp32_ = _data_->reactions;
	g_signal_emit (_data_->_tmp27_, xmpp_xep_reactions_module_signals[XMPP_XEP_REACTIONS_MODULE_RECEIVED_REACTIONS_SIGNAL], 0, _data_->stream, _data_->_tmp30_, _data_->_tmp31_, _data_->_tmp32_, _data_->message);
	_xmpp_jid_unref0 (_data_->_tmp30_);
	_g_object_unref0 (_data_->_tmp27_);
	_data_->result = TRUE;
	_g_object_unref0 (_data_->reactions);
	_g_free0 (_data_->id_attribute);
	_xmpp_stanza_entry_unref0 (_data_->reactions_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;
}

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

XmppXepReactionsReceivedPipelineListener*
xmpp_xep_reactions_received_pipeline_listener_new (void)
{
	return xmpp_xep_reactions_received_pipeline_listener_construct (XMPP_XEP_REACTIONS_TYPE_RECEIVED_PIPELINE_LISTENER);
}

static const gchar*
xmpp_xep_reactions_received_pipeline_listener_real_get_action_group (XmppOrderedListener* base)
{
	const gchar* result;
	XmppXepReactionsReceivedPipelineListener* self;
	self = (XmppXepReactionsReceivedPipelineListener*) base;
	result = "";
	return result;
}

static gchar**
xmpp_xep_reactions_received_pipeline_listener_real_get_after_actions (XmppOrderedListener* base,
                                                                      gint* result_length1)
{
	gchar** result;
	XmppXepReactionsReceivedPipelineListener* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	self = (XmppXepReactionsReceivedPipelineListener*) base;
	_tmp0_ = XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_after_actions_const;
	_tmp0__length1 = G_N_ELEMENTS (XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_after_actions_const);
	if (result_length1) {
		*result_length1 = _tmp0__length1;
	}
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_reactions_received_pipeline_listener_class_init (XmppXepReactionsReceivedPipelineListenerClass * klass,
                                                          gpointer klass_data)
{
	xmpp_xep_reactions_received_pipeline_listener_parent_class = g_type_class_peek_parent (klass);
	((XmppStanzaListenerClass *) klass)->run = (void (*) (XmppStanzaListener*, XmppXmppStream*, gconstpointer, GAsyncReadyCallback, gpointer)) xmpp_xep_reactions_received_pipeline_listener_real_run;
	((XmppStanzaListenerClass *) klass)->run_finish = (gboolean (*) (XmppStanzaListener*, GAsyncResult*)) xmpp_xep_reactions_received_pipeline_listener_run_finish;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_action_group = (const gchar* (*) (XmppOrderedListener*)) xmpp_xep_reactions_received_pipeline_listener_real_get_action_group;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_after_actions = (gchar** (*) (XmppOrderedListener*, gint*)) xmpp_xep_reactions_received_pipeline_listener_real_get_after_actions;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_reactions_received_pipeline_listener_get_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY, xmpp_xep_reactions_received_pipeline_listener_properties[XMPP_XEP_REACTIONS_RECEIVED_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_REACTIONS_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY, xmpp_xep_reactions_received_pipeline_listener_properties[XMPP_XEP_REACTIONS_RECEIVED_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_reactions_received_pipeline_listener_instance_init (XmppXepReactionsReceivedPipelineListener * self,
                                                             gpointer klass)
{
}

static GType
xmpp_xep_reactions_received_pipeline_listener_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepReactionsReceivedPipelineListenerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_reactions_received_pipeline_listener_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepReactionsReceivedPipelineListener), 0, (GInstanceInitFunc) xmpp_xep_reactions_received_pipeline_listener_instance_init, NULL };
	GType xmpp_xep_reactions_received_pipeline_listener_type_id;
	xmpp_xep_reactions_received_pipeline_listener_type_id = g_type_register_static (XMPP_TYPE_STANZA_LISTENER, "XmppXepReactionsReceivedPipelineListener", &g_define_type_info, 0);
	return xmpp_xep_reactions_received_pipeline_listener_type_id;
}

GType
xmpp_xep_reactions_received_pipeline_listener_get_type (void)
{
	static volatile gsize xmpp_xep_reactions_received_pipeline_listener_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_reactions_received_pipeline_listener_type_id__once)) {
		GType xmpp_xep_reactions_received_pipeline_listener_type_id;
		xmpp_xep_reactions_received_pipeline_listener_type_id = xmpp_xep_reactions_received_pipeline_listener_get_type_once ();
		g_once_init_leave (&xmpp_xep_reactions_received_pipeline_listener_type_id__once, xmpp_xep_reactions_received_pipeline_listener_type_id);
	}
	return xmpp_xep_reactions_received_pipeline_listener_type_id__once;
}

static void
_vala_xmpp_xep_reactions_received_pipeline_listener_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec)
{
	XmppXepReactionsReceivedPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_REACTIONS_TYPE_RECEIVED_PIPELINE_LISTENER, XmppXepReactionsReceivedPipelineListener);
	switch (property_id) {
		case XMPP_XEP_REACTIONS_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY:
		g_value_set_string (value, xmpp_ordered_listener_get_action_group ((XmppOrderedListener*) self));
		break;
		case XMPP_XEP_REACTIONS_RECEIVED_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 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;
}

