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

#include "libdino.h"
#include <glib.h>
#include <gio/gio.h>
#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gee.h>
#include <gobject/gvaluecollector.h>
#include <float.h>
#include <math.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  {
	DINO_JINGLE_FILE_ENCRYPTION_HELPER_TRANSFER_ONLY_0_PROPERTY,
	DINO_JINGLE_FILE_ENCRYPTION_HELPER_TRANSFER_ONLY_NUM_PROPERTIES
};
static GParamSpec* dino_jingle_file_encryption_helper_transfer_only_properties[DINO_JINGLE_FILE_ENCRYPTION_HELPER_TRANSFER_ONLY_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 _DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData;
#define _dino_jingle_file_helper_registry_unref0(var) ((var == NULL) ? NULL : (var = (dino_jingle_file_helper_registry_unref (var), NULL)))
typedef struct _DinoParamSpecJingleFileHelperRegistry DinoParamSpecJingleFileHelperRegistry;
enum  {
	DINO_JINGLE_FILE_PROVIDER_0_PROPERTY,
	DINO_JINGLE_FILE_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* dino_jingle_file_provider_properties[DINO_JINGLE_FILE_PROVIDER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _dino_file_receive_data_unref0(var) ((var == NULL) ? NULL : (var = (dino_file_receive_data_unref (var), NULL)))
#define _dino_file_meta_unref0(var) ((var == NULL) ? NULL : (var = (dino_file_meta_unref (var), NULL)))
typedef struct _DinoJingleFileProviderGetMetaInfoData DinoJingleFileProviderGetMetaInfoData;
typedef struct _DinoJingleFileProviderDownloadData DinoJingleFileProviderDownloadData;
typedef struct _Block18Data Block18Data;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
enum  {
	DINO_JINGLE_FILE_SENDER_0_PROPERTY,
	DINO_JINGLE_FILE_SENDER_NUM_PROPERTIES
};
static GParamSpec* dino_jingle_file_sender_properties[DINO_JINGLE_FILE_SENDER_NUM_PROPERTIES];
typedef struct _DinoJingleFileSenderIsUploadAvailableData DinoJingleFileSenderIsUploadAvailableData;
typedef struct _DinoJingleFileSenderGetFileSizeLimitData DinoJingleFileSenderGetFileSizeLimitData;
typedef struct _DinoJingleFileSenderCanSendData DinoJingleFileSenderCanSendData;
typedef struct _DinoJingleFileSenderCanSendConvData DinoJingleFileSenderCanSendConvData;
typedef struct _DinoJingleFileSenderCanEncryptData DinoJingleFileSenderCanEncryptData;
#define _dino_file_send_data_unref0(var) ((var == NULL) ? NULL : (var = (dino_file_send_data_unref (var), NULL)))
typedef struct _DinoJingleFileSenderPrepareSendFileData DinoJingleFileSenderPrepareSendFileData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DinoJingleFileSenderSendFileData DinoJingleFileSenderSendFileData;

struct _DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileEncryptionHelperTransferOnly* self;
	DinoEntitiesConversation* conversation;
	DinoEntitiesFileTransfer* file_transfer;
	XmppJid* full_jid;
	gboolean result;
};

struct _DinoParamSpecJingleFileHelperRegistry {
	GParamSpec parent_instance;
};

struct _DinoJingleFileProviderPrivate {
	DinoStreamInteractor* stream_interactor;
	GeeHashMap* file_transfers;
};

struct _DinoJingleFileProviderGetMetaInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileProvider* self;
	DinoEntitiesFileTransfer* file_transfer;
	DinoFileReceiveData* receive_data;
	DinoFileMeta* file_meta;
	DinoFileMeta* result;
	DinoFileMeta* _tmp0_;
};

struct _DinoJingleFileProviderDownloadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileProvider* self;
	DinoEntitiesFileTransfer* file_transfer;
	DinoFileReceiveData* receive_data;
	DinoFileMeta* file_meta;
	GInputStream* result;
	XmppXmppStream* stream;
	DinoStreamInteractor* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppXmppStream* _tmp3_;
	XmppXepJingleFileTransferFileTransfer* jingle_file_transfer;
	GeeHashMap* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gpointer _tmp7_;
	XmppXepJingleFileTransferFileTransfer* _tmp8_;
	GError* _tmp9_;
	XmppXepJingleFileTransferFileTransfer* _tmp10_;
	XmppXmppStream* _tmp11_;
	XmppXepJingleFileTransferFileTransfer* _tmp12_;
	GInputStream* _tmp13_;
	GInputStream* _tmp14_;
	DinoLimitInputStream* _tmp15_;
	GError* _inner_error0_;
};

struct _Block18Data {
	int _ref_count_;
	DinoJingleFileProvider* self;
	DinoEntitiesAccount* account;
};

struct _DinoJingleFileSenderPrivate {
	DinoStreamInteractor* stream_interactor;
};

struct _DinoJingleFileSenderIsUploadAvailableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	gboolean result;
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
	DinoJingleFileEncryptionHelper* helper;
	DinoJingleFileHelperRegistry* _tmp2_;
	DinoJingleFileHelperRegistry* _tmp3_;
	DinoEntitiesEncryption _tmp4_;
	DinoEntitiesEncryption _tmp5_;
	DinoJingleFileEncryptionHelper* _tmp6_;
	DinoJingleFileEncryptionHelper* _tmp7_;
	DinoJingleFileEncryptionHelper* _tmp8_;
	XmppXmppStream* stream;
	DinoStreamInteractor* _tmp9_;
	DinoEntitiesAccount* _tmp10_;
	DinoEntitiesAccount* _tmp11_;
	XmppXmppStream* _tmp12_;
	XmppXmppStream* _tmp13_;
	GeeList* resources;
	XmppXmppStream* _tmp14_;
	XmppFlagIdentity* _tmp15_;
	gpointer _tmp16_;
	XmppPresenceFlag* _tmp17_;
	XmppJid* _tmp18_;
	XmppJid* _tmp19_;
	GeeList* _tmp20_;
	GeeList* _tmp21_;
	GeeList* _tmp22_;
	GeeList* _full_jid_list;
	GeeList* _tmp23_;
	gint _full_jid_size;
	GeeList* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	gint _full_jid_index;
	gint _tmp27_;
	gint _tmp28_;
	XmppJid* full_jid;
	GeeList* _tmp29_;
	gpointer _tmp30_;
	XmppXmppStream* _tmp31_;
	XmppModuleIdentity* _tmp32_;
	gpointer _tmp33_;
	XmppXepJingleFileTransferModule* _tmp34_;
	XmppXmppStream* _tmp35_;
	XmppJid* _tmp36_;
	gboolean _tmp37_;
};

struct _DinoJingleFileSenderGetFileSizeLimitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	glong result;
};

struct _DinoJingleFileSenderCanSendData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	DinoEntitiesFileTransfer* file_transfer;
	gboolean result;
};

struct _DinoJingleFileSenderCanSendConvData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	gboolean result;
	DinoEntitiesConversationType _tmp0_;
	DinoEntitiesConversationType _tmp1_;
};

struct _DinoJingleFileSenderCanEncryptData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	DinoEntitiesFileTransfer* file_transfer;
	gboolean result;
	DinoJingleFileEncryptionHelper* helper;
	DinoJingleFileHelperRegistry* _tmp0_;
	DinoJingleFileHelperRegistry* _tmp1_;
	DinoEntitiesEncryption _tmp2_;
	DinoEntitiesEncryption _tmp3_;
	DinoJingleFileEncryptionHelper* _tmp4_;
	DinoJingleFileEncryptionHelper* _tmp5_;
	DinoJingleFileEncryptionHelper* _tmp6_;
};

struct _DinoJingleFileSenderPrepareSendFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	DinoEntitiesFileTransfer* file_transfer;
	DinoFileMeta* file_meta;
	DinoFileSendData* result;
	GError* _tmp0_;
	DinoFileSendData* _tmp1_;
	GError* _inner_error0_;
};

struct _DinoJingleFileSenderSendFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoJingleFileSender* self;
	DinoEntitiesConversation* conversation;
	DinoEntitiesFileTransfer* file_transfer;
	DinoFileSendData* file_send_data;
	DinoFileMeta* file_meta;
	XmppXmppStream* stream;
	DinoStreamInteractor* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppXmppStream* _tmp3_;
	XmppXmppStream* _tmp4_;
	GError* _tmp5_;
	DinoJingleFileEncryptionHelper* helper;
	DinoJingleFileHelperRegistry* _tmp6_;
	DinoJingleFileHelperRegistry* _tmp7_;
	DinoEntitiesEncryption _tmp8_;
	DinoEntitiesEncryption _tmp9_;
	DinoJingleFileEncryptionHelper* _tmp10_;
	gboolean _tmp11_;
	DinoJingleFileEncryptionHelper* _tmp12_;
	DinoJingleFileEncryptionHelper* _tmp13_;
	gboolean must_encrypt;
	GeeList* _full_jid_list;
	XmppXmppStream* _tmp14_;
	XmppFlagIdentity* _tmp15_;
	gpointer _tmp16_;
	XmppPresenceFlag* _tmp17_;
	XmppJid* _tmp18_;
	XmppJid* _tmp19_;
	GeeList* _tmp20_;
	GeeList* _tmp21_;
	gint _full_jid_size;
	GeeList* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	gint _full_jid_index;
	gint _tmp25_;
	gint _tmp26_;
	XmppJid* full_jid;
	GeeList* _tmp27_;
	gpointer _tmp28_;
	XmppJid* _tmp29_;
	XmppXmppStream* _tmp30_;
	XmppFlagIdentity* _tmp31_;
	gpointer _tmp32_;
	XmppBindFlag* _tmp33_;
	XmppJid* _tmp34_;
	gboolean _tmp35_;
	XmppXmppStream* _tmp36_;
	XmppModuleIdentity* _tmp37_;
	gpointer _tmp38_;
	XmppXepJingleFileTransferModule* _tmp39_;
	XmppXmppStream* _tmp40_;
	XmppJid* _tmp41_;
	gboolean _tmp42_;
	gboolean _tmp43_;
	DinoJingleFileEncryptionHelper* _tmp44_;
	XmppJid* _tmp45_;
	gchar* precondition_name;
	GObject* precondition_options;
	DinoJingleFileEncryptionHelper* _tmp46_;
	gchar* _tmp47_;
	DinoJingleFileEncryptionHelper* _tmp48_;
	GObject* _tmp49_;
	const gchar* _tmp50_;
	GError* _tmp51_;
	XmppXmppStream* _tmp52_;
	XmppModuleIdentity* _tmp53_;
	gpointer _tmp54_;
	XmppXepJingleFileTransferModule* _tmp55_;
	XmppXmppStream* _tmp56_;
	XmppJid* _tmp57_;
	GInputStream* _tmp58_;
	GInputStream* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	GObject* _tmp63_;
	GError* e;
	GError* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	gchar* _tmp67_;
	gchar* _tmp68_;
	GError* _tmp69_;
	GError* _tmp70_;
	GError* _inner_error0_;
};

static gpointer dino_jingle_file_encryption_helper_transfer_only_parent_class = NULL;
static DinoJingleFileEncryptionHelperIface * dino_jingle_file_encryption_helper_transfer_only_dino_jingle_file_encryption_helper_parent_iface = NULL;
static gpointer dino_jingle_file_helper_registry_parent_class = NULL;
static DinoJingleFileHelperRegistry* dino_jingle_file_helper_registry_INSTANCE;
static DinoJingleFileHelperRegistry* dino_jingle_file_helper_registry_INSTANCE = NULL;
static gint DinoJingleFileProvider_private_offset;
static gpointer dino_jingle_file_provider_parent_class = NULL;
static DinoFileProviderIface * dino_jingle_file_provider_dino_file_provider_parent_iface = NULL;
static gint DinoJingleFileSender_private_offset;
static gpointer dino_jingle_file_sender_parent_class = NULL;
static DinoFileSenderIface * dino_jingle_file_sender_dino_file_sender_parent_iface = NULL;

static GType dino_jingle_file_encryption_helper_get_type_once (void);
static gboolean dino_jingle_file_encryption_helper_transfer_only_real_can_transfer (DinoJingleFileEncryptionHelper* base,
                                                                             DinoEntitiesConversation* conversation);
static void dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt_data_free (gpointer _data);
static void dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt (DinoJingleFileEncryptionHelper* base,
                                                                        DinoEntitiesConversation* conversation,
                                                                        DinoEntitiesFileTransfer* file_transfer,
                                                                        XmppJid* full_jid,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static gboolean dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt_co (DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData* _data_);
static gchar* dino_jingle_file_encryption_helper_transfer_only_real_get_precondition_name (DinoJingleFileEncryptionHelper* base,
                                                                                    DinoEntitiesConversation* conversation,
                                                                                    DinoEntitiesFileTransfer* file_transfer);
static GObject* dino_jingle_file_encryption_helper_transfer_only_real_get_precondition_options (DinoJingleFileEncryptionHelper* base,
                                                                                         DinoEntitiesConversation* conversation,
                                                                                         DinoEntitiesFileTransfer* file_transfer);
static DinoEntitiesEncryption dino_jingle_file_encryption_helper_transfer_only_real_get_encryption (DinoJingleFileEncryptionHelper* base,
                                                                                             XmppXepJingleFileTransferFileTransfer* jingle_transfer);
static GType dino_jingle_file_encryption_helper_transfer_only_get_type_once (void);
static void dino_jingle_file_helper_registry_finalize (DinoJingleFileHelperRegistry * obj);
static GType dino_jingle_file_helper_registry_get_type_once (void);
static void dino_jingle_file_provider_on_account_added (DinoJingleFileProvider* self,
                                                 DinoEntitiesAccount* account);
static void _dino_jingle_file_provider_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                                       DinoEntitiesAccount* account,
                                                                                       gpointer self);
static DinoFileMeta* dino_jingle_file_provider_real_get_file_meta (DinoFileProvider* base,
                                                            DinoEntitiesFileTransfer* file_transfer,
                                                            GError** error);
static DinoFileReceiveData* dino_jingle_file_provider_real_get_file_receive_data (DinoFileProvider* base,
                                                                           DinoEntitiesFileTransfer* file_transfer);
static void dino_jingle_file_provider_real_get_meta_info_data_free (gpointer _data);
static void dino_jingle_file_provider_real_get_meta_info (DinoFileProvider* base,
                                                   DinoEntitiesFileTransfer* file_transfer,
                                                   DinoFileReceiveData* receive_data,
                                                   DinoFileMeta* file_meta,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static gboolean dino_jingle_file_provider_real_get_meta_info_co (DinoJingleFileProviderGetMetaInfoData* _data_);
static DinoEntitiesEncryption dino_jingle_file_provider_real_get_encryption (DinoFileProvider* base,
                                                                      DinoEntitiesFileTransfer* file_transfer,
                                                                      DinoFileReceiveData* receive_data,
                                                                      DinoFileMeta* file_meta);
static void dino_jingle_file_provider_real_download_data_free (gpointer _data);
static void dino_jingle_file_provider_real_download (DinoFileProvider* base,
                                              DinoEntitiesFileTransfer* file_transfer,
                                              DinoFileReceiveData* receive_data,
                                              DinoFileMeta* file_meta,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean dino_jingle_file_provider_real_download_co (DinoJingleFileProviderDownloadData* _data_);
static void dino_jingle_file_provider_download_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static gint dino_jingle_file_provider_real_get_id (DinoFileProvider* base);
static Block18Data* block18_data_ref (Block18Data* _data18_);
static void block18_data_unref (void * _userdata_);
static void __lambda44_ (Block18Data* _data18_,
                  XmppXmppStream* stream,
                  XmppXepJingleFileTransferFileTransfer* jingle_file_transfer);
static void ___lambda44__xmpp_xep_jingle_file_transfer_module_file_incoming (XmppXepJingleFileTransferModule* _sender,
                                                                      XmppXmppStream* stream,
                                                                      XmppXepJingleFileTransferFileTransfer* file_transfer,
                                                                      gpointer self);
static void dino_jingle_file_provider_finalize (GObject * obj);
static GType dino_jingle_file_provider_get_type_once (void);
static void dino_jingle_file_sender_real_is_upload_available_data_free (gpointer _data);
static void dino_jingle_file_sender_real_is_upload_available (DinoFileSender* base,
                                                       DinoEntitiesConversation* conversation,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static gboolean dino_jingle_file_sender_real_is_upload_available_co (DinoJingleFileSenderIsUploadAvailableData* _data_);
static void dino_jingle_file_sender_is_upload_available_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void dino_jingle_file_sender_real_get_file_size_limit_data_free (gpointer _data);
static void dino_jingle_file_sender_real_get_file_size_limit (DinoFileSender* base,
                                                       DinoEntitiesConversation* conversation,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static gboolean dino_jingle_file_sender_real_get_file_size_limit_co (DinoJingleFileSenderGetFileSizeLimitData* _data_);
static void dino_jingle_file_sender_can_send_conv (DinoJingleFileSender* self,
                                            DinoEntitiesConversation* conversation,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean dino_jingle_file_sender_can_send_conv_finish (DinoJingleFileSender* self,
                                                       GAsyncResult* _res_);
static void dino_jingle_file_sender_get_file_size_limit_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void dino_jingle_file_sender_real_can_send_data_free (gpointer _data);
static void dino_jingle_file_sender_real_can_send (DinoFileSender* base,
                                            DinoEntitiesConversation* conversation,
                                            DinoEntitiesFileTransfer* file_transfer,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean dino_jingle_file_sender_real_can_send_co (DinoJingleFileSenderCanSendData* _data_);
static void dino_jingle_file_sender_can_send_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static void dino_jingle_file_sender_can_send_conv_data_free (gpointer _data);
static gboolean dino_jingle_file_sender_can_send_conv_co (DinoJingleFileSenderCanSendConvData* _data_);
static void dino_jingle_file_sender_can_send_conv_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static void dino_jingle_file_sender_real_can_encrypt_data_free (gpointer _data);
static void dino_jingle_file_sender_real_can_encrypt (DinoFileSender* base,
                                               DinoEntitiesConversation* conversation,
                                               DinoEntitiesFileTransfer* file_transfer,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static gboolean dino_jingle_file_sender_real_can_encrypt_co (DinoJingleFileSenderCanEncryptData* _data_);
static void dino_jingle_file_sender_can_encrypt_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dino_jingle_file_sender_real_prepare_send_file_data_free (gpointer _data);
static void dino_jingle_file_sender_real_prepare_send_file (DinoFileSender* base,
                                                     DinoEntitiesConversation* conversation,
                                                     DinoEntitiesFileTransfer* file_transfer,
                                                     DinoFileMeta* file_meta,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
static gboolean dino_jingle_file_sender_real_prepare_send_file_co (DinoJingleFileSenderPrepareSendFileData* _data_);
static void dino_jingle_file_sender_real_send_file_data_free (gpointer _data);
static void dino_jingle_file_sender_real_send_file (DinoFileSender* base,
                                             DinoEntitiesConversation* conversation,
                                             DinoEntitiesFileTransfer* file_transfer,
                                             DinoFileSendData* file_send_data,
                                             DinoFileMeta* file_meta,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean dino_jingle_file_sender_real_send_file_co (DinoJingleFileSenderSendFileData* _data_);
static void dino_jingle_file_sender_send_file_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static gint dino_jingle_file_sender_real_get_id (DinoFileSender* base);
static gfloat dino_jingle_file_sender_real_get_priority (DinoFileSender* base);
static void dino_jingle_file_sender_finalize (GObject * obj);
static GType dino_jingle_file_sender_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

gboolean
dino_jingle_file_encryption_helper_can_transfer (DinoJingleFileEncryptionHelper* self,
                                                 DinoEntitiesConversation* conversation)
{
	DinoJingleFileEncryptionHelperIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = DINO_JINGLE_FILE_ENCRYPTION_HELPER_GET_INTERFACE (self);
	if (_iface_->can_transfer) {
		return _iface_->can_transfer (self, conversation);
	}
	return FALSE;
}

void
dino_jingle_file_encryption_helper_can_encrypt (DinoJingleFileEncryptionHelper* self,
                                                DinoEntitiesConversation* conversation,
                                                DinoEntitiesFileTransfer* file_transfer,
                                                XmppJid* full_jid,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	DinoJingleFileEncryptionHelperIface* _iface_;
	_iface_ = DINO_JINGLE_FILE_ENCRYPTION_HELPER_GET_INTERFACE (self);
	if (_iface_->can_encrypt) {
		_iface_->can_encrypt (self, conversation, file_transfer, full_jid, _callback_, _user_data_);
	}
}

gboolean
dino_jingle_file_encryption_helper_can_encrypt_finish (DinoJingleFileEncryptionHelper* self,
                                                       GAsyncResult* _res_)
{
	DinoJingleFileEncryptionHelperIface* _iface_;
	_iface_ = DINO_JINGLE_FILE_ENCRYPTION_HELPER_GET_INTERFACE (self);
	if (_iface_->can_encrypt_finish) {
		return _iface_->can_encrypt_finish (self, _res_);
	}
	return FALSE;
}

gchar*
dino_jingle_file_encryption_helper_get_precondition_name (DinoJingleFileEncryptionHelper* self,
                                                          DinoEntitiesConversation* conversation,
                                                          DinoEntitiesFileTransfer* file_transfer)
{
	DinoJingleFileEncryptionHelperIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = DINO_JINGLE_FILE_ENCRYPTION_HELPER_GET_INTERFACE (self);
	if (_iface_->get_precondition_name) {
		return _iface_->get_precondition_name (self, conversation, file_transfer);
	}
	return NULL;
}

GObject*
dino_jingle_file_encryption_helper_get_precondition_options (DinoJingleFileEncryptionHelper* self,
                                                             DinoEntitiesConversation* conversation,
                                                             DinoEntitiesFileTransfer* file_transfer)
{
	DinoJingleFileEncryptionHelperIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = DINO_JINGLE_FILE_ENCRYPTION_HELPER_GET_INTERFACE (self);
	if (_iface_->get_precondition_options) {
		return _iface_->get_precondition_options (self, conversation, file_transfer);
	}
	return NULL;
}

DinoEntitiesEncryption
dino_jingle_file_encryption_helper_get_encryption (DinoJingleFileEncryptionHelper* self,
                                                   XmppXepJingleFileTransferFileTransfer* jingle_transfer)
{
	DinoJingleFileEncryptionHelperIface* _iface_;
	g_return_val_if_fail (self != NULL, 0);
	_iface_ = DINO_JINGLE_FILE_ENCRYPTION_HELPER_GET_INTERFACE (self);
	if (_iface_->get_encryption) {
		return _iface_->get_encryption (self, jingle_transfer);
	}
	return 0;
}

static void
dino_jingle_file_encryption_helper_default_init (DinoJingleFileEncryptionHelperIface * iface,
                                                 gpointer iface_data)
{
}

static GType
dino_jingle_file_encryption_helper_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoJingleFileEncryptionHelperIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_jingle_file_encryption_helper_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType dino_jingle_file_encryption_helper_type_id;
	dino_jingle_file_encryption_helper_type_id = g_type_register_static (G_TYPE_INTERFACE, "DinoJingleFileEncryptionHelper", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (dino_jingle_file_encryption_helper_type_id, G_TYPE_OBJECT);
	return dino_jingle_file_encryption_helper_type_id;
}

GType
dino_jingle_file_encryption_helper_get_type (void)
{
	static volatile gsize dino_jingle_file_encryption_helper_type_id__once = 0;
	if (g_once_init_enter (&dino_jingle_file_encryption_helper_type_id__once)) {
		GType dino_jingle_file_encryption_helper_type_id;
		dino_jingle_file_encryption_helper_type_id = dino_jingle_file_encryption_helper_get_type_once ();
		g_once_init_leave (&dino_jingle_file_encryption_helper_type_id__once, dino_jingle_file_encryption_helper_type_id);
	}
	return dino_jingle_file_encryption_helper_type_id__once;
}

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

static void
dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt_data_free (gpointer _data)
{
	DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData* _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 (DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData, _data_);
}

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

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

static void
dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt (DinoJingleFileEncryptionHelper* base,
                                                                   DinoEntitiesConversation* conversation,
                                                                   DinoEntitiesFileTransfer* file_transfer,
                                                                   XmppJid* full_jid,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	DinoJingleFileEncryptionHelperTransferOnly * self;
	DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData* _data_;
	DinoJingleFileEncryptionHelperTransferOnly* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesFileTransfer* _tmp2_;
	XmppJid* _tmp3_;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (file_transfer != NULL);
	self = (DinoJingleFileEncryptionHelperTransferOnly*) base;
	_data_ = g_slice_new0 (DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_encryption_helper_transfer_only_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_jingle_file_encryption_helper_transfer_only_real_can_encrypt_co (_data_);
}

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

static gboolean
dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt_co (DinoJingleFileEncryptionHelperTransferOnlyCanEncryptData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->result = FALSE;
	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_jingle_file_encryption_helper_transfer_only_real_get_precondition_name (DinoJingleFileEncryptionHelper* base,
                                                                             DinoEntitiesConversation* conversation,
                                                                             DinoEntitiesFileTransfer* file_transfer)
{
	DinoJingleFileEncryptionHelperTransferOnly * self;
	gchar* result;
	self = (DinoJingleFileEncryptionHelperTransferOnly*) base;
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (file_transfer != NULL, NULL);
	result = NULL;
	return result;
}

static GObject*
dino_jingle_file_encryption_helper_transfer_only_real_get_precondition_options (DinoJingleFileEncryptionHelper* base,
                                                                                DinoEntitiesConversation* conversation,
                                                                                DinoEntitiesFileTransfer* file_transfer)
{
	DinoJingleFileEncryptionHelperTransferOnly * self;
	GObject* result;
	self = (DinoJingleFileEncryptionHelperTransferOnly*) base;
	g_return_val_if_fail (conversation != NULL, NULL);
	g_return_val_if_fail (file_transfer != NULL, NULL);
	result = NULL;
	return result;
}

static DinoEntitiesEncryption
dino_jingle_file_encryption_helper_transfer_only_real_get_encryption (DinoJingleFileEncryptionHelper* base,
                                                                      XmppXepJingleFileTransferFileTransfer* jingle_transfer)
{
	DinoJingleFileEncryptionHelperTransferOnly * self;
	DinoEntitiesEncryption result;
	self = (DinoJingleFileEncryptionHelperTransferOnly*) base;
	g_return_val_if_fail (jingle_transfer != NULL, 0);
	result = DINO_ENTITIES_ENCRYPTION_NONE;
	return result;
}

DinoJingleFileEncryptionHelperTransferOnly*
dino_jingle_file_encryption_helper_transfer_only_construct (GType object_type)
{
	DinoJingleFileEncryptionHelperTransferOnly * self = NULL;
	self = (DinoJingleFileEncryptionHelperTransferOnly*) g_object_new (object_type, NULL);
	return self;
}

DinoJingleFileEncryptionHelperTransferOnly*
dino_jingle_file_encryption_helper_transfer_only_new (void)
{
	return dino_jingle_file_encryption_helper_transfer_only_construct (DINO_TYPE_JINGLE_FILE_ENCRYPTION_HELPER_TRANSFER_ONLY);
}

static void
dino_jingle_file_encryption_helper_transfer_only_class_init (DinoJingleFileEncryptionHelperTransferOnlyClass * klass,
                                                             gpointer klass_data)
{
	dino_jingle_file_encryption_helper_transfer_only_parent_class = g_type_class_peek_parent (klass);
}

static void
dino_jingle_file_encryption_helper_transfer_only_dino_jingle_file_encryption_helper_interface_init (DinoJingleFileEncryptionHelperIface * iface,
                                                                                                    gpointer iface_data)
{
	dino_jingle_file_encryption_helper_transfer_only_dino_jingle_file_encryption_helper_parent_iface = g_type_interface_peek_parent (iface);
	iface->can_transfer = (gboolean (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*)) dino_jingle_file_encryption_helper_transfer_only_real_can_transfer;
	iface->can_encrypt = (void (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*, XmppJid*, GAsyncReadyCallback, gpointer)) dino_jingle_file_encryption_helper_transfer_only_real_can_encrypt;
	iface->can_encrypt_finish = (gboolean (*) (DinoJingleFileEncryptionHelper*, GAsyncResult*)) dino_jingle_file_encryption_helper_transfer_only_can_encrypt_finish;
	iface->get_precondition_name = (gchar* (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*)) dino_jingle_file_encryption_helper_transfer_only_real_get_precondition_name;
	iface->get_precondition_options = (GObject* (*) (DinoJingleFileEncryptionHelper*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*)) dino_jingle_file_encryption_helper_transfer_only_real_get_precondition_options;
	iface->get_encryption = (DinoEntitiesEncryption (*) (DinoJingleFileEncryptionHelper*, XmppXepJingleFileTransferFileTransfer*)) dino_jingle_file_encryption_helper_transfer_only_real_get_encryption;
}

static void
dino_jingle_file_encryption_helper_transfer_only_instance_init (DinoJingleFileEncryptionHelperTransferOnly * self,
                                                                gpointer klass)
{
}

static GType
dino_jingle_file_encryption_helper_transfer_only_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoJingleFileEncryptionHelperTransferOnlyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_jingle_file_encryption_helper_transfer_only_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoJingleFileEncryptionHelperTransferOnly), 0, (GInstanceInitFunc) dino_jingle_file_encryption_helper_transfer_only_instance_init, NULL };
	static const GInterfaceInfo dino_jingle_file_encryption_helper_info = { (GInterfaceInitFunc) dino_jingle_file_encryption_helper_transfer_only_dino_jingle_file_encryption_helper_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_jingle_file_encryption_helper_transfer_only_type_id;
	dino_jingle_file_encryption_helper_transfer_only_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoJingleFileEncryptionHelperTransferOnly", &g_define_type_info, 0);
	g_type_add_interface_static (dino_jingle_file_encryption_helper_transfer_only_type_id, DINO_TYPE_JINGLE_FILE_ENCRYPTION_HELPER, &dino_jingle_file_encryption_helper_info);
	return dino_jingle_file_encryption_helper_transfer_only_type_id;
}

GType
dino_jingle_file_encryption_helper_transfer_only_get_type (void)
{
	static volatile gsize dino_jingle_file_encryption_helper_transfer_only_type_id__once = 0;
	if (g_once_init_enter (&dino_jingle_file_encryption_helper_transfer_only_type_id__once)) {
		GType dino_jingle_file_encryption_helper_transfer_only_type_id;
		dino_jingle_file_encryption_helper_transfer_only_type_id = dino_jingle_file_encryption_helper_transfer_only_get_type_once ();
		g_once_init_leave (&dino_jingle_file_encryption_helper_transfer_only_type_id__once, dino_jingle_file_encryption_helper_transfer_only_type_id);
	}
	return dino_jingle_file_encryption_helper_transfer_only_type_id__once;
}

void
dino_jingle_file_helper_registry_add_encryption_helper (DinoJingleFileHelperRegistry* self,
                                                        DinoEntitiesEncryption encryption,
                                                        DinoJingleFileEncryptionHelper* helper)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (helper != NULL);
	_tmp0_ = self->encryption_helpers;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, (gpointer) ((gintptr) encryption), helper);
}

DinoJingleFileEncryptionHelper*
dino_jingle_file_helper_registry_get_encryption_helper (DinoJingleFileHelperRegistry* self,
                                                        DinoEntitiesEncryption encryption)
{
	GeeHashMap* _tmp0_;
	DinoJingleFileEncryptionHelper* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->encryption_helpers;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, (gpointer) ((gintptr) encryption))) {
		GeeHashMap* _tmp1_;
		gpointer _tmp2_;
		_tmp1_ = self->encryption_helpers;
		_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, (gpointer) ((gintptr) encryption));
		result = (DinoJingleFileEncryptionHelper*) _tmp2_;
		return result;
	}
	result = NULL;
	return result;
}

DinoJingleFileHelperRegistry*
dino_jingle_file_helper_registry_construct (GType object_type)
{
	DinoJingleFileHelperRegistry* self = NULL;
	self = (DinoJingleFileHelperRegistry*) g_type_create_instance (object_type);
	return self;
}

DinoJingleFileHelperRegistry*
dino_jingle_file_helper_registry_new (void)
{
	return dino_jingle_file_helper_registry_construct (DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY);
}

DinoJingleFileHelperRegistry*
dino_jingle_file_helper_registry_get_instance (void)
{
	DinoJingleFileHelperRegistry* result;
	DinoJingleFileHelperRegistry* _tmp0_;
	DinoJingleFileHelperRegistry* _tmp5_;
	_tmp0_ = dino_jingle_file_helper_registry_INSTANCE;
	if (_tmp0_ == NULL) {
		DinoJingleFileHelperRegistry* _tmp1_;
		DinoJingleFileHelperRegistry* _tmp2_;
		DinoJingleFileEncryptionHelperTransferOnly* _tmp3_;
		DinoJingleFileEncryptionHelperTransferOnly* _tmp4_;
		_tmp1_ = dino_jingle_file_helper_registry_new ();
		_dino_jingle_file_helper_registry_unref0 (dino_jingle_file_helper_registry_INSTANCE);
		dino_jingle_file_helper_registry_INSTANCE = _tmp1_;
		_tmp2_ = dino_jingle_file_helper_registry_INSTANCE;
		_tmp3_ = dino_jingle_file_encryption_helper_transfer_only_new ();
		_tmp4_ = _tmp3_;
		dino_jingle_file_helper_registry_add_encryption_helper (_tmp2_, DINO_ENTITIES_ENCRYPTION_NONE, (DinoJingleFileEncryptionHelper*) _tmp4_);
		_g_object_unref0 (_tmp4_);
	}
	_tmp5_ = dino_jingle_file_helper_registry_INSTANCE;
	result = _tmp5_;
	return result;
}

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

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

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

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

static gchar*
dino_value_jingle_file_helper_registry_collect_value (GValue* value,
                                                      guint n_collect_values,
                                                      GTypeCValue* collect_values,
                                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		DinoJingleFileHelperRegistry * 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 = dino_jingle_file_helper_registry_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
dino_value_jingle_file_helper_registry_lcopy_value (const GValue* value,
                                                    guint n_collect_values,
                                                    GTypeCValue* collect_values,
                                                    guint collect_flags)
{
	DinoJingleFileHelperRegistry ** 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 = dino_jingle_file_helper_registry_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
dino_param_spec_jingle_file_helper_registry (const gchar* name,
                                             const gchar* nick,
                                             const gchar* blurb,
                                             GType object_type,
                                             GParamFlags flags)
{
	DinoParamSpecJingleFileHelperRegistry* spec;
	g_return_val_if_fail (g_type_is_a (object_type, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY), 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
dino_value_get_jingle_file_helper_registry (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY), NULL);
	return value->data[0].v_pointer;
}

void
dino_value_set_jingle_file_helper_registry (GValue* value,
                                            gpointer v_object)
{
	DinoJingleFileHelperRegistry * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY));
		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;
		dino_jingle_file_helper_registry_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_jingle_file_helper_registry_unref (old);
	}
}

void
dino_value_take_jingle_file_helper_registry (GValue* value,
                                             gpointer v_object)
{
	DinoJingleFileHelperRegistry * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY));
		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) {
		dino_jingle_file_helper_registry_unref (old);
	}
}

static void
dino_jingle_file_helper_registry_class_init (DinoJingleFileHelperRegistryClass * klass,
                                             gpointer klass_data)
{
	dino_jingle_file_helper_registry_parent_class = g_type_class_peek_parent (klass);
	((DinoJingleFileHelperRegistryClass *) klass)->finalize = dino_jingle_file_helper_registry_finalize;
}

static void
dino_jingle_file_helper_registry_instance_init (DinoJingleFileHelperRegistry * self,
                                                gpointer klass)
{
	GeeHashMap* _tmp0_;
	_tmp0_ = gee_hash_map_new (DINO_ENTITIES_TYPE_ENCRYPTION, NULL, NULL, DINO_TYPE_JINGLE_FILE_ENCRYPTION_HELPER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->encryption_helpers = _tmp0_;
	self->ref_count = 1;
}

static void
dino_jingle_file_helper_registry_finalize (DinoJingleFileHelperRegistry * obj)
{
	DinoJingleFileHelperRegistry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_JINGLE_FILE_HELPER_REGISTRY, DinoJingleFileHelperRegistry);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->encryption_helpers);
}

static GType
dino_jingle_file_helper_registry_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dino_value_jingle_file_helper_registry_init, dino_value_jingle_file_helper_registry_free_value, dino_value_jingle_file_helper_registry_copy_value, dino_value_jingle_file_helper_registry_peek_pointer, "p", dino_value_jingle_file_helper_registry_collect_value, "p", dino_value_jingle_file_helper_registry_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DinoJingleFileHelperRegistryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_jingle_file_helper_registry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoJingleFileHelperRegistry), 0, (GInstanceInitFunc) dino_jingle_file_helper_registry_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 dino_jingle_file_helper_registry_type_id;
	dino_jingle_file_helper_registry_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DinoJingleFileHelperRegistry", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return dino_jingle_file_helper_registry_type_id;
}

GType
dino_jingle_file_helper_registry_get_type (void)
{
	static volatile gsize dino_jingle_file_helper_registry_type_id__once = 0;
	if (g_once_init_enter (&dino_jingle_file_helper_registry_type_id__once)) {
		GType dino_jingle_file_helper_registry_type_id;
		dino_jingle_file_helper_registry_type_id = dino_jingle_file_helper_registry_get_type_once ();
		g_once_init_leave (&dino_jingle_file_helper_registry_type_id__once, dino_jingle_file_helper_registry_type_id);
	}
	return dino_jingle_file_helper_registry_type_id__once;
}

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

void
dino_jingle_file_helper_registry_unref (gpointer instance)
{
	DinoJingleFileHelperRegistry * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DINO_JINGLE_FILE_HELPER_REGISTRY_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
dino_jingle_file_provider_get_instance_private (DinoJingleFileProvider* self)
{
	return G_STRUCT_MEMBER_P (self, DinoJingleFileProvider_private_offset);
}

static void
_dino_jingle_file_provider_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                                  DinoEntitiesAccount* account,
                                                                                  gpointer self)
{
	dino_jingle_file_provider_on_account_added ((DinoJingleFileProvider*) self, account);
}

DinoJingleFileProvider*
dino_jingle_file_provider_construct (GType object_type,
                                     DinoStreamInteractor* stream_interactor)
{
	DinoJingleFileProvider * self = NULL;
	DinoStreamInteractor* _tmp0_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoJingleFileProvider*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp0_;
	g_signal_connect_object (stream_interactor, "account-added", (GCallback) _dino_jingle_file_provider_on_account_added_dino_stream_interactor_account_added, self, 0);
	return self;
}

DinoJingleFileProvider*
dino_jingle_file_provider_new (DinoStreamInteractor* stream_interactor)
{
	return dino_jingle_file_provider_construct (DINO_TYPE_JINGLE_FILE_PROVIDER, stream_interactor);
}

static DinoFileMeta*
dino_jingle_file_provider_real_get_file_meta (DinoFileProvider* base,
                                              DinoEntitiesFileTransfer* file_transfer,
                                              GError** error)
{
	DinoJingleFileProvider * self;
	DinoFileMeta* file_meta = NULL;
	DinoFileMeta* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gint64 _tmp4_;
	gint64 _tmp5_;
	DinoFileMeta* result;
	self = (DinoJingleFileProvider*) base;
	g_return_val_if_fail (file_transfer != NULL, NULL);
	_tmp0_ = dino_file_meta_new ();
	file_meta = _tmp0_;
	_tmp1_ = dino_entities_file_transfer_get_file_name (file_transfer);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (file_meta->file_name);
	file_meta->file_name = _tmp3_;
	_tmp4_ = dino_entities_file_transfer_get_size (file_transfer);
	_tmp5_ = _tmp4_;
	file_meta->size = _tmp5_;
	result = file_meta;
	return result;
}

static DinoFileReceiveData*
dino_jingle_file_provider_real_get_file_receive_data (DinoFileProvider* base,
                                                      DinoEntitiesFileTransfer* file_transfer)
{
	DinoJingleFileProvider * self;
	DinoFileReceiveData* _tmp0_;
	DinoFileReceiveData* result;
	self = (DinoJingleFileProvider*) base;
	g_return_val_if_fail (file_transfer != NULL, NULL);
	_tmp0_ = dino_file_receive_data_new ();
	result = _tmp0_;
	return result;
}

static void
dino_jingle_file_provider_real_get_meta_info_data_free (gpointer _data)
{
	DinoJingleFileProviderGetMetaInfoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file_transfer);
	_dino_file_receive_data_unref0 (_data_->receive_data);
	_dino_file_meta_unref0 (_data_->file_meta);
	_dino_file_meta_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileProviderGetMetaInfoData, _data_);
}

static gpointer
_dino_file_receive_data_ref0 (gpointer self)
{
	return self ? dino_file_receive_data_ref (self) : NULL;
}

static gpointer
_dino_file_meta_ref0 (gpointer self)
{
	return self ? dino_file_meta_ref (self) : NULL;
}

static void
dino_jingle_file_provider_real_get_meta_info (DinoFileProvider* base,
                                              DinoEntitiesFileTransfer* file_transfer,
                                              DinoFileReceiveData* receive_data,
                                              DinoFileMeta* file_meta,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	DinoJingleFileProvider * self;
	DinoJingleFileProviderGetMetaInfoData* _data_;
	DinoJingleFileProvider* _tmp0_;
	DinoEntitiesFileTransfer* _tmp1_;
	DinoFileReceiveData* _tmp2_;
	DinoFileMeta* _tmp3_;
	g_return_if_fail (file_transfer != NULL);
	g_return_if_fail (receive_data != NULL);
	g_return_if_fail (file_meta != NULL);
	self = (DinoJingleFileProvider*) base;
	_data_ = g_slice_new0 (DinoJingleFileProviderGetMetaInfoData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_provider_real_get_meta_info_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file_transfer);
	_g_object_unref0 (_data_->file_transfer);
	_data_->file_transfer = _tmp1_;
	_tmp2_ = _dino_file_receive_data_ref0 (receive_data);
	_dino_file_receive_data_unref0 (_data_->receive_data);
	_data_->receive_data = _tmp2_;
	_tmp3_ = _dino_file_meta_ref0 (file_meta);
	_dino_file_meta_unref0 (_data_->file_meta);
	_data_->file_meta = _tmp3_;
	dino_jingle_file_provider_real_get_meta_info_co (_data_);
}

static DinoFileMeta*
dino_jingle_file_provider_get_meta_info_finish (DinoFileProvider* base,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	DinoFileMeta* result;
	DinoJingleFileProviderGetMetaInfoData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
dino_jingle_file_provider_real_get_meta_info_co (DinoJingleFileProviderGetMetaInfoData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _dino_file_meta_ref0 (_data_->file_meta);
	_data_->result = _data_->_tmp0_;
	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 DinoEntitiesEncryption
dino_jingle_file_provider_real_get_encryption (DinoFileProvider* base,
                                               DinoEntitiesFileTransfer* file_transfer,
                                               DinoFileReceiveData* receive_data,
                                               DinoFileMeta* file_meta)
{
	DinoJingleFileProvider * self;
	XmppXepJingleFileTransferFileTransfer* jingle_file_transfer = NULL;
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gpointer _tmp3_;
	XmppXepJingleFileTransferFileTransfer* _tmp4_;
	DinoEntitiesEncryption result;
	self = (DinoJingleFileProvider*) base;
	g_return_val_if_fail (file_transfer != NULL, 0);
	g_return_val_if_fail (receive_data != NULL, 0);
	g_return_val_if_fail (file_meta != NULL, 0);
	_tmp0_ = self->priv->file_transfers;
	_tmp1_ = dino_entities_file_transfer_get_info (file_transfer);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp2_);
	jingle_file_transfer = (XmppXepJingleFileTransferFileTransfer*) _tmp3_;
	_tmp4_ = jingle_file_transfer;
	if (_tmp4_ == NULL) {
		g_warning ("jingle_file_transfers.vala:88: Could not determine jingle encryption -" \
" transfer data not available anymore");
		result = DINO_ENTITIES_ENCRYPTION_NONE;
		_g_object_unref0 (jingle_file_transfer);
		return result;
	}
	{
		GeeIterator* _helper_it = NULL;
		DinoJingleFileHelperRegistry* _tmp5_;
		DinoJingleFileHelperRegistry* _tmp6_;
		GeeHashMap* _tmp7_;
		GeeCollection* _tmp8_;
		GeeCollection* _tmp9_;
		GeeCollection* _tmp10_;
		GeeIterator* _tmp11_;
		GeeIterator* _tmp12_;
		_tmp5_ = dino_jingle_file_helper_registry_get_instance ();
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_->encryption_helpers;
		_tmp8_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = gee_iterable_iterator ((GeeIterable*) _tmp10_);
		_tmp12_ = _tmp11_;
		_g_object_unref0 (_tmp10_);
		_helper_it = _tmp12_;
		while (TRUE) {
			GeeIterator* _tmp13_;
			DinoJingleFileEncryptionHelper* helper = NULL;
			GeeIterator* _tmp14_;
			gpointer _tmp15_;
			DinoEntitiesEncryption encryption = 0;
			DinoJingleFileEncryptionHelper* _tmp16_;
			XmppXepJingleFileTransferFileTransfer* _tmp17_;
			_tmp13_ = _helper_it;
			if (!gee_iterator_next (_tmp13_)) {
				break;
			}
			_tmp14_ = _helper_it;
			_tmp15_ = gee_iterator_get (_tmp14_);
			helper = (DinoJingleFileEncryptionHelper*) _tmp15_;
			_tmp16_ = helper;
			_tmp17_ = jingle_file_transfer;
			encryption = dino_jingle_file_encryption_helper_get_encryption (_tmp16_, _tmp17_);
			if (encryption != DINO_ENTITIES_ENCRYPTION_NONE) {
				result = encryption;
				_g_object_unref0 (helper);
				_g_object_unref0 (_helper_it);
				_g_object_unref0 (jingle_file_transfer);
				return result;
			}
			_g_object_unref0 (helper);
		}
		_g_object_unref0 (_helper_it);
	}
	result = DINO_ENTITIES_ENCRYPTION_NONE;
	_g_object_unref0 (jingle_file_transfer);
	return result;
}

static void
dino_jingle_file_provider_real_download_data_free (gpointer _data)
{
	DinoJingleFileProviderDownloadData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file_transfer);
	_dino_file_receive_data_unref0 (_data_->receive_data);
	_dino_file_meta_unref0 (_data_->file_meta);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileProviderDownloadData, _data_);
}

static void
dino_jingle_file_provider_real_download (DinoFileProvider* base,
                                         DinoEntitiesFileTransfer* file_transfer,
                                         DinoFileReceiveData* receive_data,
                                         DinoFileMeta* file_meta,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	DinoJingleFileProvider * self;
	DinoJingleFileProviderDownloadData* _data_;
	DinoJingleFileProvider* _tmp0_;
	DinoEntitiesFileTransfer* _tmp1_;
	DinoFileReceiveData* _tmp2_;
	DinoFileMeta* _tmp3_;
	g_return_if_fail (file_transfer != NULL);
	g_return_if_fail (receive_data != NULL);
	g_return_if_fail (file_meta != NULL);
	self = (DinoJingleFileProvider*) base;
	_data_ = g_slice_new0 (DinoJingleFileProviderDownloadData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_provider_real_download_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file_transfer);
	_g_object_unref0 (_data_->file_transfer);
	_data_->file_transfer = _tmp1_;
	_tmp2_ = _dino_file_receive_data_ref0 (receive_data);
	_dino_file_receive_data_unref0 (_data_->receive_data);
	_data_->receive_data = _tmp2_;
	_tmp3_ = _dino_file_meta_ref0 (file_meta);
	_dino_file_meta_unref0 (_data_->file_meta);
	_data_->file_meta = _tmp3_;
	dino_jingle_file_provider_real_download_co (_data_);
}

static GInputStream*
dino_jingle_file_provider_download_finish (DinoFileProvider* base,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	GInputStream* result;
	DinoJingleFileProviderDownloadData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dino_jingle_file_provider_download_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DinoJingleFileProviderDownloadData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_provider_real_download_co (_data_);
}

static gboolean
dino_jingle_file_provider_real_download_co (DinoJingleFileProviderDownloadData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->stream_interactor;
	_data_->_tmp1_ = dino_entities_file_transfer_get_account (_data_->file_transfer);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = dino_stream_interactor_get_stream (_data_->_tmp0_, _data_->_tmp2_);
	_data_->stream = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->self->priv->file_transfers;
	_data_->_tmp5_ = dino_entities_file_transfer_get_info (_data_->file_transfer);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp4_, _data_->_tmp6_);
	_data_->jingle_file_transfer = (XmppXepJingleFileTransferFileTransfer*) _data_->_tmp7_;
	_data_->_tmp8_ = _data_->jingle_file_transfer;
	if (_data_->_tmp8_ == NULL) {
		_data_->_tmp9_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Transfer data not available anymore");
		_data_->_inner_error0_ = _data_->_tmp9_;
		if (_data_->_inner_error0_->domain == G_IO_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->jingle_file_transfer);
			_g_object_unref0 (_data_->stream);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->jingle_file_transfer);
			_g_object_unref0 (_data_->stream);
			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;
		}
	}
	_data_->_tmp10_ = _data_->jingle_file_transfer;
	_data_->_tmp11_ = _data_->stream;
	_data_->_state_ = 1;
	xmpp_xep_jingle_file_transfer_file_transfer_accept (_data_->_tmp10_, _data_->_tmp11_, dino_jingle_file_provider_download_ready, _data_);
	return FALSE;
	_state_1:
	xmpp_xep_jingle_file_transfer_file_transfer_accept_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == G_IO_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->jingle_file_transfer);
			_g_object_unref0 (_data_->stream);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->jingle_file_transfer);
			_g_object_unref0 (_data_->stream);
			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;
		}
	}
	_data_->_tmp12_ = _data_->jingle_file_transfer;
	_data_->_tmp13_ = xmpp_xep_jingle_file_transfer_file_transfer_get_stream (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_tmp15_ = dino_limit_input_stream_new (_data_->_tmp14_, _data_->file_meta->size);
	_data_->result = (GInputStream*) _data_->_tmp15_;
	_g_object_unref0 (_data_->jingle_file_transfer);
	_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 gint
dino_jingle_file_provider_real_get_id (DinoFileProvider* base)
{
	DinoJingleFileProvider * self;
	gint result;
	self = (DinoJingleFileProvider*) base;
	result = 1;
	return result;
}

static Block18Data*
block18_data_ref (Block18Data* _data18_)
{
	g_atomic_int_inc (&_data18_->_ref_count_);
	return _data18_;
}

static void
block18_data_unref (void * _userdata_)
{
	Block18Data* _data18_;
	_data18_ = (Block18Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data18_->_ref_count_)) {
		DinoJingleFileProvider* self;
		self = _data18_->self;
		_g_object_unref0 (_data18_->account);
		_g_object_unref0 (self);
		g_slice_free (Block18Data, _data18_);
	}
}

static void
__lambda44_ (Block18Data* _data18_,
             XmppXmppStream* stream,
             XmppXepJingleFileTransferFileTransfer* jingle_file_transfer)
{
	DinoJingleFileProvider* self;
	DinoEntitiesConversation* conversation = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoModuleIdentity* _tmp1_;
	gpointer _tmp2_;
	DinoConversationManager* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	XmppJid* _tmp8_;
	DinoEntitiesConversation* _tmp9_;
	DinoEntitiesConversation* _tmp10_;
	DinoEntitiesConversation* _tmp11_;
	gchar* id = NULL;
	gchar* _tmp12_;
	GeeHashMap* _tmp13_;
	const gchar* _tmp14_;
	DinoFileMeta* file_meta = NULL;
	DinoFileMeta* _tmp15_;
	DinoFileMeta* _tmp16_;
	gint64 _tmp17_;
	gint64 _tmp18_;
	DinoFileMeta* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	GDateTime* time = NULL;
	GDateTime* _tmp23_;
	XmppJid* from = NULL;
	XmppJid* _tmp24_;
	XmppJid* _tmp25_;
	XmppJid* _tmp26_;
	XmppJid* _tmp27_;
	const gchar* _tmp28_;
	XmppJid* _tmp29_;
	GDateTime* _tmp30_;
	GDateTime* _tmp31_;
	DinoEntitiesConversation* _tmp32_;
	DinoFileReceiveData* _tmp33_;
	DinoFileReceiveData* _tmp34_;
	DinoFileMeta* _tmp35_;
	self = _data18_->self;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jingle_file_transfer != NULL);
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = dino_conversation_manager_IDENTITY;
	_tmp2_ = dino_stream_interactor_get_module (_tmp0_, DINO_TYPE_CONVERSATION_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
	_tmp3_ = (DinoConversationManager*) _tmp2_;
	_tmp4_ = xmpp_xep_jingle_file_transfer_file_transfer_get_peer (jingle_file_transfer);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_jid_get_bare_jid (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = dino_conversation_manager_get_conversation (_tmp3_, _tmp8_, _data18_->account, NULL);
	_tmp10_ = _tmp9_;
	_xmpp_jid_unref0 (_tmp8_);
	_g_object_unref0 (_tmp3_);
	conversation = _tmp10_;
	_tmp11_ = conversation;
	if (_tmp11_ == NULL) {
		_g_object_unref0 (conversation);
		return;
	}
	_tmp12_ = xmpp_random_uuid ();
	id = _tmp12_;
	_tmp13_ = self->priv->file_transfers;
	_tmp14_ = id;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp13_, _tmp14_, jingle_file_transfer);
	_tmp15_ = dino_file_meta_new ();
	file_meta = _tmp15_;
	_tmp16_ = file_meta;
	_tmp17_ = xmpp_xep_jingle_file_transfer_file_transfer_get_size (jingle_file_transfer);
	_tmp18_ = _tmp17_;
	_tmp16_->size = _tmp18_;
	_tmp19_ = file_meta;
	_tmp20_ = xmpp_xep_jingle_file_transfer_file_transfer_get_file_name (jingle_file_transfer);
	_tmp21_ = _tmp20_;
	_tmp22_ = g_strdup (_tmp21_);
	_g_free0 (_tmp19_->file_name);
	_tmp19_->file_name = _tmp22_;
	_tmp23_ = g_date_time_new_now_utc ();
	time = _tmp23_;
	_tmp24_ = xmpp_xep_jingle_file_transfer_file_transfer_get_peer (jingle_file_transfer);
	_tmp25_ = _tmp24_;
	_tmp26_ = xmpp_jid_get_bare_jid (_tmp25_);
	_tmp27_ = _tmp26_;
	from = _tmp27_;
	_tmp28_ = id;
	_tmp29_ = from;
	_tmp30_ = time;
	_tmp31_ = time;
	_tmp32_ = conversation;
	_tmp33_ = dino_file_receive_data_new ();
	_tmp34_ = _tmp33_;
	_tmp35_ = file_meta;
	g_signal_emit_by_name ((DinoFileProvider*) self, "file-incoming", _tmp28_, _tmp29_, _tmp30_, _tmp31_, _tmp32_, _tmp34_, _tmp35_);
	_dino_file_receive_data_unref0 (_tmp34_);
	_xmpp_jid_unref0 (from);
	_g_date_time_unref0 (time);
	_dino_file_meta_unref0 (file_meta);
	_g_free0 (id);
	_g_object_unref0 (conversation);
}

static void
___lambda44__xmpp_xep_jingle_file_transfer_module_file_incoming (XmppXepJingleFileTransferModule* _sender,
                                                                 XmppXmppStream* stream,
                                                                 XmppXepJingleFileTransferFileTransfer* file_transfer,
                                                                 gpointer self)
{
	__lambda44_ (self, stream, file_transfer);
}

static void
dino_jingle_file_provider_on_account_added (DinoJingleFileProvider* self,
                                            DinoEntitiesAccount* account)
{
	Block18Data* _data18_;
	DinoEntitiesAccount* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoModuleManager* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppXepJingleFileTransferModule* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_data18_ = g_slice_new0 (Block18Data);
	_data18_->_ref_count_ = 1;
	_data18_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (account);
	_g_object_unref0 (_data18_->account);
	_data18_->account = _tmp0_;
	_tmp1_ = self->priv->stream_interactor;
	_tmp2_ = _tmp1_->module_manager;
	_tmp3_ = xmpp_xep_jingle_file_transfer_module_IDENTITY;
	_tmp4_ = dino_module_manager_get_module (_tmp2_, XMPP_XEP_JINGLE_FILE_TRANSFER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data18_->account, _tmp3_);
	_tmp5_ = (XmppXepJingleFileTransferModule*) _tmp4_;
	g_signal_connect_data (_tmp5_, "file-incoming", (GCallback) ___lambda44__xmpp_xep_jingle_file_transfer_module_file_incoming, block18_data_ref (_data18_), (GClosureNotify) block18_data_unref, 0);
	_g_object_unref0 (_tmp5_);
	block18_data_unref (_data18_);
	_data18_ = NULL;
}

static void
dino_jingle_file_provider_class_init (DinoJingleFileProviderClass * klass,
                                      gpointer klass_data)
{
	dino_jingle_file_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoJingleFileProvider_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_jingle_file_provider_finalize;
}

static void
dino_jingle_file_provider_dino_file_provider_interface_init (DinoFileProviderIface * iface,
                                                             gpointer iface_data)
{
	dino_jingle_file_provider_dino_file_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_file_meta = (DinoFileMeta* (*) (DinoFileProvider*, DinoEntitiesFileTransfer*, GError**)) dino_jingle_file_provider_real_get_file_meta;
	iface->get_file_receive_data = (DinoFileReceiveData* (*) (DinoFileProvider*, DinoEntitiesFileTransfer*)) dino_jingle_file_provider_real_get_file_receive_data;
	iface->get_meta_info = (void (*) (DinoFileProvider*, DinoEntitiesFileTransfer*, DinoFileReceiveData*, DinoFileMeta*, GAsyncReadyCallback, gpointer)) dino_jingle_file_provider_real_get_meta_info;
	iface->get_meta_info_finish = (DinoFileMeta* (*) (DinoFileProvider*, GAsyncResult*, GError**)) dino_jingle_file_provider_get_meta_info_finish;
	iface->get_encryption = (DinoEntitiesEncryption (*) (DinoFileProvider*, DinoEntitiesFileTransfer*, DinoFileReceiveData*, DinoFileMeta*)) dino_jingle_file_provider_real_get_encryption;
	iface->download = (void (*) (DinoFileProvider*, DinoEntitiesFileTransfer*, DinoFileReceiveData*, DinoFileMeta*, GAsyncReadyCallback, gpointer)) dino_jingle_file_provider_real_download;
	iface->download_finish = (GInputStream* (*) (DinoFileProvider*, GAsyncResult*, GError**)) dino_jingle_file_provider_download_finish;
	iface->get_id = (gint (*) (DinoFileProvider*)) dino_jingle_file_provider_real_get_id;
}

static void
dino_jingle_file_provider_instance_init (DinoJingleFileProvider * self,
                                         gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dino_jingle_file_provider_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, XMPP_XEP_JINGLE_FILE_TRANSFER_TYPE_FILE_TRANSFER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->file_transfers = _tmp0_;
}

static void
dino_jingle_file_provider_finalize (GObject * obj)
{
	DinoJingleFileProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_JINGLE_FILE_PROVIDER, DinoJingleFileProvider);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->file_transfers);
	G_OBJECT_CLASS (dino_jingle_file_provider_parent_class)->finalize (obj);
}

static GType
dino_jingle_file_provider_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoJingleFileProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_jingle_file_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoJingleFileProvider), 0, (GInstanceInitFunc) dino_jingle_file_provider_instance_init, NULL };
	static const GInterfaceInfo dino_file_provider_info = { (GInterfaceInitFunc) dino_jingle_file_provider_dino_file_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_jingle_file_provider_type_id;
	dino_jingle_file_provider_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoJingleFileProvider", &g_define_type_info, 0);
	g_type_add_interface_static (dino_jingle_file_provider_type_id, DINO_TYPE_FILE_PROVIDER, &dino_file_provider_info);
	DinoJingleFileProvider_private_offset = g_type_add_instance_private (dino_jingle_file_provider_type_id, sizeof (DinoJingleFileProviderPrivate));
	return dino_jingle_file_provider_type_id;
}

GType
dino_jingle_file_provider_get_type (void)
{
	static volatile gsize dino_jingle_file_provider_type_id__once = 0;
	if (g_once_init_enter (&dino_jingle_file_provider_type_id__once)) {
		GType dino_jingle_file_provider_type_id;
		dino_jingle_file_provider_type_id = dino_jingle_file_provider_get_type_once ();
		g_once_init_leave (&dino_jingle_file_provider_type_id__once, dino_jingle_file_provider_type_id);
	}
	return dino_jingle_file_provider_type_id__once;
}

static inline gpointer
dino_jingle_file_sender_get_instance_private (DinoJingleFileSender* self)
{
	return G_STRUCT_MEMBER_P (self, DinoJingleFileSender_private_offset);
}

DinoJingleFileSender*
dino_jingle_file_sender_construct (GType object_type,
                                   DinoStreamInteractor* stream_interactor)
{
	DinoJingleFileSender * self = NULL;
	DinoStreamInteractor* _tmp0_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoJingleFileSender*) 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;
}

DinoJingleFileSender*
dino_jingle_file_sender_new (DinoStreamInteractor* stream_interactor)
{
	return dino_jingle_file_sender_construct (DINO_TYPE_JINGLE_FILE_SENDER, stream_interactor);
}

static void
dino_jingle_file_sender_real_is_upload_available_data_free (gpointer _data)
{
	DinoJingleFileSenderIsUploadAvailableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderIsUploadAvailableData, _data_);
}

static void
dino_jingle_file_sender_real_is_upload_available (DinoFileSender* base,
                                                  DinoEntitiesConversation* conversation,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	DinoJingleFileSender * self;
	DinoJingleFileSenderIsUploadAvailableData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	g_return_if_fail (conversation != NULL);
	self = (DinoJingleFileSender*) base;
	_data_ = g_slice_new0 (DinoJingleFileSenderIsUploadAvailableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_real_is_upload_available_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data_->conversation);
	_data_->conversation = _tmp1_;
	dino_jingle_file_sender_real_is_upload_available_co (_data_);
}

static gboolean
dino_jingle_file_sender_is_upload_available_finish (DinoFileSender* base,
                                                    GAsyncResult* _res_)
{
	gboolean result;
	DinoJingleFileSenderIsUploadAvailableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dino_jingle_file_sender_is_upload_available_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	DinoJingleFileSenderIsUploadAvailableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_sender_real_is_upload_available_co (_data_);
}

static gboolean
dino_jingle_file_sender_real_is_upload_available_co (DinoJingleFileSenderIsUploadAvailableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dino_entities_conversation_get_type_ (_data_->conversation);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_ != DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		_data_->result = FALSE;
		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_->_tmp2_ = dino_jingle_file_helper_registry_get_instance ();
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = dino_entities_conversation_get_encryption (_data_->conversation);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = dino_jingle_file_helper_registry_get_encryption_helper (_data_->_tmp3_, _data_->_tmp5_);
	_data_->helper = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->helper;
	if (_data_->_tmp7_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->helper);
		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_->_tmp8_ = _data_->helper;
	if (!dino_jingle_file_encryption_helper_can_transfer (_data_->_tmp8_, _data_->conversation)) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->helper);
		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_->_tmp9_ = _data_->self->priv->stream_interactor;
	_data_->_tmp10_ = dino_entities_conversation_get_account (_data_->conversation);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = dino_stream_interactor_get_stream (_data_->_tmp9_, _data_->_tmp11_);
	_data_->stream = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->stream;
	if (_data_->_tmp13_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->stream);
		_g_object_unref0 (_data_->helper);
		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_->_tmp14_ = _data_->stream;
	_data_->_tmp15_ = xmpp_presence_flag_IDENTITY;
	_data_->_tmp16_ = xmpp_xmpp_stream_get_flag (_data_->_tmp14_, XMPP_PRESENCE_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp15_);
	_data_->_tmp17_ = (XmppPresenceFlag*) _data_->_tmp16_;
	_data_->_tmp18_ = dino_entities_conversation_get_counterpart (_data_->conversation);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp20_ = xmpp_presence_flag_get_resources (_data_->_tmp17_, _data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	_g_object_unref0 (_data_->_tmp17_);
	_data_->resources = _data_->_tmp21_;
	_data_->_tmp22_ = _data_->resources;
	if (_data_->_tmp22_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->resources);
		_g_object_unref0 (_data_->stream);
		_g_object_unref0 (_data_->helper);
		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_->_tmp23_ = _data_->resources;
		_data_->_full_jid_list = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->_full_jid_list;
		_data_->_tmp25_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp24_);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_full_jid_size = _data_->_tmp26_;
		_data_->_full_jid_index = -1;
		while (TRUE) {
			_data_->_full_jid_index = _data_->_full_jid_index + 1;
			_data_->_tmp27_ = _data_->_full_jid_index;
			_data_->_tmp28_ = _data_->_full_jid_size;
			if (!(_data_->_tmp27_ < _data_->_tmp28_)) {
				break;
			}
			_data_->_tmp29_ = _data_->_full_jid_list;
			_data_->_tmp30_ = gee_list_get (_data_->_tmp29_, _data_->_full_jid_index);
			_data_->full_jid = (XmppJid*) _data_->_tmp30_;
			_data_->_tmp31_ = _data_->stream;
			_data_->_tmp32_ = xmpp_xep_jingle_file_transfer_module_IDENTITY;
			_data_->_tmp33_ = xmpp_xmpp_stream_get_module (_data_->_tmp31_, XMPP_XEP_JINGLE_FILE_TRANSFER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp32_);
			_data_->_tmp34_ = (XmppXepJingleFileTransferModule*) _data_->_tmp33_;
			_data_->_tmp35_ = _data_->stream;
			_data_->_tmp36_ = _data_->full_jid;
			_data_->_state_ = 1;
			xmpp_xep_jingle_file_transfer_module_is_available (_data_->_tmp34_, _data_->_tmp35_, _data_->_tmp36_, dino_jingle_file_sender_is_upload_available_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp37_ = xmpp_xep_jingle_file_transfer_module_is_available_finish (_data_->_tmp34_, _data_->_res_);
			_g_object_unref0 (_data_->_tmp34_);
			if (_data_->_tmp37_) {
				_data_->result = TRUE;
				_xmpp_jid_unref0 (_data_->full_jid);
				_g_object_unref0 (_data_->resources);
				_g_object_unref0 (_data_->stream);
				_g_object_unref0 (_data_->helper);
				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_->full_jid);
		}
	}
	_data_->result = FALSE;
	_g_object_unref0 (_data_->resources);
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->helper);
	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
dino_jingle_file_sender_real_get_file_size_limit_data_free (gpointer _data)
{
	DinoJingleFileSenderGetFileSizeLimitData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderGetFileSizeLimitData, _data_);
}

static void
dino_jingle_file_sender_real_get_file_size_limit (DinoFileSender* base,
                                                  DinoEntitiesConversation* conversation,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	DinoJingleFileSender * self;
	DinoJingleFileSenderGetFileSizeLimitData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	g_return_if_fail (conversation != NULL);
	self = (DinoJingleFileSender*) base;
	_data_ = g_slice_new0 (DinoJingleFileSenderGetFileSizeLimitData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_real_get_file_size_limit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data_->conversation);
	_data_->conversation = _tmp1_;
	dino_jingle_file_sender_real_get_file_size_limit_co (_data_);
}

static glong
dino_jingle_file_sender_get_file_size_limit_finish (DinoFileSender* base,
                                                    GAsyncResult* _res_)
{
	glong result;
	DinoJingleFileSenderGetFileSizeLimitData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dino_jingle_file_sender_get_file_size_limit_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	DinoJingleFileSenderGetFileSizeLimitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_sender_real_get_file_size_limit_co (_data_);
}

static gboolean
dino_jingle_file_sender_real_get_file_size_limit_co (DinoJingleFileSenderGetFileSizeLimitData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dino_jingle_file_sender_can_send_conv (_data_->self, _data_->conversation, dino_jingle_file_sender_get_file_size_limit_ready, _data_);
	return FALSE;
	_state_1:
	if (dino_jingle_file_sender_can_send_conv_finish (_data_->self, _data_->_res_)) {
		_data_->result = (glong) G_MAXINT;
		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 = (glong) -1;
	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
dino_jingle_file_sender_real_can_send_data_free (gpointer _data)
{
	DinoJingleFileSenderCanSendData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->file_transfer);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderCanSendData, _data_);
}

static void
dino_jingle_file_sender_real_can_send (DinoFileSender* base,
                                       DinoEntitiesConversation* conversation,
                                       DinoEntitiesFileTransfer* file_transfer,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DinoJingleFileSender * self;
	DinoJingleFileSenderCanSendData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesFileTransfer* _tmp2_;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (file_transfer != NULL);
	self = (DinoJingleFileSender*) base;
	_data_ = g_slice_new0 (DinoJingleFileSenderCanSendData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_real_can_send_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_;
	dino_jingle_file_sender_real_can_send_co (_data_);
}

static gboolean
dino_jingle_file_sender_can_send_finish (DinoFileSender* base,
                                         GAsyncResult* _res_)
{
	gboolean result;
	DinoJingleFileSenderCanSendData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dino_jingle_file_sender_can_send_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	DinoJingleFileSenderCanSendData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_sender_real_can_send_co (_data_);
}

static gboolean
dino_jingle_file_sender_real_can_send_co (DinoJingleFileSenderCanSendData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dino_jingle_file_sender_can_send_conv (_data_->self, _data_->conversation, dino_jingle_file_sender_can_send_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = dino_jingle_file_sender_can_send_conv_finish (_data_->self, _data_->_res_);
	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
dino_jingle_file_sender_can_send_conv_data_free (gpointer _data)
{
	DinoJingleFileSenderCanSendConvData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderCanSendConvData, _data_);
}

static void
dino_jingle_file_sender_can_send_conv (DinoJingleFileSender* self,
                                       DinoEntitiesConversation* conversation,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DinoJingleFileSenderCanSendConvData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conversation != NULL);
	_data_ = g_slice_new0 (DinoJingleFileSenderCanSendConvData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_can_send_conv_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data_->conversation);
	_data_->conversation = _tmp1_;
	dino_jingle_file_sender_can_send_conv_co (_data_);
}

static gboolean
dino_jingle_file_sender_can_send_conv_finish (DinoJingleFileSender* self,
                                              GAsyncResult* _res_)
{
	gboolean result;
	DinoJingleFileSenderCanSendConvData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dino_jingle_file_sender_can_send_conv_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	DinoJingleFileSenderCanSendConvData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_sender_can_send_conv_co (_data_);
}

static gboolean
dino_jingle_file_sender_can_send_conv_co (DinoJingleFileSenderCanSendConvData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dino_entities_conversation_get_type_ (_data_->conversation);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_ != DINO_ENTITIES_CONVERSATION_TYPE_CHAT) {
		_data_->result = FALSE;
		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_->_state_ = 1;
	dino_file_sender_is_upload_available ((DinoFileSender*) _data_->self, _data_->conversation, dino_jingle_file_sender_can_send_conv_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = dino_file_sender_is_upload_available_finish ((DinoFileSender*) _data_->self, _data_->_res_);
	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
dino_jingle_file_sender_real_can_encrypt_data_free (gpointer _data)
{
	DinoJingleFileSenderCanEncryptData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->file_transfer);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderCanEncryptData, _data_);
}

static void
dino_jingle_file_sender_real_can_encrypt (DinoFileSender* base,
                                          DinoEntitiesConversation* conversation,
                                          DinoEntitiesFileTransfer* file_transfer,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	DinoJingleFileSender * self;
	DinoJingleFileSenderCanEncryptData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesFileTransfer* _tmp2_;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (file_transfer != NULL);
	self = (DinoJingleFileSender*) base;
	_data_ = g_slice_new0 (DinoJingleFileSenderCanEncryptData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_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_;
	dino_jingle_file_sender_real_can_encrypt_co (_data_);
}

static gboolean
dino_jingle_file_sender_can_encrypt_finish (DinoFileSender* base,
                                            GAsyncResult* _res_)
{
	gboolean result;
	DinoJingleFileSenderCanEncryptData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dino_jingle_file_sender_can_encrypt_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DinoJingleFileSenderCanEncryptData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_sender_real_can_encrypt_co (_data_);
}

static gboolean
dino_jingle_file_sender_real_can_encrypt_co (DinoJingleFileSenderCanEncryptData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dino_jingle_file_helper_registry_get_instance ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = dino_entities_file_transfer_get_encryption (_data_->file_transfer);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = dino_jingle_file_helper_registry_get_encryption_helper (_data_->_tmp1_, _data_->_tmp3_);
	_data_->helper = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->helper;
	if (_data_->_tmp5_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->helper);
		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_->_tmp6_ = _data_->helper;
	_data_->_state_ = 1;
	dino_jingle_file_encryption_helper_can_encrypt (_data_->_tmp6_, _data_->conversation, _data_->file_transfer, NULL, dino_jingle_file_sender_can_encrypt_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = dino_jingle_file_encryption_helper_can_encrypt_finish (_data_->_tmp6_, _data_->_res_);
	_g_object_unref0 (_data_->helper);
	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
dino_jingle_file_sender_real_prepare_send_file_data_free (gpointer _data)
{
	DinoJingleFileSenderPrepareSendFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->file_transfer);
	_dino_file_meta_unref0 (_data_->file_meta);
	_dino_file_send_data_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderPrepareSendFileData, _data_);
}

static void
dino_jingle_file_sender_real_prepare_send_file (DinoFileSender* base,
                                                DinoEntitiesConversation* conversation,
                                                DinoEntitiesFileTransfer* file_transfer,
                                                DinoFileMeta* file_meta,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	DinoJingleFileSender * self;
	DinoJingleFileSenderPrepareSendFileData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesFileTransfer* _tmp2_;
	DinoFileMeta* _tmp3_;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (file_transfer != NULL);
	g_return_if_fail (file_meta != NULL);
	self = (DinoJingleFileSender*) base;
	_data_ = g_slice_new0 (DinoJingleFileSenderPrepareSendFileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_real_prepare_send_file_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_ = _dino_file_meta_ref0 (file_meta);
	_dino_file_meta_unref0 (_data_->file_meta);
	_data_->file_meta = _tmp3_;
	dino_jingle_file_sender_real_prepare_send_file_co (_data_);
}

static DinoFileSendData*
dino_jingle_file_sender_prepare_send_file_finish (DinoFileSender* base,
                                                  GAsyncResult* _res_,
                                                  GError** error)
{
	DinoFileSendData* result;
	DinoJingleFileSenderPrepareSendFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
dino_jingle_file_sender_real_prepare_send_file_co (DinoJingleFileSenderPrepareSendFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (DINO_IS_HTTP_FILE_META (_data_->file_meta)) {
		_data_->_tmp0_ = g_error_new_literal (DINO_FILE_SEND_ERROR, DINO_FILE_SEND_ERROR_UPLOAD_FAILED, "Cannot upload http file meta over Jingle");
		_data_->_inner_error0_ = _data_->_tmp0_;
		if (_data_->_inner_error0_->domain == DINO_FILE_SEND_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			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;
		}
	}
	_data_->_tmp1_ = dino_file_send_data_new ();
	_data_->result = _data_->_tmp1_;
	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
dino_jingle_file_sender_real_send_file_data_free (gpointer _data)
{
	DinoJingleFileSenderSendFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->conversation);
	_g_object_unref0 (_data_->file_transfer);
	_dino_file_send_data_unref0 (_data_->file_send_data);
	_dino_file_meta_unref0 (_data_->file_meta);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoJingleFileSenderSendFileData, _data_);
}

static gpointer
_dino_file_send_data_ref0 (gpointer self)
{
	return self ? dino_file_send_data_ref (self) : NULL;
}

static void
dino_jingle_file_sender_real_send_file (DinoFileSender* base,
                                        DinoEntitiesConversation* conversation,
                                        DinoEntitiesFileTransfer* file_transfer,
                                        DinoFileSendData* file_send_data,
                                        DinoFileMeta* file_meta,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DinoJingleFileSender * self;
	DinoJingleFileSenderSendFileData* _data_;
	DinoJingleFileSender* _tmp0_;
	DinoEntitiesConversation* _tmp1_;
	DinoEntitiesFileTransfer* _tmp2_;
	DinoFileSendData* _tmp3_;
	DinoFileMeta* _tmp4_;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (file_transfer != NULL);
	g_return_if_fail (file_send_data != NULL);
	g_return_if_fail (file_meta != NULL);
	self = (DinoJingleFileSender*) base;
	_data_ = g_slice_new0 (DinoJingleFileSenderSendFileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_jingle_file_sender_real_send_file_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_ = _dino_file_send_data_ref0 (file_send_data);
	_dino_file_send_data_unref0 (_data_->file_send_data);
	_data_->file_send_data = _tmp3_;
	_tmp4_ = _dino_file_meta_ref0 (file_meta);
	_dino_file_meta_unref0 (_data_->file_meta);
	_data_->file_meta = _tmp4_;
	dino_jingle_file_sender_real_send_file_co (_data_);
}

static void
dino_jingle_file_sender_send_file_finish (DinoFileSender* base,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	DinoJingleFileSenderSendFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
dino_jingle_file_sender_send_file_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DinoJingleFileSenderSendFileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_jingle_file_sender_real_send_file_co (_data_);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static gboolean
dino_jingle_file_sender_real_send_file_co (DinoJingleFileSenderSendFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->stream_interactor;
	_data_->_tmp1_ = dino_entities_file_transfer_get_account (_data_->file_transfer);
	_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_->_tmp5_ = g_error_new_literal (DINO_FILE_SEND_ERROR, DINO_FILE_SEND_ERROR_UPLOAD_FAILED, "No stream available");
		_data_->_inner_error0_ = _data_->_tmp5_;
		if (_data_->_inner_error0_->domain == DINO_FILE_SEND_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->stream);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->stream);
			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;
		}
	}
	_data_->_tmp6_ = dino_jingle_file_helper_registry_get_instance ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = dino_entities_file_transfer_get_encryption (_data_->file_transfer);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = dino_jingle_file_helper_registry_get_encryption_helper (_data_->_tmp7_, _data_->_tmp9_);
	_data_->helper = _data_->_tmp10_;
	_data_->_tmp12_ = _data_->helper;
	if (_data_->_tmp12_ != NULL) {
		_data_->_tmp13_ = _data_->helper;
		_data_->_state_ = 1;
		dino_jingle_file_encryption_helper_can_encrypt (_data_->_tmp13_, _data_->conversation, _data_->file_transfer, NULL, dino_jingle_file_sender_send_file_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = dino_jingle_file_encryption_helper_can_encrypt_finish (_data_->_tmp13_, _data_->_res_);
	} else {
		_data_->_tmp11_ = FALSE;
	}
	_data_->must_encrypt = _data_->_tmp11_;
	{
		_data_->_tmp14_ = _data_->stream;
		_data_->_tmp15_ = xmpp_presence_flag_IDENTITY;
		_data_->_tmp16_ = xmpp_xmpp_stream_get_flag (_data_->_tmp14_, XMPP_PRESENCE_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp15_);
		_data_->_tmp17_ = (XmppPresenceFlag*) _data_->_tmp16_;
		_data_->_tmp18_ = dino_entities_conversation_get_counterpart (_data_->conversation);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = xmpp_presence_flag_get_resources (_data_->_tmp17_, _data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_g_object_unref0 (_data_->_tmp17_);
		_data_->_full_jid_list = _data_->_tmp21_;
		_data_->_tmp22_ = _data_->_full_jid_list;
		_data_->_tmp23_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp22_);
		_data_->_tmp24_ = _data_->_tmp23_;
		_data_->_full_jid_size = _data_->_tmp24_;
		_data_->_full_jid_index = -1;
		while (TRUE) {
			_data_->_full_jid_index = _data_->_full_jid_index + 1;
			_data_->_tmp25_ = _data_->_full_jid_index;
			_data_->_tmp26_ = _data_->_full_jid_size;
			if (!(_data_->_tmp25_ < _data_->_tmp26_)) {
				break;
			}
			_data_->_tmp27_ = _data_->_full_jid_list;
			_data_->_tmp28_ = gee_list_get (_data_->_tmp27_, _data_->_full_jid_index);
			_data_->full_jid = (XmppJid*) _data_->_tmp28_;
			_data_->_tmp29_ = _data_->full_jid;
			_data_->_tmp30_ = _data_->stream;
			_data_->_tmp31_ = xmpp_bind_flag_IDENTITY;
			_data_->_tmp32_ = xmpp_xmpp_stream_get_flag (_data_->_tmp30_, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp31_);
			_data_->_tmp33_ = (XmppBindFlag*) _data_->_tmp32_;
			_data_->_tmp34_ = _data_->_tmp33_->my_jid;
			_data_->_tmp35_ = xmpp_jid_equals (_data_->_tmp29_, _data_->_tmp34_);
			_g_object_unref0 (_data_->_tmp33_);
			if (_data_->_tmp35_) {
				_xmpp_jid_unref0 (_data_->full_jid);
				continue;
			}
			_data_->_tmp36_ = _data_->stream;
			_data_->_tmp37_ = xmpp_xep_jingle_file_transfer_module_IDENTITY;
			_data_->_tmp38_ = xmpp_xmpp_stream_get_module (_data_->_tmp36_, XMPP_XEP_JINGLE_FILE_TRANSFER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp37_);
			_data_->_tmp39_ = (XmppXepJingleFileTransferModule*) _data_->_tmp38_;
			_data_->_tmp40_ = _data_->stream;
			_data_->_tmp41_ = _data_->full_jid;
			_data_->_state_ = 2;
			xmpp_xep_jingle_file_transfer_module_is_available (_data_->_tmp39_, _data_->_tmp40_, _data_->_tmp41_, dino_jingle_file_sender_send_file_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp42_ = !xmpp_xep_jingle_file_transfer_module_is_available_finish (_data_->_tmp39_, _data_->_res_);
			_g_object_unref0 (_data_->_tmp39_);
			if (_data_->_tmp42_) {
				_xmpp_jid_unref0 (_data_->full_jid);
				continue;
			}
			if (_data_->must_encrypt) {
				_data_->_tmp44_ = _data_->helper;
				_data_->_tmp45_ = _data_->full_jid;
				_data_->_state_ = 3;
				dino_jingle_file_encryption_helper_can_encrypt (_data_->_tmp44_, _data_->conversation, _data_->file_transfer, _data_->_tmp45_, dino_jingle_file_sender_send_file_ready, _data_);
				return FALSE;
				_state_3:
				_data_->_tmp43_ = !dino_jingle_file_encryption_helper_can_encrypt_finish (_data_->_tmp44_, _data_->_res_);
			} else {
				_data_->_tmp43_ = FALSE;
			}
			if (_data_->_tmp43_) {
				_xmpp_jid_unref0 (_data_->full_jid);
				continue;
			}
			_data_->precondition_name = NULL;
			_data_->precondition_options = NULL;
			if (_data_->must_encrypt) {
				_data_->_tmp46_ = _data_->helper;
				_data_->_tmp47_ = dino_jingle_file_encryption_helper_get_precondition_name (_data_->_tmp46_, _data_->conversation, _data_->file_transfer);
				_g_free0 (_data_->precondition_name);
				_data_->precondition_name = _data_->_tmp47_;
				_data_->_tmp48_ = _data_->helper;
				_data_->_tmp49_ = dino_jingle_file_encryption_helper_get_precondition_options (_data_->_tmp48_, _data_->conversation, _data_->file_transfer);
				_g_object_unref0 (_data_->precondition_options);
				_data_->precondition_options = _data_->_tmp49_;
				_data_->_tmp50_ = _data_->precondition_name;
				if (_data_->_tmp50_ == NULL) {
					_data_->_tmp51_ = g_error_new_literal (DINO_FILE_SEND_ERROR, DINO_FILE_SEND_ERROR_ENCRYPTION_FAILED, "Should have created a precondition, but did not");
					_data_->_inner_error0_ = _data_->_tmp51_;
					if (_data_->_inner_error0_->domain == DINO_FILE_SEND_ERROR) {
						g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
						_g_object_unref0 (_data_->precondition_options);
						_g_free0 (_data_->precondition_name);
						_xmpp_jid_unref0 (_data_->full_jid);
						_g_object_unref0 (_data_->_full_jid_list);
						_g_object_unref0 (_data_->helper);
						_g_object_unref0 (_data_->stream);
						g_object_unref (_data_->_async_result);
						return FALSE;
					} else {
						_g_object_unref0 (_data_->precondition_options);
						_g_free0 (_data_->precondition_name);
						_xmpp_jid_unref0 (_data_->full_jid);
						_g_object_unref0 (_data_->_full_jid_list);
						_g_object_unref0 (_data_->helper);
						_g_object_unref0 (_data_->stream);
						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;
					}
				}
			}
			{
				_data_->_tmp52_ = _data_->stream;
				_data_->_tmp53_ = xmpp_xep_jingle_file_transfer_module_IDENTITY;
				_data_->_tmp54_ = xmpp_xmpp_stream_get_module (_data_->_tmp52_, XMPP_XEP_JINGLE_FILE_TRANSFER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp53_);
				_data_->_tmp55_ = (XmppXepJingleFileTransferModule*) _data_->_tmp54_;
				_data_->_tmp56_ = _data_->stream;
				_data_->_tmp57_ = _data_->full_jid;
				_data_->_tmp58_ = dino_entities_file_transfer_get_input_stream (_data_->file_transfer);
				_data_->_tmp59_ = _data_->_tmp58_;
				_data_->_tmp60_ = dino_entities_file_transfer_get_server_file_name (_data_->file_transfer);
				_data_->_tmp61_ = _data_->_tmp60_;
				_data_->_tmp62_ = _data_->precondition_name;
				_data_->_tmp63_ = _data_->precondition_options;
				_data_->_state_ = 4;
				xmpp_xep_jingle_file_transfer_module_offer_file_stream (_data_->_tmp55_, _data_->_tmp56_, _data_->_tmp57_, _data_->_tmp59_, _data_->_tmp61_, _data_->file_meta->size, _data_->_tmp62_, _data_->_tmp63_, dino_jingle_file_sender_send_file_ready, _data_);
				return FALSE;
				_state_4:
				xmpp_xep_jingle_file_transfer_module_offer_file_stream_finish (_data_->_tmp55_, _data_->_res_, &_data_->_inner_error0_);
				_g_object_unref0 (_data_->_tmp55_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			}
			goto __finally0;
			__catch0_g_error:
			{
				_data_->e = _data_->_inner_error0_;
				_data_->_inner_error0_ = NULL;
				_data_->_tmp64_ = _data_->e;
				_data_->_tmp65_ = _data_->_tmp64_->message;
				_data_->_tmp66_ = string_to_string (_data_->_tmp65_);
				_data_->_tmp67_ = g_strconcat ("offer_file_stream failed: ", _data_->_tmp66_, NULL);
				_data_->_tmp68_ = _data_->_tmp67_;
				_data_->_tmp69_ = g_error_new_literal (DINO_FILE_SEND_ERROR, DINO_FILE_SEND_ERROR_UPLOAD_FAILED, _data_->_tmp68_);
				_data_->_tmp70_ = _data_->_tmp69_;
				_g_free0 (_data_->_tmp68_);
				_data_->_inner_error0_ = _data_->_tmp70_;
				_g_error_free0 (_data_->e);
				goto __finally0;
			}
			__finally0:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				if (_data_->_inner_error0_->domain == DINO_FILE_SEND_ERROR) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->precondition_options);
					_g_free0 (_data_->precondition_name);
					_xmpp_jid_unref0 (_data_->full_jid);
					_g_object_unref0 (_data_->_full_jid_list);
					_g_object_unref0 (_data_->helper);
					_g_object_unref0 (_data_->stream);
					g_object_unref (_data_->_async_result);
					return FALSE;
				} else {
					_g_object_unref0 (_data_->precondition_options);
					_g_free0 (_data_->precondition_name);
					_xmpp_jid_unref0 (_data_->full_jid);
					_g_object_unref0 (_data_->_full_jid_list);
					_g_object_unref0 (_data_->helper);
					_g_object_unref0 (_data_->stream);
					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_->precondition_options);
			_g_free0 (_data_->precondition_name);
			_xmpp_jid_unref0 (_data_->full_jid);
			_g_object_unref0 (_data_->_full_jid_list);
			_g_object_unref0 (_data_->helper);
			_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;
		}
		_g_object_unref0 (_data_->_full_jid_list);
	}
	_g_object_unref0 (_data_->helper);
	_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 gint
dino_jingle_file_sender_real_get_id (DinoFileSender* base)
{
	DinoJingleFileSender * self;
	gint result;
	self = (DinoJingleFileSender*) base;
	result = 1;
	return result;
}

static gfloat
dino_jingle_file_sender_real_get_priority (DinoFileSender* base)
{
	DinoJingleFileSender * self;
	gfloat result;
	self = (DinoJingleFileSender*) base;
	result = (gfloat) 50;
	return result;
}

static void
dino_jingle_file_sender_class_init (DinoJingleFileSenderClass * klass,
                                    gpointer klass_data)
{
	dino_jingle_file_sender_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoJingleFileSender_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_jingle_file_sender_finalize;
}

static void
dino_jingle_file_sender_dino_file_sender_interface_init (DinoFileSenderIface * iface,
                                                         gpointer iface_data)
{
	dino_jingle_file_sender_dino_file_sender_parent_iface = g_type_interface_peek_parent (iface);
	iface->is_upload_available = (void (*) (DinoFileSender*, DinoEntitiesConversation*, GAsyncReadyCallback, gpointer)) dino_jingle_file_sender_real_is_upload_available;
	iface->is_upload_available_finish = (gboolean (*) (DinoFileSender*, GAsyncResult*)) dino_jingle_file_sender_is_upload_available_finish;
	iface->get_file_size_limit = (void (*) (DinoFileSender*, DinoEntitiesConversation*, GAsyncReadyCallback, gpointer)) dino_jingle_file_sender_real_get_file_size_limit;
	iface->get_file_size_limit_finish = (glong (*) (DinoFileSender*, GAsyncResult*)) dino_jingle_file_sender_get_file_size_limit_finish;
	iface->can_send = (void (*) (DinoFileSender*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*, GAsyncReadyCallback, gpointer)) dino_jingle_file_sender_real_can_send;
	iface->can_send_finish = (gboolean (*) (DinoFileSender*, GAsyncResult*)) dino_jingle_file_sender_can_send_finish;
	iface->can_encrypt = (void (*) (DinoFileSender*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*, GAsyncReadyCallback, gpointer)) dino_jingle_file_sender_real_can_encrypt;
	iface->can_encrypt_finish = (gboolean (*) (DinoFileSender*, GAsyncResult*)) dino_jingle_file_sender_can_encrypt_finish;
	iface->prepare_send_file = (void (*) (DinoFileSender*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*, DinoFileMeta*, GAsyncReadyCallback, gpointer)) dino_jingle_file_sender_real_prepare_send_file;
	iface->prepare_send_file_finish = (DinoFileSendData* (*) (DinoFileSender*, GAsyncResult*, GError**)) dino_jingle_file_sender_prepare_send_file_finish;
	iface->send_file = (void (*) (DinoFileSender*, DinoEntitiesConversation*, DinoEntitiesFileTransfer*, DinoFileSendData*, DinoFileMeta*, GAsyncReadyCallback, gpointer)) dino_jingle_file_sender_real_send_file;
	iface->send_file_finish = (void (*) (DinoFileSender*, GAsyncResult*, GError**)) dino_jingle_file_sender_send_file_finish;
	iface->get_id = (gint (*) (DinoFileSender*)) dino_jingle_file_sender_real_get_id;
	iface->get_priority = (gfloat (*) (DinoFileSender*)) dino_jingle_file_sender_real_get_priority;
}

static void
dino_jingle_file_sender_instance_init (DinoJingleFileSender * self,
                                       gpointer klass)
{
	self->priv = dino_jingle_file_sender_get_instance_private (self);
}

static void
dino_jingle_file_sender_finalize (GObject * obj)
{
	DinoJingleFileSender * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_JINGLE_FILE_SENDER, DinoJingleFileSender);
	_g_object_unref0 (self->priv->stream_interactor);
	G_OBJECT_CLASS (dino_jingle_file_sender_parent_class)->finalize (obj);
}

static GType
dino_jingle_file_sender_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoJingleFileSenderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_jingle_file_sender_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoJingleFileSender), 0, (GInstanceInitFunc) dino_jingle_file_sender_instance_init, NULL };
	static const GInterfaceInfo dino_file_sender_info = { (GInterfaceInitFunc) dino_jingle_file_sender_dino_file_sender_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_jingle_file_sender_type_id;
	dino_jingle_file_sender_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoJingleFileSender", &g_define_type_info, 0);
	g_type_add_interface_static (dino_jingle_file_sender_type_id, DINO_TYPE_FILE_SENDER, &dino_file_sender_info);
	DinoJingleFileSender_private_offset = g_type_add_instance_private (dino_jingle_file_sender_type_id, sizeof (DinoJingleFileSenderPrivate));
	return dino_jingle_file_sender_type_id;
}

GType
dino_jingle_file_sender_get_type (void)
{
	static volatile gsize dino_jingle_file_sender_type_id__once = 0;
	if (g_once_init_enter (&dino_jingle_file_sender_type_id__once)) {
		GType dino_jingle_file_sender_type_id;
		dino_jingle_file_sender_type_id = dino_jingle_file_sender_get_type_once ();
		g_once_init_leave (&dino_jingle_file_sender_type_id__once, dino_jingle_file_sender_type_id);
	}
	return dino_jingle_file_sender_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;
}

