/* imap-engine-list-email-by-sparse-id.c generated by valac 0.56.3, the Vala compiler
 * generated from imap-engine-list-email-by-sparse-id.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "geary-engine.h"
#include <gee.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#define GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION (geary_imap_engine_replay_operation_get_type ())
#define GEARY_IMAP_ENGINE_REPLAY_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperation))
#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperationClass))
#define GEARY_IMAP_ENGINE_IS_REPLAY_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION))
#define GEARY_IMAP_ENGINE_IS_REPLAY_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION))
#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperationClass))

typedef struct _GearyImapEngineReplayOperation GearyImapEngineReplayOperation;
typedef struct _GearyImapEngineReplayOperationClass GearyImapEngineReplayOperationClass;
typedef struct _GearyImapEngineReplayOperationPrivate GearyImapEngineReplayOperationPrivate;

#define GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER (geary_imap_db_email_identifier_get_type ())
#define GEARY_IMAP_DB_EMAIL_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifier))
#define GEARY_IMAP_DB_EMAIL_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifierClass))
#define GEARY_IMAP_DB_IS_EMAIL_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER))
#define GEARY_IMAP_DB_IS_EMAIL_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER))
#define GEARY_IMAP_DB_EMAIL_IDENTIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifierClass))

typedef struct _GearyImapDBEmailIdentifier GearyImapDBEmailIdentifier;
typedef struct _GearyImapDBEmailIdentifierClass GearyImapDBEmailIdentifierClass;
typedef enum  {
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_COMPLETED,
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_CONTINUE
} GearyImapEngineReplayOperationStatus;

#define GEARY_IMAP_ENGINE_REPLAY_OPERATION_TYPE_STATUS (geary_imap_engine_replay_operation_status_get_type ())

#define GEARY_IMAP_TYPE_FOLDER_SESSION (geary_imap_folder_session_get_type ())
#define GEARY_IMAP_FOLDER_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_TYPE_FOLDER_SESSION, GearyImapFolderSession))
#define GEARY_IMAP_FOLDER_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_TYPE_FOLDER_SESSION, GearyImapFolderSessionClass))
#define GEARY_IMAP_IS_FOLDER_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_TYPE_FOLDER_SESSION))
#define GEARY_IMAP_IS_FOLDER_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_TYPE_FOLDER_SESSION))
#define GEARY_IMAP_FOLDER_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_TYPE_FOLDER_SESSION, GearyImapFolderSessionClass))

typedef struct _GearyImapFolderSession GearyImapFolderSession;
typedef struct _GearyImapFolderSessionClass GearyImapFolderSessionClass;

#define GEARY_IMAP_ENGINE_TYPE_SEND_REPLAY_OPERATION (geary_imap_engine_send_replay_operation_get_type ())
#define GEARY_IMAP_ENGINE_SEND_REPLAY_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_SEND_REPLAY_OPERATION, GearyImapEngineSendReplayOperation))
#define GEARY_IMAP_ENGINE_SEND_REPLAY_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_SEND_REPLAY_OPERATION, GearyImapEngineSendReplayOperationClass))
#define GEARY_IMAP_ENGINE_IS_SEND_REPLAY_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_SEND_REPLAY_OPERATION))
#define GEARY_IMAP_ENGINE_IS_SEND_REPLAY_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_SEND_REPLAY_OPERATION))
#define GEARY_IMAP_ENGINE_SEND_REPLAY_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_SEND_REPLAY_OPERATION, GearyImapEngineSendReplayOperationClass))

typedef struct _GearyImapEngineSendReplayOperation GearyImapEngineSendReplayOperation;
typedef struct _GearyImapEngineSendReplayOperationClass GearyImapEngineSendReplayOperationClass;
typedef struct _GearyImapEngineSendReplayOperationPrivate GearyImapEngineSendReplayOperationPrivate;

#define GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL (geary_imap_engine_abstract_list_email_get_type ())
#define GEARY_IMAP_ENGINE_ABSTRACT_LIST_EMAIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail))
#define GEARY_IMAP_ENGINE_ABSTRACT_LIST_EMAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmailClass))
#define GEARY_IMAP_ENGINE_IS_ABSTRACT_LIST_EMAIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL))
#define GEARY_IMAP_ENGINE_IS_ABSTRACT_LIST_EMAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL))
#define GEARY_IMAP_ENGINE_ABSTRACT_LIST_EMAIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmailClass))

typedef struct _GearyImapEngineAbstractListEmail GearyImapEngineAbstractListEmail;
typedef struct _GearyImapEngineAbstractListEmailClass GearyImapEngineAbstractListEmailClass;
typedef struct _GearyImapEngineAbstractListEmailPrivate GearyImapEngineAbstractListEmailPrivate;

#define GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER (geary_imap_engine_minimal_folder_get_type ())
#define GEARY_IMAP_ENGINE_MINIMAL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolder))
#define GEARY_IMAP_ENGINE_MINIMAL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolderClass))
#define GEARY_IMAP_ENGINE_IS_MINIMAL_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER))
#define GEARY_IMAP_ENGINE_IS_MINIMAL_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER))
#define GEARY_IMAP_ENGINE_MINIMAL_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_MINIMAL_FOLDER, GearyImapEngineMinimalFolderClass))

typedef struct _GearyImapEngineMinimalFolder GearyImapEngineMinimalFolder;
typedef struct _GearyImapEngineMinimalFolderClass GearyImapEngineMinimalFolderClass;

#define GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID (geary_imap_engine_list_email_by_sparse_id_get_type ())
#define GEARY_IMAP_ENGINE_LIST_EMAIL_BY_SPARSE_ID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseID))
#define GEARY_IMAP_ENGINE_LIST_EMAIL_BY_SPARSE_ID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseIDClass))
#define GEARY_IMAP_ENGINE_IS_LIST_EMAIL_BY_SPARSE_ID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID))
#define GEARY_IMAP_ENGINE_IS_LIST_EMAIL_BY_SPARSE_ID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID))
#define GEARY_IMAP_ENGINE_LIST_EMAIL_BY_SPARSE_ID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseIDClass))

typedef struct _GearyImapEngineListEmailBySparseID GearyImapEngineListEmailBySparseID;
typedef struct _GearyImapEngineListEmailBySparseIDClass GearyImapEngineListEmailBySparseIDClass;
typedef struct _GearyImapEngineListEmailBySparseIDPrivate GearyImapEngineListEmailBySparseIDPrivate;
enum  {
	GEARY_IMAP_ENGINE_LIST_EMAIL_BY_SPARSE_ID_0_PROPERTY,
	GEARY_IMAP_ENGINE_LIST_EMAIL_BY_SPARSE_ID_NUM_PROPERTIES
};
static GParamSpec* geary_imap_engine_list_email_by_sparse_id_properties[GEARY_IMAP_ENGINE_LIST_EMAIL_BY_SPARSE_ID_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GEARY_IMAP_DB_TYPE_FOLDER (geary_imap_db_folder_get_type ())
#define GEARY_IMAP_DB_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEARY_IMAP_DB_TYPE_FOLDER, GearyImapDBFolder))
#define GEARY_IMAP_DB_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEARY_IMAP_DB_TYPE_FOLDER, GearyImapDBFolderClass))
#define GEARY_IMAP_DB_IS_FOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEARY_IMAP_DB_TYPE_FOLDER))
#define GEARY_IMAP_DB_IS_FOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEARY_IMAP_DB_TYPE_FOLDER))
#define GEARY_IMAP_DB_FOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEARY_IMAP_DB_TYPE_FOLDER, GearyImapDBFolderClass))

typedef struct _GearyImapDBFolder GearyImapDBFolder;
typedef struct _GearyImapDBFolderClass GearyImapDBFolderClass;
typedef enum  {
	GEARY_IMAP_DB_FOLDER_LIST_FLAGS_NONE = 0,
	GEARY_IMAP_DB_FOLDER_LIST_FLAGS_PARTIAL_OK = 1 << 0,
	GEARY_IMAP_DB_FOLDER_LIST_FLAGS_INCLUDE_MARKED_FOR_REMOVE = 1 << 1,
	GEARY_IMAP_DB_FOLDER_LIST_FLAGS_INCLUDING_ID = 1 << 2,
	GEARY_IMAP_DB_FOLDER_LIST_FLAGS_OLDEST_TO_NEWEST = 1 << 3,
	GEARY_IMAP_DB_FOLDER_LIST_FLAGS_ONLY_INCOMPLETE = 1 << 4
} GearyImapDBFolderListFlags;

#define GEARY_IMAP_DB_FOLDER_TYPE_LIST_FLAGS (geary_imap_db_folder_list_flags_get_type ())
typedef struct _GearyImapEngineListEmailBySparseIdReplayLocalAsyncData GearyImapEngineListEmailBySparseIdReplayLocalAsyncData;
typedef struct _GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GearyImapEngineReplayOperation {
	GearyBaseObject parent_instance;
	GearyImapEngineReplayOperationPrivate * priv;
};

struct _GearyImapEngineReplayOperationClass {
	GearyBaseObjectClass parent_class;
	void (*notify_remote_removed_position) (GearyImapEngineReplayOperation* self, GearyImapSequenceNumber* removed);
	void (*notify_remote_removed_ids) (GearyImapEngineReplayOperation* self, GeeCollection* ids);
	void (*get_ids_to_be_remote_removed) (GearyImapEngineReplayOperation* self, GeeCollection* ids);
	void (*replay_local_async) (GearyImapEngineReplayOperation* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GearyImapEngineReplayOperationStatus (*replay_local_finish) (GearyImapEngineReplayOperation* self, GAsyncResult* _res_, GError** error);
	void (*replay_remote_async) (GearyImapEngineReplayOperation* self, GearyImapFolderSession* remote, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*replay_remote_finish) (GearyImapEngineReplayOperation* self, GAsyncResult* _res_, GError** error);
	void (*backout_local_async) (GearyImapEngineReplayOperation* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*backout_local_finish) (GearyImapEngineReplayOperation* self, GAsyncResult* _res_, GError** error);
	gchar* (*describe_state) (GearyImapEngineReplayOperation* self);
};

struct _GearyImapEngineSendReplayOperation {
	GearyImapEngineReplayOperation parent_instance;
	GearyImapEngineSendReplayOperationPrivate * priv;
};

struct _GearyImapEngineSendReplayOperationClass {
	GearyImapEngineReplayOperationClass parent_class;
};

struct _GearyImapEngineAbstractListEmail {
	GearyImapEngineSendReplayOperation parent_instance;
	GeeList* accumulator;
	GearyImapEngineMinimalFolder* owner;
	GearyEmailField required_fields;
	GCancellable* cancellable;
	GearyFolderListFlags flags;
	GearyImapEngineAbstractListEmailPrivate * priv;
};

struct _GearyImapEngineAbstractListEmailClass {
	GearyImapEngineSendReplayOperationClass parent_class;
};

struct _GearyImapEngineListEmailBySparseID {
	GearyImapEngineAbstractListEmail parent_instance;
	GearyImapEngineListEmailBySparseIDPrivate * priv;
};

struct _GearyImapEngineListEmailBySparseIDClass {
	GearyImapEngineAbstractListEmailClass parent_class;
};

struct _GearyImapEngineListEmailBySparseIDPrivate {
	GeeHashSet* ids;
};

struct _GearyImapEngineListEmailBySparseIdReplayLocalAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GearyImapEngineListEmailBySparseID* self;
	GearyImapEngineReplayOperationStatus result;
	GeeSet* uids;
	GearyImapEngineMinimalFolder* _tmp0_;
	GearyImapDBFolder* _tmp1_;
	GearyImapDBFolder* _tmp2_;
	GeeHashSet* _tmp3_;
	GCancellable* _tmp4_;
	GeeSet* _tmp5_;
	GeeSet* _tmp6_;
	GeeList* local_list;
	GearyImapEngineMinimalFolder* _tmp7_;
	GearyImapDBFolder* _tmp8_;
	GearyImapDBFolder* _tmp9_;
	GeeHashSet* _tmp10_;
	GCancellable* _tmp11_;
	GeeList* _tmp12_;
	GeeList* fulfilled;
	GeeArrayList* _tmp13_;
	gboolean _tmp14_;
	GeeList* _tmp15_;
	GeeList* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	GeeMap* map;
	GeeList* _tmp19_;
	GeeMap* _tmp20_;
	GeeMap* _tmp21_;
	GeeIterator* _id_it;
	GeeHashSet* _tmp22_;
	GeeIterator* _tmp23_;
	GeeIterator* _tmp24_;
	GearyImapDBEmailIdentifier* id;
	GeeIterator* _tmp25_;
	gpointer _tmp26_;
	GearyEmail* email;
	GeeMap* _tmp27_;
	GearyImapDBEmailIdentifier* _tmp28_;
	gpointer _tmp29_;
	GearyEmail* _tmp30_;
	GearyEmail* _tmp31_;
	GearyEmailField _tmp32_;
	GearyEmailField _tmp33_;
	GearyEmail* _tmp34_;
	GearyEmailIdentifier* _tmp35_;
	GearyEmailIdentifier* _tmp36_;
	GearyImapUID* _tmp37_;
	GearyImapUID* _tmp38_;
	GearyEmail* _tmp39_;
	GearyEmailField _tmp40_;
	GearyEmailField _tmp41_;
	GeeList* _tmp42_;
	GearyEmail* _tmp43_;
	GeeList* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	GeeList* _tmp47_;
	GeeList* _tmp48_;
	gboolean _tmp49_;
	GError* _inner_error0_;
};

struct _GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GearyImapEngineListEmailBySparseID* self;
};

static gint GearyImapEngineListEmailBySparseID_private_offset;
static gpointer geary_imap_engine_list_email_by_sparse_id_parent_class = NULL;

VALA_EXTERN GType geary_imap_engine_replay_operation_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_db_email_identifier_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_replay_operation_status_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_folder_session_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_send_replay_operation_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_abstract_list_email_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_minimal_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType geary_imap_engine_list_email_by_sparse_id_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void geary_imap_engine_replay_operation_notify_remote_removed_ids (GearyImapEngineReplayOperation* self,
                                                                   GeeCollection* ids);
VALA_EXTERN void geary_imap_engine_replay_operation_replay_local_async (GearyImapEngineReplayOperation* self,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
VALA_EXTERN GearyImapEngineReplayOperationStatus geary_imap_engine_replay_operation_replay_local_finish (GearyImapEngineReplayOperation* self,
                                                                                             GAsyncResult* _res_,
                                                                                             GError** error);
VALA_EXTERN void geary_imap_engine_replay_operation_backout_local_async (GearyImapEngineReplayOperation* self,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
VALA_EXTERN void geary_imap_engine_replay_operation_backout_local_finish (GearyImapEngineReplayOperation* self,
                                                              GAsyncResult* _res_,
                                                              GError** error);
VALA_EXTERN gchar* geary_imap_engine_replay_operation_describe_state (GearyImapEngineReplayOperation* self);
VALA_EXTERN GearyImapEngineListEmailBySparseID* geary_imap_engine_list_email_by_sparse_id_new (GearyImapEngineMinimalFolder* owner,
                                                                                   GeeCollection* ids,
                                                                                   GearyEmailField required_fields,
                                                                                   GearyFolderListFlags flags,
                                                                                   GCancellable* cancellable);
VALA_EXTERN GearyImapEngineListEmailBySparseID* geary_imap_engine_list_email_by_sparse_id_construct (GType object_type,
                                                                                         GearyImapEngineMinimalFolder* owner,
                                                                                         GeeCollection* ids,
                                                                                         GearyEmailField required_fields,
                                                                                         GearyFolderListFlags flags,
                                                                                         GCancellable* cancellable);
VALA_EXTERN GearyImapEngineAbstractListEmail* geary_imap_engine_abstract_list_email_construct (GType object_type,
                                                                                   const gchar* name,
                                                                                   GearyImapEngineMinimalFolder* owner,
                                                                                   GearyEmailField required_fields,
                                                                                   GearyFolderListFlags flags,
                                                                                   GCancellable* cancellable);
static void geary_imap_engine_list_email_by_sparse_id_real_notify_remote_removed_ids (GearyImapEngineReplayOperation* base,
                                                                               GeeCollection* removed_ids);
static void geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_data_free (gpointer _data);
static void geary_imap_engine_list_email_by_sparse_id_real_replay_local_async (GearyImapEngineReplayOperation* base,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static gboolean geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_co (GearyImapEngineListEmailBySparseIdReplayLocalAsyncData* _data_);
VALA_EXTERN GType geary_imap_db_folder_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GearyImapDBFolder* geary_imap_engine_minimal_folder_get_local_folder (GearyImapEngineMinimalFolder* self);
VALA_EXTERN GType geary_imap_db_folder_list_flags_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void geary_imap_db_folder_get_uids_async (GearyImapDBFolder* self,
                                          GeeCollection* ids,
                                          GearyImapDBFolderListFlags flags,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN GeeSet* geary_imap_db_folder_get_uids_finish (GearyImapDBFolder* self,
                                              GAsyncResult* _res_,
                                              GError** error);
static void geary_imap_engine_list_email_by_sparse_id_replay_local_async_ready (GObject* source_object,
                                                                         GAsyncResult* _res_,
                                                                         gpointer _user_data_);
VALA_EXTERN void geary_imap_engine_abstract_list_email_add_many_unfulfilled_fields (GearyImapEngineAbstractListEmail* self,
                                                                        GeeCollection* uids,
                                                                        GearyEmailField unfulfilled_fields);
VALA_EXTERN void geary_imap_db_folder_list_email_by_sparse_id_async (GearyImapDBFolder* self,
                                                         GeeCollection* ids,
                                                         GearyEmailField required_fields,
                                                         GearyImapDBFolderListFlags flags,
                                                         GCancellable* cancellable,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
VALA_EXTERN GeeList* geary_imap_db_folder_list_email_by_sparse_id_finish (GearyImapDBFolder* self,
                                                              GAsyncResult* _res_,
                                                              GError** error);
VALA_EXTERN void geary_imap_engine_abstract_list_email_add_unfulfilled_fields (GearyImapEngineAbstractListEmail* self,
                                                                   GearyImapUID* uid,
                                                                   GearyEmailField unfulfilled_fields);
VALA_EXTERN GearyImapUID* geary_imap_db_email_identifier_get_uid (GearyImapDBEmailIdentifier* self);
VALA_EXTERN gint geary_imap_engine_abstract_list_email_get_unfulfilled_count (GearyImapEngineAbstractListEmail* self);
static void geary_imap_engine_list_email_by_sparse_id_real_backout_local_async_data_free (gpointer _data);
static void geary_imap_engine_list_email_by_sparse_id_real_backout_local_async (GearyImapEngineReplayOperation* base,
                                                                         GAsyncReadyCallback _callback_,
                                                                         gpointer _user_data_);
static gboolean geary_imap_engine_list_email_by_sparse_id_real_backout_local_async_co (GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData* _data_);
static gchar* geary_imap_engine_list_email_by_sparse_id_real_describe_state (GearyImapEngineReplayOperation* base);
static void geary_imap_engine_list_email_by_sparse_id_finalize (GObject * obj);
static GType geary_imap_engine_list_email_by_sparse_id_get_type_once (void);

static inline gpointer
geary_imap_engine_list_email_by_sparse_id_get_instance_private (GearyImapEngineListEmailBySparseID* self)
{
	return G_STRUCT_MEMBER_P (self, GearyImapEngineListEmailBySparseID_private_offset);
}

GearyImapEngineListEmailBySparseID*
geary_imap_engine_list_email_by_sparse_id_construct (GType object_type,
                                                     GearyImapEngineMinimalFolder* owner,
                                                     GeeCollection* ids,
                                                     GearyEmailField required_fields,
                                                     GearyFolderListFlags flags,
                                                     GCancellable* cancellable)
{
	GearyImapEngineListEmailBySparseID * self = NULL;
	GeeHashSet* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_ENGINE_IS_MINIMAL_FOLDER (owner), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (ids, GEE_TYPE_COLLECTION), NULL);
	g_return_val_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()), NULL);
	self = (GearyImapEngineListEmailBySparseID*) geary_imap_engine_abstract_list_email_construct (object_type, "ListEmailBySparseID", owner, required_fields, flags, cancellable);
	_tmp0_ = self->priv->ids;
	gee_collection_add_all (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_COLLECTION, GeeCollection), ids);
	return self;
}

GearyImapEngineListEmailBySparseID*
geary_imap_engine_list_email_by_sparse_id_new (GearyImapEngineMinimalFolder* owner,
                                               GeeCollection* ids,
                                               GearyEmailField required_fields,
                                               GearyFolderListFlags flags,
                                               GCancellable* cancellable)
{
	return geary_imap_engine_list_email_by_sparse_id_construct (GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, owner, ids, required_fields, flags, cancellable);
}

static void
geary_imap_engine_list_email_by_sparse_id_real_notify_remote_removed_ids (GearyImapEngineReplayOperation* base,
                                                                          GeeCollection* removed_ids)
{
	GearyImapEngineListEmailBySparseID * self;
	GeeHashSet* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseID);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (removed_ids, GEE_TYPE_COLLECTION));
	_tmp0_ = self->priv->ids;
	gee_collection_remove_all (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_COLLECTION, GeeCollection), removed_ids);
	GEARY_IMAP_ENGINE_REPLAY_OPERATION_CLASS (geary_imap_engine_list_email_by_sparse_id_parent_class)->notify_remote_removed_ids (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail), GEARY_IMAP_ENGINE_TYPE_REPLAY_OPERATION, GearyImapEngineReplayOperation), removed_ids);
}

static void
geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_data_free (gpointer _data)
{
	GearyImapEngineListEmailBySparseIdReplayLocalAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GearyImapEngineListEmailBySparseIdReplayLocalAsyncData, _data_);
}

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

static void
geary_imap_engine_list_email_by_sparse_id_real_replay_local_async (GearyImapEngineReplayOperation* base,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	GearyImapEngineListEmailBySparseID * self;
	GearyImapEngineListEmailBySparseIdReplayLocalAsyncData* _data_;
	GearyImapEngineListEmailBySparseID* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseID);
	_data_ = g_slice_new0 (GearyImapEngineListEmailBySparseIdReplayLocalAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_co (_data_);
}

static GearyImapEngineReplayOperationStatus
geary_imap_engine_list_email_by_sparse_id_replay_local_finish (GearyImapEngineReplayOperation* base,
                                                               GAsyncResult* _res_,
                                                               GError** error)
{
	GearyImapEngineReplayOperationStatus result;
	GearyImapEngineListEmailBySparseIdReplayLocalAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return 0;
	}
	result = _data_->result;
	return result;
}

static void
geary_imap_engine_list_email_by_sparse_id_replay_local_async_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_)
{
	GearyImapEngineListEmailBySparseIdReplayLocalAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_co (_data_);
}

static gboolean
geary_imap_engine_list_email_by_sparse_id_real_replay_local_async_co (GearyImapEngineListEmailBySparseIdReplayLocalAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (geary_folder_list_flags_is_force_update (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->flags)) {
		_data_->_tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->owner;
		_data_->_tmp1_ = geary_imap_engine_minimal_folder_get_local_folder (_data_->_tmp0_);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = _data_->self->priv->ids;
		_data_->_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->cancellable;
		_data_->_state_ = 1;
		geary_imap_db_folder_get_uids_async (_data_->_tmp2_, G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, GEE_TYPE_COLLECTION, GeeCollection), GEARY_IMAP_DB_FOLDER_LIST_FLAGS_NONE, _data_->_tmp4_, geary_imap_engine_list_email_by_sparse_id_replay_local_async_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = geary_imap_db_folder_get_uids_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		_data_->uids = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp6_ = _data_->uids;
		geary_imap_engine_abstract_list_email_add_many_unfulfilled_fields (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail), G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp6_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->required_fields);
		_data_->result = GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_CONTINUE;
		_g_object_unref0 (_data_->uids);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp7_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->owner;
	_data_->_tmp8_ = geary_imap_engine_minimal_folder_get_local_folder (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->self->priv->ids;
	_data_->_tmp11_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->cancellable;
	_data_->_state_ = 2;
	geary_imap_db_folder_list_email_by_sparse_id_async (_data_->_tmp9_, G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp10_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->required_fields, GEARY_IMAP_DB_FOLDER_LIST_FLAGS_PARTIAL_OK, _data_->_tmp11_, geary_imap_engine_list_email_by_sparse_id_replay_local_async_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp12_ = geary_imap_db_folder_list_email_by_sparse_id_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
	_data_->local_list = _data_->_tmp12_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp13_ = gee_array_list_new (GEARY_TYPE_EMAIL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->fulfilled = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp13_, GEE_TYPE_LIST, GeeList);
	_data_->_tmp15_ = _data_->local_list;
	if (_data_->_tmp15_ != NULL) {
		_data_->_tmp16_ = _data_->local_list;
		_data_->_tmp17_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp16_, GEE_TYPE_COLLECTION, GeeCollection));
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp14_ = _data_->_tmp18_ > 0;
	} else {
		_data_->_tmp14_ = FALSE;
	}
	if (_data_->_tmp14_) {
		_data_->_tmp19_ = _data_->local_list;
		_data_->_tmp20_ = geary_email_emails_to_map (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp19_, GEE_TYPE_COLLECTION, GeeCollection));
		_data_->map = _data_->_tmp20_;
		_data_->_tmp21_ = _data_->map;
		_vala_assert (_data_->_tmp21_ != NULL, "map != null");
		{
			_data_->_tmp22_ = _data_->self->priv->ids;
			_data_->_tmp23_ = gee_abstract_collection_iterator (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp22_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
			_data_->_id_it = _data_->_tmp23_;
			while (TRUE) {
				_data_->_tmp24_ = _data_->_id_it;
				if (!gee_iterator_next (_data_->_tmp24_)) {
					break;
				}
				_data_->_tmp25_ = _data_->_id_it;
				_data_->_tmp26_ = gee_iterator_get (_data_->_tmp25_);
				_data_->id = (GearyImapDBEmailIdentifier*) _data_->_tmp26_;
				_data_->_tmp27_ = _data_->map;
				_data_->_tmp28_ = _data_->id;
				_data_->_tmp29_ = gee_map_get (_data_->_tmp27_, G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp28_, GEARY_TYPE_EMAIL_IDENTIFIER, GearyEmailIdentifier));
				_data_->email = (GearyEmail*) _data_->_tmp29_;
				_data_->_tmp30_ = _data_->email;
				if (_data_->_tmp30_ == NULL) {
					_g_object_unref0 (_data_->email);
					_g_object_unref0 (_data_->id);
					continue;
				}
				_data_->_tmp31_ = _data_->email;
				_data_->_tmp32_ = geary_email_get_fields (_data_->_tmp31_);
				_data_->_tmp33_ = _data_->_tmp32_;
				if (!geary_email_field_fulfills (_data_->_tmp33_, G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->required_fields)) {
					_data_->_tmp34_ = _data_->email;
					_data_->_tmp35_ = geary_email_get_id (_data_->_tmp34_);
					_data_->_tmp36_ = _data_->_tmp35_;
					_data_->_tmp37_ = geary_imap_db_email_identifier_get_uid (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp36_, GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, GearyImapDBEmailIdentifier));
					_data_->_tmp38_ = _data_->_tmp37_;
					_data_->_tmp39_ = _data_->email;
					_data_->_tmp40_ = geary_email_get_fields (_data_->_tmp39_);
					_data_->_tmp41_ = _data_->_tmp40_;
					geary_imap_engine_abstract_list_email_add_unfulfilled_fields (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail), _data_->_tmp38_, geary_email_field_clear (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->required_fields, _data_->_tmp41_));
				} else {
					_data_->_tmp42_ = _data_->fulfilled;
					_data_->_tmp43_ = _data_->email;
					gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp42_, GEE_TYPE_COLLECTION, GeeCollection), _data_->_tmp43_);
				}
				_g_object_unref0 (_data_->email);
				_g_object_unref0 (_data_->id);
			}
			_g_object_unref0 (_data_->_id_it);
		}
		_g_object_unref0 (_data_->map);
	}
	_data_->_tmp44_ = _data_->fulfilled;
	_data_->_tmp45_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp44_, GEE_TYPE_COLLECTION, GeeCollection));
	_data_->_tmp46_ = _data_->_tmp45_;
	if (_data_->_tmp46_ > 0) {
		_data_->_tmp47_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->accumulator;
		_data_->_tmp48_ = _data_->fulfilled;
		gee_collection_add_all (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp47_, GEE_TYPE_COLLECTION, GeeCollection), G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp48_, GEE_TYPE_COLLECTION, GeeCollection));
	}
	if (geary_folder_list_flags_is_local_only (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->flags)) {
		_data_->_tmp49_ = TRUE;
	} else {
		_data_->_tmp49_ = geary_imap_engine_abstract_list_email_get_unfulfilled_count (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)) == 0;
	}
	if (_data_->_tmp49_) {
		_data_->result = GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_COMPLETED;
		_g_object_unref0 (_data_->fulfilled);
		_g_object_unref0 (_data_->local_list);
		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 = GEARY_IMAP_ENGINE_REPLAY_OPERATION_STATUS_CONTINUE;
	_g_object_unref0 (_data_->fulfilled);
	_g_object_unref0 (_data_->local_list);
	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
geary_imap_engine_list_email_by_sparse_id_real_backout_local_async_data_free (gpointer _data)
{
	GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData, _data_);
}

static void
geary_imap_engine_list_email_by_sparse_id_real_backout_local_async (GearyImapEngineReplayOperation* base,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_)
{
	GearyImapEngineListEmailBySparseID * self;
	GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData* _data_;
	GearyImapEngineListEmailBySparseID* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseID);
	_data_ = g_slice_new0 (GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, geary_imap_engine_list_email_by_sparse_id_real_backout_local_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	geary_imap_engine_list_email_by_sparse_id_real_backout_local_async_co (_data_);
}

static void
geary_imap_engine_list_email_by_sparse_id_backout_local_finish (GearyImapEngineReplayOperation* base,
                                                                GAsyncResult* _res_,
                                                                GError** error)
{
	GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
geary_imap_engine_list_email_by_sparse_id_real_backout_local_async_co (GearyImapEngineListEmailBySparseIdBackoutLocalAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	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*
geary_imap_engine_list_email_by_sparse_id_real_describe_state (GearyImapEngineReplayOperation* base)
{
	GearyImapEngineListEmailBySparseID * self;
	GeeHashSet* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseID);
	_tmp0_ = self->priv->ids;
	_tmp1_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf ("ids.size=%d required_fields=%Xh flags=%Xh", _tmp2_, (guint) G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->required_fields, (guint) G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, GearyImapEngineAbstractListEmail)->flags);
	result = _tmp3_;
	return result;
}

static void
geary_imap_engine_list_email_by_sparse_id_class_init (GearyImapEngineListEmailBySparseIDClass * klass,
                                                      gpointer klass_data)
{
	geary_imap_engine_list_email_by_sparse_id_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GearyImapEngineListEmailBySparseID_private_offset);
	((GearyImapEngineReplayOperationClass *) klass)->notify_remote_removed_ids = (void (*) (GearyImapEngineReplayOperation*, GeeCollection*)) geary_imap_engine_list_email_by_sparse_id_real_notify_remote_removed_ids;
	((GearyImapEngineReplayOperationClass *) klass)->replay_local_async = (void (*) (GearyImapEngineReplayOperation*, GAsyncReadyCallback, gpointer)) geary_imap_engine_list_email_by_sparse_id_real_replay_local_async;
	((GearyImapEngineReplayOperationClass *) klass)->replay_local_finish = (GearyImapEngineReplayOperationStatus (*) (GearyImapEngineReplayOperation*, GAsyncResult*, GError**)) geary_imap_engine_list_email_by_sparse_id_replay_local_finish;
	((GearyImapEngineReplayOperationClass *) klass)->backout_local_async = (void (*) (GearyImapEngineReplayOperation*, GAsyncReadyCallback, gpointer)) geary_imap_engine_list_email_by_sparse_id_real_backout_local_async;
	((GearyImapEngineReplayOperationClass *) klass)->backout_local_finish = (void (*) (GearyImapEngineReplayOperation*, GAsyncResult*, GError**)) geary_imap_engine_list_email_by_sparse_id_backout_local_finish;
	((GearyImapEngineReplayOperationClass *) klass)->describe_state = (gchar* (*) (GearyImapEngineReplayOperation*)) geary_imap_engine_list_email_by_sparse_id_real_describe_state;
	G_OBJECT_CLASS (klass)->finalize = geary_imap_engine_list_email_by_sparse_id_finalize;
}

static void
geary_imap_engine_list_email_by_sparse_id_instance_init (GearyImapEngineListEmailBySparseID * self,
                                                         gpointer klass)
{
	GeeHashSet* _tmp0_;
	self->priv = geary_imap_engine_list_email_by_sparse_id_get_instance_private (self);
	_tmp0_ = gee_hash_set_new (GEARY_IMAP_DB_TYPE_EMAIL_IDENTIFIER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->ids = _tmp0_;
}

static void
geary_imap_engine_list_email_by_sparse_id_finalize (GObject * obj)
{
	GearyImapEngineListEmailBySparseID * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEARY_IMAP_ENGINE_TYPE_LIST_EMAIL_BY_SPARSE_ID, GearyImapEngineListEmailBySparseID);
	_g_object_unref0 (self->priv->ids);
	G_OBJECT_CLASS (geary_imap_engine_list_email_by_sparse_id_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
geary_imap_engine_list_email_by_sparse_id_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapEngineListEmailBySparseIDClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_engine_list_email_by_sparse_id_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapEngineListEmailBySparseID), 0, (GInstanceInitFunc) geary_imap_engine_list_email_by_sparse_id_instance_init, NULL };
	GType geary_imap_engine_list_email_by_sparse_id_type_id;
	geary_imap_engine_list_email_by_sparse_id_type_id = g_type_register_static (GEARY_IMAP_ENGINE_TYPE_ABSTRACT_LIST_EMAIL, "GearyImapEngineListEmailBySparseID", &g_define_type_info, 0);
	GearyImapEngineListEmailBySparseID_private_offset = g_type_add_instance_private (geary_imap_engine_list_email_by_sparse_id_type_id, sizeof (GearyImapEngineListEmailBySparseIDPrivate));
	return geary_imap_engine_list_email_by_sparse_id_type_id;
}

GType
geary_imap_engine_list_email_by_sparse_id_get_type (void)
{
	static gsize geary_imap_engine_list_email_by_sparse_id_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_engine_list_email_by_sparse_id_type_id__once)) {
		GType geary_imap_engine_list_email_by_sparse_id_type_id;
		geary_imap_engine_list_email_by_sparse_id_type_id = geary_imap_engine_list_email_by_sparse_id_get_type_once ();
		g_once_init_leave (&geary_imap_engine_list_email_by_sparse_id_type_id__once, geary_imap_engine_list_email_by_sparse_id_type_id);
	}
	return geary_imap_engine_list_email_by_sparse_id_type_id__once;
}

