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

#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <gobject/gvaluecollector.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_OMEMO_OMEMO_ENCRYPTOR_0_PROPERTY,
	XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_OWN_DEVICE_ID_PROPERTY,
	XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_omemo_omemo_encryptor_properties[XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_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 _g_free0(var) (var = (g_free (var), NULL))
typedef struct _XmppXepOmemoParamSpecEncryptionData XmppXepOmemoParamSpecEncryptionData;
typedef struct _XmppXepOmemoParamSpecEncryptionResult XmppXepOmemoParamSpecEncryptionResult;
typedef struct _XmppXepOmemoParamSpecEncryptState XmppXepOmemoParamSpecEncryptState;

struct _XmppXepOmemoParamSpecEncryptionData {
	GParamSpec parent_instance;
};

struct _XmppXepOmemoEncryptionResultPrivate {
	gint _lost;
	gint _success;
	gint _unknown;
	gint _failure;
};

struct _XmppXepOmemoParamSpecEncryptionResult {
	GParamSpec parent_instance;
};

struct _XmppXepOmemoEncryptStatePrivate {
	gboolean _encrypted;
	gint _other_devices;
	gint _other_success;
	gint _other_lost;
	gint _other_unknown;
	gint _other_failure;
	gint _other_waiting_lists;
	gint _own_devices;
	gint _own_success;
	gint _own_lost;
	gint _own_unknown;
	gint _own_failure;
	gboolean _own_list;
};

struct _XmppXepOmemoParamSpecEncryptState {
	GParamSpec parent_instance;
};

static gpointer xmpp_xep_omemo_omemo_encryptor_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_omemo_omemo_encryptor_IDENTITY = NULL;
static gpointer xmpp_xep_omemo_encryption_data_parent_class = NULL;
static gint XmppXepOmemoEncryptionResult_private_offset;
static gpointer xmpp_xep_omemo_encryption_result_parent_class = NULL;
static gint XmppXepOmemoEncryptState_private_offset;
static gpointer xmpp_xep_omemo_encrypt_state_parent_class = NULL;

static XmppXepOmemoEncryptionData* xmpp_xep_omemo_omemo_encryptor_real_encrypt_plaintext (XmppXepOmemoOmemoEncryptor* self,
                                                                                   const gchar* plaintext,
                                                                                   GError** error);
static void xmpp_xep_omemo_omemo_encryptor_real_encrypt_key (XmppXepOmemoOmemoEncryptor* self,
                                                      XmppXepOmemoEncryptionData* encryption_data,
                                                      XmppJid* jid,
                                                      gint32 device_id,
                                                      GError** error);
static XmppXepOmemoEncryptionResult* xmpp_xep_omemo_omemo_encryptor_real_encrypt_key_to_recipient (XmppXepOmemoOmemoEncryptor* self,
                                                                                            XmppXmppStream* stream,
                                                                                            XmppXepOmemoEncryptionData* enc_data,
                                                                                            XmppJid* recipient,
                                                                                            GError** error);
static void xmpp_xep_omemo_omemo_encryptor_real_attach (XmppXmppStreamModule* base,
                                                 XmppXmppStream* stream);
static void xmpp_xep_omemo_omemo_encryptor_real_detach (XmppXmppStreamModule* base,
                                                 XmppXmppStream* stream);
static gchar* xmpp_xep_omemo_omemo_encryptor_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_omemo_omemo_encryptor_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_omemo_omemo_encryptor_finalize (GObject * obj);
static GType xmpp_xep_omemo_omemo_encryptor_get_type_once (void);
static void _vala_xmpp_xep_omemo_omemo_encryptor_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void xmpp_xep_omemo_encryption_data_finalize (XmppXepOmemoEncryptionData * obj);
static GType xmpp_xep_omemo_encryption_data_get_type_once (void);
static void xmpp_xep_omemo_encryption_result_finalize (XmppXepOmemoEncryptionResult * obj);
static GType xmpp_xep_omemo_encryption_result_get_type_once (void);
static void xmpp_xep_omemo_encrypt_state_finalize (XmppXepOmemoEncryptState * obj);
static GType xmpp_xep_omemo_encrypt_state_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static XmppXepOmemoEncryptionData*
xmpp_xep_omemo_omemo_encryptor_real_encrypt_plaintext (XmppXepOmemoOmemoEncryptor* self,
                                                       const gchar* plaintext,
                                                       GError** error)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_omemo_omemo_encryptor_encrypt_plaintext'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

XmppXepOmemoEncryptionData*
xmpp_xep_omemo_omemo_encryptor_encrypt_plaintext (XmppXepOmemoOmemoEncryptor* self,
                                                  const gchar* plaintext,
                                                  GError** error)
{
	XmppXepOmemoOmemoEncryptorClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_GET_CLASS (self);
	if (_klass_->encrypt_plaintext) {
		return _klass_->encrypt_plaintext (self, plaintext, error);
	}
	return NULL;
}

static void
xmpp_xep_omemo_omemo_encryptor_real_encrypt_key (XmppXepOmemoOmemoEncryptor* self,
                                                 XmppXepOmemoEncryptionData* encryption_data,
                                                 XmppJid* jid,
                                                 gint32 device_id,
                                                 GError** error)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_omemo_omemo_encryptor_encrypt_key'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}

void
xmpp_xep_omemo_omemo_encryptor_encrypt_key (XmppXepOmemoOmemoEncryptor* self,
                                            XmppXepOmemoEncryptionData* encryption_data,
                                            XmppJid* jid,
                                            gint32 device_id,
                                            GError** error)
{
	XmppXepOmemoOmemoEncryptorClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_GET_CLASS (self);
	if (_klass_->encrypt_key) {
		_klass_->encrypt_key (self, encryption_data, jid, device_id, error);
	}
}

static XmppXepOmemoEncryptionResult*
xmpp_xep_omemo_omemo_encryptor_real_encrypt_key_to_recipient (XmppXepOmemoOmemoEncryptor* self,
                                                              XmppXmppStream* stream,
                                                              XmppXepOmemoEncryptionData* enc_data,
                                                              XmppJid* recipient,
                                                              GError** error)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_omemo_omemo_encryptor_encrypt_key_to_recipient'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

XmppXepOmemoEncryptionResult*
xmpp_xep_omemo_omemo_encryptor_encrypt_key_to_recipient (XmppXepOmemoOmemoEncryptor* self,
                                                         XmppXmppStream* stream,
                                                         XmppXepOmemoEncryptionData* enc_data,
                                                         XmppJid* recipient,
                                                         GError** error)
{
	XmppXepOmemoOmemoEncryptorClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_GET_CLASS (self);
	if (_klass_->encrypt_key_to_recipient) {
		return _klass_->encrypt_key_to_recipient (self, stream, enc_data, recipient, error);
	}
	return NULL;
}

static void
xmpp_xep_omemo_omemo_encryptor_real_attach (XmppXmppStreamModule* base,
                                            XmppXmppStream* stream)
{
	XmppXepOmemoOmemoEncryptor * self;
	self = (XmppXepOmemoOmemoEncryptor*) base;
	g_return_if_fail (stream != NULL);
}

static void
xmpp_xep_omemo_omemo_encryptor_real_detach (XmppXmppStreamModule* base,
                                            XmppXmppStream* stream)
{
	XmppXepOmemoOmemoEncryptor * self;
	self = (XmppXepOmemoOmemoEncryptor*) base;
	g_return_if_fail (stream != NULL);
}

static gchar*
xmpp_xep_omemo_omemo_encryptor_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepOmemoOmemoEncryptor * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepOmemoOmemoEncryptor*) base;
	_tmp0_ = g_strdup (XMPP_XEP_OMEMO_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_omemo_omemo_encryptor_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepOmemoOmemoEncryptor * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepOmemoOmemoEncryptor*) base;
	_tmp0_ = xmpp_xep_omemo_omemo_encryptor_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepOmemoOmemoEncryptor*
xmpp_xep_omemo_omemo_encryptor_construct (GType object_type)
{
	XmppXepOmemoOmemoEncryptor * self = NULL;
	self = (XmppXepOmemoOmemoEncryptor*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

guint32
xmpp_xep_omemo_omemo_encryptor_get_own_device_id (XmppXepOmemoOmemoEncryptor* self)
{
	XmppXepOmemoOmemoEncryptorClass* _klass_;
	g_return_val_if_fail (self != NULL, 0U);
	_klass_ = XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_GET_CLASS (self);
	if (_klass_->get_own_device_id) {
		return _klass_->get_own_device_id (self);
	}
	return 0U;
}

static void
xmpp_xep_omemo_omemo_encryptor_class_init (XmppXepOmemoOmemoEncryptorClass * klass,
                                           gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_omemo_omemo_encryptor_parent_class = g_type_class_peek_parent (klass);
	((XmppXepOmemoOmemoEncryptorClass *) klass)->encrypt_plaintext = (XmppXepOmemoEncryptionData* (*) (XmppXepOmemoOmemoEncryptor*, const gchar*, GError**)) xmpp_xep_omemo_omemo_encryptor_real_encrypt_plaintext;
	((XmppXepOmemoOmemoEncryptorClass *) klass)->encrypt_key = (void (*) (XmppXepOmemoOmemoEncryptor*, XmppXepOmemoEncryptionData*, XmppJid*, gint32, GError**)) xmpp_xep_omemo_omemo_encryptor_real_encrypt_key;
	((XmppXepOmemoOmemoEncryptorClass *) klass)->encrypt_key_to_recipient = (XmppXepOmemoEncryptionResult* (*) (XmppXepOmemoOmemoEncryptor*, XmppXmppStream*, XmppXepOmemoEncryptionData*, XmppJid*, GError**)) xmpp_xep_omemo_omemo_encryptor_real_encrypt_key_to_recipient;
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_omemo_omemo_encryptor_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_omemo_omemo_encryptor_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_omemo_omemo_encryptor_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_omemo_omemo_encryptor_real_get_id;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_omemo_omemo_encryptor_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_omemo_omemo_encryptor_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_OWN_DEVICE_ID_PROPERTY, xmpp_xep_omemo_omemo_encryptor_properties[XMPP_XEP_OMEMO_OMEMO_ENCRYPTOR_OWN_DEVICE_ID_PROPERTY] = g_param_spec_uint ("own-device-id", "own-device-id", "own-device-id", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_OMEMO_TYPE_OMEMO_ENCRYPTOR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_OMEMO_NS_URI, "0384_omemo_encryptor");
	xmpp_xep_omemo_omemo_encryptor_IDENTITY = _tmp0_;
}

static void
xmpp_xep_omemo_omemo_encryptor_instance_init (XmppXepOmemoOmemoEncryptor * self,
                                              gpointer klass)
{
}

static void
xmpp_xep_omemo_omemo_encryptor_finalize (GObject * obj)
{
	XmppXepOmemoOmemoEncryptor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_OMEMO_TYPE_OMEMO_ENCRYPTOR, XmppXepOmemoOmemoEncryptor);
	G_OBJECT_CLASS (xmpp_xep_omemo_omemo_encryptor_parent_class)->finalize (obj);
}

static GType
xmpp_xep_omemo_omemo_encryptor_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepOmemoOmemoEncryptorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_omemo_omemo_encryptor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepOmemoOmemoEncryptor), 0, (GInstanceInitFunc) xmpp_xep_omemo_omemo_encryptor_instance_init, NULL };
	GType xmpp_xep_omemo_omemo_encryptor_type_id;
	xmpp_xep_omemo_omemo_encryptor_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepOmemoOmemoEncryptor", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	return xmpp_xep_omemo_omemo_encryptor_type_id;
}

GType
xmpp_xep_omemo_omemo_encryptor_get_type (void)
{
	static volatile gsize xmpp_xep_omemo_omemo_encryptor_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_omemo_omemo_encryptor_type_id__once)) {
		GType xmpp_xep_omemo_omemo_encryptor_type_id;
		xmpp_xep_omemo_omemo_encryptor_type_id = xmpp_xep_omemo_omemo_encryptor_get_type_once ();
		g_once_init_leave (&xmpp_xep_omemo_omemo_encryptor_type_id__once, xmpp_xep_omemo_omemo_encryptor_type_id);
	}
	return xmpp_xep_omemo_omemo_encryptor_type_id__once;
}

static void
_vala_xmpp_xep_omemo_omemo_encryptor_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	XmppXepOmemoOmemoEncryptor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_OMEMO_TYPE_OMEMO_ENCRYPTOR, XmppXepOmemoOmemoEncryptor);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

XmppXepOmemoEncryptionData*
xmpp_xep_omemo_encryption_data_construct (GType object_type,
                                          guint32 own_device_id)
{
	XmppXepOmemoEncryptionData* self = NULL;
	self = (XmppXepOmemoEncryptionData*) g_type_create_instance (object_type);
	self->own_device_id = own_device_id;
	return self;
}

XmppXepOmemoEncryptionData*
xmpp_xep_omemo_encryption_data_new (guint32 own_device_id)
{
	return xmpp_xep_omemo_encryption_data_construct (XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA, own_device_id);
}

void
xmpp_xep_omemo_encryption_data_add_device_key (XmppXepOmemoEncryptionData* self,
                                               gint device_id,
                                               guint8* device_key,
                                               gint device_key_length1,
                                               gboolean prekey)
{
	XmppStanzaNode* key_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	GeeList* _tmp15_;
	XmppStanzaNode* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("key", XMPP_XEP_OMEMO_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("%i", device_id);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmpp_stanza_node_put_attribute (_tmp1_, "rid", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_base64_encode (device_key, (gint) device_key_length1);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_new_text (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = xmpp_stanza_node_put_node (_tmp5_, _tmp9_);
	_tmp11_ = _tmp10_;
	_xmpp_stanza_entry_unref0 (_tmp9_);
	_g_free0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp5_);
	_g_free0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	key_node = _tmp11_;
	if (prekey) {
		XmppStanzaNode* _tmp12_;
		XmppStanzaNode* _tmp13_;
		XmppStanzaNode* _tmp14_;
		_tmp12_ = key_node;
		_tmp13_ = xmpp_stanza_node_put_attribute (_tmp12_, "prekey", "true", NULL);
		_tmp14_ = _tmp13_;
		_xmpp_stanza_entry_unref0 (_tmp14_);
	}
	_tmp15_ = self->key_nodes;
	_tmp16_ = key_node;
	gee_collection_add ((GeeCollection*) _tmp15_, _tmp16_);
	_xmpp_stanza_entry_unref0 (key_node);
}

XmppStanzaNode*
xmpp_xep_omemo_encryption_data_get_encrypted_node (XmppXepOmemoEncryptionData* self)
{
	XmppStanzaNode* encrypted_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* header_node = NULL;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	XmppStanzaNode* _tmp11_;
	guint8* _tmp12_;
	gint _tmp12__length1;
	gchar* _tmp13_;
	gchar* _tmp14_;
	XmppStanzaNode* _tmp15_;
	XmppStanzaNode* _tmp16_;
	XmppStanzaNode* _tmp17_;
	XmppStanzaNode* _tmp18_;
	XmppStanzaNode* _tmp19_;
	XmppStanzaNode* _tmp20_;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppStanzaNode* _tmp23_;
	XmppStanzaNode* _tmp24_;
	guint8* _tmp25_;
	gint _tmp25__length1;
	XmppStanzaNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("encrypted", XMPP_XEP_OMEMO_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_xmpp_stanza_entry_unref0 (_tmp1_);
	encrypted_node = _tmp3_;
	_tmp4_ = xmpp_stanza_node_new_build ("header", XMPP_XEP_OMEMO_NS_URI, NULL, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup_printf ("%u", self->own_device_id);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmpp_stanza_node_put_attribute (_tmp5_, "sid", _tmp7_, NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = xmpp_stanza_node_new_build ("iv", XMPP_XEP_OMEMO_NS_URI, NULL, NULL);
	_tmp11_ = _tmp10_;
	_tmp12_ = self->iv;
	_tmp12__length1 = self->iv_length1;
	_tmp13_ = g_base64_encode (_tmp12_, (gint) _tmp12__length1);
	_tmp14_ = _tmp13_;
	_tmp15_ = xmpp_stanza_node_new_text (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = xmpp_stanza_node_put_node (_tmp11_, _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = xmpp_stanza_node_put_node (_tmp9_, _tmp18_);
	_tmp20_ = _tmp19_;
	_xmpp_stanza_entry_unref0 (_tmp18_);
	_xmpp_stanza_entry_unref0 (_tmp16_);
	_g_free0 (_tmp14_);
	_xmpp_stanza_entry_unref0 (_tmp11_);
	_xmpp_stanza_entry_unref0 (_tmp9_);
	_g_free0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp5_);
	header_node = _tmp20_;
	_tmp21_ = encrypted_node;
	_tmp22_ = header_node;
	_tmp23_ = xmpp_stanza_node_put_node (_tmp21_, _tmp22_);
	_tmp24_ = _tmp23_;
	_xmpp_stanza_entry_unref0 (_tmp24_);
	_tmp25_ = self->ciphertext;
	_tmp25__length1 = self->ciphertext_length1;
	if (_tmp25_ != NULL) {
		XmppStanzaNode* payload_node = NULL;
		XmppStanzaNode* _tmp26_;
		XmppStanzaNode* _tmp27_;
		guint8* _tmp28_;
		gint _tmp28__length1;
		gchar* _tmp29_;
		gchar* _tmp30_;
		XmppStanzaNode* _tmp31_;
		XmppStanzaNode* _tmp32_;
		XmppStanzaNode* _tmp33_;
		XmppStanzaNode* _tmp34_;
		XmppStanzaNode* _tmp35_;
		XmppStanzaNode* _tmp36_;
		XmppStanzaNode* _tmp37_;
		XmppStanzaNode* _tmp38_;
		_tmp26_ = xmpp_stanza_node_new_build ("payload", XMPP_XEP_OMEMO_NS_URI, NULL, NULL);
		_tmp27_ = _tmp26_;
		_tmp28_ = self->ciphertext;
		_tmp28__length1 = self->ciphertext_length1;
		_tmp29_ = g_base64_encode (_tmp28_, (gint) _tmp28__length1);
		_tmp30_ = _tmp29_;
		_tmp31_ = xmpp_stanza_node_new_text (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = xmpp_stanza_node_put_node (_tmp27_, _tmp32_);
		_tmp34_ = _tmp33_;
		_xmpp_stanza_entry_unref0 (_tmp32_);
		_g_free0 (_tmp30_);
		_xmpp_stanza_entry_unref0 (_tmp27_);
		payload_node = _tmp34_;
		_tmp35_ = encrypted_node;
		_tmp36_ = payload_node;
		_tmp37_ = xmpp_stanza_node_put_node (_tmp35_, _tmp36_);
		_tmp38_ = _tmp37_;
		_xmpp_stanza_entry_unref0 (_tmp38_);
		_xmpp_stanza_entry_unref0 (payload_node);
	}
	{
		GeeList* _key_node_list = NULL;
		GeeList* _tmp39_;
		gint _key_node_size = 0;
		GeeList* _tmp40_;
		gint _tmp41_;
		gint _tmp42_;
		gint _key_node_index = 0;
		_tmp39_ = self->key_nodes;
		_key_node_list = _tmp39_;
		_tmp40_ = _key_node_list;
		_tmp41_ = gee_collection_get_size ((GeeCollection*) _tmp40_);
		_tmp42_ = _tmp41_;
		_key_node_size = _tmp42_;
		_key_node_index = -1;
		while (TRUE) {
			gint _tmp43_;
			gint _tmp44_;
			XmppStanzaNode* key_node = NULL;
			GeeList* _tmp45_;
			gpointer _tmp46_;
			XmppStanzaNode* _tmp47_;
			XmppStanzaNode* _tmp48_;
			XmppStanzaNode* _tmp49_;
			XmppStanzaNode* _tmp50_;
			_key_node_index = _key_node_index + 1;
			_tmp43_ = _key_node_index;
			_tmp44_ = _key_node_size;
			if (!(_tmp43_ < _tmp44_)) {
				break;
			}
			_tmp45_ = _key_node_list;
			_tmp46_ = gee_list_get (_tmp45_, _key_node_index);
			key_node = (XmppStanzaNode*) _tmp46_;
			_tmp47_ = header_node;
			_tmp48_ = key_node;
			_tmp49_ = xmpp_stanza_node_put_node (_tmp47_, _tmp48_);
			_tmp50_ = _tmp49_;
			_xmpp_stanza_entry_unref0 (_tmp50_);
			_xmpp_stanza_entry_unref0 (key_node);
		}
	}
	result = encrypted_node;
	_xmpp_stanza_entry_unref0 (header_node);
	return result;
}

static void
xmpp_xep_omemo_value_encryption_data_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xep_omemo_value_encryption_data_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xep_omemo_encryption_data_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xep_omemo_value_encryption_data_copy_value (const GValue* src_value,
                                                 GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xep_omemo_encryption_data_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xep_omemo_value_encryption_data_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xep_omemo_value_encryption_data_collect_value (GValue* value,
                                                    guint n_collect_values,
                                                    GTypeCValue* collect_values,
                                                    guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXepOmemoEncryptionData * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xep_omemo_encryption_data_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xep_omemo_value_encryption_data_lcopy_value (const GValue* value,
                                                  guint n_collect_values,
                                                  GTypeCValue* collect_values,
                                                  guint collect_flags)
{
	XmppXepOmemoEncryptionData ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xep_omemo_encryption_data_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_xep_omemo_param_spec_encryption_data (const gchar* name,
                                           const gchar* nick,
                                           const gchar* blurb,
                                           GType object_type,
                                           GParamFlags flags)
{
	XmppXepOmemoParamSpecEncryptionData* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_xep_omemo_value_get_encryption_data (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_xep_omemo_value_set_encryption_data (GValue* value,
                                          gpointer v_object)
{
	XmppXepOmemoEncryptionData * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xep_omemo_encryption_data_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_omemo_encryption_data_unref (old);
	}
}

void
xmpp_xep_omemo_value_take_encryption_data (GValue* value,
                                           gpointer v_object)
{
	XmppXepOmemoEncryptionData * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_omemo_encryption_data_unref (old);
	}
}

static void
xmpp_xep_omemo_encryption_data_class_init (XmppXepOmemoEncryptionDataClass * klass,
                                           gpointer klass_data)
{
	xmpp_xep_omemo_encryption_data_parent_class = g_type_class_peek_parent (klass);
	((XmppXepOmemoEncryptionDataClass *) klass)->finalize = xmpp_xep_omemo_encryption_data_finalize;
}

static void
xmpp_xep_omemo_encryption_data_instance_init (XmppXepOmemoEncryptionData * self,
                                              gpointer klass)
{
	GeeArrayList* _tmp0_;
	_tmp0_ = gee_array_list_new (XMPP_TYPE_STANZA_NODE, (GBoxedCopyFunc) xmpp_stanza_entry_ref, (GDestroyNotify) xmpp_stanza_entry_unref, NULL, NULL, NULL);
	self->key_nodes = (GeeList*) _tmp0_;
	self->ref_count = 1;
}

static void
xmpp_xep_omemo_encryption_data_finalize (XmppXepOmemoEncryptionData * obj)
{
	XmppXepOmemoEncryptionData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_DATA, XmppXepOmemoEncryptionData);
	g_signal_handlers_destroy (self);
	self->ciphertext = (g_free (self->ciphertext), NULL);
	self->keytag = (g_free (self->keytag), NULL);
	self->iv = (g_free (self->iv), NULL);
	_g_object_unref0 (self->key_nodes);
}

static GType
xmpp_xep_omemo_encryption_data_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_omemo_value_encryption_data_init, xmpp_xep_omemo_value_encryption_data_free_value, xmpp_xep_omemo_value_encryption_data_copy_value, xmpp_xep_omemo_value_encryption_data_peek_pointer, "p", xmpp_xep_omemo_value_encryption_data_collect_value, "p", xmpp_xep_omemo_value_encryption_data_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepOmemoEncryptionDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_omemo_encryption_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepOmemoEncryptionData), 0, (GInstanceInitFunc) xmpp_xep_omemo_encryption_data_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xep_omemo_encryption_data_type_id;
	xmpp_xep_omemo_encryption_data_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepOmemoEncryptionData", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return xmpp_xep_omemo_encryption_data_type_id;
}

GType
xmpp_xep_omemo_encryption_data_get_type (void)
{
	static volatile gsize xmpp_xep_omemo_encryption_data_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_omemo_encryption_data_type_id__once)) {
		GType xmpp_xep_omemo_encryption_data_type_id;
		xmpp_xep_omemo_encryption_data_type_id = xmpp_xep_omemo_encryption_data_get_type_once ();
		g_once_init_leave (&xmpp_xep_omemo_encryption_data_type_id__once, xmpp_xep_omemo_encryption_data_type_id);
	}
	return xmpp_xep_omemo_encryption_data_type_id__once;
}

gpointer
xmpp_xep_omemo_encryption_data_ref (gpointer instance)
{
	XmppXepOmemoEncryptionData * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xep_omemo_encryption_data_unref (gpointer instance)
{
	XmppXepOmemoEncryptionData * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_OMEMO_ENCRYPTION_DATA_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
xmpp_xep_omemo_encryption_result_get_instance_private (XmppXepOmemoEncryptionResult* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepOmemoEncryptionResult_private_offset);
}

XmppXepOmemoEncryptionResult*
xmpp_xep_omemo_encryption_result_construct (GType object_type)
{
	XmppXepOmemoEncryptionResult* self = NULL;
	self = (XmppXepOmemoEncryptionResult*) g_type_create_instance (object_type);
	return self;
}

XmppXepOmemoEncryptionResult*
xmpp_xep_omemo_encryption_result_new (void)
{
	return xmpp_xep_omemo_encryption_result_construct (XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT);
}

gint
xmpp_xep_omemo_encryption_result_get_lost (XmppXepOmemoEncryptionResult* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_lost;
	return result;
}

void
xmpp_xep_omemo_encryption_result_set_lost (XmppXepOmemoEncryptionResult* self,
                                           gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_lost = value;
}

gint
xmpp_xep_omemo_encryption_result_get_success (XmppXepOmemoEncryptionResult* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_success;
	return result;
}

void
xmpp_xep_omemo_encryption_result_set_success (XmppXepOmemoEncryptionResult* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_success = value;
}

gint
xmpp_xep_omemo_encryption_result_get_unknown (XmppXepOmemoEncryptionResult* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_unknown;
	return result;
}

void
xmpp_xep_omemo_encryption_result_set_unknown (XmppXepOmemoEncryptionResult* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_unknown = value;
}

gint
xmpp_xep_omemo_encryption_result_get_failure (XmppXepOmemoEncryptionResult* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_failure;
	return result;
}

void
xmpp_xep_omemo_encryption_result_set_failure (XmppXepOmemoEncryptionResult* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_failure = value;
}

static void
xmpp_xep_omemo_value_encryption_result_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xep_omemo_value_encryption_result_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xep_omemo_encryption_result_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xep_omemo_value_encryption_result_copy_value (const GValue* src_value,
                                                   GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xep_omemo_encryption_result_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xep_omemo_value_encryption_result_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xep_omemo_value_encryption_result_collect_value (GValue* value,
                                                      guint n_collect_values,
                                                      GTypeCValue* collect_values,
                                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXepOmemoEncryptionResult * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xep_omemo_encryption_result_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xep_omemo_value_encryption_result_lcopy_value (const GValue* value,
                                                    guint n_collect_values,
                                                    GTypeCValue* collect_values,
                                                    guint collect_flags)
{
	XmppXepOmemoEncryptionResult ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xep_omemo_encryption_result_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_xep_omemo_param_spec_encryption_result (const gchar* name,
                                             const gchar* nick,
                                             const gchar* blurb,
                                             GType object_type,
                                             GParamFlags flags)
{
	XmppXepOmemoParamSpecEncryptionResult* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_xep_omemo_value_get_encryption_result (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_xep_omemo_value_set_encryption_result (GValue* value,
                                            gpointer v_object)
{
	XmppXepOmemoEncryptionResult * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xep_omemo_encryption_result_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_omemo_encryption_result_unref (old);
	}
}

void
xmpp_xep_omemo_value_take_encryption_result (GValue* value,
                                             gpointer v_object)
{
	XmppXepOmemoEncryptionResult * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_omemo_encryption_result_unref (old);
	}
}

static void
xmpp_xep_omemo_encryption_result_class_init (XmppXepOmemoEncryptionResultClass * klass,
                                             gpointer klass_data)
{
	xmpp_xep_omemo_encryption_result_parent_class = g_type_class_peek_parent (klass);
	((XmppXepOmemoEncryptionResultClass *) klass)->finalize = xmpp_xep_omemo_encryption_result_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXepOmemoEncryptionResult_private_offset);
}

static void
xmpp_xep_omemo_encryption_result_instance_init (XmppXepOmemoEncryptionResult * self,
                                                gpointer klass)
{
	self->priv = xmpp_xep_omemo_encryption_result_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xep_omemo_encryption_result_finalize (XmppXepOmemoEncryptionResult * obj)
{
	XmppXepOmemoEncryptionResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_OMEMO_TYPE_ENCRYPTION_RESULT, XmppXepOmemoEncryptionResult);
	g_signal_handlers_destroy (self);
}

static GType
xmpp_xep_omemo_encryption_result_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_omemo_value_encryption_result_init, xmpp_xep_omemo_value_encryption_result_free_value, xmpp_xep_omemo_value_encryption_result_copy_value, xmpp_xep_omemo_value_encryption_result_peek_pointer, "p", xmpp_xep_omemo_value_encryption_result_collect_value, "p", xmpp_xep_omemo_value_encryption_result_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepOmemoEncryptionResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_omemo_encryption_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepOmemoEncryptionResult), 0, (GInstanceInitFunc) xmpp_xep_omemo_encryption_result_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xep_omemo_encryption_result_type_id;
	xmpp_xep_omemo_encryption_result_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepOmemoEncryptionResult", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXepOmemoEncryptionResult_private_offset = g_type_add_instance_private (xmpp_xep_omemo_encryption_result_type_id, sizeof (XmppXepOmemoEncryptionResultPrivate));
	return xmpp_xep_omemo_encryption_result_type_id;
}

GType
xmpp_xep_omemo_encryption_result_get_type (void)
{
	static volatile gsize xmpp_xep_omemo_encryption_result_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_omemo_encryption_result_type_id__once)) {
		GType xmpp_xep_omemo_encryption_result_type_id;
		xmpp_xep_omemo_encryption_result_type_id = xmpp_xep_omemo_encryption_result_get_type_once ();
		g_once_init_leave (&xmpp_xep_omemo_encryption_result_type_id__once, xmpp_xep_omemo_encryption_result_type_id);
	}
	return xmpp_xep_omemo_encryption_result_type_id__once;
}

gpointer
xmpp_xep_omemo_encryption_result_ref (gpointer instance)
{
	XmppXepOmemoEncryptionResult * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xep_omemo_encryption_result_unref (gpointer instance)
{
	XmppXepOmemoEncryptionResult * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_OMEMO_ENCRYPTION_RESULT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
xmpp_xep_omemo_encrypt_state_get_instance_private (XmppXepOmemoEncryptState* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepOmemoEncryptState_private_offset);
}

void
xmpp_xep_omemo_encrypt_state_add_result (XmppXepOmemoEncryptState* self,
                                         XmppXepOmemoEncryptionResult* enc_res,
                                         gboolean own)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (enc_res != NULL);
	if (own) {
		gint _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp0_ = self->priv->_own_lost;
		_tmp1_ = xmpp_xep_omemo_encryption_result_get_lost (enc_res);
		_tmp2_ = _tmp1_;
		xmpp_xep_omemo_encrypt_state_set_own_lost (self, _tmp0_ + _tmp2_);
		_tmp3_ = self->priv->_own_success;
		_tmp4_ = xmpp_xep_omemo_encryption_result_get_success (enc_res);
		_tmp5_ = _tmp4_;
		xmpp_xep_omemo_encrypt_state_set_own_success (self, _tmp3_ + _tmp5_);
		_tmp6_ = self->priv->_own_unknown;
		_tmp7_ = xmpp_xep_omemo_encryption_result_get_unknown (enc_res);
		_tmp8_ = _tmp7_;
		xmpp_xep_omemo_encrypt_state_set_own_unknown (self, _tmp6_ + _tmp8_);
		_tmp9_ = self->priv->_own_failure;
		_tmp10_ = xmpp_xep_omemo_encryption_result_get_failure (enc_res);
		_tmp11_ = _tmp10_;
		xmpp_xep_omemo_encrypt_state_set_own_failure (self, _tmp9_ + _tmp11_);
	} else {
		gint _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		_tmp12_ = self->priv->_other_lost;
		_tmp13_ = xmpp_xep_omemo_encryption_result_get_lost (enc_res);
		_tmp14_ = _tmp13_;
		xmpp_xep_omemo_encrypt_state_set_other_lost (self, _tmp12_ + _tmp14_);
		_tmp15_ = self->priv->_other_success;
		_tmp16_ = xmpp_xep_omemo_encryption_result_get_success (enc_res);
		_tmp17_ = _tmp16_;
		xmpp_xep_omemo_encrypt_state_set_other_success (self, _tmp15_ + _tmp17_);
		_tmp18_ = self->priv->_other_unknown;
		_tmp19_ = xmpp_xep_omemo_encryption_result_get_unknown (enc_res);
		_tmp20_ = _tmp19_;
		xmpp_xep_omemo_encrypt_state_set_other_unknown (self, _tmp18_ + _tmp20_);
		_tmp21_ = self->priv->_other_failure;
		_tmp22_ = xmpp_xep_omemo_encryption_result_get_failure (enc_res);
		_tmp23_ = _tmp22_;
		xmpp_xep_omemo_encrypt_state_set_other_failure (self, _tmp21_ + _tmp23_);
	}
}

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

gchar*
xmpp_xep_omemo_encrypt_state_to_string (XmppXepOmemoEncryptState* self)
{
	gboolean _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gint _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gint _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gint _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gint _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gint _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gint _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gint _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gint _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gboolean _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_encrypted;
	_tmp1_ = bool_to_string (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_other_devices;
	_tmp4_ = g_strdup_printf ("%i", _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->_other_success;
	_tmp7_ = g_strdup_printf ("%i", _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_other_lost;
	_tmp10_ = g_strdup_printf ("%i", _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = self->priv->_other_unknown;
	_tmp13_ = g_strdup_printf ("%i", _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = self->priv->_other_failure;
	_tmp16_ = g_strdup_printf ("%i", _tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = self->priv->_other_waiting_lists;
	_tmp19_ = g_strdup_printf ("%i", _tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->_own_devices;
	_tmp22_ = g_strdup_printf ("%i", _tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = self->priv->_own_success;
	_tmp25_ = g_strdup_printf ("%i", _tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = self->priv->_own_lost;
	_tmp28_ = g_strdup_printf ("%i", _tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = self->priv->_own_unknown;
	_tmp31_ = g_strdup_printf ("%i", _tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = self->priv->_own_failure;
	_tmp34_ = g_strdup_printf ("%i", _tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = self->priv->_own_list;
	_tmp37_ = bool_to_string (_tmp36_);
	_tmp38_ = _tmp37_;
	_tmp39_ = g_strconcat ("EncryptState (encrypted=", _tmp2_, ", other=(devices=", _tmp5_, ", success=", _tmp8_, ", lost=", _tmp11_, ", unknown=", _tmp14_, ", failure=", _tmp17_, ", waiting_lists=", _tmp20_, ", own=(devices=", _tmp23_, ", success=", _tmp26_, ", lost=", _tmp29_, ", unknown=", _tmp32_, ", failure=", _tmp35_, ", list=", _tmp38_, "))", NULL);
	_tmp40_ = _tmp39_;
	_g_free0 (_tmp38_);
	_g_free0 (_tmp35_);
	_g_free0 (_tmp32_);
	_g_free0 (_tmp29_);
	_g_free0 (_tmp26_);
	_g_free0 (_tmp23_);
	_g_free0 (_tmp20_);
	_g_free0 (_tmp17_);
	_g_free0 (_tmp14_);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	result = _tmp40_;
	return result;
}

XmppXepOmemoEncryptState*
xmpp_xep_omemo_encrypt_state_construct (GType object_type)
{
	XmppXepOmemoEncryptState* self = NULL;
	self = (XmppXepOmemoEncryptState*) g_type_create_instance (object_type);
	return self;
}

XmppXepOmemoEncryptState*
xmpp_xep_omemo_encrypt_state_new (void)
{
	return xmpp_xep_omemo_encrypt_state_construct (XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE);
}

gboolean
xmpp_xep_omemo_encrypt_state_get_encrypted (XmppXepOmemoEncryptState* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_encrypted;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_encrypted (XmppXepOmemoEncryptState* self,
                                            gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_encrypted = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_other_devices (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_other_devices;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_other_devices (XmppXepOmemoEncryptState* self,
                                                gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_other_devices = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_other_success (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_other_success;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_other_success (XmppXepOmemoEncryptState* self,
                                                gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_other_success = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_other_lost (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_other_lost;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_other_lost (XmppXepOmemoEncryptState* self,
                                             gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_other_lost = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_other_unknown (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_other_unknown;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_other_unknown (XmppXepOmemoEncryptState* self,
                                                gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_other_unknown = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_other_failure (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_other_failure;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_other_failure (XmppXepOmemoEncryptState* self,
                                                gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_other_failure = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_other_waiting_lists (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_other_waiting_lists;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_other_waiting_lists (XmppXepOmemoEncryptState* self,
                                                      gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_other_waiting_lists = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_own_devices (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_own_devices;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_own_devices (XmppXepOmemoEncryptState* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_own_devices = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_own_success (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_own_success;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_own_success (XmppXepOmemoEncryptState* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_own_success = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_own_lost (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_own_lost;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_own_lost (XmppXepOmemoEncryptState* self,
                                           gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_own_lost = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_own_unknown (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_own_unknown;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_own_unknown (XmppXepOmemoEncryptState* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_own_unknown = value;
}

gint
xmpp_xep_omemo_encrypt_state_get_own_failure (XmppXepOmemoEncryptState* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_own_failure;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_own_failure (XmppXepOmemoEncryptState* self,
                                              gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_own_failure = value;
}

gboolean
xmpp_xep_omemo_encrypt_state_get_own_list (XmppXepOmemoEncryptState* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_own_list;
	return result;
}

void
xmpp_xep_omemo_encrypt_state_set_own_list (XmppXepOmemoEncryptState* self,
                                           gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_own_list = value;
}

static void
xmpp_xep_omemo_value_encrypt_state_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xep_omemo_value_encrypt_state_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xep_omemo_encrypt_state_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xep_omemo_value_encrypt_state_copy_value (const GValue* src_value,
                                               GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xep_omemo_encrypt_state_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xep_omemo_value_encrypt_state_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xep_omemo_value_encrypt_state_collect_value (GValue* value,
                                                  guint n_collect_values,
                                                  GTypeCValue* collect_values,
                                                  guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXepOmemoEncryptState * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xep_omemo_encrypt_state_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xep_omemo_value_encrypt_state_lcopy_value (const GValue* value,
                                                guint n_collect_values,
                                                GTypeCValue* collect_values,
                                                guint collect_flags)
{
	XmppXepOmemoEncryptState ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xep_omemo_encrypt_state_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_xep_omemo_param_spec_encrypt_state (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags)
{
	XmppXepOmemoParamSpecEncryptState* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_xep_omemo_value_get_encrypt_state (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_xep_omemo_value_set_encrypt_state (GValue* value,
                                        gpointer v_object)
{
	XmppXepOmemoEncryptState * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xep_omemo_encrypt_state_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_omemo_encrypt_state_unref (old);
	}
}

void
xmpp_xep_omemo_value_take_encrypt_state (GValue* value,
                                         gpointer v_object)
{
	XmppXepOmemoEncryptState * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_omemo_encrypt_state_unref (old);
	}
}

static void
xmpp_xep_omemo_encrypt_state_class_init (XmppXepOmemoEncryptStateClass * klass,
                                         gpointer klass_data)
{
	xmpp_xep_omemo_encrypt_state_parent_class = g_type_class_peek_parent (klass);
	((XmppXepOmemoEncryptStateClass *) klass)->finalize = xmpp_xep_omemo_encrypt_state_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXepOmemoEncryptState_private_offset);
}

static void
xmpp_xep_omemo_encrypt_state_instance_init (XmppXepOmemoEncryptState * self,
                                            gpointer klass)
{
	self->priv = xmpp_xep_omemo_encrypt_state_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xep_omemo_encrypt_state_finalize (XmppXepOmemoEncryptState * obj)
{
	XmppXepOmemoEncryptState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_OMEMO_TYPE_ENCRYPT_STATE, XmppXepOmemoEncryptState);
	g_signal_handlers_destroy (self);
}

static GType
xmpp_xep_omemo_encrypt_state_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_omemo_value_encrypt_state_init, xmpp_xep_omemo_value_encrypt_state_free_value, xmpp_xep_omemo_value_encrypt_state_copy_value, xmpp_xep_omemo_value_encrypt_state_peek_pointer, "p", xmpp_xep_omemo_value_encrypt_state_collect_value, "p", xmpp_xep_omemo_value_encrypt_state_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepOmemoEncryptStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_omemo_encrypt_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepOmemoEncryptState), 0, (GInstanceInitFunc) xmpp_xep_omemo_encrypt_state_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xep_omemo_encrypt_state_type_id;
	xmpp_xep_omemo_encrypt_state_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepOmemoEncryptState", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXepOmemoEncryptState_private_offset = g_type_add_instance_private (xmpp_xep_omemo_encrypt_state_type_id, sizeof (XmppXepOmemoEncryptStatePrivate));
	return xmpp_xep_omemo_encrypt_state_type_id;
}

GType
xmpp_xep_omemo_encrypt_state_get_type (void)
{
	static volatile gsize xmpp_xep_omemo_encrypt_state_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_omemo_encrypt_state_type_id__once)) {
		GType xmpp_xep_omemo_encrypt_state_type_id;
		xmpp_xep_omemo_encrypt_state_type_id = xmpp_xep_omemo_encrypt_state_get_type_once ();
		g_once_init_leave (&xmpp_xep_omemo_encrypt_state_type_id__once, xmpp_xep_omemo_encrypt_state_type_id);
	}
	return xmpp_xep_omemo_encrypt_state_type_id__once;
}

gpointer
xmpp_xep_omemo_encrypt_state_ref (gpointer instance)
{
	XmppXepOmemoEncryptState * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xep_omemo_encrypt_state_unref (gpointer instance)
{
	XmppXepOmemoEncryptState * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_OMEMO_ENCRYPT_STATE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

