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

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

#define DINO_PLUGINS_OMEMO_NS_URI "eu.siacs.conversations.axolotl"
#define DINO_PLUGINS_JET_OMEMO_AES_128_GCM_URI "urn:xmpp:ciphers:aes-128-gcm-nopadding"
#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  {
	DINO_PLUGINS_JET_OMEMO_ENCRYPTION_HELPER_0_PROPERTY,
	DINO_PLUGINS_JET_OMEMO_ENCRYPTION_HELPER_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_jet_omemo_encryption_helper_properties[DINO_PLUGINS_JET_OMEMO_ENCRYPTION_HELPER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
typedef struct _DinoPluginsJetOmemoEncryptionHelperCanEncryptData DinoPluginsJetOmemoEncryptionHelperCanEncryptData;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _DinoPluginsJetOmemoEncryptionHelperPrivate {
	DinoStreamInteractor* stream_interactor;
};

struct _DinoPluginsJetOmemoEncryptionHelperCanEncryptData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoPluginsJetOmemoEncryptionHelper* self;
	DinoEntitiesConversation* conversation;
	DinoEntitiesFileTransfer* file_transfer;
	XmppJid* full_jid;
	gboolean result;
	XmppXmppStream* stream;
	DinoStreamInteractor* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppXmppStream* _tmp3_;
	XmppXmppStream* _tmp4_;
	GeeList* resources;
	XmppXmppStream* _tmp5_;
	XmppFlagIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppPresenceFlag* _tmp8_;
	XmppJid* _tmp9_;
	XmppJid* _tmp10_;
	GeeList* _tmp11_;
	GeeList* _tmp12_;
	GeeList* _tmp13_;
	GeeList* _test_jid_list;
	GeeList* _tmp14_;
	gint _test_jid_size;
	GeeList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gint _test_jid_index;
	gint _tmp18_;
	gint _tmp19_;
	XmppJid* test_jid;
	GeeList* _tmp20_;
	gpointer _tmp21_;
	XmppXmppStream* _tmp22_;
	XmppModuleIdentity* _tmp23_;
	gpointer _tmp24_;
	DinoPluginsJetOmemoModule* _tmp25_;
	XmppXmppStream* _tmp26_;
	XmppJid* _tmp27_;
	gboolean _tmp28_;
	XmppXmppStream* _tmp29_;
	XmppModuleIdentity* _tmp30_;
	gpointer _tmp31_;
	DinoPluginsJetOmemoModule* _tmp32_;
	XmppXmppStream* _tmp33_;
	gboolean _tmp34_;
};

static gint DinoPluginsJetOmemoEncryptionHelper_private_offset;
static gpointer dino_plugins_jet_omemo_encryption_helper_parent_class = NULL;
static DinoJingleFileEncryptionHelperIface * dino_plugins_jet_omemo_encryption_helper_dino_jingle_file_encryption_helper_parent_iface = NULL;

static gboolean dino_plugins_jet_omemo_encryption_helper_real_can_transfer (DinoJingleFileEncryptionHelper* base,
                                                                     DinoEntitiesConversation* conversation);
static void dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_data_free (gpointer _data);
static void dino_plugins_jet_omemo_encryption_helper_real_can_encrypt (DinoJingleFileEncryptionHelper* base,
                                                                DinoEntitiesConversation* conversation,
                                                                DinoEntitiesFileTransfer* file_transfer,
                                                                XmppJid* full_jid,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
static gboolean dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_co (DinoPluginsJetOmemoEncryptionHelperCanEncryptData* _data_);
static void dino_plugins_jet_omemo_encryption_helper_can_encrypt_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_);
static gchar* dino_plugins_jet_omemo_encryption_helper_real_get_precondition_name (DinoJingleFileEncryptionHelper* base,
                                                                            DinoEntitiesConversation* conversation,
                                                                            DinoEntitiesFileTransfer* file_transfer);
static GObject* dino_plugins_jet_omemo_encryption_helper_real_get_precondition_options (DinoJingleFileEncryptionHelper* base,
                                                                                 DinoEntitiesConversation* conversation,
                                                                                 DinoEntitiesFileTransfer* file_transfer);
static DinoEntitiesEncryption dino_plugins_jet_omemo_encryption_helper_real_get_encryption (DinoJingleFileEncryptionHelper* base,
                                                                                     XmppXepJingleFileTransferFileTransfer* jingle_transfer);
static void dino_plugins_jet_omemo_encryption_helper_finalize (GObject * obj);
static GType dino_plugins_jet_omemo_encryption_helper_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_plugins_jet_omemo_encryption_helper_get_instance_private (DinoPluginsJetOmemoEncryptionHelper* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsJetOmemoEncryptionHelper_private_offset);
}

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

DinoPluginsJetOmemoEncryptionHelper*
dino_plugins_jet_omemo_encryption_helper_construct (GType object_type,
                                                    DinoStreamInteractor* stream_interactor)
{
	DinoPluginsJetOmemoEncryptionHelper * self = NULL;
	DinoStreamInteractor* _tmp0_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoPluginsJetOmemoEncryptionHelper*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp0_;
	return self;
}

DinoPluginsJetOmemoEncryptionHelper*
dino_plugins_jet_omemo_encryption_helper_new (DinoStreamInteractor* stream_interactor)
{
	return dino_plugins_jet_omemo_encryption_helper_construct (DINO_PLUGINS_JET_OMEMO_TYPE_ENCRYPTION_HELPER, stream_interactor);
}

static gboolean
dino_plugins_jet_omemo_encryption_helper_real_can_transfer (DinoJingleFileEncryptionHelper* base,
                                                            DinoEntitiesConversation* conversation)
{
	DinoPluginsJetOmemoEncryptionHelper * self;
	gboolean result;
	self = (DinoPluginsJetOmemoEncryptionHelper*) base;
	g_return_val_if_fail (conversation != NULL, FALSE);
	result = TRUE;
	return result;
}

static void
dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_data_free (gpointer _data)
{
	DinoPluginsJetOmemoEncryptionHelperCanEncryptData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->file_transfer);
	_xmpp_jid_unref0 (_data_->full_jid);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoPluginsJetOmemoEncryptionHelperCanEncryptData, _data_);
}

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

static void
dino_plugins_jet_omemo_encryption_helper_real_can_encrypt (DinoJingleFileEncryptionHelper* base,
                                                           DinoEntitiesConversation* conversation,
                                                           DinoEntitiesFileTransfer* file_transfer,
                                                           XmppJid* full_jid,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	DinoPluginsJetOmemoEncryptionHelper * self;
	DinoPluginsJetOmemoEncryptionHelperCanEncryptData* _data_;
	DinoPluginsJetOmemoEncryptionHelper* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesFileTransfer* _tmp2_;
	XmppJid* _tmp3_;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (file_transfer != NULL);
	self = (DinoPluginsJetOmemoEncryptionHelper*) base;
	_data_ = g_slice_new0 (DinoPluginsJetOmemoEncryptionHelperCanEncryptData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data_->conversation);
	_data_->conversation = _tmp1_;
	_tmp2_ = _g_object_ref0 (file_transfer);
	_g_object_unref0 (_data_->file_transfer);
	_data_->file_transfer = _tmp2_;
	_tmp3_ = _xmpp_jid_ref0 (full_jid);
	_xmpp_jid_unref0 (_data_->full_jid);
	_data_->full_jid = _tmp3_;
	dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_co (_data_);
}

static gboolean
dino_plugins_jet_omemo_encryption_helper_can_encrypt_finish (DinoJingleFileEncryptionHelper* base,
                                                             GAsyncResult* _res_)
{
	gboolean result;
	DinoPluginsJetOmemoEncryptionHelperCanEncryptData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dino_plugins_jet_omemo_encryption_helper_can_encrypt_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_)
{
	DinoPluginsJetOmemoEncryptionHelperCanEncryptData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_co (_data_);
}

static gboolean
dino_plugins_jet_omemo_encryption_helper_real_can_encrypt_co (DinoPluginsJetOmemoEncryptionHelperCanEncryptData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->stream_interactor;
	_data_->_tmp1_ = dino_entities_conversation_get_account (_data_->conversation);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = dino_stream_interactor_get_stream (_data_->_tmp0_, _data_->_tmp2_);
	_data_->stream = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->stream;
	if (_data_->_tmp4_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->stream);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = _data_->stream;
	_data_->_tmp6_ = xmpp_presence_flag_IDENTITY;
	_data_->_tmp7_ = xmpp_xmpp_stream_get_flag (_data_->_tmp5_, XMPP_PRESENCE_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp6_);
	_data_->_tmp8_ = (XmppPresenceFlag*) _data_->_tmp7_;
	_data_->_tmp9_ = dino_entities_conversation_get_counterpart (_data_->conversation);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = xmpp_presence_flag_get_resources (_data_->_tmp8_, _data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_g_object_unref0 (_data_->_tmp8_);
	_data_->resources = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->resources;
	if (_data_->_tmp13_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->resources);
		_g_object_unref0 (_data_->stream);
		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;
	}
	if (_data_->full_jid == NULL) {
		{
			_data_->_tmp14_ = _data_->resources;
			_data_->_test_jid_list = _data_->_tmp14_;
			_data_->_tmp15_ = _data_->_test_jid_list;
			_data_->_tmp16_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp15_);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_test_jid_size = _data_->_tmp17_;
			_data_->_test_jid_index = -1;
			while (TRUE) {
				_data_->_test_jid_index = _data_->_test_jid_index + 1;
				_data_->_tmp18_ = _data_->_test_jid_index;
				_data_->_tmp19_ = _data_->_test_jid_size;
				if (!(_data_->_tmp18_ < _data_->_tmp19_)) {
					break;
				}
				_data_->_tmp20_ = _data_->_test_jid_list;
				_data_->_tmp21_ = gee_list_get (_data_->_tmp20_, _data_->_test_jid_index);
				_data_->test_jid = (XmppJid*) _data_->_tmp21_;
				_data_->_tmp22_ = _data_->stream;
				_data_->_tmp23_ = dino_plugins_jet_omemo_module_IDENTITY;
				_data_->_tmp24_ = xmpp_xmpp_stream_get_module (_data_->_tmp22_, DINO_PLUGINS_JET_OMEMO_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp23_);
				_data_->_tmp25_ = (DinoPluginsJetOmemoModule*) _data_->_tmp24_;
				_data_->_tmp26_ = _data_->stream;
				_data_->_tmp27_ = _data_->test_jid;
				_data_->_state_ = 1;
				dino_plugins_jet_omemo_module_is_available (_data_->_tmp25_, _data_->_tmp26_, _data_->_tmp27_, dino_plugins_jet_omemo_encryption_helper_can_encrypt_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp28_ = dino_plugins_jet_omemo_module_is_available_finish (_data_->_tmp25_, _data_->_res_);
				_g_object_unref0 (_data_->_tmp25_);
				if (_data_->_tmp28_) {
					_data_->result = TRUE;
					_xmpp_jid_unref0 (_data_->test_jid);
					_g_object_unref0 (_data_->resources);
					_g_object_unref0 (_data_->stream);
					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;
				}
				_xmpp_jid_unref0 (_data_->test_jid);
			}
		}
	} else {
		_data_->_tmp29_ = _data_->stream;
		_data_->_tmp30_ = dino_plugins_jet_omemo_module_IDENTITY;
		_data_->_tmp31_ = xmpp_xmpp_stream_get_module (_data_->_tmp29_, DINO_PLUGINS_JET_OMEMO_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp30_);
		_data_->_tmp32_ = (DinoPluginsJetOmemoModule*) _data_->_tmp31_;
		_data_->_tmp33_ = _data_->stream;
		_data_->_state_ = 2;
		dino_plugins_jet_omemo_module_is_available (_data_->_tmp32_, _data_->_tmp33_, _data_->full_jid, dino_plugins_jet_omemo_encryption_helper_can_encrypt_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp34_ = dino_plugins_jet_omemo_module_is_available_finish (_data_->_tmp32_, _data_->_res_);
		_g_object_unref0 (_data_->_tmp32_);
		if (_data_->_tmp34_) {
			_data_->result = TRUE;
			_g_object_unref0 (_data_->resources);
			_g_object_unref0 (_data_->stream);
			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_->result = FALSE;
	_g_object_unref0 (_data_->resources);
	_g_object_unref0 (_data_->stream);
	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 gchar*
dino_plugins_jet_omemo_encryption_helper_real_get_precondition_name (DinoJingleFileEncryptionHelper* base,
                                                                     DinoEntitiesConversation* conversation,
                                                                     DinoEntitiesFileTransfer* file_transfer)
{
	DinoPluginsJetOmemoEncryptionHelper * self;
	gchar* _tmp0_;
	gchar* result;
	self = (DinoPluginsJetOmemoEncryptionHelper*) base;
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (file_transfer != NULL, NULL);
	_tmp0_ = g_strdup (XMPP_XEP_JET_NS_URI);
	result = _tmp0_;
	return result;
}

static GObject*
dino_plugins_jet_omemo_encryption_helper_real_get_precondition_options (DinoJingleFileEncryptionHelper* base,
                                                                        DinoEntitiesConversation* conversation,
                                                                        DinoEntitiesFileTransfer* file_transfer)
{
	DinoPluginsJetOmemoEncryptionHelper * self;
	XmppXepJetOptions* _tmp0_;
	GObject* result;
	self = (DinoPluginsJetOmemoEncryptionHelper*) base;
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (file_transfer != NULL, NULL);
	_tmp0_ = xmpp_xep_jet_options_new (DINO_PLUGINS_OMEMO_NS_URI, DINO_PLUGINS_JET_OMEMO_AES_128_GCM_URI);
	result = (GObject*) _tmp0_;
	return result;
}

static DinoEntitiesEncryption
dino_plugins_jet_omemo_encryption_helper_real_get_encryption (DinoJingleFileEncryptionHelper* base,
                                                              XmppXepJingleFileTransferFileTransfer* jingle_transfer)
{
	DinoPluginsJetOmemoEncryptionHelper * self;
	XmppXepJetSecurityParameters* security = NULL;
	XmppXepJingleSecurityParameters* _tmp0_;
	XmppXepJingleSecurityParameters* _tmp1_;
	XmppXepJetSecurityParameters* _tmp2_;
	gboolean _tmp3_ = FALSE;
	XmppXepJetSecurityParameters* _tmp4_;
	DinoEntitiesEncryption result;
	self = (DinoPluginsJetOmemoEncryptionHelper*) base;
	g_return_val_if_fail (jingle_transfer != NULL, 0);
	_tmp0_ = xmpp_xep_jingle_file_transfer_file_transfer_get_security (jingle_transfer);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, XMPP_XEP_JET_TYPE_SECURITY_PARAMETERS) ? ((XmppXepJetSecurityParameters*) _tmp1_) : NULL);
	security = _tmp2_;
	_tmp4_ = security;
	if (_tmp4_ != NULL) {
		XmppXepJetSecurityParameters* _tmp5_;
		XmppXepJetEnvelopEncoding* _tmp6_;
		XmppXepJetEnvelopEncoding* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp5_ = security;
		_tmp6_ = xmpp_xep_jet_security_parameters_get_encoding (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = xmpp_xep_jet_envelop_encoding_get_type_uri (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp3_ = g_strcmp0 (_tmp9_, DINO_PLUGINS_OMEMO_NS_URI) == 0;
		_g_free0 (_tmp9_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		result = DINO_ENTITIES_ENCRYPTION_OMEMO;
		_g_object_unref0 (security);
		return result;
	}
	result = DINO_ENTITIES_ENCRYPTION_NONE;
	_g_object_unref0 (security);
	return result;
}

static void
dino_plugins_jet_omemo_encryption_helper_class_init (DinoPluginsJetOmemoEncryptionHelperClass * klass,
                                                     gpointer klass_data)
{
	dino_plugins_jet_omemo_encryption_helper_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsJetOmemoEncryptionHelper_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_jet_omemo_encryption_helper_finalize;
}

static void
dino_plugins_jet_omemo_encryption_helper_dino_jingle_file_encryption_helper_interface_init (DinoJingleFileEncryptionHelperIface * iface,
                                                                                            gpointer iface_data)
{
	dino_plugins_jet_omemo_encryption_helper_dino_jingle_file_encryption_helper_parent_iface = g_type_interface_peek_parent (iface);
	iface->can_transfer = (gboolean (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*)) dino_plugins_jet_omemo_encryption_helper_real_can_transfer;
	iface->can_encrypt = (void (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*, XmppJid*, GAsyncReadyCallback, gpointer)) dino_plugins_jet_omemo_encryption_helper_real_can_encrypt;
	iface->can_encrypt_finish = (gboolean (*) (DinoJingleFileEncryptionHelper*, GAsyncResult*)) dino_plugins_jet_omemo_encryption_helper_can_encrypt_finish;
	iface->get_precondition_name = (gchar* (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*)) dino_plugins_jet_omemo_encryption_helper_real_get_precondition_name;
	iface->get_precondition_options = (GObject* (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*)) dino_plugins_jet_omemo_encryption_helper_real_get_precondition_options;
	iface->get_encryption = (DinoEntitiesEncryption (*) (DinoJingleFileEncryptionHelper*, XmppXepJingleFileTransferFileTransfer*)) dino_plugins_jet_omemo_encryption_helper_real_get_encryption;
}

static void
dino_plugins_jet_omemo_encryption_helper_instance_init (DinoPluginsJetOmemoEncryptionHelper * self,
                                                        gpointer klass)
{
	self->priv = dino_plugins_jet_omemo_encryption_helper_get_instance_private (self);
}

static void
dino_plugins_jet_omemo_encryption_helper_finalize (GObject * obj)
{
	DinoPluginsJetOmemoEncryptionHelper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_JET_OMEMO_TYPE_ENCRYPTION_HELPER, DinoPluginsJetOmemoEncryptionHelper);
	_g_object_unref0 (self->priv->stream_interactor);
	G_OBJECT_CLASS (dino_plugins_jet_omemo_encryption_helper_parent_class)->finalize (obj);
}

static GType
dino_plugins_jet_omemo_encryption_helper_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsJetOmemoEncryptionHelperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_jet_omemo_encryption_helper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsJetOmemoEncryptionHelper), 0, (GInstanceInitFunc) dino_plugins_jet_omemo_encryption_helper_instance_init, NULL };
	static const GInterfaceInfo dino_jingle_file_encryption_helper_info = { (GInterfaceInitFunc) dino_plugins_jet_omemo_encryption_helper_dino_jingle_file_encryption_helper_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_plugins_jet_omemo_encryption_helper_type_id;
	dino_plugins_jet_omemo_encryption_helper_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoPluginsJetOmemoEncryptionHelper", &g_define_type_info, 0);
	g_type_add_interface_static (dino_plugins_jet_omemo_encryption_helper_type_id, DINO_TYPE_JINGLE_FILE_ENCRYPTION_HELPER, &dino_jingle_file_encryption_helper_info);
	DinoPluginsJetOmemoEncryptionHelper_private_offset = g_type_add_instance_private (dino_plugins_jet_omemo_encryption_helper_type_id, sizeof (DinoPluginsJetOmemoEncryptionHelperPrivate));
	return dino_plugins_jet_omemo_encryption_helper_type_id;
}

GType
dino_plugins_jet_omemo_encryption_helper_get_type (void)
{
	static volatile gsize dino_plugins_jet_omemo_encryption_helper_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_jet_omemo_encryption_helper_type_id__once)) {
		GType dino_plugins_jet_omemo_encryption_helper_type_id;
		dino_plugins_jet_omemo_encryption_helper_type_id = dino_plugins_jet_omemo_encryption_helper_get_type_once ();
		g_once_init_leave (&dino_plugins_jet_omemo_encryption_helper_type_id__once, dino_plugins_jet_omemo_encryption_helper_type_id);
	}
	return dino_plugins_jet_omemo_encryption_helper_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

