/* 0280_message_carbons.c generated by valac 0.56.19, the Vala compiler
 * generated from 0280_message_carbons.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_CARBONS_NS_URI "urn:xmpp:carbons:2"
#define XMPP_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_XEP_MESSAGE_CARBONS_MODULE_0_PROPERTY,
	XMPP_XEP_MESSAGE_CARBONS_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_message_carbons_module_properties[XMPP_XEP_MESSAGE_CARBONS_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)))
typedef struct _XmppXepMessageCarbonsModuleEnableData XmppXepMessageCarbonsModuleEnableData;
typedef struct _XmppXepMessageCarbonsModuleDisableData XmppXepMessageCarbonsModuleDisableData;
enum  {
	XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_0_PROPERTY,
	XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY,
	XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY,
	XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_message_carbons_received_pipeline_listener_properties[XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_NUM_PROPERTIES];
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _XmppXepMessageCarbonsReceivedPipelineListenerRunData XmppXepMessageCarbonsReceivedPipelineListenerRunData;
enum  {
	XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_0_PROPERTY,
	XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_message_carbons_message_flag_properties[XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_NUM_PROPERTIES];

struct _XmppXepMessageCarbonsModulePrivate {
	XmppXepMessageCarbonsReceivedPipelineListener* received_pipeline_listener;
};

struct _XmppXepMessageCarbonsModuleEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepMessageCarbonsModule* self;
	XmppXmppStream* stream;
	XmppIqStanza* iq;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppIqStanza* _tmp4_;
	XmppIqStanza* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppIqModule* _tmp8_;
	XmppIqStanza* _tmp9_;
	XmppIqStanza* _tmp10_;
	GError* _inner_error0_;
};

struct _XmppXepMessageCarbonsModuleDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepMessageCarbonsModule* self;
	XmppXmppStream* stream;
	XmppIqStanza* iq;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppIqStanza* _tmp4_;
	XmppIqStanza* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppIqModule* _tmp8_;
	XmppIqStanza* _tmp9_;
	XmppIqStanza* _tmp10_;
	GError* _inner_error0_;
};

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

struct _XmppXepMessageCarbonsReceivedPipelineListenerRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepMessageCarbonsReceivedPipelineListener* self;
	XmppXmppStream* stream;
	XmppMessageStanza* message;
	gboolean result;
	XmppStanzaNode* received_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* sent_node;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* carbons_node;
	XmppStanzaNode* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* forwarded_node;
	XmppStanzaNode* _tmp13_;
	XmppStanzaNode* _tmp14_;
	XmppStanzaNode* _tmp15_;
	XmppStanzaNode* message_node;
	XmppStanzaNode* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppJid* _tmp18_;
	XmppJid* _tmp19_;
	XmppJid* _tmp20_;
	XmppFlagIdentity* _tmp21_;
	gpointer _tmp22_;
	XmppBindFlag* _tmp23_;
	XmppJid* _tmp24_;
	XmppJid* _tmp25_;
	XmppJid* _tmp26_;
	XmppJid* _tmp27_;
	gboolean _tmp28_;
	XmppJid* _tmp29_;
	XmppJid* _tmp30_;
	XmppJid* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	XmppStanzaNode* _tmp34_;
	XmppJid* _tmp35_;
	XmppJid* _tmp36_;
	XmppJid* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	XmppStanzaNode* _tmp40_;
	XmppXepMessageCarbonsMessageFlag* _tmp41_;
	XmppXepMessageCarbonsMessageFlag* _tmp42_;
	XmppStanzaNode* _tmp43_;
	XmppXepMessageCarbonsMessageFlag* _tmp44_;
	XmppXepMessageCarbonsMessageFlag* _tmp45_;
	XmppStanzaNode* _tmp46_;
	XmppStanzaNode* _tmp47_;
};

struct _XmppXepMessageCarbonsMessageFlagPrivate {
	gchar* type_;
};

static gint XmppXepMessageCarbonsModule_private_offset;
static gpointer xmpp_xep_message_carbons_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_message_carbons_module_IDENTITY = NULL;
static gint XmppXepMessageCarbonsReceivedPipelineListener_private_offset;
static gpointer xmpp_xep_message_carbons_received_pipeline_listener_parent_class = NULL;
static gint XmppXepMessageCarbonsMessageFlag_private_offset;
static gpointer xmpp_xep_message_carbons_message_flag_parent_class = NULL;

static void xmpp_xep_message_carbons_module_enable_data_free (gpointer _data);
static gboolean xmpp_xep_message_carbons_module_enable_co (XmppXepMessageCarbonsModuleEnableData* _data_);
static void xmpp_xep_message_carbons_module_enable_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void xmpp_xep_message_carbons_module_disable_data_free (gpointer _data);
static gboolean xmpp_xep_message_carbons_module_disable_co (XmppXepMessageCarbonsModuleDisableData* _data_);
static void xmpp_xep_message_carbons_module_disable_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void xmpp_xep_message_carbons_module_real_attach (XmppXmppStreamModule* base,
                                                  XmppXmppStream* stream);
static void _xmpp_xep_message_carbons_module_enable_xmpp_xmpp_stream_stream_negotiated (XmppXmppStream* _sender,
                                                                                 XmppXmppStream* stream,
                                                                                 gpointer self);
static void xmpp_xep_message_carbons_module_real_detach (XmppXmppStreamModule* base,
                                                  XmppXmppStream* stream);
static gchar* xmpp_xep_message_carbons_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_message_carbons_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_message_carbons_module_finalize (GObject * obj);
static GType xmpp_xep_message_carbons_module_get_type_once (void);
static void xmpp_xep_message_carbons_received_pipeline_listener_real_run_data_free (gpointer _data);
static void xmpp_xep_message_carbons_received_pipeline_listener_real_run (XmppStanzaListener* base,
                                                                   XmppXmppStream* stream,
                                                                   XmppMessageStanza* message,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_);
static gboolean xmpp_xep_message_carbons_received_pipeline_listener_real_run_co (XmppXepMessageCarbonsReceivedPipelineListenerRunData* _data_);
static void xmpp_xep_message_carbons_received_pipeline_listener_finalize (GObject * obj);
static GType xmpp_xep_message_carbons_received_pipeline_listener_get_type_once (void);
static void _vala_xmpp_xep_message_carbons_received_pipeline_listener_get_property (GObject * object,
                                                                             guint property_id,
                                                                             GValue * value,
                                                                             GParamSpec * pspec);
static gchar* xmpp_xep_message_carbons_message_flag_real_get_ns (XmppMessageFlag* base);
static gchar* xmpp_xep_message_carbons_message_flag_real_get_id (XmppMessageFlag* base);
static void xmpp_xep_message_carbons_message_flag_finalize (GObject * obj);
static GType xmpp_xep_message_carbons_message_flag_get_type_once (void);
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_carbons_module_get_instance_private (XmppXepMessageCarbonsModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepMessageCarbonsModule_private_offset);
}

static void
xmpp_xep_message_carbons_module_enable_data_free (gpointer _data)
{
	XmppXepMessageCarbonsModuleEnableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepMessageCarbonsModuleEnableData, _data_);
}

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

void
xmpp_xep_message_carbons_module_enable (XmppXepMessageCarbonsModule* self,
                                        XmppXmppStream* stream,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	XmppXepMessageCarbonsModuleEnableData* _data_;
	XmppXepMessageCarbonsModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (XmppXepMessageCarbonsModuleEnableData);
	_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_carbons_module_enable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	xmpp_xep_message_carbons_module_enable_co (_data_);
}

void
xmpp_xep_message_carbons_module_enable_finish (XmppXepMessageCarbonsModule* self,
                                               GAsyncResult* _res_)
{
	XmppXepMessageCarbonsModuleEnableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_xep_message_carbons_module_enable_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	XmppXepMessageCarbonsModuleEnableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_message_carbons_module_enable_co (_data_);
}

static gboolean
xmpp_xep_message_carbons_module_enable_co (XmppXepMessageCarbonsModuleEnableData* _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 ("enable", XMPP_XEP_MESSAGE_CARBONS_NS_URI, NULL, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = xmpp_iq_stanza_new_set (_data_->_tmp3_, NULL);
	_data_->_tmp5_ = _data_->_tmp4_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp3_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp1_);
	_data_->iq = _data_->_tmp5_;
	_data_->_tmp6_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp7_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp6_);
	_data_->_tmp8_ = (XmppIqModule*) _data_->_tmp7_;
	_data_->_state_ = 1;
	xmpp_iq_module_send_iq_async (_data_->_tmp8_, _data_->stream, _data_->iq, G_PRIORITY_DEFAULT, NULL, xmpp_xep_message_carbons_module_enable_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = xmpp_iq_module_send_iq_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_g_object_unref0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp8_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->iq);
		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_->iq);
	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_message_carbons_module_disable_data_free (gpointer _data)
{
	XmppXepMessageCarbonsModuleDisableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepMessageCarbonsModuleDisableData, _data_);
}

void
xmpp_xep_message_carbons_module_disable (XmppXepMessageCarbonsModule* self,
                                         XmppXmppStream* stream,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	XmppXepMessageCarbonsModuleDisableData* _data_;
	XmppXepMessageCarbonsModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (XmppXepMessageCarbonsModuleDisableData);
	_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_carbons_module_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	xmpp_xep_message_carbons_module_disable_co (_data_);
}

void
xmpp_xep_message_carbons_module_disable_finish (XmppXepMessageCarbonsModule* self,
                                                GAsyncResult* _res_)
{
	XmppXepMessageCarbonsModuleDisableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_xep_message_carbons_module_disable_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	XmppXepMessageCarbonsModuleDisableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_message_carbons_module_disable_co (_data_);
}

static gboolean
xmpp_xep_message_carbons_module_disable_co (XmppXepMessageCarbonsModuleDisableData* _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 ("disable", XMPP_XEP_MESSAGE_CARBONS_NS_URI, NULL, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = xmpp_iq_stanza_new_set (_data_->_tmp3_, NULL);
	_data_->_tmp5_ = _data_->_tmp4_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp3_);
	_xmpp_stanza_entry_unref0 (_data_->_tmp1_);
	_data_->iq = _data_->_tmp5_;
	_data_->_tmp6_ = xmpp_iq_module_IDENTITY;
	_data_->_tmp7_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp6_);
	_data_->_tmp8_ = (XmppIqModule*) _data_->_tmp7_;
	_data_->_state_ = 1;
	xmpp_iq_module_send_iq_async (_data_->_tmp8_, _data_->stream, _data_->iq, G_PRIORITY_DEFAULT, NULL, xmpp_xep_message_carbons_module_disable_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = xmpp_iq_module_send_iq_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_g_object_unref0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp8_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->iq);
		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_->iq);
	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_message_carbons_module_enable_xmpp_xmpp_stream_stream_negotiated (XmppXmppStream* _sender,
                                                                            XmppXmppStream* stream,
                                                                            gpointer self)
{
	xmpp_xep_message_carbons_module_enable ((XmppXepMessageCarbonsModule*) self, stream, NULL, NULL);
}

static void
xmpp_xep_message_carbons_module_real_attach (XmppXmppStreamModule* base,
                                             XmppXmppStream* stream)
{
	XmppXepMessageCarbonsModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppMessageModule* _tmp2_;
	XmppStanzaListenerHolder* _tmp3_;
	XmppXepMessageCarbonsReceivedPipelineListener* _tmp4_;
	XmppModuleIdentity* _tmp5_;
	gpointer _tmp6_;
	XmppXepServiceDiscoveryModule* _tmp7_;
	self = (XmppXepMessageCarbonsModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_connect_object (stream, "stream-negotiated", (GCallback) _xmpp_xep_message_carbons_module_enable_xmpp_xmpp_stream_stream_negotiated, self, 0);
	_tmp0_ = xmpp_message_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppMessageModule*) _tmp1_;
	_tmp3_ = _tmp2_->received_pipeline;
	_tmp4_ = self->priv->received_pipeline_listener;
	xmpp_listener_holder_connect ((XmppListenerHolder*) _tmp3_, (XmppOrderedListener*) _tmp4_);
	_g_object_unref0 (_tmp2_);
	_tmp5_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp6_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp5_);
	_tmp7_ = (XmppXepServiceDiscoveryModule*) _tmp6_;
	xmpp_xep_service_discovery_module_add_feature (_tmp7_, stream, XMPP_XEP_MESSAGE_CARBONS_NS_URI);
	_g_object_unref0 (_tmp7_);
}

static void
xmpp_xep_message_carbons_module_real_detach (XmppXmppStreamModule* base,
                                             XmppXmppStream* stream)
{
	XmppXepMessageCarbonsModule * self;
	guint _tmp0_;
	XmppModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	XmppMessageModule* _tmp3_;
	XmppStanzaListenerHolder* _tmp4_;
	XmppXepMessageCarbonsReceivedPipelineListener* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppXepServiceDiscoveryModule* _tmp8_;
	self = (XmppXepMessageCarbonsModule*) base;
	g_return_if_fail (stream != NULL);
	g_signal_parse_name ("stream-negotiated", 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_xep_message_carbons_module_enable_xmpp_xmpp_stream_stream_negotiated, self);
	_tmp1_ = xmpp_message_module_IDENTITY;
	_tmp2_ = xmpp_xmpp_stream_get_module (stream, XMPP_TYPE_MESSAGE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
	_tmp3_ = (XmppMessageModule*) _tmp2_;
	_tmp4_ = _tmp3_->received_pipeline;
	_tmp5_ = self->priv->received_pipeline_listener;
	xmpp_listener_holder_disconnect ((XmppListenerHolder*) _tmp4_, (XmppOrderedListener*) _tmp5_);
	_g_object_unref0 (_tmp3_);
	_tmp6_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp7_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp6_);
	_tmp8_ = (XmppXepServiceDiscoveryModule*) _tmp7_;
	xmpp_xep_service_discovery_module_remove_feature (_tmp8_, stream, XMPP_XEP_MESSAGE_CARBONS_NS_URI);
	_g_object_unref0 (_tmp8_);
}

static gchar*
xmpp_xep_message_carbons_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepMessageCarbonsModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepMessageCarbonsModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_MESSAGE_CARBONS_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_message_carbons_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepMessageCarbonsModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepMessageCarbonsModule*) base;
	_tmp0_ = xmpp_xep_message_carbons_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepMessageCarbonsModule*
xmpp_xep_message_carbons_module_construct (GType object_type)
{
	XmppXepMessageCarbonsModule * self = NULL;
	self = (XmppXepMessageCarbonsModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepMessageCarbonsModule*
xmpp_xep_message_carbons_module_new (void)
{
	return xmpp_xep_message_carbons_module_construct (XMPP_XEP_MESSAGE_CARBONS_TYPE_MODULE);
}

static void
xmpp_xep_message_carbons_module_class_init (XmppXepMessageCarbonsModuleClass * klass,
                                            gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_message_carbons_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepMessageCarbonsModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_message_carbons_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_message_carbons_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_message_carbons_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_message_carbons_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_message_carbons_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_MESSAGE_CARBONS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_MESSAGE_CARBONS_NS_URI, "0280_message_carbons_module");
	xmpp_xep_message_carbons_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_message_carbons_module_instance_init (XmppXepMessageCarbonsModule * self,
                                               gpointer klass)
{
	XmppXepMessageCarbonsReceivedPipelineListener* _tmp0_;
	self->priv = xmpp_xep_message_carbons_module_get_instance_private (self);
	_tmp0_ = xmpp_xep_message_carbons_received_pipeline_listener_new ();
	self->priv->received_pipeline_listener = _tmp0_;
}

static void
xmpp_xep_message_carbons_module_finalize (GObject * obj)
{
	XmppXepMessageCarbonsModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_MESSAGE_CARBONS_TYPE_MODULE, XmppXepMessageCarbonsModule);
	_g_object_unref0 (self->priv->received_pipeline_listener);
	G_OBJECT_CLASS (xmpp_xep_message_carbons_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_message_carbons_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepMessageCarbonsModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_message_carbons_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepMessageCarbonsModule), 0, (GInstanceInitFunc) xmpp_xep_message_carbons_module_instance_init, NULL };
	GType xmpp_xep_message_carbons_module_type_id;
	xmpp_xep_message_carbons_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepMessageCarbonsModule", &g_define_type_info, 0);
	XmppXepMessageCarbonsModule_private_offset = g_type_add_instance_private (xmpp_xep_message_carbons_module_type_id, sizeof (XmppXepMessageCarbonsModulePrivate));
	return xmpp_xep_message_carbons_module_type_id;
}

GType
xmpp_xep_message_carbons_module_get_type (void)
{
	static volatile gsize xmpp_xep_message_carbons_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_message_carbons_module_type_id__once)) {
		GType xmpp_xep_message_carbons_module_type_id;
		xmpp_xep_message_carbons_module_type_id = xmpp_xep_message_carbons_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_message_carbons_module_type_id__once, xmpp_xep_message_carbons_module_type_id);
	}
	return xmpp_xep_message_carbons_module_type_id__once;
}

static inline gpointer
xmpp_xep_message_carbons_received_pipeline_listener_get_instance_private (XmppXepMessageCarbonsReceivedPipelineListener* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepMessageCarbonsReceivedPipelineListener_private_offset);
}

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

static void
xmpp_xep_message_carbons_received_pipeline_listener_real_run (XmppStanzaListener* base,
                                                              XmppXmppStream* stream,
                                                              XmppMessageStanza* message,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_)
{
	XmppXepMessageCarbonsReceivedPipelineListener * self;
	XmppXepMessageCarbonsReceivedPipelineListenerRunData* _data_;
	XmppXepMessageCarbonsReceivedPipelineListener* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppMessageStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (message != NULL);
	self = (XmppXepMessageCarbonsReceivedPipelineListener*) base;
	_data_ = g_slice_new0 (XmppXepMessageCarbonsReceivedPipelineListenerRunData);
	_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_carbons_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_message_carbons_received_pipeline_listener_real_run_co (_data_);
}

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

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

static gboolean
xmpp_xep_message_carbons_received_pipeline_listener_real_run_co (XmppXepMessageCarbonsReceivedPipelineListenerRunData* _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_CARBONS_NS_URI, FALSE);
	_data_->received_node = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->received_node;
	if (_data_->_tmp3_ == NULL) {
		_data_->_tmp4_ = ((XmppStanza*) _data_->message)->stanza;
		_data_->_tmp5_ = xmpp_stanza_node_get_subnode (_data_->_tmp4_, "sent", XMPP_XEP_MESSAGE_CARBONS_NS_URI, FALSE);
		_xmpp_stanza_entry_unref0 (_data_->_tmp2_);
		_data_->_tmp2_ = _data_->_tmp5_;
	} else {
		_xmpp_stanza_entry_unref0 (_data_->_tmp2_);
		_data_->_tmp2_ = NULL;
	}
	_data_->_tmp6_ = _data_->_tmp2_;
	_data_->_tmp2_ = NULL;
	_data_->sent_node = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->received_node;
	if (_data_->_tmp8_ != NULL) {
		_data_->_tmp9_ = _data_->received_node;
		_data_->_tmp7_ = _data_->_tmp9_;
	} else {
		_data_->_tmp10_ = _data_->sent_node;
		_data_->_tmp7_ = _data_->_tmp10_;
	}
	_data_->_tmp11_ = _xmpp_stanza_entry_ref0 (_data_->_tmp7_);
	_data_->carbons_node = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->carbons_node;
	if (_data_->_tmp12_ != NULL) {
		_data_->_tmp13_ = _data_->carbons_node;
		_data_->_tmp14_ = xmpp_stanza_node_get_subnode (_data_->_tmp13_, "forwarded", "urn:xmpp:forward:0", FALSE);
		_data_->forwarded_node = _data_->_tmp14_;
		_data_->_tmp15_ = _data_->forwarded_node;
		if (_data_->_tmp15_ != NULL) {
			_data_->_tmp16_ = _data_->forwarded_node;
			_data_->_tmp17_ = xmpp_stanza_node_get_subnode (_data_->_tmp16_, "message", XMPP_NS_URI, FALSE);
			_data_->message_node = _data_->_tmp17_;
			_data_->_tmp18_ = xmpp_stanza_get_from ((XmppStanza*) _data_->message);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp20_ = _data_->_tmp19_;
			_data_->_tmp21_ = xmpp_bind_flag_IDENTITY;
			_data_->_tmp22_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp21_);
			_data_->_tmp23_ = (XmppBindFlag*) _data_->_tmp22_;
			_data_->_tmp24_ = _data_->_tmp23_->my_jid;
			_data_->_tmp25_ = xmpp_jid_get_bare_jid (_data_->_tmp24_);
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_tmp27_ = _data_->_tmp26_;
			_data_->_tmp28_ = !xmpp_jid_equals (_data_->_tmp20_, _data_->_tmp27_);
			_xmpp_jid_unref0 (_data_->_tmp27_);
			_g_object_unref0 (_data_->_tmp23_);
			_xmpp_jid_unref0 (_data_->_tmp20_);
			if (_data_->_tmp28_) {
				_data_->_tmp29_ = xmpp_stanza_get_from ((XmppStanza*) _data_->message);
				_data_->_tmp30_ = _data_->_tmp29_;
				_data_->_tmp31_ = _data_->_tmp30_;
				_data_->_tmp32_ = xmpp_jid_to_string (_data_->_tmp31_);
				_data_->_tmp33_ = _data_->_tmp32_;
				g_warning ("0280_message_carbons.vala:58: Received alleged carbon message from %s," \
" ignoring", _data_->_tmp33_);
				_g_free0 (_data_->_tmp33_);
				_xmpp_jid_unref0 (_data_->_tmp31_);
				_data_->result = TRUE;
				_xmpp_stanza_entry_unref0 (_data_->message_node);
				_xmpp_stanza_entry_unref0 (_data_->forwarded_node);
				_xmpp_stanza_entry_unref0 (_data_->carbons_node);
				_xmpp_stanza_entry_unref0 (_data_->sent_node);
				_xmpp_stanza_entry_unref0 (_data_->_tmp2_);
				_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_->_tmp34_ = _data_->message_node;
			if (_data_->_tmp34_ == NULL) {
				_data_->_tmp35_ = xmpp_stanza_get_from ((XmppStanza*) _data_->message);
				_data_->_tmp36_ = _data_->_tmp35_;
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp38_ = xmpp_jid_to_string (_data_->_tmp37_);
				_data_->_tmp39_ = _data_->_tmp38_;
				g_warning ("0280_message_carbons.vala:62: Received a carbon message with no messag" \
"e subnode in jabber:client namespace from %s, ignoring", _data_->_tmp39_);
				_g_free0 (_data_->_tmp39_);
				_xmpp_jid_unref0 (_data_->_tmp37_);
				_data_->result = TRUE;
				_xmpp_stanza_entry_unref0 (_data_->message_node);
				_xmpp_stanza_entry_unref0 (_data_->forwarded_node);
				_xmpp_stanza_entry_unref0 (_data_->carbons_node);
				_xmpp_stanza_entry_unref0 (_data_->sent_node);
				_xmpp_stanza_entry_unref0 (_data_->_tmp2_);
				_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_->_tmp40_ = _data_->received_node;
			if (_data_->_tmp40_ != NULL) {
				_data_->_tmp41_ = xmpp_xep_message_carbons_message_flag_new (XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_TYPE_RECEIVED);
				_data_->_tmp42_ = _data_->_tmp41_;
				xmpp_message_stanza_add_flag (_data_->message, (XmppMessageFlag*) _data_->_tmp42_);
				_g_object_unref0 (_data_->_tmp42_);
			} else {
				_data_->_tmp43_ = _data_->sent_node;
				if (_data_->_tmp43_ != NULL) {
					_data_->_tmp44_ = xmpp_xep_message_carbons_message_flag_new (XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_TYPE_SENT);
					_data_->_tmp45_ = _data_->_tmp44_;
					xmpp_message_stanza_add_flag (_data_->message, (XmppMessageFlag*) _data_->_tmp45_);
					_g_object_unref0 (_data_->_tmp45_);
				}
			}
			_data_->_tmp46_ = _data_->message_node;
			_data_->_tmp47_ = _xmpp_stanza_entry_ref0 (_data_->_tmp46_);
			_xmpp_stanza_entry_unref0 (((XmppStanza*) _data_->message)->stanza);
			((XmppStanza*) _data_->message)->stanza = _data_->_tmp47_;
			_data_->message->rerun_parsing = TRUE;
			_xmpp_stanza_entry_unref0 (_data_->message_node);
		}
		_xmpp_stanza_entry_unref0 (_data_->forwarded_node);
	}
	_data_->result = FALSE;
	_xmpp_stanza_entry_unref0 (_data_->carbons_node);
	_xmpp_stanza_entry_unref0 (_data_->sent_node);
	_xmpp_stanza_entry_unref0 (_data_->_tmp2_);
	_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;
}

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

XmppXepMessageCarbonsReceivedPipelineListener*
xmpp_xep_message_carbons_received_pipeline_listener_new (void)
{
	return xmpp_xep_message_carbons_received_pipeline_listener_construct (XMPP_XEP_MESSAGE_CARBONS_TYPE_RECEIVED_PIPELINE_LISTENER);
}

static const gchar*
xmpp_xep_message_carbons_received_pipeline_listener_real_get_action_group (XmppOrderedListener* base)
{
	const gchar* result;
	XmppXepMessageCarbonsReceivedPipelineListener* self;
	self = (XmppXepMessageCarbonsReceivedPipelineListener*) base;
	result = "EXTRACT_MESSAGE_2";
	return result;
}

static gchar**
xmpp_xep_message_carbons_received_pipeline_listener_real_get_after_actions (XmppOrderedListener* base,
                                                                            gint* result_length1)
{
	gchar** result;
	XmppXepMessageCarbonsReceivedPipelineListener* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	self = (XmppXepMessageCarbonsReceivedPipelineListener*) 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_carbons_received_pipeline_listener_class_init (XmppXepMessageCarbonsReceivedPipelineListenerClass * klass,
                                                                gpointer klass_data)
{
	xmpp_xep_message_carbons_received_pipeline_listener_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepMessageCarbonsReceivedPipelineListener_private_offset);
	((XmppStanzaListenerClass *) klass)->run = (void (*) (XmppStanzaListener*, XmppXmppStream*, gconstpointer, GAsyncReadyCallback, gpointer)) xmpp_xep_message_carbons_received_pipeline_listener_real_run;
	((XmppStanzaListenerClass *) klass)->run_finish = (gboolean (*) (XmppStanzaListener*, GAsyncResult*)) xmpp_xep_message_carbons_received_pipeline_listener_run_finish;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_action_group = (const gchar* (*) (XmppOrderedListener*)) xmpp_xep_message_carbons_received_pipeline_listener_real_get_action_group;
	XMPP_ORDERED_LISTENER_CLASS (klass)->get_after_actions = (gchar** (*) (XmppOrderedListener*, gint*)) xmpp_xep_message_carbons_received_pipeline_listener_real_get_after_actions;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_message_carbons_received_pipeline_listener_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_message_carbons_received_pipeline_listener_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY, xmpp_xep_message_carbons_received_pipeline_listener_properties[XMPP_XEP_MESSAGE_CARBONS_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_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_AFTER_ACTIONS_PROPERTY, xmpp_xep_message_carbons_received_pipeline_listener_properties[XMPP_XEP_MESSAGE_CARBONS_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_message_carbons_received_pipeline_listener_instance_init (XmppXepMessageCarbonsReceivedPipelineListener * self,
                                                                   gpointer klass)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	self->priv = xmpp_xep_message_carbons_received_pipeline_listener_get_instance_private (self);
	_tmp0_ = g_strdup ("EXTRACT_MESSAGE_1");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	self->priv->after_actions_const = _tmp1_;
	self->priv->after_actions_const_length1 = 1;
	self->priv->_after_actions_const_size_ = self->priv->after_actions_const_length1;
}

static void
xmpp_xep_message_carbons_received_pipeline_listener_finalize (GObject * obj)
{
	XmppXepMessageCarbonsReceivedPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_MESSAGE_CARBONS_TYPE_RECEIVED_PIPELINE_LISTENER, XmppXepMessageCarbonsReceivedPipelineListener);
	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_carbons_received_pipeline_listener_parent_class)->finalize (obj);
}

static GType
xmpp_xep_message_carbons_received_pipeline_listener_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepMessageCarbonsReceivedPipelineListenerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_message_carbons_received_pipeline_listener_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepMessageCarbonsReceivedPipelineListener), 0, (GInstanceInitFunc) xmpp_xep_message_carbons_received_pipeline_listener_instance_init, NULL };
	GType xmpp_xep_message_carbons_received_pipeline_listener_type_id;
	xmpp_xep_message_carbons_received_pipeline_listener_type_id = g_type_register_static (XMPP_TYPE_STANZA_LISTENER, "XmppXepMessageCarbonsReceivedPipelineListener", &g_define_type_info, 0);
	XmppXepMessageCarbonsReceivedPipelineListener_private_offset = g_type_add_instance_private (xmpp_xep_message_carbons_received_pipeline_listener_type_id, sizeof (XmppXepMessageCarbonsReceivedPipelineListenerPrivate));
	return xmpp_xep_message_carbons_received_pipeline_listener_type_id;
}

GType
xmpp_xep_message_carbons_received_pipeline_listener_get_type (void)
{
	static volatile gsize xmpp_xep_message_carbons_received_pipeline_listener_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_message_carbons_received_pipeline_listener_type_id__once)) {
		GType xmpp_xep_message_carbons_received_pipeline_listener_type_id;
		xmpp_xep_message_carbons_received_pipeline_listener_type_id = xmpp_xep_message_carbons_received_pipeline_listener_get_type_once ();
		g_once_init_leave (&xmpp_xep_message_carbons_received_pipeline_listener_type_id__once, xmpp_xep_message_carbons_received_pipeline_listener_type_id);
	}
	return xmpp_xep_message_carbons_received_pipeline_listener_type_id__once;
}

static void
_vala_xmpp_xep_message_carbons_received_pipeline_listener_get_property (GObject * object,
                                                                        guint property_id,
                                                                        GValue * value,
                                                                        GParamSpec * pspec)
{
	XmppXepMessageCarbonsReceivedPipelineListener * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_MESSAGE_CARBONS_TYPE_RECEIVED_PIPELINE_LISTENER, XmppXepMessageCarbonsReceivedPipelineListener);
	switch (property_id) {
		case XMPP_XEP_MESSAGE_CARBONS_RECEIVED_PIPELINE_LISTENER_ACTION_GROUP_PROPERTY:
		g_value_set_string (value, xmpp_ordered_listener_get_action_group ((XmppOrderedListener*) self));
		break;
		case XMPP_XEP_MESSAGE_CARBONS_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
xmpp_xep_message_carbons_message_flag_get_instance_private (XmppXepMessageCarbonsMessageFlag* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepMessageCarbonsMessageFlag_private_offset);
}

XmppXepMessageCarbonsMessageFlag*
xmpp_xep_message_carbons_message_flag_construct (GType object_type,
                                                 const gchar* type)
{
	XmppXepMessageCarbonsMessageFlag * self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (type != NULL, NULL);
	self = (XmppXepMessageCarbonsMessageFlag*) xmpp_message_flag_construct (object_type);
	_tmp0_ = g_strdup (type);
	_g_free0 (self->priv->type_);
	self->priv->type_ = _tmp0_;
	return self;
}

XmppXepMessageCarbonsMessageFlag*
xmpp_xep_message_carbons_message_flag_new (const gchar* type)
{
	return xmpp_xep_message_carbons_message_flag_construct (XMPP_XEP_MESSAGE_CARBONS_TYPE_MESSAGE_FLAG, type);
}

XmppXepMessageCarbonsMessageFlag*
xmpp_xep_message_carbons_message_flag_get_flag (XmppMessageStanza* message)
{
	XmppMessageFlag* _tmp0_;
	XmppXepMessageCarbonsMessageFlag* result;
	g_return_val_if_fail (message != NULL, NULL);
	_tmp0_ = xmpp_message_stanza_get_flag (message, XMPP_XEP_MESSAGE_CARBONS_NS_URI, XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_ID);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, XMPP_XEP_MESSAGE_CARBONS_TYPE_MESSAGE_FLAG, XmppXepMessageCarbonsMessageFlag);
	return result;
}

static gchar*
xmpp_xep_message_carbons_message_flag_real_get_ns (XmppMessageFlag* base)
{
	XmppXepMessageCarbonsMessageFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepMessageCarbonsMessageFlag*) base;
	_tmp0_ = g_strdup (XMPP_XEP_MESSAGE_CARBONS_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_message_carbons_message_flag_real_get_id (XmppMessageFlag* base)
{
	XmppXepMessageCarbonsMessageFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepMessageCarbonsMessageFlag*) base;
	_tmp0_ = g_strdup (XMPP_XEP_MESSAGE_CARBONS_MESSAGE_FLAG_ID);
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_message_carbons_message_flag_class_init (XmppXepMessageCarbonsMessageFlagClass * klass,
                                                  gpointer klass_data)
{
	xmpp_xep_message_carbons_message_flag_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepMessageCarbonsMessageFlag_private_offset);
	((XmppMessageFlagClass *) klass)->get_ns = (gchar* (*) (XmppMessageFlag*)) xmpp_xep_message_carbons_message_flag_real_get_ns;
	((XmppMessageFlagClass *) klass)->get_id = (gchar* (*) (XmppMessageFlag*)) xmpp_xep_message_carbons_message_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_message_carbons_message_flag_finalize;
}

static void
xmpp_xep_message_carbons_message_flag_instance_init (XmppXepMessageCarbonsMessageFlag * self,
                                                     gpointer klass)
{
	self->priv = xmpp_xep_message_carbons_message_flag_get_instance_private (self);
}

static void
xmpp_xep_message_carbons_message_flag_finalize (GObject * obj)
{
	XmppXepMessageCarbonsMessageFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_MESSAGE_CARBONS_TYPE_MESSAGE_FLAG, XmppXepMessageCarbonsMessageFlag);
	_g_free0 (self->priv->type_);
	G_OBJECT_CLASS (xmpp_xep_message_carbons_message_flag_parent_class)->finalize (obj);
}

static GType
xmpp_xep_message_carbons_message_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepMessageCarbonsMessageFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_message_carbons_message_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepMessageCarbonsMessageFlag), 0, (GInstanceInitFunc) xmpp_xep_message_carbons_message_flag_instance_init, NULL };
	GType xmpp_xep_message_carbons_message_flag_type_id;
	xmpp_xep_message_carbons_message_flag_type_id = g_type_register_static (XMPP_TYPE_MESSAGE_FLAG, "XmppXepMessageCarbonsMessageFlag", &g_define_type_info, 0);
	XmppXepMessageCarbonsMessageFlag_private_offset = g_type_add_instance_private (xmpp_xep_message_carbons_message_flag_type_id, sizeof (XmppXepMessageCarbonsMessageFlagPrivate));
	return xmpp_xep_message_carbons_message_flag_type_id;
}

GType
xmpp_xep_message_carbons_message_flag_get_type (void)
{
	static volatile gsize xmpp_xep_message_carbons_message_flag_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_message_carbons_message_flag_type_id__once)) {
		GType xmpp_xep_message_carbons_message_flag_type_id;
		xmpp_xep_message_carbons_message_flag_type_id = xmpp_xep_message_carbons_message_flag_get_type_once ();
		g_once_init_leave (&xmpp_xep_message_carbons_message_flag_type_id__once, xmpp_xep_message_carbons_message_flag_type_id);
	}
	return xmpp_xep_message_carbons_message_flag_type_id__once;
}

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

