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

/*
 * Copyright © 2025 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <glib-object.h>
#include <libsoup/soup.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <gee.h>
#include <gxml/gxml.h>
#include <glib/gi18n-lib.h>
#include <libical-glib/libical-glib.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  {
	SERVICES_CAL_DAV_CAL_DAV_CLIENT_0_PROPERTY,
	SERVICES_CAL_DAV_CAL_DAV_CLIENT_NUM_PROPERTIES
};
static GParamSpec* services_cal_dav_cal_dav_client_properties[SERVICES_CAL_DAV_CAL_DAV_CLIENT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ServicesCalDavCalDavClientGetPrincipalUrlData ServicesCalDavCalDavClientGetPrincipalUrlData;
typedef struct _ServicesCalDavCalDavClientGetCalendarHomeData ServicesCalDavCalDavClientGetCalendarHomeData;
typedef struct _ServicesCalDavCalDavClientUpdateUserdataData ServicesCalDavCalDavClientUpdateUserdataData;
typedef struct _ServicesCalDavCalDavClientFetchProjectListData ServicesCalDavCalDavClientFetchProjectListData;
typedef struct _ServicesCalDavCalDavClientSyncData ServicesCalDavCalDavClientSyncData;
typedef struct _ServicesCalDavCalDavClientFetchProjectDetailsData ServicesCalDavCalDavClientFetchProjectDetailsData;
typedef struct _Block14Data Block14Data;
typedef struct _ServicesCalDavCalDavClientFetchItemsForProjectData ServicesCalDavCalDavClientFetchItemsForProjectData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ServicesCalDavCalDavClientSyncTasklistData ServicesCalDavCalDavClientSyncTasklistData;
typedef struct _ServicesCalDavCalDavClientEtagSyncProjectData ServicesCalDavCalDavClientEtagSyncProjectData;
typedef struct _ServicesCalDavCalDavClientGetVtodoByUrlData ServicesCalDavCalDavClientGetVtodoByUrlData;
typedef struct _ServicesCalDavCalDavClientUpdateSyncTokenData ServicesCalDavCalDavClientUpdateSyncTokenData;
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
typedef struct _ServicesCalDavCalDavClientCreateProjectData ServicesCalDavCalDavClientCreateProjectData;
typedef struct _ServicesCalDavCalDavClientUpdateProjectData ServicesCalDavCalDavClientUpdateProjectData;
typedef struct _ServicesCalDavCalDavClientDeleteProjectData ServicesCalDavCalDavClientDeleteProjectData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _ServicesCalDavCalDavClientAddItemData ServicesCalDavCalDavClientAddItemData;
typedef struct _ServicesCalDavCalDavClientCompleteItemData ServicesCalDavCalDavClientCompleteItemData;
typedef struct _ServicesCalDavCalDavClientMoveItemData ServicesCalDavCalDavClientMoveItemData;
typedef struct _ServicesCalDavCalDavClientMoveItemFallbackData ServicesCalDavCalDavClientMoveItemFallbackData;
typedef struct _ServicesCalDavCalDavClientDeleteItemData ServicesCalDavCalDavClientDeleteItemData;
typedef struct _ServicesCalDavCalDavClientAddSectionData ServicesCalDavCalDavClientAddSectionData;
typedef struct _ServicesCalDavCalDavClientDeleteSectionData ServicesCalDavCalDavClientDeleteSectionData;

struct _ServicesCalDavCalDavClientGetPrincipalUrlData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	GCancellable* cancellable;
	gchar* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	const gchar* _tmp3_;
	ServicesCalDAVWebDAVMultiStatus* _tmp4_;
	GeeArrayList* _response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp5_;
	GeeArrayList* _tmp6_;
	gint _response_size;
	GeeArrayList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint _response_index;
	gint _tmp10_;
	gint _tmp11_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp12_;
	gpointer _tmp13_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp14_;
	GeeArrayList* _tmp15_;
	gint _propstat_size;
	GeeArrayList* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _propstat_index;
	gint _tmp19_;
	gint _tmp20_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp21_;
	gpointer _tmp22_;
	GXmlDomHTMLCollection* _principal_list;
	ServicesCalDAVWebDAVPropStat* _tmp23_;
	GXmlDomElement* _tmp24_;
	GXmlDomElement* _tmp25_;
	GXmlDomHTMLCollection* _tmp26_;
	gint _principal_size;
	GXmlDomHTMLCollection* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	gint _principal_index;
	gint _tmp30_;
	gint _tmp31_;
	GXmlDomElement* principal;
	GXmlDomHTMLCollection* _tmp32_;
	gpointer _tmp33_;
	GXmlDomHTMLCollection* href_elements;
	GXmlDomElement* _tmp34_;
	GXmlDomHTMLCollection* _tmp35_;
	GXmlDomHTMLCollection* _href_list;
	GXmlDomHTMLCollection* _tmp36_;
	gint _href_size;
	GXmlDomHTMLCollection* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	gint _href_index;
	gint _tmp40_;
	gint _tmp41_;
	GXmlDomElement* href;
	GXmlDomHTMLCollection* _tmp42_;
	gpointer _tmp43_;
	gchar* link;
	GXmlDomElement* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientGetCalendarHomeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	gchar* principal_url;
	GCancellable* cancellable;
	gchar* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	const gchar* _tmp3_;
	ServicesCalDAVWebDAVMultiStatus* _tmp4_;
	GeeArrayList* _response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp5_;
	GeeArrayList* _tmp6_;
	gint _response_size;
	GeeArrayList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint _response_index;
	gint _tmp10_;
	gint _tmp11_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp12_;
	gpointer _tmp13_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp14_;
	GeeArrayList* _tmp15_;
	gint _propstat_size;
	GeeArrayList* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _propstat_index;
	gint _tmp19_;
	gint _tmp20_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp21_;
	gpointer _tmp22_;
	GXmlDomHTMLCollection* _calendar_home_list;
	ServicesCalDAVWebDAVPropStat* _tmp23_;
	GXmlDomElement* _tmp24_;
	GXmlDomElement* _tmp25_;
	GXmlDomHTMLCollection* _tmp26_;
	gint _calendar_home_size;
	GXmlDomHTMLCollection* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	gint _calendar_home_index;
	gint _tmp30_;
	gint _tmp31_;
	GXmlDomElement* calendar_home;
	GXmlDomHTMLCollection* _tmp32_;
	gpointer _tmp33_;
	GXmlDomHTMLCollection* href_elements;
	GXmlDomElement* _tmp34_;
	GXmlDomHTMLCollection* _tmp35_;
	GXmlDomHTMLCollection* _href_list;
	GXmlDomHTMLCollection* _tmp36_;
	gint _href_size;
	GXmlDomHTMLCollection* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	gint _href_index;
	gint _tmp40_;
	gint _tmp41_;
	GXmlDomElement* href;
	GXmlDomHTMLCollection* _tmp42_;
	gpointer _tmp43_;
	gchar* link;
	GXmlDomElement* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientUpdateUserdataData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	gchar* principal_url;
	ObjectsSource* source;
	GCancellable* cancellable;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	ServicesCalDAVWebDAVMultiStatus* _tmp3_;
	GeeArrayList* _response_list;
	GeeArrayList* _tmp4_;
	gint _response_size;
	GeeArrayList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _response_index;
	gint _tmp8_;
	gint _tmp9_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp10_;
	gpointer _tmp11_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp12_;
	GeeArrayList* _tmp13_;
	gint _propstat_size;
	GeeArrayList* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gint _propstat_index;
	gint _tmp17_;
	gint _tmp18_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp19_;
	gpointer _tmp20_;
	GXmlDomElement* prop;
	ServicesCalDAVWebDAVPropStat* _tmp21_;
	GXmlDomElement* _tmp22_;
	GXmlDomElement* _tmp23_;
	GXmlDomElement* _tmp24_;
	GXmlDomHTMLCollection* names;
	GXmlDomElement* _tmp25_;
	GXmlDomHTMLCollection* _tmp26_;
	GXmlDomHTMLCollection* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	ObjectsSourceCalDAVData* _tmp30_;
	ObjectsSourceCalDAVData* _tmp31_;
	GXmlDomHTMLCollection* _tmp32_;
	gpointer _tmp33_;
	GXmlDomElement* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	GXmlDomHTMLCollection* emails;
	GXmlDomElement* _tmp40_;
	GXmlDomHTMLCollection* _tmp41_;
	GXmlDomHTMLCollection* _tmp42_;
	gint _tmp43_;
	gint _tmp44_;
	ObjectsSourceCalDAVData* _tmp45_;
	ObjectsSourceCalDAVData* _tmp46_;
	GXmlDomHTMLCollection* _tmp47_;
	gpointer _tmp48_;
	GXmlDomElement* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	gboolean _tmp55_;
	ObjectsSourceCalDAVData* _tmp56_;
	ObjectsSourceCalDAVData* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	ObjectsSourceCalDAVData* _tmp60_;
	ObjectsSourceCalDAVData* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	ObjectsSourceCalDAVData* _tmp64_;
	ObjectsSourceCalDAVData* _tmp65_;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	gboolean _tmp68_;
	ObjectsSourceCalDAVData* _tmp69_;
	ObjectsSourceCalDAVData* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	ObjectsSourceCalDAVData* _tmp73_;
	ObjectsSourceCalDAVData* _tmp74_;
	const gchar* _tmp75_;
	const gchar* _tmp76_;
	ObjectsSourceCalDAVData* _tmp77_;
	ObjectsSourceCalDAVData* _tmp78_;
	const gchar* _tmp79_;
	const gchar* _tmp80_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientFetchProjectListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsSource* source;
	GCancellable* cancellable;
	GeeArrayList* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	ObjectsSourceCalDAVData* _tmp3_;
	ObjectsSourceCalDAVData* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	ServicesCalDAVWebDAVMultiStatus* _tmp7_;
	GeeArrayList* projects;
	GeeArrayList* _tmp8_;
	GeeArrayList* _response_list;
	GeeArrayList* _tmp9_;
	gint _response_size;
	GeeArrayList* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint _response_index;
	gint _tmp13_;
	gint _tmp14_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp15_;
	gpointer _tmp16_;
	gchar* href;
	ServicesCalDAVWebDAVResponse* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp21_;
	GeeArrayList* _tmp22_;
	gint _propstat_size;
	GeeArrayList* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	gint _propstat_index;
	gint _tmp26_;
	gint _tmp27_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp28_;
	gpointer _tmp29_;
	ServicesCalDAVWebDAVPropStat* _tmp30_;
	SoupStatus _tmp31_;
	SoupStatus _tmp32_;
	GXmlDomElement* resourcetype;
	ServicesCalDAVWebDAVPropStat* _tmp33_;
	GXmlDomElement* _tmp34_;
	GXmlDomElement* supported_calendar;
	ServicesCalDAVWebDAVPropStat* _tmp35_;
	GXmlDomElement* _tmp36_;
	GXmlDomElement* _tmp37_;
	GXmlDomElement* _tmp38_;
	ObjectsProject* project;
	ServicesCalDAVWebDAVPropStat* _tmp39_;
	const gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	ObjectsProject* _tmp43_;
	ObjectsProject* _tmp44_;
	ObjectsProject* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	GeeArrayList* _tmp48_;
	ObjectsProject* _tmp49_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientSyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsSource* source;
	GCancellable* cancellable;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	ObjectsSourceCalDAVData* _tmp3_;
	ObjectsSourceCalDAVData* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	ServicesCalDAVWebDAVMultiStatus* _tmp8_;
	GeeHashSet* server_urls;
	GeeHashSet* _tmp9_;
	GeeArrayList* _response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp10_;
	GeeArrayList* _tmp11_;
	gint _response_size;
	GeeArrayList* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gint _response_index;
	gint _tmp15_;
	gint _tmp16_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp17_;
	gpointer _tmp18_;
	ServicesCalDAVWebDAVResponse* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	GeeHashSet* _tmp22_;
	ServicesCalDAVWebDAVResponse* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GeeArrayList* local_projects;
	ServicesStore* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GeeArrayList* _tmp31_;
	GeeArrayList* _local_project_list;
	GeeArrayList* _tmp32_;
	gint _local_project_size;
	GeeArrayList* _tmp33_;
	gint _tmp34_;
	gint _tmp35_;
	gint _local_project_index;
	gint _tmp36_;
	gint _tmp37_;
	ObjectsProject* local_project;
	GeeArrayList* _tmp38_;
	gpointer _tmp39_;
	GeeHashSet* _tmp40_;
	ObjectsProject* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	ServicesStore* _tmp44_;
	ObjectsProject* _tmp45_;
	GeeArrayList* _vala1__response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp46_;
	GeeArrayList* _tmp47_;
	gint _vala1__response_size;
	GeeArrayList* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	gint _vala1__response_index;
	gint _tmp51_;
	gint _tmp52_;
	ServicesCalDAVWebDAVResponse* _vala1_response;
	GeeArrayList* _tmp53_;
	gpointer _tmp54_;
	gchar* href;
	ServicesCalDAVWebDAVResponse* _tmp55_;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	gchar* _tmp58_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp59_;
	GeeArrayList* _tmp60_;
	gint _propstat_size;
	GeeArrayList* _tmp61_;
	gint _tmp62_;
	gint _tmp63_;
	gint _propstat_index;
	gint _tmp64_;
	gint _tmp65_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp66_;
	gpointer _tmp67_;
	ServicesCalDAVWebDAVPropStat* _tmp68_;
	SoupStatus _tmp69_;
	SoupStatus _tmp70_;
	GXmlDomElement* resourcetype;
	ServicesCalDAVWebDAVPropStat* _tmp71_;
	GXmlDomElement* _tmp72_;
	GXmlDomElement* supported_calendar;
	ServicesCalDAVWebDAVPropStat* _tmp73_;
	GXmlDomElement* _tmp74_;
	GXmlDomElement* _tmp75_;
	ServicesLogService* _tmp76_;
	ServicesLogService* _tmp77_;
	ObjectsProject* project;
	ServicesStore* _tmp78_;
	const gchar* _tmp79_;
	gchar* _tmp80_;
	gchar* _tmp81_;
	ObjectsProject* _tmp82_;
	ObjectsProject* _tmp83_;
	ObjectsProject* _tmp84_;
	ServicesStore* _tmp85_;
	ObjectsProject* _tmp86_;
	GXmlDomElement* _tmp87_;
	GXmlDomElement* _tmp88_;
	GXmlDomElement* name;
	ServicesCalDAVWebDAVPropStat* _tmp89_;
	GXmlDomElement* _tmp90_;
	gboolean _tmp91_;
	const gchar* _tmp92_;
	GXmlDomElement* _tmp93_;
	ObjectsProject* _vala1_project;
	ServicesStore* _tmp94_;
	const gchar* _tmp95_;
	gchar* _tmp96_;
	gchar* _tmp97_;
	ObjectsProject* _tmp98_;
	ObjectsProject* _tmp99_;
	ObjectsProject* _tmp100_;
	ServicesLogService* _tmp101_;
	ServicesLogService* _tmp102_;
	ServicesCalDAVWebDAVPropStat* _tmp103_;
	const gchar* _tmp104_;
	gchar* _tmp105_;
	gchar* _tmp106_;
	ObjectsProject* _tmp107_;
	ObjectsProject* _tmp108_;
	const gchar* _tmp109_;
	const gchar* _tmp110_;
	ServicesStore* _tmp111_;
	ObjectsProject* _tmp112_;
	ObjectsProject* _tmp113_;
	ObjectsProject* _tmp114_;
	ServicesCalDAVWebDAVPropStat* _tmp115_;
	ServicesStore* _tmp116_;
	ObjectsProject* _tmp117_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientFetchProjectDetailsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	GCancellable* cancellable;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	ServicesCalDAVWebDAVMultiStatus* _tmp6_;
	GeeArrayList* _response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp7_;
	GeeArrayList* _tmp8_;
	gint _response_size;
	GeeArrayList* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint _response_index;
	gint _tmp12_;
	gint _tmp13_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp14_;
	gpointer _tmp15_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp16_;
	GeeArrayList* _tmp17_;
	gint _propstat_size;
	GeeArrayList* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	gint _propstat_index;
	gint _tmp21_;
	gint _tmp22_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp23_;
	gpointer _tmp24_;
	ServicesCalDAVWebDAVPropStat* _tmp25_;
	SoupStatus _tmp26_;
	SoupStatus _tmp27_;
	GXmlDomElement* resourcetype;
	ServicesCalDAVWebDAVPropStat* _tmp28_;
	GXmlDomElement* _tmp29_;
	GXmlDomElement* supported_calendar;
	ServicesCalDAVWebDAVPropStat* _tmp30_;
	GXmlDomElement* _tmp31_;
	GXmlDomElement* _tmp32_;
	GXmlDomElement* _tmp33_;
	ServicesCalDAVWebDAVPropStat* _tmp34_;
	ServicesStore* _tmp35_;
	GError* _inner_error0_;
};

struct _Block14Data {
	int _ref_count_;
	ServicesCalDAVCalDAVClient* self;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	GeeArrayList* responses;
	gint index;
	GeeArrayList* items_list;
	ObjectsProject* project;
	GCancellable* cancellable;
	ServicesCalDAVCalDAVClientProgressCallback progress_callback;
	gpointer progress_callback_target;
	GDestroyNotify progress_callback_target_destroy_notify;
	gpointer _async_data_;
};

struct _ServicesCalDavCalDavClientFetchItemsForProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	GCancellable* cancellable;
	ServicesCalDAVCalDAVClientProgressCallback progress_callback;
	gpointer progress_callback_target;
	GDestroyNotify progress_callback_target_destroy_notify;
	Block14Data* _data14_;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ServicesCalDAVWebDAVMultiStatus* _tmp5_;
	GeeArrayList* _tmp6_;
	GeeArrayList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GeeArrayList* _tmp14_;
	ServicesStore* _tmp15_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientSyncTasklistData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	GCancellable* cancellable;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	const gchar* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	ServicesLogService* _tmp8_;
	ServicesLogService* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	ServicesLogService* _tmp12_;
	ServicesLogService* _tmp13_;
	gchar* xml;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	ServicesLogService* _tmp20_;
	ServicesLogService* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ServicesLogService* _tmp29_;
	ServicesLogService* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	ServicesCalDAVWebDAVMultiStatus* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	ServicesCalDAVWebDAVMultiStatus* _tmp39_;
	ServicesCalDAVWebDAVMultiStatus* _tmp40_;
	GError* e;
	GError* _tmp41_;
	GError* _tmp42_;
	GError* _tmp43_;
	ServicesLogService* _tmp44_;
	ServicesLogService* _tmp45_;
	GError* _tmp46_;
	const gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	GeeArrayList* _response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp50_;
	GeeArrayList* _tmp51_;
	gint _response_size;
	GeeArrayList* _tmp52_;
	gint _tmp53_;
	gint _tmp54_;
	gint _response_index;
	gint _tmp55_;
	gint _tmp56_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp57_;
	gpointer _tmp58_;
	gchar* href;
	ServicesCalDAVWebDAVResponse* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	gchar* _tmp62_;
	gchar* url;
	const gchar* _tmp63_;
	gchar* _tmp64_;
	ServicesCalDAVWebDAVResponse* _tmp65_;
	SoupStatus _tmp66_;
	SoupStatus _tmp67_;
	ObjectsItem* item;
	ServicesStore* _tmp68_;
	const gchar* _tmp69_;
	ObjectsItem* _tmp70_;
	ObjectsItem* _tmp71_;
	ServicesStore* _tmp72_;
	ObjectsItem* _tmp73_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp74_;
	GeeArrayList* _tmp75_;
	gint _propstat_size;
	GeeArrayList* _tmp76_;
	gint _tmp77_;
	gint _tmp78_;
	gint _propstat_index;
	gint _tmp79_;
	gint _tmp80_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp81_;
	gpointer _tmp82_;
	ServicesCalDAVWebDAVPropStat* _tmp83_;
	SoupStatus _tmp84_;
	SoupStatus _tmp85_;
	ObjectsItem* _vala1_item;
	ServicesStore* _tmp86_;
	const gchar* _tmp87_;
	ObjectsItem* _tmp88_;
	ObjectsItem* _tmp89_;
	ServicesStore* _tmp90_;
	ObjectsItem* _tmp91_;
	gboolean has_component_parameter;
	gboolean is_vtodo;
	GXmlDomElement* getcontenttype;
	ServicesCalDAVWebDAVPropStat* _tmp92_;
	GXmlDomElement* _tmp93_;
	GXmlDomElement* _tmp94_;
	GXmlDomElement* _tmp95_;
	gchar* _tmp96_;
	gchar* _tmp97_;
	gchar* _tmp98_;
	gchar* _tmp99_;
	gchar* _tmp100_;
	GXmlDomElement* _tmp101_;
	gchar* _tmp102_;
	gchar* _tmp103_;
	gchar* _tmp104_;
	gchar* _tmp105_;
	gchar* _tmp106_;
	ServicesLogService* _tmp107_;
	ServicesLogService* _tmp108_;
	gboolean _tmp109_;
	GXmlDomElement* getetag;
	ServicesCalDAVWebDAVPropStat* _tmp110_;
	GXmlDomElement* _tmp111_;
	gchar* _tmp112_;
	GXmlDomElement* _tmp113_;
	GXmlDomElement* _tmp114_;
	gchar* _tmp115_;
	gchar* _tmp116_;
	gchar* _tmp117_;
	gchar* _tmp118_;
	gchar* _tmp119_;
	gchar* etag;
	gchar* _tmp120_;
	gchar* vtodo_content;
	const gchar* _tmp121_;
	gchar* _tmp122_;
	const gchar* _tmp123_;
	const gchar* _tmp124_;
	const gchar* _tmp125_;
	gchar* sync_token;
	ServicesCalDAVWebDAVMultiStatus* _tmp126_;
	gchar* _tmp127_;
	gboolean _tmp128_;
	const gchar* _tmp129_;
	const gchar* _tmp130_;
	const gchar* _tmp131_;
	const gchar* _tmp132_;
	const gchar* _tmp133_;
	const gchar* _tmp134_;
	ServicesStore* _tmp135_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientEtagSyncProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	GCancellable* cancellable;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* xml;
	gchar* _tmp6_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	ServicesCalDAVWebDAVMultiStatus* _tmp10_;
	GeeHashMap* server_map;
	GeeHashMap* _tmp11_;
	GeeArrayList* _response_list;
	ServicesCalDAVWebDAVMultiStatus* _tmp12_;
	GeeArrayList* _tmp13_;
	gint _response_size;
	GeeArrayList* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gint _response_index;
	gint _tmp17_;
	gint _tmp18_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp19_;
	gpointer _tmp20_;
	ServicesCalDAVWebDAVResponse* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* url;
	ServicesCalDAVWebDAVResponse* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp28_;
	GeeArrayList* _tmp29_;
	gint _propstat_size;
	GeeArrayList* _tmp30_;
	gint _tmp31_;
	gint _tmp32_;
	gint _propstat_index;
	gint _tmp33_;
	gint _tmp34_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp35_;
	gpointer _tmp36_;
	ServicesCalDAVWebDAVPropStat* _tmp37_;
	SoupStatus _tmp38_;
	SoupStatus _tmp39_;
	GXmlDomElement* getetag;
	ServicesCalDAVWebDAVPropStat* _tmp40_;
	GXmlDomElement* _tmp41_;
	gchar* _tmp42_;
	GXmlDomElement* _tmp43_;
	GXmlDomElement* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	GeeHashMap* _tmp50_;
	const gchar* _tmp51_;
	ServicesLogService* _tmp52_;
	ServicesLogService* _tmp53_;
	GeeHashMap* _tmp54_;
	gint _tmp55_;
	gint _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	GeeArrayList* stale_items;
	GeeArrayList* _tmp59_;
	GeeArrayList* _local_item_list;
	ServicesStore* _tmp60_;
	GeeArrayList* _tmp61_;
	gint _local_item_size;
	GeeArrayList* _tmp62_;
	gint _tmp63_;
	gint _tmp64_;
	gint _local_item_index;
	gint _tmp65_;
	gint _tmp66_;
	ObjectsItem* local_item;
	GeeArrayList* _tmp67_;
	gpointer _tmp68_;
	gboolean _tmp69_;
	ObjectsItem* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	GeeHashMap* _tmp73_;
	ObjectsItem* _tmp74_;
	const gchar* _tmp75_;
	const gchar* _tmp76_;
	GeeArrayList* _tmp77_;
	ObjectsItem* _tmp78_;
	GeeArrayList* _stale_item_list;
	GeeArrayList* _tmp79_;
	gint _stale_item_size;
	GeeArrayList* _tmp80_;
	gint _tmp81_;
	gint _tmp82_;
	gint _stale_item_index;
	gint _tmp83_;
	gint _tmp84_;
	ObjectsItem* stale_item;
	GeeArrayList* _tmp85_;
	gpointer _tmp86_;
	ServicesLogService* _tmp87_;
	ServicesLogService* _tmp88_;
	ObjectsItem* _tmp89_;
	const gchar* _tmp90_;
	const gchar* _tmp91_;
	gchar* _tmp92_;
	gchar* _tmp93_;
	ServicesStore* _tmp94_;
	ObjectsItem* _tmp95_;
	GeeArrayList* stale_sections;
	GeeArrayList* _tmp96_;
	GeeArrayList* _local_section_list;
	ServicesStore* _tmp97_;
	GeeArrayList* _tmp98_;
	gint _local_section_size;
	GeeArrayList* _tmp99_;
	gint _tmp100_;
	gint _tmp101_;
	gint _local_section_index;
	gint _tmp102_;
	gint _tmp103_;
	ObjectsSection* local_section;
	GeeArrayList* _tmp104_;
	gpointer _tmp105_;
	gboolean _tmp106_;
	ObjectsSection* _tmp107_;
	const gchar* _tmp108_;
	const gchar* _tmp109_;
	GeeHashMap* _tmp110_;
	ObjectsSection* _tmp111_;
	const gchar* _tmp112_;
	const gchar* _tmp113_;
	GeeArrayList* _tmp114_;
	ObjectsSection* _tmp115_;
	GeeArrayList* _stale_section_list;
	GeeArrayList* _tmp116_;
	gint _stale_section_size;
	GeeArrayList* _tmp117_;
	gint _tmp118_;
	gint _tmp119_;
	gint _stale_section_index;
	gint _tmp120_;
	gint _tmp121_;
	ObjectsSection* stale_section;
	GeeArrayList* _tmp122_;
	gpointer _tmp123_;
	ServicesLogService* _tmp124_;
	ServicesLogService* _tmp125_;
	ObjectsSection* _tmp126_;
	const gchar* _tmp127_;
	const gchar* _tmp128_;
	gchar* _tmp129_;
	gchar* _tmp130_;
	ServicesStore* _tmp131_;
	ObjectsSection* _tmp132_;
	GeeIterator* _entry_it;
	GeeHashMap* _tmp133_;
	GeeSet* _tmp134_;
	GeeSet* _tmp135_;
	GeeSet* _tmp136_;
	GeeIterator* _tmp137_;
	GeeIterator* _tmp138_;
	GeeIterator* _tmp139_;
	GeeMapEntry* entry;
	GeeIterator* _tmp140_;
	gpointer _tmp141_;
	gchar* _vala1_url;
	GeeMapEntry* _tmp142_;
	gconstpointer _tmp143_;
	gconstpointer _tmp144_;
	gchar* _tmp145_;
	gchar* server_etag;
	GeeMapEntry* _tmp146_;
	gconstpointer _tmp147_;
	gconstpointer _tmp148_;
	gchar* _tmp149_;
	ObjectsItem* _vala1_local_item;
	ServicesStore* _tmp150_;
	const gchar* _tmp151_;
	ObjectsItem* _tmp152_;
	gboolean _tmp153_;
	gboolean _tmp154_;
	ObjectsItem* _tmp155_;
	const gchar* _tmp156_;
	ObjectsItem* _tmp157_;
	const gchar* _tmp158_;
	const gchar* _tmp159_;
	const gchar* _tmp160_;
	gchar* vtodo_content;
	const gchar* _tmp161_;
	gchar* _tmp162_;
	const gchar* _tmp163_;
	const gchar* _tmp164_;
	const gchar* _tmp165_;
	GError* _inner_error1_;
	ServicesStore* _tmp166_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientGetVtodoByUrlData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	gchar* url;
	GCancellable* cancellable;
	gchar* result;
	gchar* _tmp0_;
	SoupStatus* _tmp1_;
	SoupStatus* _tmp2_;
	gint _tmp2__length1;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientUpdateSyncTokenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	GCancellable* cancellable;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	gchar* _tmp2_;
	ServicesCalDAVWebDAVMultiStatus* multi_status;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ServicesCalDAVWebDAVMultiStatus* _tmp5_;
	GeeArrayList* _response_list;
	GeeArrayList* _tmp6_;
	gint _response_size;
	GeeArrayList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint _response_index;
	gint _tmp10_;
	gint _tmp11_;
	ServicesCalDAVWebDAVResponse* response;
	GeeArrayList* _tmp12_;
	gpointer _tmp13_;
	GeeArrayList* _propstat_list;
	ServicesCalDAVWebDAVResponse* _tmp14_;
	GeeArrayList* _tmp15_;
	gint _propstat_size;
	GeeArrayList* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _propstat_index;
	gint _tmp19_;
	gint _tmp20_;
	ServicesCalDAVWebDAVPropStat* propstat;
	GeeArrayList* _tmp21_;
	gpointer _tmp22_;
	ServicesCalDAVWebDAVPropStat* _tmp23_;
	SoupStatus _tmp24_;
	SoupStatus _tmp25_;
	GXmlDomElement* sync_token;
	ServicesCalDAVWebDAVPropStat* _tmp26_;
	GXmlDomElement* _tmp27_;
	GXmlDomElement* _tmp28_;
	GXmlDomElement* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientCreateProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* calendar_url;
	ObjectsSource* _tmp7_;
	ObjectsSource* _tmp8_;
	ObjectsSourceCalDAVData* _tmp9_;
	ObjectsSourceCalDAVData* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	HttpResponse* response;
	HttpResponse* _tmp19_;
	const gchar* _tmp20_;
	SoupStatus* _tmp21_;
	SoupStatus* _tmp22_;
	gint _tmp22__length1;
	gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	HttpResponse* _tmp26_;
	GError* e;
	GError* _tmp27_;
	const gchar* _tmp28_;
	ServicesLogService* _tmp29_;
	ServicesLogService* _tmp30_;
	HttpResponse* _tmp31_;
	HttpResponse* _tmp32_;
	ServicesLogService* _tmp33_;
	ServicesLogService* _tmp34_;
	GError* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	HttpResponse* _tmp39_;
	GError* _tmp40_;
	HttpResponse* _tmp41_;
	GError* _tmp42_;
	const gchar* _tmp43_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientUpdateProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* xml;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	HttpResponse* response;
	HttpResponse* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	SoupStatus* _tmp10_;
	SoupStatus* _tmp11_;
	gint _tmp11__length1;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GError* e;
	ServicesLogService* _tmp14_;
	ServicesLogService* _tmp15_;
	GError* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	GError* _tmp20_;
	GError* _tmp21_;
	const gchar* _tmp22_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientDeleteProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsProject* project;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	HttpResponse* response;
	HttpResponse* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	SoupStatus* _tmp5_;
	SoupStatus* _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* e;
	GError* _tmp9_;
	const gchar* _tmp10_;
	ServicesLogService* _tmp11_;
	ServicesLogService* _tmp12_;
	GError* _tmp13_;
	const gchar* _tmp14_;
	ServicesLogService* _tmp15_;
	ServicesLogService* _tmp16_;
	ServicesLogService* _tmp17_;
	ServicesLogService* _tmp18_;
	GError* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GError* _tmp23_;
	GError* _tmp24_;
	const gchar* _tmp25_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientAddItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsItem* item;
	gboolean update;
	HttpResponse* result;
	const gchar* _tmp0_;
	ServicesLogService* _tmp1_;
	ServicesLogService* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	ObjectsProject* _tmp7_;
	ObjectsProject* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* url;
	gchar* _tmp16_;
	gchar* body;
	gchar* _tmp17_;
	SoupStatus* _tmp18_;
	gint _tmp18__length1;
	gint __tmp18__size_;
	SoupStatus* _tmp19_;
	SoupStatus* _tmp20_;
	SoupStatus* expected;
	SoupStatus* _tmp21_;
	gint _tmp21__length1;
	gint expected_length1;
	gint _expected_size_;
	HttpResponse* response;
	HttpResponse* _tmp22_;
	GHashTable* headers;
	gboolean _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GHashFunc _tmp29_;
	GEqualFunc _tmp30_;
	GHashTable* _tmp31_;
	GHashTable* _tmp32_;
	gchar* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	SoupStatus* _tmp39_;
	gint _tmp39__length1;
	GHashTable* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	HttpResponse* _tmp50_;
	GError* e;
	GError* _tmp51_;
	const gchar* _tmp52_;
	ServicesLogService* _tmp53_;
	ServicesLogService* _tmp54_;
	HttpResponse* _tmp55_;
	HttpResponse* _tmp56_;
	const gchar* _tmp57_;
	ServicesLogService* _tmp58_;
	ServicesLogService* _tmp59_;
	GError* _tmp60_;
	const gchar* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	HttpResponse* _tmp64_;
	GError* _tmp65_;
	HttpResponse* _tmp66_;
	GError* _tmp67_;
	const gchar* _tmp68_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientCompleteItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsItem* item;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* body;
	gchar* _tmp2_;
	HttpResponse* response;
	HttpResponse* _tmp3_;
	GHashTable* headers;
	gboolean _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GHashFunc _tmp9_;
	GEqualFunc _tmp10_;
	GHashTable* _tmp11_;
	GHashTable* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	SoupStatus* _tmp20_;
	SoupStatus* _tmp21_;
	gint _tmp21__length1;
	GHashTable* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	HttpResponse* _tmp33_;
	GError* e;
	GError* _tmp34_;
	const gchar* _tmp35_;
	ServicesLogService* _tmp36_;
	ServicesLogService* _tmp37_;
	GCancellable* retry_cancellable;
	GCancellable* _tmp38_;
	gchar* vtodo_content;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	GCancellable* _tmp41_;
	gchar* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	gchar* fresh_etag;
	gchar* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	gchar* _tmp52_;
	GHashTable* retry_headers;
	const gchar* _tmp53_;
	GHashFunc _tmp54_;
	GEqualFunc _tmp55_;
	GHashTable* _tmp56_;
	GHashTable* _tmp57_;
	gchar* _tmp58_;
	const gchar* _tmp59_;
	gchar* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	SoupStatus* _tmp64_;
	SoupStatus* _tmp65_;
	gint _tmp65__length1;
	GHashTable* _tmp66_;
	gchar* _tmp67_;
	gchar* _tmp68_;
	const gchar* _tmp69_;
	const gchar* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	gchar* _tmp75_;
	gchar* _tmp76_;
	HttpResponse* _tmp77_;
	GError* retry_error;
	ServicesLogService* _tmp78_;
	ServicesLogService* _tmp79_;
	GError* _tmp80_;
	const gchar* _tmp81_;
	gchar* _tmp82_;
	gchar* _tmp83_;
	HttpResponse* _tmp84_;
	HttpResponse* _tmp85_;
	ServicesLogService* _tmp86_;
	ServicesLogService* _tmp87_;
	GError* _tmp88_;
	const gchar* _tmp89_;
	gchar* _tmp90_;
	gchar* _tmp91_;
	HttpResponse* _tmp92_;
	GError* _tmp93_;
	HttpResponse* _tmp94_;
	GError* _tmp95_;
	const gchar* _tmp96_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientMoveItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsItem* item;
	ObjectsProject* destination_project;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* destination;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GHashTable* headers;
	GHashFunc _tmp10_;
	GEqualFunc _tmp11_;
	GHashTable* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	HttpResponse* response;
	HttpResponse* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	SoupStatus* _tmp18_;
	SoupStatus* _tmp19_;
	gint _tmp19__length1;
	gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	HttpResponse* _tmp26_;
	GError* e;
	gboolean _tmp27_;
	gboolean _tmp28_;
	GError* _tmp29_;
	const gchar* _tmp30_;
	GError* _tmp31_;
	const gchar* _tmp32_;
	GError* _tmp33_;
	const gchar* _tmp34_;
	ServicesLogService* _tmp35_;
	ServicesLogService* _tmp36_;
	HttpResponse* _tmp37_;
	ServicesLogService* _tmp38_;
	ServicesLogService* _tmp39_;
	GError* _tmp40_;
	const gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	HttpResponse* _tmp44_;
	GError* _tmp45_;
	HttpResponse* _tmp46_;
	GError* _tmp47_;
	const gchar* _tmp48_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientMoveItemFallbackData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsItem* item;
	ObjectsProject* destination_project;
	gchar* destination;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	gchar* body;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	SoupStatus* _tmp3_;
	SoupStatus* _tmp4_;
	gint _tmp4__length1;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	SoupStatus* _tmp15_;
	SoupStatus* _tmp16_;
	gint _tmp16__length1;
	gchar* _tmp17_;
	gchar* _tmp18_;
	HttpResponse* _tmp19_;
	GError* e;
	ServicesLogService* _tmp20_;
	ServicesLogService* _tmp21_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	HttpResponse* _tmp26_;
	GError* _tmp27_;
	HttpResponse* _tmp28_;
	GError* _tmp29_;
	const gchar* _tmp30_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientDeleteItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsItem* item;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	HttpResponse* response;
	HttpResponse* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	SoupStatus* _tmp5_;
	SoupStatus* _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* e;
	ServicesLogService* _tmp9_;
	ServicesLogService* _tmp10_;
	GError* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	GError* _tmp15_;
	GError* _tmp16_;
	const gchar* _tmp17_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientAddSectionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsSection* section;
	gboolean update;
	HttpResponse* result;
	const gchar* _tmp0_;
	ServicesLogService* _tmp1_;
	ServicesLogService* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	ObjectsProject* _tmp7_;
	ObjectsProject* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* url;
	gchar* _tmp16_;
	gchar* body;
	gchar* _tmp17_;
	SoupStatus* _tmp18_;
	gint _tmp18__length1;
	gint __tmp18__size_;
	SoupStatus* _tmp19_;
	SoupStatus* _tmp20_;
	SoupStatus* expected;
	SoupStatus* _tmp21_;
	gint _tmp21__length1;
	gint expected_length1;
	gint _expected_size_;
	HttpResponse* response;
	HttpResponse* _tmp22_;
	GHashTable* headers;
	gboolean _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GHashFunc _tmp29_;
	GEqualFunc _tmp30_;
	GHashTable* _tmp31_;
	GHashTable* _tmp32_;
	gchar* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	SoupStatus* _tmp39_;
	gint _tmp39__length1;
	GHashTable* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	HttpResponse* _tmp50_;
	GError* e;
	const gchar* _tmp51_;
	ServicesLogService* _tmp52_;
	ServicesLogService* _tmp53_;
	GError* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	HttpResponse* _tmp58_;
	GError* _tmp59_;
	HttpResponse* _tmp60_;
	GError* _tmp61_;
	const gchar* _tmp62_;
	GError* _inner_error0_;
};

struct _ServicesCalDavCalDavClientDeleteSectionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVCalDAVClient* self;
	ObjectsSection* section;
	HttpResponse* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	HttpResponse* response;
	HttpResponse* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	SoupStatus* _tmp5_;
	SoupStatus* _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* e;
	ServicesLogService* _tmp9_;
	ServicesLogService* _tmp10_;
	GError* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	GError* _tmp15_;
	GError* _tmp16_;
	const gchar* _tmp17_;
	GError* _inner_error0_;
};

static gpointer services_cal_dav_cal_dav_client_parent_class = NULL;

static void services_cal_dav_cal_dav_client_get_principal_url_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_get_principal_url_co (ServicesCalDavCalDavClientGetPrincipalUrlData* _data_);
static void services_cal_dav_cal_dav_client_get_principal_url_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
static void services_cal_dav_cal_dav_client_get_calendar_home_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_get_calendar_home_co (ServicesCalDavCalDavClientGetCalendarHomeData* _data_);
static void services_cal_dav_cal_dav_client_get_calendar_home_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
static void services_cal_dav_cal_dav_client_update_userdata_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_update_userdata_co (ServicesCalDavCalDavClientUpdateUserdataData* _data_);
static void services_cal_dav_cal_dav_client_update_userdata_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static void services_cal_dav_cal_dav_client_fetch_project_list_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_fetch_project_list_co (ServicesCalDavCalDavClientFetchProjectListData* _data_);
static void services_cal_dav_cal_dav_client_fetch_project_list_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_);
static gboolean services_cal_dav_cal_dav_client_is_vtodo_calendar (ServicesCalDAVCalDAVClient* self,
                                                            GXmlDomElement* resourcetype,
                                                            GXmlDomElement* supported_calendar);
static void services_cal_dav_cal_dav_client_sync_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_sync_co (ServicesCalDavCalDavClientSyncData* _data_);
static void services_cal_dav_cal_dav_client_sync_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void services_cal_dav_cal_dav_client_fetch_project_details_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_fetch_project_details_co (ServicesCalDavCalDavClientFetchProjectDetailsData* _data_);
static void services_cal_dav_cal_dav_client_fetch_project_details_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
static void services_cal_dav_cal_dav_client_fetch_items_for_project_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_fetch_items_for_project_co (ServicesCalDavCalDavClientFetchItemsForProjectData* _data_);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static gboolean _services_cal_dav_cal_dav_client_fetch_items_for_project_co_gsource_func (gpointer self);
static void services_cal_dav_cal_dav_client_fetch_items_for_project_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_);
static gboolean __lambda34_ (Block14Data* _data14_);
static void services_cal_dav_cal_dav_client_upsert_vtodo_content (ServicesCalDAVCalDAVClient* self,
                                                           ObjectsProject* project,
                                                           const gchar* url,
                                                           const gchar* etag,
                                                           const gchar* vtodo_content,
                                                           GeeArrayList* batched_items);
static gboolean ___lambda34__gsource_func (gpointer self);
static void services_cal_dav_cal_dav_client_sync_tasklist_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_sync_tasklist_co (ServicesCalDavCalDavClientSyncTasklistData* _data_);
static void services_cal_dav_cal_dav_client_sync_tasklist_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
static void services_cal_dav_cal_dav_client_etag_sync_project (ServicesCalDAVCalDAVClient* self,
                                                        ObjectsProject* project,
                                                        GCancellable* cancellable,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
static void services_cal_dav_cal_dav_client_etag_sync_project_finish (ServicesCalDAVCalDAVClient* self,
                                                               GAsyncResult* _res_,
                                                               GError** error);
static void services_cal_dav_cal_dav_client_get_vtodo_by_url (ServicesCalDAVCalDAVClient* self,
                                                       const gchar* url,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static gchar* services_cal_dav_cal_dav_client_get_vtodo_by_url_finish (ServicesCalDAVCalDAVClient* self,
                                                                GAsyncResult* _res_,
                                                                GError** error);
static void services_cal_dav_cal_dav_client_upsert_section_from_vtodo (ServicesCalDAVCalDAVClient* self,
                                                                ObjectsProject* project,
                                                                const gchar* url,
                                                                const gchar* etag,
                                                                const gchar* vtodo_content);
static void services_cal_dav_cal_dav_client_etag_sync_project_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_etag_sync_project_co (ServicesCalDavCalDavClientEtagSyncProjectData* _data_);
static void services_cal_dav_cal_dav_client_etag_sync_project_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
static void services_cal_dav_cal_dav_client_get_vtodo_by_url_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_get_vtodo_by_url_co (ServicesCalDavCalDavClientGetVtodoByUrlData* _data_);
static void services_cal_dav_cal_dav_client_get_vtodo_by_url_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
static void services_cal_dav_cal_dav_client_update_sync_token_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_update_sync_token_co (ServicesCalDavCalDavClientUpdateSyncTokenData* _data_);
static void services_cal_dav_cal_dav_client_update_sync_token_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
static void services_cal_dav_cal_dav_client_create_project_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_create_project_co (ServicesCalDavCalDavClientCreateProjectData* _data_);
static void services_cal_dav_cal_dav_client_create_project_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static void services_cal_dav_cal_dav_client_update_project_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_update_project_co (ServicesCalDavCalDavClientUpdateProjectData* _data_);
static void services_cal_dav_cal_dav_client_update_project_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static void services_cal_dav_cal_dav_client_delete_project_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_delete_project_co (ServicesCalDavCalDavClientDeleteProjectData* _data_);
static void services_cal_dav_cal_dav_client_delete_project_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static void services_cal_dav_cal_dav_client_add_item_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_add_item_co (ServicesCalDavCalDavClientAddItemData* _data_);
static void _g_free0_ (gpointer var);
static void services_cal_dav_cal_dav_client_add_item_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static void services_cal_dav_cal_dav_client_complete_item_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_complete_item_co (ServicesCalDavCalDavClientCompleteItemData* _data_);
static void services_cal_dav_cal_dav_client_complete_item_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
static void services_cal_dav_cal_dav_client_move_item_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_move_item_co (ServicesCalDavCalDavClientMoveItemData* _data_);
static void services_cal_dav_cal_dav_client_move_item_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static void services_cal_dav_cal_dav_client_move_item_fallback (ServicesCalDAVCalDAVClient* self,
                                                         ObjectsItem* item,
                                                         ObjectsProject* destination_project,
                                                         const gchar* destination,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static HttpResponse* services_cal_dav_cal_dav_client_move_item_fallback_finish (ServicesCalDAVCalDAVClient* self,
                                                                         GAsyncResult* _res_);
static void services_cal_dav_cal_dav_client_move_item_fallback_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_move_item_fallback_co (ServicesCalDavCalDavClientMoveItemFallbackData* _data_);
static void services_cal_dav_cal_dav_client_move_item_fallback_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_);
static void services_cal_dav_cal_dav_client_delete_item_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_delete_item_co (ServicesCalDavCalDavClientDeleteItemData* _data_);
static void services_cal_dav_cal_dav_client_delete_item_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void services_cal_dav_cal_dav_client_add_section_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_add_section_co (ServicesCalDavCalDavClientAddSectionData* _data_);
static void services_cal_dav_cal_dav_client_add_section_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void services_cal_dav_cal_dav_client_delete_section_data_free (gpointer _data);
static gboolean services_cal_dav_cal_dav_client_delete_section_co (ServicesCalDavCalDavClientDeleteSectionData* _data_);
static void services_cal_dav_cal_dav_client_delete_section_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static GType services_cal_dav_cal_dav_client_get_type_once (void);

ServicesCalDAVCalDAVClient*
services_cal_dav_cal_dav_client_construct (GType object_type,
                                           SoupSession* session,
                                           const gchar* base_url,
                                           const gchar* username,
                                           const gchar* password,
                                           gboolean ignore_ssl)
{
	ServicesCalDAVCalDAVClient * self = NULL;
	g_return_val_if_fail (session != NULL, NULL);
	g_return_val_if_fail (base_url != NULL, NULL);
	g_return_val_if_fail (username != NULL, NULL);
	g_return_val_if_fail (password != NULL, NULL);
	self = (ServicesCalDAVCalDAVClient*) services_cal_dav_web_dav_client_construct (object_type, session, base_url, username, password, ignore_ssl);
	return self;
}

ServicesCalDAVCalDAVClient*
services_cal_dav_cal_dav_client_new (SoupSession* session,
                                     const gchar* base_url,
                                     const gchar* username,
                                     const gchar* password,
                                     gboolean ignore_ssl)
{
	return services_cal_dav_cal_dav_client_construct (SERVICES_CAL_DAV_TYPE_CAL_DAV_CLIENT, session, base_url, username, password, ignore_ssl);
}

static void
services_cal_dav_cal_dav_client_get_principal_url_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientGetPrincipalUrlData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientGetPrincipalUrlData, _data_);
}

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

void
services_cal_dav_cal_dav_client_get_principal_url (ServicesCalDAVCalDAVClient* self,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ServicesCalDavCalDavClientGetPrincipalUrlData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientGetPrincipalUrlData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_get_principal_url_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	services_cal_dav_cal_dav_client_get_principal_url_co (_data_);
}

gchar*
services_cal_dav_cal_dav_client_get_principal_url_finish (ServicesCalDAVCalDAVClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	gchar* result;
	ServicesCalDavCalDavClientGetPrincipalUrlData* _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
services_cal_dav_cal_dav_client_get_principal_url_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	ServicesCalDavCalDavClientGetPrincipalUrlData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_get_principal_url_co (_data_);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
services_cal_dav_cal_dav_client_get_principal_url_co (ServicesCalDavCalDavClientGetPrincipalUrlData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Fetching principal URL");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"                        <propfind xmlns=\"DAV:\">\n" \
"                            <prop>\n" \
"                                <current-user-principal/>\n" \
"                            </prop>\n" \
"                        </propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->xml;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, "", _data_->_tmp3_, "0", _data_->cancellable, services_cal_dav_cal_dav_client_get_principal_url_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp5_ = _data_->multi_status;
		_data_->_tmp6_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp5_);
		_data_->_response_list = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->_response_list;
		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_response_size = _data_->_tmp9_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp10_ = _data_->_response_index;
			_data_->_tmp11_ = _data_->_response_size;
			if (!(_data_->_tmp10_ < _data_->_tmp11_)) {
				break;
			}
			_data_->_tmp12_ = _data_->_response_list;
			_data_->_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp12_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp13_;
			{
				_data_->_tmp14_ = _data_->response;
				_data_->_tmp15_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp14_);
				_data_->_propstat_list = _data_->_tmp15_;
				_data_->_tmp16_ = _data_->_propstat_list;
				_data_->_tmp17_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp16_);
				_data_->_tmp18_ = _data_->_tmp17_;
				_data_->_propstat_size = _data_->_tmp18_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp19_ = _data_->_propstat_index;
					_data_->_tmp20_ = _data_->_propstat_size;
					if (!(_data_->_tmp19_ < _data_->_tmp20_)) {
						break;
					}
					_data_->_tmp21_ = _data_->_propstat_list;
					_data_->_tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp21_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp22_;
					{
						_data_->_tmp23_ = _data_->propstat;
						_data_->_tmp24_ = services_cal_dav_web_dav_prop_stat_get_prop (_data_->_tmp23_);
						_data_->_tmp25_ = _data_->_tmp24_;
						_data_->_tmp26_ = gxml_dom_element_get_elements_by_tag_name (_data_->_tmp25_, "current-user-principal");
						_data_->_principal_list = _data_->_tmp26_;
						_data_->_tmp27_ = _data_->_principal_list;
						_data_->_tmp28_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp27_);
						_data_->_tmp29_ = _data_->_tmp28_;
						_data_->_principal_size = _data_->_tmp29_;
						_data_->_principal_index = -1;
						while (TRUE) {
							_data_->_principal_index = _data_->_principal_index + 1;
							_data_->_tmp30_ = _data_->_principal_index;
							_data_->_tmp31_ = _data_->_principal_size;
							if (!(_data_->_tmp30_ < _data_->_tmp31_)) {
								break;
							}
							_data_->_tmp32_ = _data_->_principal_list;
							_data_->_tmp33_ = gee_list_get ((GeeList*) _data_->_tmp32_, _data_->_principal_index);
							_data_->principal = (GXmlDomElement*) _data_->_tmp33_;
							_data_->_tmp34_ = _data_->principal;
							_data_->_tmp35_ = gxml_dom_element_get_elements_by_tag_name (_data_->_tmp34_, "href");
							_data_->href_elements = _data_->_tmp35_;
							{
								_data_->_tmp36_ = _data_->href_elements;
								_data_->_href_list = _data_->_tmp36_;
								_data_->_tmp37_ = _data_->_href_list;
								_data_->_tmp38_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp37_);
								_data_->_tmp39_ = _data_->_tmp38_;
								_data_->_href_size = _data_->_tmp39_;
								_data_->_href_index = -1;
								while (TRUE) {
									_data_->_href_index = _data_->_href_index + 1;
									_data_->_tmp40_ = _data_->_href_index;
									_data_->_tmp41_ = _data_->_href_size;
									if (!(_data_->_tmp40_ < _data_->_tmp41_)) {
										break;
									}
									_data_->_tmp42_ = _data_->_href_list;
									_data_->_tmp43_ = gee_list_get ((GeeList*) _data_->_tmp42_, _data_->_href_index);
									_data_->href = (GXmlDomElement*) _data_->_tmp43_;
									_data_->_tmp44_ = _data_->href;
									_data_->_tmp45_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp44_);
									_data_->_tmp46_ = _data_->_tmp45_;
									_data_->_tmp47_ = _data_->_tmp46_;
									_data_->_tmp48_ = string_strip (_data_->_tmp47_);
									_data_->_tmp49_ = _data_->_tmp48_;
									_g_free0 (_data_->_tmp47_);
									_data_->link = _data_->_tmp49_;
									_data_->_tmp50_ = _data_->link;
									_data_->_tmp51_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp50_);
									_data_->result = _data_->_tmp51_;
									_g_free0 (_data_->link);
									_g_object_unref0 (_data_->href);
									_g_object_unref0 (_data_->href_elements);
									_g_object_unref0 (_data_->principal);
									_g_object_unref0 (_data_->_principal_list);
									_g_object_unref0 (_data_->propstat);
									_g_object_unref0 (_data_->_propstat_list);
									_g_object_unref0 (_data_->response);
									_g_object_unref0 (_data_->_response_list);
									_g_object_unref0 (_data_->multi_status);
									_g_free0 (_data_->xml);
									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_->href_elements);
							_g_object_unref0 (_data_->principal);
						}
						_g_object_unref0 (_data_->_principal_list);
					}
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->result = NULL;
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_get_calendar_home_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientGetCalendarHomeData* _data_;
	_data_ = _data;
	_g_free0 (_data_->principal_url);
	_g_object_unref0 (_data_->cancellable);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientGetCalendarHomeData, _data_);
}

void
services_cal_dav_cal_dav_client_get_calendar_home (ServicesCalDAVCalDAVClient* self,
                                                   const gchar* principal_url,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ServicesCalDavCalDavClientGetCalendarHomeData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (principal_url != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientGetCalendarHomeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_get_calendar_home_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (principal_url);
	_g_free0 (_data_->principal_url);
	_data_->principal_url = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_get_calendar_home_co (_data_);
}

gchar*
services_cal_dav_cal_dav_client_get_calendar_home_finish (ServicesCalDAVCalDAVClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	gchar* result;
	ServicesCalDavCalDavClientGetCalendarHomeData* _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
services_cal_dav_cal_dav_client_get_calendar_home_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	ServicesCalDavCalDavClientGetCalendarHomeData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_get_calendar_home_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_get_calendar_home_co (ServicesCalDavCalDavClientGetCalendarHomeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Fetching calendar home");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"                        <propfind xmlns=\"DAV:\" xmlns:cal=\"urn:ietf:" \
"params:xml:ns:caldav\">\n" \
"                            <prop>\n" \
"                                <cal:calendar-home-set/>\n" \
"                            </prop>\n" \
"                        </propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->xml;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->principal_url, _data_->_tmp3_, "0", _data_->cancellable, services_cal_dav_cal_dav_client_get_calendar_home_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp5_ = _data_->multi_status;
		_data_->_tmp6_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp5_);
		_data_->_response_list = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->_response_list;
		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_response_size = _data_->_tmp9_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp10_ = _data_->_response_index;
			_data_->_tmp11_ = _data_->_response_size;
			if (!(_data_->_tmp10_ < _data_->_tmp11_)) {
				break;
			}
			_data_->_tmp12_ = _data_->_response_list;
			_data_->_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp12_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp13_;
			{
				_data_->_tmp14_ = _data_->response;
				_data_->_tmp15_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp14_);
				_data_->_propstat_list = _data_->_tmp15_;
				_data_->_tmp16_ = _data_->_propstat_list;
				_data_->_tmp17_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp16_);
				_data_->_tmp18_ = _data_->_tmp17_;
				_data_->_propstat_size = _data_->_tmp18_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp19_ = _data_->_propstat_index;
					_data_->_tmp20_ = _data_->_propstat_size;
					if (!(_data_->_tmp19_ < _data_->_tmp20_)) {
						break;
					}
					_data_->_tmp21_ = _data_->_propstat_list;
					_data_->_tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp21_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp22_;
					{
						_data_->_tmp23_ = _data_->propstat;
						_data_->_tmp24_ = services_cal_dav_web_dav_prop_stat_get_prop (_data_->_tmp23_);
						_data_->_tmp25_ = _data_->_tmp24_;
						_data_->_tmp26_ = gxml_dom_element_get_elements_by_tag_name (_data_->_tmp25_, "calendar-home-set");
						_data_->_calendar_home_list = _data_->_tmp26_;
						_data_->_tmp27_ = _data_->_calendar_home_list;
						_data_->_tmp28_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp27_);
						_data_->_tmp29_ = _data_->_tmp28_;
						_data_->_calendar_home_size = _data_->_tmp29_;
						_data_->_calendar_home_index = -1;
						while (TRUE) {
							_data_->_calendar_home_index = _data_->_calendar_home_index + 1;
							_data_->_tmp30_ = _data_->_calendar_home_index;
							_data_->_tmp31_ = _data_->_calendar_home_size;
							if (!(_data_->_tmp30_ < _data_->_tmp31_)) {
								break;
							}
							_data_->_tmp32_ = _data_->_calendar_home_list;
							_data_->_tmp33_ = gee_list_get ((GeeList*) _data_->_tmp32_, _data_->_calendar_home_index);
							_data_->calendar_home = (GXmlDomElement*) _data_->_tmp33_;
							_data_->_tmp34_ = _data_->calendar_home;
							_data_->_tmp35_ = gxml_dom_element_get_elements_by_tag_name (_data_->_tmp34_, "href");
							_data_->href_elements = _data_->_tmp35_;
							{
								_data_->_tmp36_ = _data_->href_elements;
								_data_->_href_list = _data_->_tmp36_;
								_data_->_tmp37_ = _data_->_href_list;
								_data_->_tmp38_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp37_);
								_data_->_tmp39_ = _data_->_tmp38_;
								_data_->_href_size = _data_->_tmp39_;
								_data_->_href_index = -1;
								while (TRUE) {
									_data_->_href_index = _data_->_href_index + 1;
									_data_->_tmp40_ = _data_->_href_index;
									_data_->_tmp41_ = _data_->_href_size;
									if (!(_data_->_tmp40_ < _data_->_tmp41_)) {
										break;
									}
									_data_->_tmp42_ = _data_->_href_list;
									_data_->_tmp43_ = gee_list_get ((GeeList*) _data_->_tmp42_, _data_->_href_index);
									_data_->href = (GXmlDomElement*) _data_->_tmp43_;
									_data_->_tmp44_ = _data_->href;
									_data_->_tmp45_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp44_);
									_data_->_tmp46_ = _data_->_tmp45_;
									_data_->_tmp47_ = _data_->_tmp46_;
									_data_->_tmp48_ = string_strip (_data_->_tmp47_);
									_data_->_tmp49_ = _data_->_tmp48_;
									_g_free0 (_data_->_tmp47_);
									_data_->link = _data_->_tmp49_;
									_data_->_tmp50_ = _data_->link;
									_data_->_tmp51_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp50_);
									_data_->result = _data_->_tmp51_;
									_g_free0 (_data_->link);
									_g_object_unref0 (_data_->href);
									_g_object_unref0 (_data_->href_elements);
									_g_object_unref0 (_data_->calendar_home);
									_g_object_unref0 (_data_->_calendar_home_list);
									_g_object_unref0 (_data_->propstat);
									_g_object_unref0 (_data_->_propstat_list);
									_g_object_unref0 (_data_->response);
									_g_object_unref0 (_data_->_response_list);
									_g_object_unref0 (_data_->multi_status);
									_g_free0 (_data_->xml);
									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_->href_elements);
							_g_object_unref0 (_data_->calendar_home);
						}
						_g_object_unref0 (_data_->_calendar_home_list);
					}
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->result = NULL;
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_update_userdata_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientUpdateUserdataData* _data_;
	_data_ = _data;
	_g_free0 (_data_->principal_url);
	_g_object_unref0 (_data_->source);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientUpdateUserdataData, _data_);
}

void
services_cal_dav_cal_dav_client_update_userdata (ServicesCalDAVCalDAVClient* self,
                                                 const gchar* principal_url,
                                                 ObjectsSource* source,
                                                 GCancellable* cancellable,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	ServicesCalDavCalDavClientUpdateUserdataData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	gchar* _tmp1_;
	ObjectsSource* _tmp2_;
	GCancellable* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (principal_url != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientUpdateUserdataData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_update_userdata_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (principal_url);
	_g_free0 (_data_->principal_url);
	_data_->principal_url = _tmp1_;
	_tmp2_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp2_;
	_tmp3_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp3_;
	services_cal_dav_cal_dav_client_update_userdata_co (_data_);
}

void
services_cal_dav_cal_dav_client_update_userdata_finish (ServicesCalDAVCalDAVClient* self,
                                                        GAsyncResult* _res_,
                                                        GError** error)
{
	ServicesCalDavCalDavClientUpdateUserdataData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
services_cal_dav_cal_dav_client_update_userdata_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	ServicesCalDavCalDavClientUpdateUserdataData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_update_userdata_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_update_userdata_co (ServicesCalDavCalDavClientUpdateUserdataData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Updating user data");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"                    <d:propfind xmlns:d=\"DAV:\" xmlns:s=\"http://sabr" \
"edav.org/ns\">\n" \
"                        <d:prop>\n" \
"                            <d:displayname/>\n" \
"                            <s:email-address/>\n" \
"                        </d:prop>\n" \
"                    </d:propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->principal_url, _data_->xml, "0", _data_->cancellable, services_cal_dav_cal_dav_client_update_userdata_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp3_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp4_ = services_cal_dav_web_dav_multi_status_responses (_data_->multi_status);
		_data_->_response_list = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->_response_list;
		_data_->_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_response_size = _data_->_tmp7_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp8_ = _data_->_response_index;
			_data_->_tmp9_ = _data_->_response_size;
			if (!(_data_->_tmp8_ < _data_->_tmp9_)) {
				break;
			}
			_data_->_tmp10_ = _data_->_response_list;
			_data_->_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp10_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp11_;
			{
				_data_->_tmp12_ = _data_->response;
				_data_->_tmp13_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp12_);
				_data_->_propstat_list = _data_->_tmp13_;
				_data_->_tmp14_ = _data_->_propstat_list;
				_data_->_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp14_);
				_data_->_tmp16_ = _data_->_tmp15_;
				_data_->_propstat_size = _data_->_tmp16_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp17_ = _data_->_propstat_index;
					_data_->_tmp18_ = _data_->_propstat_size;
					if (!(_data_->_tmp17_ < _data_->_tmp18_)) {
						break;
					}
					_data_->_tmp19_ = _data_->_propstat_list;
					_data_->_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp19_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp20_;
					_data_->_tmp21_ = _data_->propstat;
					_data_->_tmp22_ = services_cal_dav_web_dav_prop_stat_get_prop (_data_->_tmp21_);
					_data_->_tmp23_ = _data_->_tmp22_;
					_data_->_tmp24_ = _g_object_ref0 (_data_->_tmp23_);
					_data_->prop = _data_->_tmp24_;
					_data_->_tmp25_ = _data_->prop;
					_data_->_tmp26_ = gxml_dom_element_get_elements_by_tag_name (_data_->_tmp25_, "displayname");
					_data_->names = _data_->_tmp26_;
					_data_->_tmp27_ = _data_->names;
					_data_->_tmp28_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp27_);
					_data_->_tmp29_ = _data_->_tmp28_;
					if (_data_->_tmp29_ > 0) {
						_data_->_tmp30_ = objects_source_get_caldav_data (_data_->source);
						_data_->_tmp31_ = _data_->_tmp30_;
						_data_->_tmp32_ = _data_->names;
						_data_->_tmp33_ = gee_list_get ((GeeList*) _data_->_tmp32_, 0);
						_data_->_tmp34_ = (GXmlDomElement*) _data_->_tmp33_;
						_data_->_tmp35_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp34_);
						_data_->_tmp36_ = _data_->_tmp35_;
						_data_->_tmp37_ = _data_->_tmp36_;
						_data_->_tmp38_ = string_strip (_data_->_tmp37_);
						_data_->_tmp39_ = _data_->_tmp38_;
						objects_source_cal_dav_data_set_user_displayname (_data_->_tmp31_, _data_->_tmp39_);
						_g_free0 (_data_->_tmp39_);
						_g_free0 (_data_->_tmp37_);
						_g_object_unref0 (_data_->_tmp34_);
					}
					_data_->_tmp40_ = _data_->prop;
					_data_->_tmp41_ = gxml_dom_element_get_elements_by_tag_name (_data_->_tmp40_, "email-address");
					_data_->emails = _data_->_tmp41_;
					_data_->_tmp42_ = _data_->emails;
					_data_->_tmp43_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp42_);
					_data_->_tmp44_ = _data_->_tmp43_;
					if (_data_->_tmp44_ > 0) {
						_data_->_tmp45_ = objects_source_get_caldav_data (_data_->source);
						_data_->_tmp46_ = _data_->_tmp45_;
						_data_->_tmp47_ = _data_->emails;
						_data_->_tmp48_ = gee_list_get ((GeeList*) _data_->_tmp47_, 0);
						_data_->_tmp49_ = (GXmlDomElement*) _data_->_tmp48_;
						_data_->_tmp50_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp49_);
						_data_->_tmp51_ = _data_->_tmp50_;
						_data_->_tmp52_ = _data_->_tmp51_;
						_data_->_tmp53_ = string_strip (_data_->_tmp52_);
						_data_->_tmp54_ = _data_->_tmp53_;
						objects_source_cal_dav_data_set_user_email (_data_->_tmp46_, _data_->_tmp54_);
						_g_free0 (_data_->_tmp54_);
						_g_free0 (_data_->_tmp52_);
						_g_object_unref0 (_data_->_tmp49_);
					}
					_g_object_unref0 (_data_->emails);
					_g_object_unref0 (_data_->names);
					_g_object_unref0 (_data_->prop);
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->_tmp56_ = objects_source_get_caldav_data (_data_->source);
	_data_->_tmp57_ = _data_->_tmp56_;
	_data_->_tmp58_ = objects_source_cal_dav_data_get_user_email (_data_->_tmp57_);
	_data_->_tmp59_ = _data_->_tmp58_;
	if (_data_->_tmp59_ != NULL) {
		_data_->_tmp60_ = objects_source_get_caldav_data (_data_->source);
		_data_->_tmp61_ = _data_->_tmp60_;
		_data_->_tmp62_ = objects_source_cal_dav_data_get_user_email (_data_->_tmp61_);
		_data_->_tmp63_ = _data_->_tmp62_;
		_data_->_tmp55_ = g_strcmp0 (_data_->_tmp63_, "") != 0;
	} else {
		_data_->_tmp55_ = FALSE;
	}
	if (_data_->_tmp55_) {
		_data_->_tmp64_ = objects_source_get_caldav_data (_data_->source);
		_data_->_tmp65_ = _data_->_tmp64_;
		_data_->_tmp66_ = objects_source_cal_dav_data_get_user_email (_data_->_tmp65_);
		_data_->_tmp67_ = _data_->_tmp66_;
		objects_source_set_display_name (_data_->source, _data_->_tmp67_);
		_g_object_unref0 (_data_->multi_status);
		_g_free0 (_data_->xml);
		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_->_tmp69_ = objects_source_get_caldav_data (_data_->source);
	_data_->_tmp70_ = _data_->_tmp69_;
	_data_->_tmp71_ = objects_source_cal_dav_data_get_user_displayname (_data_->_tmp70_);
	_data_->_tmp72_ = _data_->_tmp71_;
	if (_data_->_tmp72_ != NULL) {
		_data_->_tmp73_ = objects_source_get_caldav_data (_data_->source);
		_data_->_tmp74_ = _data_->_tmp73_;
		_data_->_tmp75_ = objects_source_cal_dav_data_get_user_displayname (_data_->_tmp74_);
		_data_->_tmp76_ = _data_->_tmp75_;
		_data_->_tmp68_ = g_strcmp0 (_data_->_tmp76_, "") != 0;
	} else {
		_data_->_tmp68_ = FALSE;
	}
	if (_data_->_tmp68_) {
		_data_->_tmp77_ = objects_source_get_caldav_data (_data_->source);
		_data_->_tmp78_ = _data_->_tmp77_;
		_data_->_tmp79_ = objects_source_cal_dav_data_get_user_displayname (_data_->_tmp78_);
		_data_->_tmp80_ = _data_->_tmp79_;
		objects_source_set_display_name (_data_->source, _data_->_tmp80_);
		_g_object_unref0 (_data_->multi_status);
		_g_free0 (_data_->xml);
		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;
	}
	objects_source_set_display_name (_data_->source, _ ("CalDAV"));
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_fetch_project_list_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientFetchProjectListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->source);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientFetchProjectListData, _data_);
}

void
services_cal_dav_cal_dav_client_fetch_project_list (ServicesCalDAVCalDAVClient* self,
                                                    ObjectsSource* source,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	ServicesCalDavCalDavClientFetchProjectListData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsSource* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientFetchProjectListData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_fetch_project_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_fetch_project_list_co (_data_);
}

GeeArrayList*
services_cal_dav_cal_dav_client_fetch_project_list_finish (ServicesCalDAVCalDAVClient* self,
                                                           GAsyncResult* _res_,
                                                           GError** error)
{
	GeeArrayList* result;
	ServicesCalDavCalDavClientFetchProjectListData* _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
services_cal_dav_cal_dav_client_fetch_project_list_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_)
{
	ServicesCalDavCalDavClientFetchProjectListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_fetch_project_list_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_fetch_project_list_co (ServicesCalDavCalDavClientFetchProjectListData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Fetching project list");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version='1.0' encoding='utf-8'?>\n" \
"                    <d:propfind xmlns:d=\"DAV:\" xmlns:ical=\"http://a" \
"pple.com/ns/ical/\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\">\n" \
"                        <d:prop>\n" \
"                            <d:resourcetype />\n" \
"                            <d:displayname />\n" \
"                            <d:sync-token />\n" \
"                            <ical:calendar-color />\n" \
"                            <cal:supported-calendar-component-set />\n" \
"                        </d:prop>\n" \
"                    </d:propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = objects_source_get_caldav_data (_data_->source);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = objects_source_cal_dav_data_get_calendar_home_url (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp6_, _data_->xml, "1", _data_->cancellable, services_cal_dav_cal_dav_client_fetch_project_list_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp7_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = gee_array_list_new (OBJECTS_TYPE_PROJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->projects = _data_->_tmp8_;
	{
		_data_->_tmp9_ = services_cal_dav_web_dav_multi_status_responses (_data_->multi_status);
		_data_->_response_list = _data_->_tmp9_;
		_data_->_tmp10_ = _data_->_response_list;
		_data_->_tmp11_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_response_size = _data_->_tmp12_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp13_ = _data_->_response_index;
			_data_->_tmp14_ = _data_->_response_size;
			if (!(_data_->_tmp13_ < _data_->_tmp14_)) {
				break;
			}
			_data_->_tmp15_ = _data_->_response_list;
			_data_->_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp15_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp16_;
			_data_->_tmp17_ = _data_->response;
			_data_->_tmp18_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp20_ = g_strdup (_data_->_tmp19_);
			_data_->href = _data_->_tmp20_;
			{
				_data_->_tmp21_ = _data_->response;
				_data_->_tmp22_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp21_);
				_data_->_propstat_list = _data_->_tmp22_;
				_data_->_tmp23_ = _data_->_propstat_list;
				_data_->_tmp24_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp23_);
				_data_->_tmp25_ = _data_->_tmp24_;
				_data_->_propstat_size = _data_->_tmp25_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp26_ = _data_->_propstat_index;
					_data_->_tmp27_ = _data_->_propstat_size;
					if (!(_data_->_tmp26_ < _data_->_tmp27_)) {
						break;
					}
					_data_->_tmp28_ = _data_->_propstat_list;
					_data_->_tmp29_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp28_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp29_;
					_data_->_tmp30_ = _data_->propstat;
					_data_->_tmp31_ = services_cal_dav_web_dav_prop_stat_get_status (_data_->_tmp30_);
					_data_->_tmp32_ = _data_->_tmp31_;
					if (_data_->_tmp32_ != SOUP_STATUS_OK) {
						_g_object_unref0 (_data_->propstat);
						continue;
					}
					_data_->_tmp33_ = _data_->propstat;
					_data_->_tmp34_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp33_, "resourcetype");
					_data_->resourcetype = _data_->_tmp34_;
					_data_->_tmp35_ = _data_->propstat;
					_data_->_tmp36_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp35_, "supported-calendar-component-set");
					_data_->supported_calendar = _data_->_tmp36_;
					_data_->_tmp37_ = _data_->resourcetype;
					_data_->_tmp38_ = _data_->supported_calendar;
					if (services_cal_dav_cal_dav_client_is_vtodo_calendar (_data_->self, _data_->_tmp37_, _data_->_tmp38_)) {
						_data_->_tmp39_ = _data_->propstat;
						_data_->_tmp40_ = _data_->href;
						_data_->_tmp41_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp40_);
						_data_->_tmp42_ = _data_->_tmp41_;
						_data_->_tmp43_ = objects_project_new_from_propstat (_data_->_tmp39_, _data_->_tmp42_);
						_data_->_tmp44_ = _data_->_tmp43_;
						_g_free0 (_data_->_tmp42_);
						_data_->project = _data_->_tmp44_;
						_data_->_tmp45_ = _data_->project;
						_data_->_tmp46_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->source);
						_data_->_tmp47_ = _data_->_tmp46_;
						objects_project_set_source_id (_data_->_tmp45_, _data_->_tmp47_);
						_data_->_tmp48_ = _data_->projects;
						_data_->_tmp49_ = _data_->project;
						gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp48_, _data_->_tmp49_);
						_g_object_unref0 (_data_->project);
					}
					_g_object_unref0 (_data_->supported_calendar);
					_g_object_unref0 (_data_->resourcetype);
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_free0 (_data_->href);
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->result = _data_->projects;
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_sync_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientSyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->source);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientSyncData, _data_);
}

void
services_cal_dav_cal_dav_client_sync (ServicesCalDAVCalDAVClient* self,
                                      ObjectsSource* source,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	ServicesCalDavCalDavClientSyncData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsSource* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientSyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_sync_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_sync_co (_data_);
}

void
services_cal_dav_cal_dav_client_sync_finish (ServicesCalDAVCalDAVClient* self,
                                             GAsyncResult* _res_,
                                             GError** error)
{
	ServicesCalDavCalDavClientSyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
services_cal_dav_cal_dav_client_sync_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	ServicesCalDavCalDavClientSyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_sync_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_sync_co (ServicesCalDavCalDavClientSyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Syncing project list");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version='1.0' encoding='utf-8'?>\n" \
"                    <d:propfind xmlns:d=\"DAV:\" xmlns:ical=\"http://a" \
"pple.com/ns/ical/\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\" xmlns:" \
"nc=\"http://nextcloud.com/ns\">\n" \
"                        <d:prop>\n" \
"                            <d:resourcetype />\n" \
"                            <d:displayname />\n" \
"                            <d:sync-token />\n" \
"                            <ical:calendar-color />\n" \
"                            <cal:supported-calendar-component-set />\n" \
"                            <nc:deleted-at/>\n" \
"                        </d:prop>\n" \
"                    </d:propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = objects_source_get_caldav_data (_data_->source);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = objects_source_cal_dav_data_get_calendar_home_url (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->xml;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp6_, _data_->_tmp7_, "1", _data_->cancellable, services_cal_dav_cal_dav_client_sync_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp8_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp8_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp9_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->server_urls = _data_->_tmp9_;
	{
		_data_->_tmp10_ = _data_->multi_status;
		_data_->_tmp11_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp10_);
		_data_->_response_list = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->_response_list;
		_data_->_tmp13_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_response_size = _data_->_tmp14_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp15_ = _data_->_response_index;
			_data_->_tmp16_ = _data_->_response_size;
			if (!(_data_->_tmp15_ < _data_->_tmp16_)) {
				break;
			}
			_data_->_tmp17_ = _data_->_response_list;
			_data_->_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp17_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp18_;
			_data_->_tmp19_ = _data_->response;
			_data_->_tmp20_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp19_);
			_data_->_tmp21_ = _data_->_tmp20_;
			if (_data_->_tmp21_ != NULL) {
				_data_->_tmp22_ = _data_->server_urls;
				_data_->_tmp23_ = _data_->response;
				_data_->_tmp24_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp23_);
				_data_->_tmp25_ = _data_->_tmp24_;
				_data_->_tmp26_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp25_);
				_data_->_tmp27_ = _data_->_tmp26_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp22_, _data_->_tmp27_);
				_g_free0 (_data_->_tmp27_);
			}
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->_tmp28_ = services_store_instance ();
	_data_->_tmp29_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->source);
	_data_->_tmp30_ = _data_->_tmp29_;
	_data_->_tmp31_ = services_store_get_projects_by_source (_data_->_tmp28_, _data_->_tmp30_);
	_data_->local_projects = _data_->_tmp31_;
	{
		_data_->_tmp32_ = _data_->local_projects;
		_data_->_local_project_list = _data_->_tmp32_;
		_data_->_tmp33_ = _data_->_local_project_list;
		_data_->_tmp34_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp33_);
		_data_->_tmp35_ = _data_->_tmp34_;
		_data_->_local_project_size = _data_->_tmp35_;
		_data_->_local_project_index = -1;
		while (TRUE) {
			_data_->_local_project_index = _data_->_local_project_index + 1;
			_data_->_tmp36_ = _data_->_local_project_index;
			_data_->_tmp37_ = _data_->_local_project_size;
			if (!(_data_->_tmp36_ < _data_->_tmp37_)) {
				break;
			}
			_data_->_tmp38_ = _data_->_local_project_list;
			_data_->_tmp39_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp38_, _data_->_local_project_index);
			_data_->local_project = (ObjectsProject*) _data_->_tmp39_;
			_data_->_tmp40_ = _data_->server_urls;
			_data_->_tmp41_ = _data_->local_project;
			_data_->_tmp42_ = objects_project_get_calendar_url (_data_->_tmp41_);
			_data_->_tmp43_ = _data_->_tmp42_;
			if (!gee_abstract_collection_contains ((GeeAbstractCollection*) _data_->_tmp40_, _data_->_tmp43_)) {
				_data_->_tmp44_ = services_store_instance ();
				_data_->_tmp45_ = _data_->local_project;
				services_store_delete_project (_data_->_tmp44_, _data_->_tmp45_, NULL, NULL);
			}
			_g_object_unref0 (_data_->local_project);
		}
	}
	{
		_data_->_tmp46_ = _data_->multi_status;
		_data_->_tmp47_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp46_);
		_data_->_vala1__response_list = _data_->_tmp47_;
		_data_->_tmp48_ = _data_->_vala1__response_list;
		_data_->_tmp49_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp48_);
		_data_->_tmp50_ = _data_->_tmp49_;
		_data_->_vala1__response_size = _data_->_tmp50_;
		_data_->_vala1__response_index = -1;
		while (TRUE) {
			_data_->_vala1__response_index = _data_->_vala1__response_index + 1;
			_data_->_tmp51_ = _data_->_vala1__response_index;
			_data_->_tmp52_ = _data_->_vala1__response_size;
			if (!(_data_->_tmp51_ < _data_->_tmp52_)) {
				break;
			}
			_data_->_tmp53_ = _data_->_vala1__response_list;
			_data_->_tmp54_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp53_, _data_->_vala1__response_index);
			_data_->_vala1_response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp54_;
			_data_->_tmp55_ = _data_->_vala1_response;
			_data_->_tmp56_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp55_);
			_data_->_tmp57_ = _data_->_tmp56_;
			_data_->_tmp58_ = g_strdup (_data_->_tmp57_);
			_data_->href = _data_->_tmp58_;
			{
				_data_->_tmp59_ = _data_->_vala1_response;
				_data_->_tmp60_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp59_);
				_data_->_propstat_list = _data_->_tmp60_;
				_data_->_tmp61_ = _data_->_propstat_list;
				_data_->_tmp62_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp61_);
				_data_->_tmp63_ = _data_->_tmp62_;
				_data_->_propstat_size = _data_->_tmp63_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp64_ = _data_->_propstat_index;
					_data_->_tmp65_ = _data_->_propstat_size;
					if (!(_data_->_tmp64_ < _data_->_tmp65_)) {
						break;
					}
					_data_->_tmp66_ = _data_->_propstat_list;
					_data_->_tmp67_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp66_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp67_;
					_data_->_tmp68_ = _data_->propstat;
					_data_->_tmp69_ = services_cal_dav_web_dav_prop_stat_get_status (_data_->_tmp68_);
					_data_->_tmp70_ = _data_->_tmp69_;
					if (_data_->_tmp70_ != SOUP_STATUS_OK) {
						_g_object_unref0 (_data_->propstat);
						continue;
					}
					_data_->_tmp71_ = _data_->propstat;
					_data_->_tmp72_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp71_, "resourcetype");
					_data_->resourcetype = _data_->_tmp72_;
					_data_->_tmp73_ = _data_->propstat;
					_data_->_tmp74_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp73_, "supported-calendar-component-set");
					_data_->supported_calendar = _data_->_tmp74_;
					_data_->_tmp75_ = _data_->resourcetype;
					if (services_cal_dav_cal_dav_client_is_deleted_calendar (_data_->self, _data_->_tmp75_)) {
						_data_->_tmp76_ = services_log_service_get_default ();
						_data_->_tmp77_ = _data_->_tmp76_;
						services_log_service_info (_data_->_tmp77_, "CalDAV", "Removing deleted calendar from server");
						_g_object_unref0 (_data_->_tmp77_);
						_data_->_tmp78_ = services_store_instance ();
						_data_->_tmp79_ = _data_->href;
						_data_->_tmp80_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp79_);
						_data_->_tmp81_ = _data_->_tmp80_;
						_data_->_tmp82_ = services_store_get_project_via_url (_data_->_tmp78_, _data_->_tmp81_);
						_data_->_tmp83_ = _data_->_tmp82_;
						_g_free0 (_data_->_tmp81_);
						_data_->project = _data_->_tmp83_;
						_data_->_tmp84_ = _data_->project;
						if (_data_->_tmp84_ != NULL) {
							_data_->_tmp85_ = services_store_instance ();
							_data_->_tmp86_ = _data_->project;
							services_store_delete_project (_data_->_tmp85_, _data_->_tmp86_, NULL, NULL);
						}
						_g_object_unref0 (_data_->project);
						_g_object_unref0 (_data_->supported_calendar);
						_g_object_unref0 (_data_->resourcetype);
						_g_object_unref0 (_data_->propstat);
						continue;
					}
					_data_->_tmp87_ = _data_->resourcetype;
					_data_->_tmp88_ = _data_->supported_calendar;
					if (services_cal_dav_cal_dav_client_is_vtodo_calendar (_data_->self, _data_->_tmp87_, _data_->_tmp88_)) {
						_data_->_tmp89_ = _data_->propstat;
						_data_->_tmp90_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp89_, "displayname");
						_data_->name = _data_->_tmp90_;
						_data_->_tmp92_ = _data_->href;
						if (_data_->_tmp92_ != NULL) {
							_data_->_tmp93_ = _data_->name;
							_data_->_tmp91_ = _data_->_tmp93_ != NULL;
						} else {
							_data_->_tmp91_ = FALSE;
						}
						if (_data_->_tmp91_) {
							_data_->_tmp94_ = services_store_instance ();
							_data_->_tmp95_ = _data_->href;
							_data_->_tmp96_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp95_);
							_data_->_tmp97_ = _data_->_tmp96_;
							_data_->_tmp98_ = services_store_get_project_via_url (_data_->_tmp94_, _data_->_tmp97_);
							_data_->_tmp99_ = _data_->_tmp98_;
							_g_free0 (_data_->_tmp97_);
							_data_->_vala1_project = _data_->_tmp99_;
							_data_->_tmp100_ = _data_->_vala1_project;
							if (_data_->_tmp100_ == NULL) {
								_data_->_tmp101_ = services_log_service_get_default ();
								_data_->_tmp102_ = _data_->_tmp101_;
								services_log_service_info (_data_->_tmp102_, "CalDAV", "Discovered new project, fetching items");
								_g_object_unref0 (_data_->_tmp102_);
								_data_->_tmp103_ = _data_->propstat;
								_data_->_tmp104_ = _data_->href;
								_data_->_tmp105_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp104_);
								_data_->_tmp106_ = _data_->_tmp105_;
								_data_->_tmp107_ = objects_project_new_from_propstat (_data_->_tmp103_, _data_->_tmp106_);
								_g_object_unref0 (_data_->_vala1_project);
								_data_->_vala1_project = _data_->_tmp107_;
								_g_free0 (_data_->_tmp106_);
								_data_->_tmp108_ = _data_->_vala1_project;
								_data_->_tmp109_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->source);
								_data_->_tmp110_ = _data_->_tmp109_;
								objects_project_set_source_id (_data_->_tmp108_, _data_->_tmp110_);
								_data_->_tmp111_ = services_store_instance ();
								_data_->_tmp112_ = _data_->_vala1_project;
								services_store_insert_project (_data_->_tmp111_, _data_->_tmp112_);
								_data_->_tmp113_ = _data_->_vala1_project;
								_data_->_state_ = 2;
								services_cal_dav_cal_dav_client_fetch_items_for_project (_data_->self, _data_->_tmp113_, _data_->cancellable, NULL, NULL, NULL, services_cal_dav_cal_dav_client_sync_ready, _data_);
								return FALSE;
								_state_2:
								services_cal_dav_cal_dav_client_fetch_items_for_project_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
								if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
									g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
									_g_object_unref0 (_data_->_vala1_project);
									_g_object_unref0 (_data_->name);
									_g_object_unref0 (_data_->supported_calendar);
									_g_object_unref0 (_data_->resourcetype);
									_g_object_unref0 (_data_->propstat);
									_g_object_unref0 (_data_->_propstat_list);
									_g_free0 (_data_->href);
									_g_object_unref0 (_data_->_vala1_response);
									_g_object_unref0 (_data_->_vala1__response_list);
									_g_object_unref0 (_data_->local_projects);
									_g_object_unref0 (_data_->server_urls);
									_g_object_unref0 (_data_->multi_status);
									_g_free0 (_data_->xml);
									g_object_unref (_data_->_async_result);
									return FALSE;
								}
							} else {
								_data_->_tmp114_ = _data_->_vala1_project;
								_data_->_tmp115_ = _data_->propstat;
								objects_project_update_from_propstat (_data_->_tmp114_, _data_->_tmp115_, FALSE);
								_data_->_tmp116_ = services_store_instance ();
								_data_->_tmp117_ = _data_->_vala1_project;
								services_store_update_project (_data_->_tmp116_, _data_->_tmp117_);
							}
							_g_object_unref0 (_data_->_vala1_project);
						}
						_g_object_unref0 (_data_->name);
					}
					_g_object_unref0 (_data_->supported_calendar);
					_g_object_unref0 (_data_->resourcetype);
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_free0 (_data_->href);
			_g_object_unref0 (_data_->_vala1_response);
		}
		_g_object_unref0 (_data_->_vala1__response_list);
	}
	_g_object_unref0 (_data_->local_projects);
	_g_object_unref0 (_data_->server_urls);
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_fetch_project_details_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientFetchProjectDetailsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientFetchProjectDetailsData, _data_);
}

void
services_cal_dav_cal_dav_client_fetch_project_details (ServicesCalDAVCalDAVClient* self,
                                                       ObjectsProject* project,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	ServicesCalDavCalDavClientFetchProjectDetailsData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientFetchProjectDetailsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_fetch_project_details_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_fetch_project_details_co (_data_);
}

void
services_cal_dav_cal_dav_client_fetch_project_details_finish (ServicesCalDAVCalDAVClient* self,
                                                              GAsyncResult* _res_,
                                                              GError** error)
{
	ServicesCalDavCalDavClientFetchProjectDetailsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
services_cal_dav_cal_dav_client_fetch_project_details_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	ServicesCalDavCalDavClientFetchProjectDetailsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_fetch_project_details_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_fetch_project_details_co (ServicesCalDavCalDavClientFetchProjectDetailsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_debug (_data_->_tmp1_, "CalDAV", "Fetching project details");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version='1.0' encoding='utf-8'?>\n" \
"                    <d:propfind xmlns:d=\"DAV:\" xmlns:ical=\"http://a" \
"pple.com/ns/ical/\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\">\n" \
"                        <d:prop>\n" \
"                            <d:resourcetype />\n" \
"                            <d:displayname />\n" \
"                            <d:sync-token />\n" \
"                            <ical:calendar-color />\n" \
"                            <cal:supported-calendar-component-set />\n" \
"                        </d:prop>\n" \
"                    </d:propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = objects_project_get_calendar_url (_data_->project);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _data_->xml;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp4_, _data_->_tmp5_, "1", _data_->cancellable, services_cal_dav_cal_dav_client_fetch_project_details_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp6_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp6_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp7_ = _data_->multi_status;
		_data_->_tmp8_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp7_);
		_data_->_response_list = _data_->_tmp8_;
		_data_->_tmp9_ = _data_->_response_list;
		_data_->_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp9_);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_response_size = _data_->_tmp11_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp12_ = _data_->_response_index;
			_data_->_tmp13_ = _data_->_response_size;
			if (!(_data_->_tmp12_ < _data_->_tmp13_)) {
				break;
			}
			_data_->_tmp14_ = _data_->_response_list;
			_data_->_tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp14_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp15_;
			{
				_data_->_tmp16_ = _data_->response;
				_data_->_tmp17_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp16_);
				_data_->_propstat_list = _data_->_tmp17_;
				_data_->_tmp18_ = _data_->_propstat_list;
				_data_->_tmp19_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp18_);
				_data_->_tmp20_ = _data_->_tmp19_;
				_data_->_propstat_size = _data_->_tmp20_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp21_ = _data_->_propstat_index;
					_data_->_tmp22_ = _data_->_propstat_size;
					if (!(_data_->_tmp21_ < _data_->_tmp22_)) {
						break;
					}
					_data_->_tmp23_ = _data_->_propstat_list;
					_data_->_tmp24_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp23_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp24_;
					_data_->_tmp25_ = _data_->propstat;
					_data_->_tmp26_ = services_cal_dav_web_dav_prop_stat_get_status (_data_->_tmp25_);
					_data_->_tmp27_ = _data_->_tmp26_;
					if (_data_->_tmp27_ != SOUP_STATUS_OK) {
						_g_object_unref0 (_data_->propstat);
						continue;
					}
					_data_->_tmp28_ = _data_->propstat;
					_data_->_tmp29_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp28_, "resourcetype");
					_data_->resourcetype = _data_->_tmp29_;
					_data_->_tmp30_ = _data_->propstat;
					_data_->_tmp31_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp30_, "supported-calendar-component-set");
					_data_->supported_calendar = _data_->_tmp31_;
					_data_->_tmp32_ = _data_->resourcetype;
					_data_->_tmp33_ = _data_->supported_calendar;
					if (services_cal_dav_cal_dav_client_is_vtodo_calendar (_data_->self, _data_->_tmp32_, _data_->_tmp33_)) {
						_data_->_tmp34_ = _data_->propstat;
						objects_project_update_from_propstat (_data_->project, _data_->_tmp34_, FALSE);
						_data_->_tmp35_ = services_store_instance ();
						services_store_update_project (_data_->_tmp35_, _data_->project);
						_g_object_unref0 (_data_->supported_calendar);
						_g_object_unref0 (_data_->resourcetype);
						_g_object_unref0 (_data_->propstat);
						_g_object_unref0 (_data_->_propstat_list);
						_g_object_unref0 (_data_->response);
						_g_object_unref0 (_data_->_response_list);
						_g_object_unref0 (_data_->multi_status);
						_g_free0 (_data_->xml);
						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_->supported_calendar);
					_g_object_unref0 (_data_->resourcetype);
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_fetch_items_for_project_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientFetchItemsForProjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientFetchItemsForProjectData, _data_);
}

void
services_cal_dav_cal_dav_client_fetch_items_for_project (ServicesCalDAVCalDAVClient* self,
                                                         ObjectsProject* project,
                                                         GCancellable* cancellable,
                                                         ServicesCalDAVCalDAVClientProgressCallback progress_callback,
                                                         gpointer progress_callback_target,
                                                         GDestroyNotify progress_callback_target_destroy_notify,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_)
{
	ServicesCalDavCalDavClientFetchItemsForProjectData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientFetchItemsForProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_fetch_items_for_project_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	(_data_->progress_callback_target_destroy_notify == NULL) ? NULL : (_data_->progress_callback_target_destroy_notify (_data_->progress_callback_target), NULL);
	_data_->progress_callback = NULL;
	_data_->progress_callback_target = NULL;
	_data_->progress_callback_target_destroy_notify = NULL;
	_data_->progress_callback = progress_callback;
	_data_->progress_callback_target = progress_callback_target;
	_data_->progress_callback_target_destroy_notify = progress_callback_target_destroy_notify;
	services_cal_dav_cal_dav_client_fetch_items_for_project_co (_data_);
}

void
services_cal_dav_cal_dav_client_fetch_items_for_project_finish (ServicesCalDAVCalDAVClient* self,
                                                                GAsyncResult* _res_,
                                                                GError** error)
{
	ServicesCalDavCalDavClientFetchItemsForProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		ServicesCalDAVCalDAVClient* self;
		self = _data14_->self;
		_g_object_unref0 (_data14_->items_list);
		_g_object_unref0 (_data14_->responses);
		(_data14_->callback_target_destroy_notify == NULL) ? NULL : (_data14_->callback_target_destroy_notify (_data14_->callback_target), NULL);
		_data14_->callback = NULL;
		_data14_->callback_target = NULL;
		_data14_->callback_target_destroy_notify = NULL;
		_g_object_unref0 (_data14_->project);
		_g_object_unref0 (_data14_->cancellable);
		(_data14_->progress_callback_target_destroy_notify == NULL) ? NULL : (_data14_->progress_callback_target_destroy_notify (_data14_->progress_callback_target), NULL);
		_data14_->progress_callback = NULL;
		_data14_->progress_callback_target = NULL;
		_data14_->progress_callback_target_destroy_notify = NULL;
		_g_object_unref0 (self);
		g_slice_free (Block14Data, _data14_);
	}
}

static gboolean
_services_cal_dav_cal_dav_client_fetch_items_for_project_co_gsource_func (gpointer self)
{
	gboolean result;
	result = services_cal_dav_cal_dav_client_fetch_items_for_project_co (self);
	return result;
}

static void
services_cal_dav_cal_dav_client_fetch_items_for_project_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_)
{
	ServicesCalDavCalDavClientFetchItemsForProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_fetch_items_for_project_co (_data_);
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gboolean
__lambda34_ (Block14Data* _data14_)
{
	ServicesCalDAVCalDAVClient* self;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	ServicesCalDAVWebDAVResponse* response = NULL;
	GeeArrayList* _tmp15_;
	gpointer _tmp16_;
	gchar* href = NULL;
	ServicesCalDAVWebDAVResponse* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gboolean _tmp97_ = FALSE;
	gint _tmp106_;
	GeeArrayList* _tmp107_;
	gint _tmp108_;
	gint _tmp109_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = _data14_->self;
	_tmp0_ = _data14_->responses;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_data14_->index >= _tmp2_) {
		GeeArrayList* _tmp13_;
		GSourceFunc _tmp14_;
		gpointer _tmp14__target;
		GDestroyNotify _tmp14__target_destroy_notify;
		if (_data14_->progress_callback != NULL) {
			GeeArrayList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			GeeArrayList* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			_tmp3_ = _data14_->responses;
			_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = _data14_->responses;
			_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = objects_base_object_get_name ((ObjectsBaseObject*) _data14_->project);
			_tmp10_ = _tmp9_;
			_tmp11_ = g_strdup_printf (_ ("Loaded tasks for %s…"), _tmp10_);
			_tmp12_ = _tmp11_;
			_data14_->progress_callback (_tmp5_, _tmp8_, _tmp12_, _data14_->progress_callback_target);
			_g_free0 (_tmp12_);
		}
		_tmp13_ = _data14_->items_list;
		objects_project_add_items_batched (_data14_->project, _tmp13_);
		_tmp14_ = _data14_->callback;
		_tmp14__target = _data14_->callback_target;
		_tmp14__target_destroy_notify = _data14_->callback_target_destroy_notify;
		_data14_->callback = NULL;
		_data14_->callback_target = NULL;
		_data14_->callback_target_destroy_notify = NULL;
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp14_, _tmp14__target, _tmp14__target_destroy_notify);
		result = FALSE;
		return result;
	}
	_tmp15_ = _data14_->responses;
	_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, _data14_->index);
	response = (ServicesCalDAVWebDAVResponse*) _tmp16_;
	_tmp17_ = response;
	_tmp18_ = services_cal_dav_web_dav_response_get_href (_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strdup (_tmp19_);
	href = _tmp20_;
	{
		GeeArrayList* _propstat_list = NULL;
		ServicesCalDAVWebDAVResponse* _tmp21_;
		GeeArrayList* _tmp22_;
		gint _propstat_size = 0;
		GeeArrayList* _tmp23_;
		gint _tmp24_;
		gint _tmp25_;
		gint _propstat_index = 0;
		_tmp21_ = response;
		_tmp22_ = services_cal_dav_web_dav_response_propstats (_tmp21_);
		_propstat_list = _tmp22_;
		_tmp23_ = _propstat_list;
		_tmp24_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp23_);
		_tmp25_ = _tmp24_;
		_propstat_size = _tmp25_;
		_propstat_index = -1;
		while (TRUE) {
			gint _tmp26_;
			gint _tmp27_;
			ServicesCalDAVWebDAVPropStat* propstat = NULL;
			GeeArrayList* _tmp28_;
			gpointer _tmp29_;
			ServicesCalDAVWebDAVPropStat* _tmp30_;
			SoupStatus _tmp31_;
			SoupStatus _tmp32_;
			GXmlDomElement* calendar_data = NULL;
			ServicesCalDAVWebDAVPropStat* _tmp33_;
			GXmlDomElement* _tmp34_;
			GXmlDomElement* _tmp35_;
			gchar* vtodo_content = NULL;
			GXmlDomElement* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			const gchar* _tmp41_;
			GXmlDomElement* getetag = NULL;
			ServicesCalDAVWebDAVPropStat* _tmp80_;
			GXmlDomElement* _tmp81_;
			gchar* _tmp82_ = NULL;
			GXmlDomElement* _tmp83_;
			gchar* etag = NULL;
			gchar* _tmp90_;
			gchar* resource_url = NULL;
			const gchar* _tmp91_;
			gchar* _tmp92_;
			const gchar* _tmp93_;
			const gchar* _tmp94_;
			const gchar* _tmp95_;
			GeeArrayList* _tmp96_;
			_propstat_index = _propstat_index + 1;
			_tmp26_ = _propstat_index;
			_tmp27_ = _propstat_size;
			if (!(_tmp26_ < _tmp27_)) {
				break;
			}
			_tmp28_ = _propstat_list;
			_tmp29_ = gee_abstract_list_get ((GeeAbstractList*) _tmp28_, _propstat_index);
			propstat = (ServicesCalDAVWebDAVPropStat*) _tmp29_;
			_tmp30_ = propstat;
			_tmp31_ = services_cal_dav_web_dav_prop_stat_get_status (_tmp30_);
			_tmp32_ = _tmp31_;
			if (_tmp32_ != SOUP_STATUS_OK) {
				_g_object_unref0 (propstat);
				continue;
			}
			_tmp33_ = propstat;
			_tmp34_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_tmp33_, "calendar-data");
			calendar_data = _tmp34_;
			_tmp35_ = calendar_data;
			if (_tmp35_ == NULL) {
				ServicesLogService* _tmp36_;
				ServicesLogService* _tmp37_;
				_tmp36_ = services_log_service_get_default ();
				_tmp37_ = _tmp36_;
				services_log_service_warn (_tmp37_, "CalDAV", "calendar_data is null");
				_g_object_unref0 (_tmp37_);
				_g_object_unref0 (calendar_data);
				_g_object_unref0 (propstat);
				continue;
			}
			_tmp38_ = calendar_data;
			_tmp39_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _tmp38_);
			_tmp40_ = _tmp39_;
			vtodo_content = _tmp40_;
			_tmp41_ = vtodo_content;
			if (_tmp41_ == NULL) {
				ServicesLogService* _tmp42_;
				ServicesLogService* _tmp43_;
				gchar* temp_vtodo = NULL;
				GXmlDomElement* _tmp44_;
				gchar* _tmp45_;
				gint cdata_start = 0;
				const gchar* _tmp47_;
				gint cdata_end = 0;
				const gchar* _tmp53_;
				gint content_start = 0;
				gint content_length = 0;
				gboolean _tmp59_ = FALSE;
				gboolean _tmp60_ = FALSE;
				const gchar* _tmp71_;
				gchar* _tmp72_;
				gchar* _tmp73_;
				gchar* _tmp74_;
				ServicesLogService* _tmp75_;
				ServicesLogService* _tmp76_;
				const gchar* _tmp77_;
				gchar* _tmp78_;
				gchar* _tmp79_;
				_tmp42_ = services_log_service_get_default ();
				_tmp43_ = _tmp42_;
				services_log_service_debug (_tmp43_, "CalDAV", "calendar_data.text_content is null, checking if data is within CDATA");
				_g_object_unref0 (_tmp43_);
				_tmp44_ = calendar_data;
				_tmp45_ = gxml_dom_element_write_string (_tmp44_, _data14_->cancellable, &_inner_error0_);
				temp_vtodo = _tmp45_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					gboolean _tmp46_ = FALSE;
					_g_free0 (vtodo_content);
					_g_object_unref0 (calendar_data);
					_g_object_unref0 (propstat);
					_g_object_unref0 (_propstat_list);
					_g_free0 (href);
					_g_object_unref0 (response);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return _tmp46_;
				}
				_tmp47_ = temp_vtodo;
				cdata_start = string_index_of (_tmp47_, "<![CDATA[", 0);
				if (cdata_start == -1) {
					ServicesLogService* _tmp48_;
					ServicesLogService* _tmp49_;
					const gchar* _tmp50_;
					gchar* _tmp51_;
					gchar* _tmp52_;
					_tmp48_ = services_log_service_get_default ();
					_tmp49_ = _tmp48_;
					_tmp50_ = temp_vtodo;
					_tmp51_ = g_strdup_printf ("No CDATA start marker found in: %s", _tmp50_);
					_tmp52_ = _tmp51_;
					services_log_service_warn (_tmp49_, "CalDAV", _tmp52_);
					_g_free0 (_tmp52_);
					_g_object_unref0 (_tmp49_);
					_g_free0 (temp_vtodo);
					_g_free0 (vtodo_content);
					_g_object_unref0 (calendar_data);
					_g_object_unref0 (propstat);
					continue;
				}
				_tmp53_ = temp_vtodo;
				cdata_end = string_index_of (_tmp53_, "]]>", cdata_start);
				if (cdata_end == -1) {
					ServicesLogService* _tmp54_;
					ServicesLogService* _tmp55_;
					const gchar* _tmp56_;
					gchar* _tmp57_;
					gchar* _tmp58_;
					_tmp54_ = services_log_service_get_default ();
					_tmp55_ = _tmp54_;
					_tmp56_ = temp_vtodo;
					_tmp57_ = g_strdup_printf ("No CDATA end marker found in: %s", _tmp56_);
					_tmp58_ = _tmp57_;
					services_log_service_warn (_tmp55_, "CalDAV", _tmp58_);
					_g_free0 (_tmp58_);
					_g_object_unref0 (_tmp55_);
					_g_free0 (temp_vtodo);
					_g_free0 (vtodo_content);
					_g_object_unref0 (calendar_data);
					_g_object_unref0 (propstat);
					continue;
				}
				content_start = cdata_start + 9;
				content_length = cdata_end - content_start;
				if (content_start < 0) {
					_tmp60_ = TRUE;
				} else {
					_tmp60_ = content_length < 0;
				}
				if (_tmp60_) {
					_tmp59_ = TRUE;
				} else {
					const gchar* _tmp61_;
					gint _tmp62_;
					gint _tmp63_;
					_tmp61_ = temp_vtodo;
					_tmp62_ = strlen (_tmp61_);
					_tmp63_ = _tmp62_;
					_tmp59_ = (content_start + content_length) > _tmp63_;
				}
				if (_tmp59_) {
					ServicesLogService* _tmp64_;
					ServicesLogService* _tmp65_;
					const gchar* _tmp66_;
					gint _tmp67_;
					gint _tmp68_;
					gchar* _tmp69_;
					gchar* _tmp70_;
					_tmp64_ = services_log_service_get_default ();
					_tmp65_ = _tmp64_;
					_tmp66_ = temp_vtodo;
					_tmp67_ = strlen (_tmp66_);
					_tmp68_ = _tmp67_;
					_tmp69_ = g_strdup_printf ("Invalid CDATA indices: start=%d, length=%d, string_length=%d", content_start, content_length, _tmp68_);
					_tmp70_ = _tmp69_;
					services_log_service_warn (_tmp65_, "CalDAV", _tmp70_);
					_g_free0 (_tmp70_);
					_g_object_unref0 (_tmp65_);
					_g_free0 (temp_vtodo);
					_g_free0 (vtodo_content);
					_g_object_unref0 (calendar_data);
					_g_object_unref0 (propstat);
					continue;
				}
				_tmp71_ = temp_vtodo;
				_tmp72_ = string_substring (_tmp71_, (glong) content_start, (glong) content_length);
				_tmp73_ = _tmp72_;
				_tmp74_ = string_strip (_tmp73_);
				_g_free0 (vtodo_content);
				vtodo_content = _tmp74_;
				_g_free0 (_tmp73_);
				_tmp75_ = services_log_service_get_default ();
				_tmp76_ = _tmp75_;
				_tmp77_ = vtodo_content;
				_tmp78_ = g_strdup_printf ("Extracted vtodo_content from CDATA: %s", _tmp77_);
				_tmp79_ = _tmp78_;
				services_log_service_debug (_tmp76_, "CalDAV", _tmp79_);
				_g_free0 (_tmp79_);
				_g_object_unref0 (_tmp76_);
				_g_free0 (temp_vtodo);
			}
			_tmp80_ = propstat;
			_tmp81_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_tmp80_, "getetag");
			getetag = _tmp81_;
			_tmp83_ = getetag;
			if (_tmp83_ != NULL) {
				GXmlDomElement* _tmp84_;
				gchar* _tmp85_;
				gchar* _tmp86_;
				gchar* _tmp87_;
				gchar* _tmp88_;
				_tmp84_ = getetag;
				_tmp85_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _tmp84_);
				_tmp86_ = _tmp85_;
				_tmp87_ = _tmp86_;
				_tmp88_ = string_strip (_tmp87_);
				_g_free0 (_tmp82_);
				_tmp82_ = _tmp88_;
				_g_free0 (_tmp87_);
			} else {
				gchar* _tmp89_;
				_tmp89_ = g_strdup ("");
				_g_free0 (_tmp82_);
				_tmp82_ = _tmp89_;
			}
			_tmp90_ = _tmp82_;
			_tmp82_ = NULL;
			etag = _tmp90_;
			_tmp91_ = href;
			_tmp92_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) self, _tmp91_);
			resource_url = _tmp92_;
			_tmp93_ = resource_url;
			_tmp94_ = etag;
			_tmp95_ = vtodo_content;
			_tmp96_ = _data14_->items_list;
			services_cal_dav_cal_dav_client_upsert_vtodo_content (self, _data14_->project, _tmp93_, _tmp94_, _tmp95_, _tmp96_);
			_g_free0 (resource_url);
			_g_free0 (etag);
			_g_free0 (_tmp82_);
			_g_object_unref0 (getetag);
			_g_free0 (vtodo_content);
			_g_object_unref0 (calendar_data);
			_g_object_unref0 (propstat);
		}
		_g_object_unref0 (_propstat_list);
	}
	if (_data14_->progress_callback != NULL) {
		_tmp97_ = (_data14_->index % 10) == 0;
	} else {
		_tmp97_ = FALSE;
	}
	if (_tmp97_) {
		GeeArrayList* _tmp98_;
		gint _tmp99_;
		gint _tmp100_;
		GeeArrayList* _tmp101_;
		gint _tmp102_;
		gint _tmp103_;
		gchar* _tmp104_;
		gchar* _tmp105_;
		_tmp98_ = _data14_->responses;
		_tmp99_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp98_);
		_tmp100_ = _tmp99_;
		_tmp101_ = _data14_->responses;
		_tmp102_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp101_);
		_tmp103_ = _tmp102_;
		_tmp104_ = g_strdup_printf (_ ("Syncing task %d of %d"), _data14_->index, _tmp103_);
		_tmp105_ = _tmp104_;
		_data14_->progress_callback (_data14_->index, _tmp100_, _tmp105_, _data14_->progress_callback_target);
		_g_free0 (_tmp105_);
	}
	_tmp106_ = _data14_->index;
	_data14_->index = _tmp106_ + 1;
	_tmp107_ = _data14_->responses;
	_tmp108_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp107_);
	_tmp109_ = _tmp108_;
	if (_data14_->index >= _tmp109_) {
		GeeArrayList* _tmp120_;
		GSourceFunc _tmp121_;
		gpointer _tmp121__target;
		GDestroyNotify _tmp121__target_destroy_notify;
		if (_data14_->progress_callback != NULL) {
			GeeArrayList* _tmp110_;
			gint _tmp111_;
			gint _tmp112_;
			GeeArrayList* _tmp113_;
			gint _tmp114_;
			gint _tmp115_;
			const gchar* _tmp116_;
			const gchar* _tmp117_;
			gchar* _tmp118_;
			gchar* _tmp119_;
			_tmp110_ = _data14_->responses;
			_tmp111_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp110_);
			_tmp112_ = _tmp111_;
			_tmp113_ = _data14_->responses;
			_tmp114_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp113_);
			_tmp115_ = _tmp114_;
			_tmp116_ = objects_base_object_get_name ((ObjectsBaseObject*) _data14_->project);
			_tmp117_ = _tmp116_;
			_tmp118_ = g_strdup_printf (_ ("Loaded tasks for %s…"), _tmp117_);
			_tmp119_ = _tmp118_;
			_data14_->progress_callback (_tmp112_, _tmp115_, _tmp119_, _data14_->progress_callback_target);
			_g_free0 (_tmp119_);
		}
		_tmp120_ = _data14_->items_list;
		objects_project_add_items_batched (_data14_->project, _tmp120_);
		_tmp121_ = _data14_->callback;
		_tmp121__target = _data14_->callback_target;
		_tmp121__target_destroy_notify = _data14_->callback_target_destroy_notify;
		_data14_->callback = NULL;
		_data14_->callback_target = NULL;
		_data14_->callback_target_destroy_notify = NULL;
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp121_, _tmp121__target, _tmp121__target_destroy_notify);
		result = FALSE;
		_g_free0 (href);
		_g_object_unref0 (response);
		return result;
	}
	result = TRUE;
	_g_free0 (href);
	_g_object_unref0 (response);
	return result;
}

static gboolean
___lambda34__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda34_ (self);
	return result;
}

static gboolean
services_cal_dav_cal_dav_client_fetch_items_for_project_co (ServicesCalDavCalDavClientFetchItemsForProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data14_ = g_slice_new0 (Block14Data);
	_data_->_data14_->_ref_count_ = 1;
	_data_->_data14_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data14_->project);
	_data_->_data14_->project = _data_->project;
	_g_object_unref0 (_data_->_data14_->cancellable);
	_data_->_data14_->cancellable = _data_->cancellable;
	(_data_->_data14_->progress_callback_target_destroy_notify == NULL) ? NULL : (_data_->_data14_->progress_callback_target_destroy_notify (_data_->_data14_->progress_callback_target), NULL);
	_data_->_data14_->progress_callback = NULL;
	_data_->_data14_->progress_callback_target = NULL;
	_data_->_data14_->progress_callback_target_destroy_notify = NULL;
	_data_->_data14_->progress_callback = _data_->progress_callback;
	_data_->_data14_->progress_callback_target = _data_->progress_callback_target;
	_data_->_data14_->progress_callback_target_destroy_notify = _data_->progress_callback_target_destroy_notify;
	_data_->_data14_->_async_data_ = _data_;
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Fetching items for project");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_data14_->callback = _services_cal_dav_cal_dav_client_fetch_items_for_project_co_gsource_func;
	_data_->_data14_->callback_target = _data_;
	_data_->_data14_->callback_target_destroy_notify = NULL;
	_data_->_tmp2_ = g_strdup ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"        <cal:calendar-query xmlns:d=\"DAV:\" xmlns:cal=\"urn:ietf:para" \
"ms:xml:ns:caldav\">\n" \
"            <d:prop>\n" \
"                <d:getetag/>\n" \
"                <d:displayname/>\n" \
"                <d:owner/>\n" \
"                <d:sync-token/>\n" \
"                <d:current-user-privilege-set/>\n" \
"                <d:resourcetype/>\n" \
"                <cal:calendar-data/>\n" \
"            </d:prop>\n" \
"            <cal:filter>\n" \
"                <cal:comp-filter name=\"VCALENDAR\">\n" \
"                    <cal:comp-filter name=\"VTODO\">\n" \
"                    </cal:comp-filter>\n" \
"                </cal:comp-filter>\n" \
"            </cal:filter>\n" \
"        </cal:calendar-query>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = objects_project_get_calendar_url (_data_->_data14_->project);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_report ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp4_, _data_->xml, "1", _data_->_data14_->cancellable, services_cal_dav_cal_dav_client_fetch_items_for_project_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp5_ = services_cal_dav_web_dav_client_report_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		block14_data_unref (_data_->_data14_);
		_data_->_data14_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = services_cal_dav_web_dav_multi_status_responses (_data_->multi_status);
	_data_->_data14_->responses = _data_->_tmp6_;
	if (_data_->_data14_->progress_callback != NULL) {
		_data_->_tmp7_ = _data_->_data14_->responses;
		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->_data14_->project);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp12_ = g_strdup_printf (_ ("Loading tasks for %s…"), _data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_data14_->progress_callback (0, _data_->_tmp9_, _data_->_tmp13_, _data_->_data14_->progress_callback_target);
		_g_free0 (_data_->_tmp13_);
	}
	objects_project_set_freeze_update (_data_->_data14_->project, TRUE);
	_data_->_data14_->index = 0;
	_data_->_tmp14_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->_data14_->items_list = _data_->_tmp14_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda34__gsource_func, block14_data_ref (_data_->_data14_), block14_data_unref);
	_data_->_state_ = 2;
	return FALSE;
	_state_2:
	;
	objects_project_set_freeze_update (_data_->_data14_->project, FALSE);
	objects_base_object_count_update ((ObjectsBaseObject*) _data_->_data14_->project);
	_data_->_tmp15_ = services_store_instance ();
	services_store_update_project (_data_->_tmp15_, _data_->_data14_->project);
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	block14_data_unref (_data_->_data14_);
	_data_->_data14_ = NULL;
	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
services_cal_dav_cal_dav_client_sync_tasklist_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientSyncTasklistData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientSyncTasklistData, _data_);
}

void
services_cal_dav_cal_dav_client_sync_tasklist (ServicesCalDAVCalDAVClient* self,
                                               ObjectsProject* project,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	ServicesCalDavCalDavClientSyncTasklistData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientSyncTasklistData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_sync_tasklist_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_sync_tasklist_co (_data_);
}

void
services_cal_dav_cal_dav_client_sync_tasklist_finish (ServicesCalDAVCalDAVClient* self,
                                                      GAsyncResult* _res_,
                                                      GError** error)
{
	ServicesCalDavCalDavClientSyncTasklistData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
services_cal_dav_cal_dav_client_sync_tasklist_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	ServicesCalDavCalDavClientSyncTasklistData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_sync_tasklist_co (_data_);
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
services_cal_dav_cal_dav_client_sync_tasklist_co (ServicesCalDavCalDavClientSyncTasklistData* _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;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = objects_project_get_is_deck (_data_->project);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp3_ = objects_project_get_is_archived (_data_->project);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp0_ = _data_->_tmp4_;
	}
	if (_data_->_tmp0_) {
		_data_->_tmp6_ = objects_project_get_is_archived (_data_->project);
		_data_->_tmp7_ = _data_->_tmp6_;
		if (_data_->_tmp7_) {
			_data_->_tmp5_ = "archived";
		} else {
			_data_->_tmp5_ = "deck";
		}
		_data_->_tmp8_ = services_log_service_get_default ();
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = g_strdup_printf ("Skipping sync for %s project", _data_->_tmp5_);
		_data_->_tmp11_ = _data_->_tmp10_;
		services_log_service_debug (_data_->_tmp9_, "CalDAV", _data_->_tmp11_);
		_g_free0 (_data_->_tmp11_);
		_g_object_unref0 (_data_->_tmp9_);
		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_->_tmp12_ = services_log_service_get_default ();
	_data_->_tmp13_ = _data_->_tmp12_;
	services_log_service_info (_data_->_tmp13_, "CalDAV", "Syncing tasklist");
	_g_object_unref0 (_data_->_tmp13_);
	_data_->_tmp14_ = objects_project_get_sync_id (_data_->project);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->_tmp16_ = g_strdup_printf ("<?xml version='1.0' encoding='utf-8'?>\n" \
"        <d:sync-collection xmlns:d=\"DAV:\">\n" \
"            <d:sync-token>%s</d:sync-token>\n" \
"            <d:sync-level>1</d:sync-level>\n" \
"            <d:prop>\n" \
"                <d:getetag/>\n" \
"                <d:getcontenttype/>\n" \
"            </d:prop>\n" \
"        </d:sync-collection>\n" \
"        ", _data_->_tmp15_);
	_data_->xml = _data_->_tmp16_;
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->project, TRUE);
	g_signal_emit_by_name (_data_->project, "sync-started");
	_data_->_state_ = 1;
	services_cal_dav_cal_dav_client_fetch_project_details (_data_->self, _data_->project, _data_->cancellable, services_cal_dav_cal_dav_client_sync_tasklist_ready, _data_);
	return FALSE;
	_state_1:
	services_cal_dav_cal_dav_client_fetch_project_details_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp18_ = objects_project_get_sync_id (_data_->project);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp17_ = _data_->_tmp19_;
	if (_data_->_tmp17_ == NULL) {
		_data_->_tmp17_ = "(null)";
	}
	_data_->_tmp20_ = services_log_service_get_default ();
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = g_strdup_printf ("sync_id after fetch_project_details: '%s'", _data_->_tmp17_);
	_data_->_tmp23_ = _data_->_tmp22_;
	services_log_service_debug (_data_->_tmp21_, "CalDAV", _data_->_tmp23_);
	_g_free0 (_data_->_tmp23_);
	_g_object_unref0 (_data_->_tmp21_);
	_data_->_tmp25_ = objects_project_get_sync_id (_data_->project);
	_data_->_tmp26_ = _data_->_tmp25_;
	if (_data_->_tmp26_ == NULL) {
		_data_->_tmp24_ = TRUE;
	} else {
		_data_->_tmp27_ = objects_project_get_sync_id (_data_->project);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp24_ = g_strcmp0 (_data_->_tmp28_, "") == 0;
	}
	if (_data_->_tmp24_) {
		_data_->_tmp29_ = services_log_service_get_default ();
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_tmp31_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->project);
		_data_->_tmp32_ = _data_->_tmp31_;
		_data_->_tmp33_ = g_strdup_printf ("No sync-token from server, falling back to etag-based sync for '%s'", _data_->_tmp32_);
		_data_->_tmp34_ = _data_->_tmp33_;
		services_log_service_warn (_data_->_tmp30_, "CalDAV", _data_->_tmp34_);
		_g_free0 (_data_->_tmp34_);
		_g_object_unref0 (_data_->_tmp30_);
		objects_base_object_set_loading ((ObjectsBaseObject*) _data_->project, FALSE);
		objects_project_set_freeze_update (_data_->project, FALSE);
		_data_->_state_ = 2;
		services_cal_dav_cal_dav_client_etag_sync_project (_data_->self, _data_->project, _data_->cancellable, services_cal_dav_cal_dav_client_sync_tasklist_ready, _data_);
		return FALSE;
		_state_2:
		services_cal_dav_cal_dav_client_etag_sync_project_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->xml);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		g_signal_emit_by_name (_data_->project, "sync-finished");
		_g_free0 (_data_->xml);
		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_->_tmp36_ = objects_project_get_calendar_url (_data_->project);
		_data_->_tmp37_ = _data_->_tmp36_;
		_data_->_tmp38_ = _data_->xml;
		_data_->_state_ = 3;
		services_cal_dav_web_dav_client_report ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp37_, _data_->_tmp38_, "1", _data_->cancellable, services_cal_dav_cal_dav_client_sync_tasklist_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp39_ = services_cal_dav_web_dav_client_report_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp35_ = _data_->_tmp39_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp40_ = _data_->_tmp35_;
		_data_->_tmp35_ = NULL;
		_g_object_unref0 (_data_->multi_status);
		_data_->multi_status = _data_->_tmp40_;
		_g_object_unref0 (_data_->_tmp35_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp41_ = _data_->e;
		if (g_error_matches (_data_->_tmp41_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
			_data_->_tmp42_ = _data_->e;
			_data_->_tmp43_ = _g_error_copy0 (_data_->_tmp42_);
			_data_->_inner_error0_ = _data_->_tmp43_;
			_g_error_free0 (_data_->e);
			goto __finally0;
		}
		_data_->_tmp44_ = services_log_service_get_default ();
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = _data_->e;
		_data_->_tmp47_ = _data_->_tmp46_->message;
		_data_->_tmp48_ = g_strdup_printf ("sync-collection failed, falling back to ETag sync: %s", _data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		services_log_service_warn (_data_->_tmp45_, "CalDAV", _data_->_tmp49_);
		_g_free0 (_data_->_tmp49_);
		_g_object_unref0 (_data_->_tmp45_);
		objects_base_object_set_loading ((ObjectsBaseObject*) _data_->project, FALSE);
		objects_project_set_freeze_update (_data_->project, FALSE);
		_data_->_state_ = 4;
		services_cal_dav_cal_dav_client_etag_sync_project (_data_->self, _data_->project, _data_->cancellable, services_cal_dav_cal_dav_client_sync_tasklist_ready, _data_);
		return FALSE;
		_state_4:
		services_cal_dav_cal_dav_client_etag_sync_project_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_error_free0 (_data_->e);
			goto __finally0;
		}
		g_signal_emit_by_name (_data_->project, "sync-finished");
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->multi_status);
		_g_free0 (_data_->xml);
		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;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->multi_status);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	objects_project_set_freeze_update (_data_->project, TRUE);
	{
		_data_->_tmp50_ = _data_->multi_status;
		_data_->_tmp51_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp50_);
		_data_->_response_list = _data_->_tmp51_;
		_data_->_tmp52_ = _data_->_response_list;
		_data_->_tmp53_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp52_);
		_data_->_tmp54_ = _data_->_tmp53_;
		_data_->_response_size = _data_->_tmp54_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp55_ = _data_->_response_index;
			_data_->_tmp56_ = _data_->_response_size;
			if (!(_data_->_tmp55_ < _data_->_tmp56_)) {
				break;
			}
			_data_->_tmp57_ = _data_->_response_list;
			_data_->_tmp58_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp57_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp58_;
			_data_->_tmp59_ = _data_->response;
			_data_->_tmp60_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp59_);
			_data_->_tmp61_ = _data_->_tmp60_;
			_data_->_tmp62_ = g_strdup (_data_->_tmp61_);
			_data_->href = _data_->_tmp62_;
			_data_->_tmp63_ = _data_->href;
			_data_->_tmp64_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp63_);
			_data_->url = _data_->_tmp64_;
			_data_->_tmp65_ = _data_->response;
			_data_->_tmp66_ = services_cal_dav_web_dav_response_get_status (_data_->_tmp65_);
			_data_->_tmp67_ = _data_->_tmp66_;
			if (_data_->_tmp67_ == SOUP_STATUS_NOT_FOUND) {
				_data_->_tmp68_ = services_store_instance ();
				_data_->_tmp69_ = _data_->url;
				_data_->_tmp70_ = services_store_get_item_by_ical_url (_data_->_tmp68_, _data_->_tmp69_);
				_data_->item = _data_->_tmp70_;
				_data_->_tmp71_ = _data_->item;
				if (_data_->_tmp71_ != NULL) {
					_data_->_tmp72_ = services_store_instance ();
					_data_->_tmp73_ = _data_->item;
					services_store_delete_item (_data_->_tmp72_, _data_->_tmp73_);
				}
				_g_object_unref0 (_data_->item);
				_g_free0 (_data_->url);
				_g_free0 (_data_->href);
				_g_object_unref0 (_data_->response);
				continue;
			}
			{
				_data_->_tmp74_ = _data_->response;
				_data_->_tmp75_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp74_);
				_data_->_propstat_list = _data_->_tmp75_;
				_data_->_tmp76_ = _data_->_propstat_list;
				_data_->_tmp77_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp76_);
				_data_->_tmp78_ = _data_->_tmp77_;
				_data_->_propstat_size = _data_->_tmp78_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp79_ = _data_->_propstat_index;
					_data_->_tmp80_ = _data_->_propstat_size;
					if (!(_data_->_tmp79_ < _data_->_tmp80_)) {
						break;
					}
					_data_->_tmp81_ = _data_->_propstat_list;
					_data_->_tmp82_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp81_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp82_;
					_data_->_tmp83_ = _data_->propstat;
					_data_->_tmp84_ = services_cal_dav_web_dav_prop_stat_get_status (_data_->_tmp83_);
					_data_->_tmp85_ = _data_->_tmp84_;
					if (_data_->_tmp85_ == SOUP_STATUS_NOT_FOUND) {
						_data_->_tmp86_ = services_store_instance ();
						_data_->_tmp87_ = _data_->url;
						_data_->_tmp88_ = services_store_get_item_by_ical_url (_data_->_tmp86_, _data_->_tmp87_);
						_data_->_vala1_item = _data_->_tmp88_;
						_data_->_tmp89_ = _data_->_vala1_item;
						if (_data_->_tmp89_ != NULL) {
							_data_->_tmp90_ = services_store_instance ();
							_data_->_tmp91_ = _data_->_vala1_item;
							services_store_delete_item (_data_->_tmp90_, _data_->_tmp91_);
						}
						_g_object_unref0 (_data_->_vala1_item);
					} else {
						_data_->has_component_parameter = FALSE;
						_data_->is_vtodo = FALSE;
						_data_->_tmp92_ = _data_->propstat;
						_data_->_tmp93_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp92_, "getcontenttype");
						_data_->getcontenttype = _data_->_tmp93_;
						_data_->_tmp94_ = _data_->getcontenttype;
						if (_data_->_tmp94_ != NULL) {
							_data_->_tmp95_ = _data_->getcontenttype;
							_data_->_tmp96_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp95_);
							_data_->_tmp97_ = _data_->_tmp96_;
							_data_->_tmp98_ = _data_->_tmp97_;
							_data_->_tmp99_ = g_utf8_strdown (_data_->_tmp98_, (gssize) -1);
							_data_->_tmp100_ = _data_->_tmp99_;
							_data_->has_component_parameter = string_contains (_data_->_tmp100_, "component");
							_g_free0 (_data_->_tmp100_);
							_g_free0 (_data_->_tmp98_);
							_data_->_tmp101_ = _data_->getcontenttype;
							_data_->_tmp102_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp101_);
							_data_->_tmp103_ = _data_->_tmp102_;
							_data_->_tmp104_ = _data_->_tmp103_;
							_data_->_tmp105_ = g_utf8_strdown (_data_->_tmp104_, (gssize) -1);
							_data_->_tmp106_ = _data_->_tmp105_;
							_data_->is_vtodo = string_contains (_data_->_tmp106_, "vtodo");
							_g_free0 (_data_->_tmp106_);
							_g_free0 (_data_->_tmp104_);
						}
						if (!_data_->has_component_parameter) {
							_data_->_tmp107_ = services_log_service_get_default ();
							_data_->_tmp108_ = _data_->_tmp107_;
							services_log_service_debug (_data_->_tmp108_, "CalDAV", "No 'component' parameter present in getcontenttype.");
							_g_object_unref0 (_data_->_tmp108_);
						}
						if (!_data_->has_component_parameter) {
							_data_->_tmp109_ = TRUE;
						} else {
							_data_->_tmp109_ = _data_->is_vtodo;
						}
						if (_data_->_tmp109_) {
							_data_->_tmp110_ = _data_->propstat;
							_data_->_tmp111_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp110_, "getetag");
							_data_->getetag = _data_->_tmp111_;
							_data_->_tmp113_ = _data_->getetag;
							if (_data_->_tmp113_ != NULL) {
								_data_->_tmp114_ = _data_->getetag;
								_data_->_tmp115_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp114_);
								_data_->_tmp116_ = _data_->_tmp115_;
								_data_->_tmp117_ = _data_->_tmp116_;
								_data_->_tmp118_ = string_strip (_data_->_tmp117_);
								_g_free0 (_data_->_tmp112_);
								_data_->_tmp112_ = _data_->_tmp118_;
								_g_free0 (_data_->_tmp117_);
							} else {
								_data_->_tmp119_ = g_strdup ("");
								_g_free0 (_data_->_tmp112_);
								_data_->_tmp112_ = _data_->_tmp119_;
							}
							_data_->_tmp120_ = _data_->_tmp112_;
							_data_->_tmp112_ = NULL;
							_data_->etag = _data_->_tmp120_;
							_data_->_tmp121_ = _data_->url;
							_data_->_state_ = 5;
							services_cal_dav_cal_dav_client_get_vtodo_by_url (_data_->self, _data_->_tmp121_, _data_->cancellable, services_cal_dav_cal_dav_client_sync_tasklist_ready, _data_);
							return FALSE;
							_state_5:
							_data_->_tmp122_ = services_cal_dav_cal_dav_client_get_vtodo_by_url_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
							_data_->vtodo_content = _data_->_tmp122_;
							if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
								g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
								_g_free0 (_data_->etag);
								_g_free0 (_data_->_tmp112_);
								_g_object_unref0 (_data_->getetag);
								_g_object_unref0 (_data_->getcontenttype);
								_g_object_unref0 (_data_->propstat);
								_g_object_unref0 (_data_->_propstat_list);
								_g_free0 (_data_->url);
								_g_free0 (_data_->href);
								_g_object_unref0 (_data_->response);
								_g_object_unref0 (_data_->_response_list);
								_g_object_unref0 (_data_->multi_status);
								_g_free0 (_data_->xml);
								g_object_unref (_data_->_async_result);
								return FALSE;
							}
							_data_->_tmp123_ = _data_->url;
							_data_->_tmp124_ = _data_->etag;
							_data_->_tmp125_ = _data_->vtodo_content;
							services_cal_dav_cal_dav_client_upsert_vtodo_content (_data_->self, _data_->project, _data_->_tmp123_, _data_->_tmp124_, _data_->_tmp125_, NULL);
							_g_free0 (_data_->vtodo_content);
							_g_free0 (_data_->etag);
							_g_free0 (_data_->_tmp112_);
							_g_object_unref0 (_data_->getetag);
						}
						_g_object_unref0 (_data_->getcontenttype);
					}
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_free0 (_data_->url);
			_g_free0 (_data_->href);
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->_tmp126_ = _data_->multi_status;
	_data_->_tmp127_ = services_cal_dav_web_dav_multi_status_get_first_text_content_by_tag_name (_data_->_tmp126_, "sync-token");
	_data_->sync_token = _data_->_tmp127_;
	_data_->_tmp129_ = _data_->sync_token;
	if (_data_->_tmp129_ != NULL) {
		_data_->_tmp130_ = _data_->sync_token;
		_data_->_tmp131_ = objects_project_get_sync_id (_data_->project);
		_data_->_tmp132_ = _data_->_tmp131_;
		_data_->_tmp128_ = g_strcmp0 (_data_->_tmp130_, _data_->_tmp132_) != 0;
	} else {
		_data_->_tmp128_ = FALSE;
	}
	if (_data_->_tmp128_) {
		_data_->_tmp133_ = _data_->sync_token;
		objects_project_set_sync_id (_data_->project, _data_->_tmp133_);
		objects_project_update_local (_data_->project);
	} else {
		_data_->_tmp134_ = _data_->sync_token;
		if (_data_->_tmp134_ == NULL) {
			objects_project_set_sync_id (_data_->project, "");
			objects_project_update_local (_data_->project);
		}
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->project, FALSE);
	objects_project_set_freeze_update (_data_->project, FALSE);
	objects_base_object_count_update ((ObjectsBaseObject*) _data_->project);
	_data_->_tmp135_ = services_store_instance ();
	services_store_update_project (_data_->_tmp135_, _data_->project);
	_g_free0 (_data_->sync_token);
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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;
}

/**
    * Adds or updates items in a project based on VTODO content from a CalDAV server.
    *
    * If @batched_items is provided, all new items are added to this list instead of
    * being added directly to the project.
    *
    */
static void
services_cal_dav_cal_dav_client_upsert_vtodo_content (ServicesCalDAVCalDAVClient* self,
                                                      ObjectsProject* project,
                                                      const gchar* url,
                                                      const gchar* etag,
                                                      const gchar* vtodo_content,
                                                      GeeArrayList* batched_items)
{
	ICalComponent* vcalendar = NULL;
	ICalComponent* _tmp0_;
	ICalComponent* vtodo_comp = NULL;
	ICalComponent* _tmp1_;
	ICalComponent* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (url != NULL);
	g_return_if_fail (etag != NULL);
	g_return_if_fail (vtodo_content != NULL);
	_tmp0_ = i_cal_component_new_from_string (vtodo_content);
	vcalendar = _tmp0_;
	_tmp1_ = vcalendar;
	_tmp2_ = i_cal_component_get_first_component (_tmp1_, I_CAL_VTODO_COMPONENT);
	vtodo_comp = _tmp2_;
	while (TRUE) {
		ICalComponent* _tmp3_;
		gchar* uid = NULL;
		ICalComponent* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_ = NULL;
		ICalComponent* _tmp8_;
		const gchar* _tmp9_;
		gchar* summary = NULL;
		gchar* _tmp10_;
		gboolean _tmp11_ = FALSE;
		const gchar* _tmp12_;
		ICalComponent* _tmp93_;
		ICalComponent* _tmp94_;
		_tmp3_ = vtodo_comp;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = vtodo_comp;
		_tmp5_ = i_cal_component_get_uid (_tmp4_);
		_tmp6_ = g_strdup (_tmp5_);
		uid = _tmp6_;
		_tmp8_ = vtodo_comp;
		_tmp9_ = i_cal_component_get_summary (_tmp8_);
		_tmp7_ = _tmp9_;
		if (_tmp7_ == NULL) {
			_tmp7_ = "";
		}
		_tmp10_ = g_strdup (_tmp7_);
		summary = _tmp10_;
		_tmp12_ = uid;
		if (_tmp12_ != NULL) {
			const gchar* _tmp13_;
			_tmp13_ = uid;
			_tmp11_ = g_strcmp0 (_tmp13_, "") != 0;
		} else {
			_tmp11_ = FALSE;
		}
		if (_tmp11_) {
			const gchar* _tmp14_;
			_tmp14_ = summary;
			if (objects_section_is_vtodo_section (_tmp14_)) {
				services_cal_dav_cal_dav_client_upsert_section_from_vtodo (self, project, url, etag, vtodo_content);
			} else {
				ObjectsItem* item = NULL;
				ServicesStore* _tmp15_;
				const gchar* _tmp16_;
				ObjectsItem* _tmp17_;
				ObjectsItem* _tmp18_;
				_tmp15_ = services_store_instance ();
				_tmp16_ = uid;
				_tmp17_ = services_store_get_item (_tmp15_, _tmp16_);
				item = _tmp17_;
				_tmp18_ = item;
				if (_tmp18_ != NULL) {
					gchar* old_project_id = NULL;
					ObjectsItem* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					gchar* _tmp22_;
					gchar* old_section_id = NULL;
					ObjectsItem* _tmp23_;
					const gchar* _tmp24_;
					const gchar* _tmp25_;
					gchar* _tmp26_;
					gchar* old_parent_id = NULL;
					ObjectsItem* _tmp27_;
					const gchar* _tmp28_;
					const gchar* _tmp29_;
					gchar* _tmp30_;
					gboolean old_checked = FALSE;
					ObjectsItem* _tmp31_;
					gboolean _tmp32_;
					gboolean _tmp33_;
					ObjectsItem* _tmp34_;
					ObjectsItem* _tmp35_;
					gchar* _tmp36_;
					gchar* _tmp37_;
					ObjectsItem* _tmp38_;
					const gchar* _tmp39_;
					const gchar* _tmp40_;
					ServicesStore* _tmp41_;
					ObjectsItem* _tmp42_;
					gboolean _tmp43_ = FALSE;
					gboolean _tmp44_ = FALSE;
					const gchar* _tmp45_;
					ObjectsItem* _tmp46_;
					const gchar* _tmp47_;
					const gchar* _tmp48_;
					ObjectsItem* _tmp63_;
					gboolean _tmp64_;
					gboolean _tmp65_;
					_tmp19_ = item;
					_tmp20_ = objects_item_get_project_id (_tmp19_);
					_tmp21_ = _tmp20_;
					_tmp22_ = g_strdup (_tmp21_);
					old_project_id = _tmp22_;
					_tmp23_ = item;
					_tmp24_ = objects_item_get_section_id (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = g_strdup (_tmp25_);
					old_section_id = _tmp26_;
					_tmp27_ = item;
					_tmp28_ = objects_item_get_parent_id (_tmp27_);
					_tmp29_ = _tmp28_;
					_tmp30_ = g_strdup (_tmp29_);
					old_parent_id = _tmp30_;
					_tmp31_ = item;
					_tmp32_ = objects_item_get_checked (_tmp31_);
					_tmp33_ = _tmp32_;
					old_checked = _tmp33_;
					_tmp34_ = item;
					objects_item_update_from_vtodo (_tmp34_, vtodo_content, url);
					_tmp35_ = item;
					_tmp36_ = util_generate_extra_data (url, etag, vtodo_content);
					_tmp37_ = _tmp36_;
					objects_item_set_extra_data (_tmp35_, _tmp37_);
					_g_free0 (_tmp37_);
					_tmp38_ = item;
					_tmp39_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
					_tmp40_ = _tmp39_;
					objects_item_set_project_id (_tmp38_, _tmp40_);
					_tmp41_ = services_store_instance ();
					_tmp42_ = item;
					services_store_update_item (_tmp41_, _tmp42_, "");
					_tmp45_ = old_project_id;
					_tmp46_ = item;
					_tmp47_ = objects_item_get_project_id (_tmp46_);
					_tmp48_ = _tmp47_;
					if (g_strcmp0 (_tmp45_, _tmp48_) != 0) {
						_tmp44_ = TRUE;
					} else {
						const gchar* _tmp49_;
						ObjectsItem* _tmp50_;
						const gchar* _tmp51_;
						const gchar* _tmp52_;
						_tmp49_ = old_section_id;
						_tmp50_ = item;
						_tmp51_ = objects_item_get_section_id (_tmp50_);
						_tmp52_ = _tmp51_;
						_tmp44_ = g_strcmp0 (_tmp49_, _tmp52_) != 0;
					}
					if (_tmp44_) {
						_tmp43_ = TRUE;
					} else {
						const gchar* _tmp53_;
						ObjectsItem* _tmp54_;
						const gchar* _tmp55_;
						const gchar* _tmp56_;
						_tmp53_ = old_parent_id;
						_tmp54_ = item;
						_tmp55_ = objects_item_get_parent_id (_tmp54_);
						_tmp56_ = _tmp55_;
						_tmp43_ = g_strcmp0 (_tmp53_, _tmp56_) != 0;
					}
					if (_tmp43_) {
						ServicesEventBus* _tmp57_;
						ServicesEventBus* _tmp58_;
						ObjectsItem* _tmp59_;
						const gchar* _tmp60_;
						const gchar* _tmp61_;
						const gchar* _tmp62_;
						_tmp57_ = services_event_bus_get_default ();
						_tmp58_ = _tmp57_;
						_tmp59_ = item;
						_tmp60_ = old_project_id;
						_tmp61_ = old_section_id;
						_tmp62_ = old_parent_id;
						g_signal_emit_by_name (_tmp58_, "item-moved", _tmp59_, _tmp60_, _tmp61_, _tmp62_);
						_g_object_unref0 (_tmp58_);
					}
					_tmp63_ = item;
					_tmp64_ = objects_item_get_checked (_tmp63_);
					_tmp65_ = _tmp64_;
					if (old_checked != _tmp65_) {
						ServicesStore* _tmp66_;
						ObjectsItem* _tmp67_;
						_tmp66_ = services_store_instance ();
						_tmp67_ = item;
						services_store_complete_item (_tmp66_, _tmp67_, old_checked, TRUE);
					}
					_g_free0 (old_parent_id);
					_g_free0 (old_section_id);
					_g_free0 (old_project_id);
				} else {
					ObjectsItem* new_item = NULL;
					const gchar* _tmp68_;
					const gchar* _tmp69_;
					ObjectsItem* _tmp70_;
					ObjectsItem* _tmp71_;
					gchar* _tmp72_;
					gchar* _tmp73_;
					_tmp68_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
					_tmp69_ = _tmp68_;
					_tmp70_ = objects_item_new_from_vtodo (vtodo_content, url, _tmp69_);
					new_item = _tmp70_;
					_tmp71_ = new_item;
					_tmp72_ = util_generate_extra_data (url, etag, vtodo_content);
					_tmp73_ = _tmp72_;
					objects_item_set_extra_data (_tmp71_, _tmp73_);
					_g_free0 (_tmp73_);
					if (batched_items != NULL) {
						ObjectsItem* _tmp74_;
						_tmp74_ = new_item;
						gee_abstract_collection_add ((GeeAbstractCollection*) batched_items, _tmp74_);
					} else {
						ObjectsItem* _tmp75_;
						gboolean _tmp76_;
						gboolean _tmp77_;
						_tmp75_ = new_item;
						_tmp76_ = objects_item_get_has_parent (_tmp75_);
						_tmp77_ = _tmp76_;
						if (_tmp77_) {
							ObjectsItem* parent_item = NULL;
							ObjectsItem* _tmp78_;
							ObjectsItem* _tmp79_;
							ObjectsItem* _tmp80_;
							ObjectsItem* _tmp81_;
							ObjectsItem* _tmp82_;
							_tmp78_ = new_item;
							_tmp79_ = objects_item_get_parent (_tmp78_);
							_tmp80_ = _tmp79_;
							_tmp81_ = _g_object_ref0 (_tmp80_);
							parent_item = _tmp81_;
							_tmp82_ = parent_item;
							if (_tmp82_ != NULL) {
								ObjectsItem* _tmp83_;
								ObjectsItem* _tmp84_;
								ObjectsItem* _tmp85_;
								ObjectsItem* _tmp86_;
								_tmp83_ = parent_item;
								_tmp84_ = new_item;
								_tmp85_ = objects_item_add_item_if_not_exists (_tmp83_, _tmp84_, TRUE);
								_tmp86_ = _tmp85_;
								_g_object_unref0 (_tmp86_);
							} else {
								ObjectsItem* _tmp87_;
								ObjectsItem* _tmp88_;
								ObjectsItem* _tmp89_;
								_tmp87_ = new_item;
								_tmp88_ = objects_project_add_item_if_not_exists (project, _tmp87_, TRUE);
								_tmp89_ = _tmp88_;
								_g_object_unref0 (_tmp89_);
							}
							_g_object_unref0 (parent_item);
						} else {
							ObjectsItem* _tmp90_;
							ObjectsItem* _tmp91_;
							ObjectsItem* _tmp92_;
							_tmp90_ = new_item;
							_tmp91_ = objects_project_add_item_if_not_exists (project, _tmp90_, TRUE);
							_tmp92_ = _tmp91_;
							_g_object_unref0 (_tmp92_);
						}
					}
					_g_object_unref0 (new_item);
				}
				_g_object_unref0 (item);
			}
		}
		_tmp93_ = vcalendar;
		_tmp94_ = i_cal_component_get_next_component (_tmp93_, I_CAL_VTODO_COMPONENT);
		_g_object_unref0 (vtodo_comp);
		vtodo_comp = _tmp94_;
		_g_free0 (summary);
		_g_free0 (uid);
	}
	_g_object_unref0 (vtodo_comp);
	_g_object_unref0 (vcalendar);
}

static void
services_cal_dav_cal_dav_client_upsert_section_from_vtodo (ServicesCalDAVCalDAVClient* self,
                                                           ObjectsProject* project,
                                                           const gchar* url,
                                                           const gchar* etag,
                                                           const gchar* vtodo_content)
{
	ICalComponent* vcalendar = NULL;
	ICalComponent* _tmp0_;
	ICalComponent* vtodo_comp = NULL;
	ICalComponent* _tmp1_;
	ICalComponent* _tmp2_;
	ICalComponent* _tmp3_;
	gchar* uid = NULL;
	ICalComponent* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	ObjectsSection* section = NULL;
	ServicesStore* _tmp10_;
	const gchar* _tmp11_;
	ObjectsSection* _tmp12_;
	ObjectsSection* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (url != NULL);
	g_return_if_fail (etag != NULL);
	g_return_if_fail (vtodo_content != NULL);
	_tmp0_ = i_cal_component_new_from_string (vtodo_content);
	vcalendar = _tmp0_;
	_tmp1_ = vcalendar;
	_tmp2_ = i_cal_component_get_first_component (_tmp1_, I_CAL_VTODO_COMPONENT);
	vtodo_comp = _tmp2_;
	_tmp3_ = vtodo_comp;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (vtodo_comp);
		_g_object_unref0 (vcalendar);
		return;
	}
	_tmp4_ = vtodo_comp;
	_tmp5_ = i_cal_component_get_uid (_tmp4_);
	_tmp6_ = g_strdup (_tmp5_);
	uid = _tmp6_;
	_tmp8_ = uid;
	if (_tmp8_ == NULL) {
		_tmp7_ = TRUE;
	} else {
		const gchar* _tmp9_;
		_tmp9_ = uid;
		_tmp7_ = g_strcmp0 (_tmp9_, "") == 0;
	}
	if (_tmp7_) {
		_g_free0 (uid);
		_g_object_unref0 (vtodo_comp);
		_g_object_unref0 (vcalendar);
		return;
	}
	_tmp10_ = services_store_instance ();
	_tmp11_ = uid;
	_tmp12_ = services_store_get_section (_tmp10_, _tmp11_);
	section = _tmp12_;
	_tmp13_ = section;
	if (_tmp13_ != NULL) {
		gchar* old_name = NULL;
		ObjectsSection* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		gchar* _tmp17_;
		ObjectsSection* _tmp18_;
		ObjectsSection* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		ObjectsSection* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		ServicesStore* _tmp25_;
		ObjectsSection* _tmp26_;
		ServicesLogService* _tmp27_;
		ServicesLogService* _tmp28_;
		ObjectsSection* _tmp29_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		_tmp14_ = section;
		_tmp15_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = g_strdup (_tmp16_);
		old_name = _tmp17_;
		_tmp18_ = section;
		objects_section_patch_from_vtodo (_tmp18_, vtodo_content, url);
		_tmp19_ = section;
		_tmp20_ = util_generate_extra_data (url, etag, vtodo_content);
		_tmp21_ = _tmp20_;
		objects_section_set_extra_data (_tmp19_, _tmp21_);
		_g_free0 (_tmp21_);
		_tmp22_ = section;
		_tmp23_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp24_ = _tmp23_;
		objects_section_set_project_id (_tmp22_, _tmp24_);
		_tmp25_ = services_store_instance ();
		_tmp26_ = section;
		services_store_update_section (_tmp25_, _tmp26_);
		_tmp27_ = services_log_service_get_default ();
		_tmp28_ = _tmp27_;
		_tmp29_ = section;
		_tmp30_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = g_strdup_printf ("Updated section '%s'", _tmp31_);
		_tmp33_ = _tmp32_;
		services_log_service_debug (_tmp28_, "CalDAV", _tmp33_);
		_g_free0 (_tmp33_);
		_g_object_unref0 (_tmp28_);
		_g_free0 (old_name);
	} else {
		ObjectsSection* new_section = NULL;
		ObjectsSection* _tmp34_;
		ObjectsSection* _tmp35_;
		const gchar* _tmp36_;
		const gchar* _tmp37_;
		ObjectsSection* _tmp38_;
		ObjectsSection* _tmp39_;
		gchar* _tmp40_;
		gchar* _tmp41_;
		ServicesStore* _tmp42_;
		ObjectsSection* _tmp43_;
		ServicesLogService* _tmp44_;
		ServicesLogService* _tmp45_;
		ObjectsSection* _tmp46_;
		const gchar* _tmp47_;
		const gchar* _tmp48_;
		gchar* _tmp49_;
		gchar* _tmp50_;
		_tmp34_ = objects_section_new ();
		new_section = _tmp34_;
		_tmp35_ = new_section;
		_tmp36_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp37_ = _tmp36_;
		objects_section_set_project_id (_tmp35_, _tmp37_);
		_tmp38_ = new_section;
		objects_section_patch_from_vtodo (_tmp38_, vtodo_content, url);
		_tmp39_ = new_section;
		_tmp40_ = util_generate_extra_data (url, etag, vtodo_content);
		_tmp41_ = _tmp40_;
		objects_section_set_extra_data (_tmp39_, _tmp41_);
		_g_free0 (_tmp41_);
		_tmp42_ = services_store_instance ();
		_tmp43_ = new_section;
		services_store_insert_section (_tmp42_, _tmp43_);
		_tmp44_ = services_log_service_get_default ();
		_tmp45_ = _tmp44_;
		_tmp46_ = new_section;
		_tmp47_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = g_strdup_printf ("Inserted new section '%s'", _tmp48_);
		_tmp50_ = _tmp49_;
		services_log_service_debug (_tmp45_, "CalDAV", _tmp50_);
		_g_free0 (_tmp50_);
		_g_object_unref0 (_tmp45_);
		_g_object_unref0 (new_section);
	}
	_g_object_unref0 (section);
	_g_free0 (uid);
	_g_object_unref0 (vtodo_comp);
	_g_object_unref0 (vcalendar);
}

static void
services_cal_dav_cal_dav_client_etag_sync_project_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientEtagSyncProjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientEtagSyncProjectData, _data_);
}

static void
services_cal_dav_cal_dav_client_etag_sync_project (ServicesCalDAVCalDAVClient* self,
                                                   ObjectsProject* project,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ServicesCalDavCalDavClientEtagSyncProjectData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientEtagSyncProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_etag_sync_project_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_etag_sync_project_co (_data_);
}

static void
services_cal_dav_cal_dav_client_etag_sync_project_finish (ServicesCalDAVCalDAVClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	ServicesCalDavCalDavClientEtagSyncProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
services_cal_dav_cal_dav_client_etag_sync_project_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	ServicesCalDavCalDavClientEtagSyncProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_etag_sync_project_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_etag_sync_project_co (ServicesCalDavCalDavClientEtagSyncProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->project);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = g_strdup_printf ("ETag sync for '%s'", _data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", _data_->_tmp5_);
	_g_free0 (_data_->_tmp5_);
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp6_ = g_strdup ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"        <cal:calendar-query xmlns:d=\"DAV:\" xmlns:cal=\"urn:ietf:para" \
"ms:xml:ns:caldav\">\n" \
"            <d:prop>\n" \
"                <d:getetag/>\n" \
"            </d:prop>\n" \
"            <cal:filter>\n" \
"                <cal:comp-filter name=\"VCALENDAR\">\n" \
"                    <cal:comp-filter name=\"VTODO\"/>\n" \
"                </cal:comp-filter>\n" \
"            </cal:filter>\n" \
"        </cal:calendar-query>\n" \
"        ");
	_data_->xml = _data_->_tmp6_;
	_data_->_tmp7_ = objects_project_get_calendar_url (_data_->project);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = _data_->xml;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_report ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp8_, _data_->_tmp9_, "1", _data_->cancellable, services_cal_dav_cal_dav_client_etag_sync_project_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp10_ = services_cal_dav_web_dav_client_report_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp10_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->server_map = _data_->_tmp11_;
	{
		_data_->_tmp12_ = _data_->multi_status;
		_data_->_tmp13_ = services_cal_dav_web_dav_multi_status_responses (_data_->_tmp12_);
		_data_->_response_list = _data_->_tmp13_;
		_data_->_tmp14_ = _data_->_response_list;
		_data_->_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_response_size = _data_->_tmp16_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp17_ = _data_->_response_index;
			_data_->_tmp18_ = _data_->_response_size;
			if (!(_data_->_tmp17_ < _data_->_tmp18_)) {
				break;
			}
			_data_->_tmp19_ = _data_->_response_list;
			_data_->_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp19_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp20_;
			_data_->_tmp21_ = _data_->response;
			_data_->_tmp22_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			if (_data_->_tmp23_ == NULL) {
				_g_object_unref0 (_data_->response);
				continue;
			}
			_data_->_tmp24_ = _data_->response;
			_data_->_tmp25_ = services_cal_dav_web_dav_response_get_href (_data_->_tmp24_);
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_tmp27_ = services_cal_dav_web_dav_client_get_absolute_url ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp26_);
			_data_->url = _data_->_tmp27_;
			{
				_data_->_tmp28_ = _data_->response;
				_data_->_tmp29_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp28_);
				_data_->_propstat_list = _data_->_tmp29_;
				_data_->_tmp30_ = _data_->_propstat_list;
				_data_->_tmp31_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp30_);
				_data_->_tmp32_ = _data_->_tmp31_;
				_data_->_propstat_size = _data_->_tmp32_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp33_ = _data_->_propstat_index;
					_data_->_tmp34_ = _data_->_propstat_size;
					if (!(_data_->_tmp33_ < _data_->_tmp34_)) {
						break;
					}
					_data_->_tmp35_ = _data_->_propstat_list;
					_data_->_tmp36_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp35_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp36_;
					_data_->_tmp37_ = _data_->propstat;
					_data_->_tmp38_ = services_cal_dav_web_dav_prop_stat_get_status (_data_->_tmp37_);
					_data_->_tmp39_ = _data_->_tmp38_;
					if (_data_->_tmp39_ != SOUP_STATUS_OK) {
						_g_object_unref0 (_data_->propstat);
						continue;
					}
					_data_->_tmp40_ = _data_->propstat;
					_data_->_tmp41_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp40_, "getetag");
					_data_->getetag = _data_->_tmp41_;
					_data_->_tmp43_ = _data_->getetag;
					if (_data_->_tmp43_ != NULL) {
						_data_->_tmp44_ = _data_->getetag;
						_data_->_tmp45_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp44_);
						_data_->_tmp46_ = _data_->_tmp45_;
						_data_->_tmp47_ = _data_->_tmp46_;
						_data_->_tmp48_ = string_strip (_data_->_tmp47_);
						_g_free0 (_data_->_tmp42_);
						_data_->_tmp42_ = _data_->_tmp48_;
						_g_free0 (_data_->_tmp47_);
					} else {
						_data_->_tmp49_ = g_strdup ("");
						_g_free0 (_data_->_tmp42_);
						_data_->_tmp42_ = _data_->_tmp49_;
					}
					_data_->_tmp50_ = _data_->server_map;
					_data_->_tmp51_ = _data_->url;
					gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp50_, _data_->_tmp51_, _data_->_tmp42_);
					_g_free0 (_data_->_tmp42_);
					_g_object_unref0 (_data_->getetag);
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_free0 (_data_->url);
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_data_->_tmp52_ = services_log_service_get_default ();
	_data_->_tmp53_ = _data_->_tmp52_;
	_data_->_tmp54_ = _data_->server_map;
	_data_->_tmp55_ = gee_abstract_map_get_size ((GeeAbstractMap*) _data_->_tmp54_);
	_data_->_tmp56_ = _data_->_tmp55_;
	_data_->_tmp57_ = g_strdup_printf ("Project has %d items", _data_->_tmp56_);
	_data_->_tmp58_ = _data_->_tmp57_;
	services_log_service_debug (_data_->_tmp53_, "CalDAV", _data_->_tmp58_);
	_g_free0 (_data_->_tmp58_);
	_g_object_unref0 (_data_->_tmp53_);
	objects_project_set_freeze_update (_data_->project, TRUE);
	{
		_data_->_tmp59_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_data_->stale_items = _data_->_tmp59_;
		{
			_data_->_tmp60_ = services_store_instance ();
			_data_->_tmp61_ = services_store_get_items_by_project (_data_->_tmp60_, _data_->project);
			_data_->_local_item_list = _data_->_tmp61_;
			_data_->_tmp62_ = _data_->_local_item_list;
			_data_->_tmp63_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp62_);
			_data_->_tmp64_ = _data_->_tmp63_;
			_data_->_local_item_size = _data_->_tmp64_;
			_data_->_local_item_index = -1;
			while (TRUE) {
				_data_->_local_item_index = _data_->_local_item_index + 1;
				_data_->_tmp65_ = _data_->_local_item_index;
				_data_->_tmp66_ = _data_->_local_item_size;
				if (!(_data_->_tmp65_ < _data_->_tmp66_)) {
					break;
				}
				_data_->_tmp67_ = _data_->_local_item_list;
				_data_->_tmp68_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp67_, _data_->_local_item_index);
				_data_->local_item = (ObjectsItem*) _data_->_tmp68_;
				_data_->_tmp70_ = _data_->local_item;
				_data_->_tmp71_ = objects_item_get_ical_url (_data_->_tmp70_);
				_data_->_tmp72_ = _data_->_tmp71_;
				if (g_strcmp0 (_data_->_tmp72_, "") != 0) {
					_data_->_tmp73_ = _data_->server_map;
					_data_->_tmp74_ = _data_->local_item;
					_data_->_tmp75_ = objects_item_get_ical_url (_data_->_tmp74_);
					_data_->_tmp76_ = _data_->_tmp75_;
					_data_->_tmp69_ = !gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp73_, _data_->_tmp76_);
				} else {
					_data_->_tmp69_ = FALSE;
				}
				if (_data_->_tmp69_) {
					_data_->_tmp77_ = _data_->stale_items;
					_data_->_tmp78_ = _data_->local_item;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp77_, _data_->_tmp78_);
				}
				_g_object_unref0 (_data_->local_item);
			}
			_g_object_unref0 (_data_->_local_item_list);
		}
		{
			_data_->_tmp79_ = _data_->stale_items;
			_data_->_stale_item_list = _data_->_tmp79_;
			_data_->_tmp80_ = _data_->_stale_item_list;
			_data_->_tmp81_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp80_);
			_data_->_tmp82_ = _data_->_tmp81_;
			_data_->_stale_item_size = _data_->_tmp82_;
			_data_->_stale_item_index = -1;
			while (TRUE) {
				_data_->_stale_item_index = _data_->_stale_item_index + 1;
				_data_->_tmp83_ = _data_->_stale_item_index;
				_data_->_tmp84_ = _data_->_stale_item_size;
				if (!(_data_->_tmp83_ < _data_->_tmp84_)) {
					break;
				}
				_data_->_tmp85_ = _data_->_stale_item_list;
				_data_->_tmp86_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp85_, _data_->_stale_item_index);
				_data_->stale_item = (ObjectsItem*) _data_->_tmp86_;
				_data_->_tmp87_ = services_log_service_get_default ();
				_data_->_tmp88_ = _data_->_tmp87_;
				_data_->_tmp89_ = _data_->stale_item;
				_data_->_tmp90_ = objects_item_get_content (_data_->_tmp89_);
				_data_->_tmp91_ = _data_->_tmp90_;
				_data_->_tmp92_ = g_strdup_printf ("Deleting stale item: %s", _data_->_tmp91_);
				_data_->_tmp93_ = _data_->_tmp92_;
				services_log_service_debug (_data_->_tmp88_, "CalDAV", _data_->_tmp93_);
				_g_free0 (_data_->_tmp93_);
				_g_object_unref0 (_data_->_tmp88_);
				_data_->_tmp94_ = services_store_instance ();
				_data_->_tmp95_ = _data_->stale_item;
				services_store_delete_item (_data_->_tmp94_, _data_->_tmp95_);
				_g_object_unref0 (_data_->stale_item);
			}
		}
		_data_->_tmp96_ = gee_array_list_new (OBJECTS_TYPE_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_data_->stale_sections = _data_->_tmp96_;
		{
			_data_->_tmp97_ = services_store_instance ();
			_data_->_tmp98_ = services_store_get_sections_by_project (_data_->_tmp97_, _data_->project);
			_data_->_local_section_list = _data_->_tmp98_;
			_data_->_tmp99_ = _data_->_local_section_list;
			_data_->_tmp100_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp99_);
			_data_->_tmp101_ = _data_->_tmp100_;
			_data_->_local_section_size = _data_->_tmp101_;
			_data_->_local_section_index = -1;
			while (TRUE) {
				_data_->_local_section_index = _data_->_local_section_index + 1;
				_data_->_tmp102_ = _data_->_local_section_index;
				_data_->_tmp103_ = _data_->_local_section_size;
				if (!(_data_->_tmp102_ < _data_->_tmp103_)) {
					break;
				}
				_data_->_tmp104_ = _data_->_local_section_list;
				_data_->_tmp105_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp104_, _data_->_local_section_index);
				_data_->local_section = (ObjectsSection*) _data_->_tmp105_;
				_data_->_tmp107_ = _data_->local_section;
				_data_->_tmp108_ = objects_section_get_ical_url (_data_->_tmp107_);
				_data_->_tmp109_ = _data_->_tmp108_;
				if (g_strcmp0 (_data_->_tmp109_, "") != 0) {
					_data_->_tmp110_ = _data_->server_map;
					_data_->_tmp111_ = _data_->local_section;
					_data_->_tmp112_ = objects_section_get_ical_url (_data_->_tmp111_);
					_data_->_tmp113_ = _data_->_tmp112_;
					_data_->_tmp106_ = !gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp110_, _data_->_tmp113_);
				} else {
					_data_->_tmp106_ = FALSE;
				}
				if (_data_->_tmp106_) {
					_data_->_tmp114_ = _data_->stale_sections;
					_data_->_tmp115_ = _data_->local_section;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp114_, _data_->_tmp115_);
				}
				_g_object_unref0 (_data_->local_section);
			}
			_g_object_unref0 (_data_->_local_section_list);
		}
		{
			_data_->_tmp116_ = _data_->stale_sections;
			_data_->_stale_section_list = _data_->_tmp116_;
			_data_->_tmp117_ = _data_->_stale_section_list;
			_data_->_tmp118_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp117_);
			_data_->_tmp119_ = _data_->_tmp118_;
			_data_->_stale_section_size = _data_->_tmp119_;
			_data_->_stale_section_index = -1;
			while (TRUE) {
				_data_->_stale_section_index = _data_->_stale_section_index + 1;
				_data_->_tmp120_ = _data_->_stale_section_index;
				_data_->_tmp121_ = _data_->_stale_section_size;
				if (!(_data_->_tmp120_ < _data_->_tmp121_)) {
					break;
				}
				_data_->_tmp122_ = _data_->_stale_section_list;
				_data_->_tmp123_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp122_, _data_->_stale_section_index);
				_data_->stale_section = (ObjectsSection*) _data_->_tmp123_;
				_data_->_tmp124_ = services_log_service_get_default ();
				_data_->_tmp125_ = _data_->_tmp124_;
				_data_->_tmp126_ = _data_->stale_section;
				_data_->_tmp127_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->_tmp126_);
				_data_->_tmp128_ = _data_->_tmp127_;
				_data_->_tmp129_ = g_strdup_printf ("Deleting stale section: %s", _data_->_tmp128_);
				_data_->_tmp130_ = _data_->_tmp129_;
				services_log_service_debug (_data_->_tmp125_, "CalDAV", _data_->_tmp130_);
				_g_free0 (_data_->_tmp130_);
				_g_object_unref0 (_data_->_tmp125_);
				_data_->_tmp131_ = services_store_instance ();
				_data_->_tmp132_ = _data_->stale_section;
				services_store_delete_section (_data_->_tmp131_, _data_->_tmp132_);
				_g_object_unref0 (_data_->stale_section);
			}
		}
		{
			_data_->_tmp133_ = _data_->server_map;
			_data_->_tmp134_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _data_->_tmp133_);
			_data_->_tmp135_ = _data_->_tmp134_;
			_data_->_tmp136_ = _data_->_tmp135_;
			_data_->_tmp137_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp136_);
			_data_->_tmp138_ = _data_->_tmp137_;
			_g_object_unref0 (_data_->_tmp136_);
			_data_->_entry_it = _data_->_tmp138_;
			while (TRUE) {
				_data_->_tmp139_ = _data_->_entry_it;
				if (!gee_iterator_next (_data_->_tmp139_)) {
					break;
				}
				_data_->_tmp140_ = _data_->_entry_it;
				_data_->_tmp141_ = gee_iterator_get (_data_->_tmp140_);
				_data_->entry = (GeeMapEntry*) _data_->_tmp141_;
				_data_->_tmp142_ = _data_->entry;
				_data_->_tmp143_ = gee_map_entry_get_key (_data_->_tmp142_);
				_data_->_tmp144_ = _data_->_tmp143_;
				_data_->_tmp145_ = g_strdup ((const gchar*) _data_->_tmp144_);
				_data_->_vala1_url = _data_->_tmp145_;
				_data_->_tmp146_ = _data_->entry;
				_data_->_tmp147_ = gee_map_entry_get_value (_data_->_tmp146_);
				_data_->_tmp148_ = _data_->_tmp147_;
				_data_->_tmp149_ = g_strdup ((const gchar*) _data_->_tmp148_);
				_data_->server_etag = _data_->_tmp149_;
				_data_->_tmp150_ = services_store_instance ();
				_data_->_tmp151_ = _data_->_vala1_url;
				_data_->_tmp152_ = services_store_get_item_by_ical_url (_data_->_tmp150_, _data_->_tmp151_);
				_data_->_vala1_local_item = _data_->_tmp152_;
				_data_->_tmp155_ = _data_->_vala1_local_item;
				if (_data_->_tmp155_ != NULL) {
					_data_->_tmp156_ = _data_->server_etag;
					_data_->_tmp154_ = g_strcmp0 (_data_->_tmp156_, "") != 0;
				} else {
					_data_->_tmp154_ = FALSE;
				}
				if (_data_->_tmp154_) {
					_data_->_tmp157_ = _data_->_vala1_local_item;
					_data_->_tmp158_ = objects_item_get_etag (_data_->_tmp157_);
					_data_->_tmp159_ = _data_->_tmp158_;
					_data_->_tmp160_ = _data_->server_etag;
					_data_->_tmp153_ = g_strcmp0 (_data_->_tmp159_, _data_->_tmp160_) == 0;
				} else {
					_data_->_tmp153_ = FALSE;
				}
				if (_data_->_tmp153_) {
					_g_object_unref0 (_data_->_vala1_local_item);
					_g_free0 (_data_->server_etag);
					_g_free0 (_data_->_vala1_url);
					_g_object_unref0 (_data_->entry);
					continue;
				}
				_data_->_tmp161_ = _data_->_vala1_url;
				_data_->_state_ = 2;
				services_cal_dav_cal_dav_client_get_vtodo_by_url (_data_->self, _data_->_tmp161_, _data_->cancellable, services_cal_dav_cal_dav_client_etag_sync_project_ready, _data_);
				return FALSE;
				_state_2:
				_data_->_tmp162_ = services_cal_dav_cal_dav_client_get_vtodo_by_url_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
				_data_->vtodo_content = _data_->_tmp162_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->_vala1_local_item);
					_g_free0 (_data_->server_etag);
					_g_free0 (_data_->_vala1_url);
					_g_object_unref0 (_data_->entry);
					_g_object_unref0 (_data_->_entry_it);
					_g_object_unref0 (_data_->stale_sections);
					_g_object_unref0 (_data_->stale_items);
					goto __finally0;
				}
				_data_->_tmp163_ = _data_->_vala1_url;
				_data_->_tmp164_ = _data_->server_etag;
				_data_->_tmp165_ = _data_->vtodo_content;
				services_cal_dav_cal_dav_client_upsert_vtodo_content (_data_->self, _data_->project, _data_->_tmp163_, _data_->_tmp164_, _data_->_tmp165_, NULL);
				_g_free0 (_data_->vtodo_content);
				_g_object_unref0 (_data_->_vala1_local_item);
				_g_free0 (_data_->server_etag);
				_g_free0 (_data_->_vala1_url);
				_g_object_unref0 (_data_->entry);
			}
			_g_object_unref0 (_data_->_entry_it);
		}
		_g_object_unref0 (_data_->stale_sections);
		_g_object_unref0 (_data_->stale_items);
	}
	__finally0:
	{
		objects_project_set_freeze_update (_data_->project, FALSE);
		objects_base_object_count_update ((ObjectsBaseObject*) _data_->project);
		_data_->_tmp166_ = services_store_instance ();
		services_store_update_project (_data_->_tmp166_, _data_->project);
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->server_map);
		_g_object_unref0 (_data_->multi_status);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->server_map);
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_get_vtodo_by_url_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientGetVtodoByUrlData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_object_unref0 (_data_->cancellable);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientGetVtodoByUrlData, _data_);
}

static void
services_cal_dav_cal_dav_client_get_vtodo_by_url (ServicesCalDAVCalDAVClient* self,
                                                  const gchar* url,
                                                  GCancellable* cancellable,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	ServicesCalDavCalDavClientGetVtodoByUrlData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientGetVtodoByUrlData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_get_vtodo_by_url_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_get_vtodo_by_url_co (_data_);
}

static gchar*
services_cal_dav_cal_dav_client_get_vtodo_by_url_finish (ServicesCalDAVCalDAVClient* self,
                                                         GAsyncResult* _res_,
                                                         GError** error)
{
	gchar* result;
	ServicesCalDavCalDavClientGetVtodoByUrlData* _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
services_cal_dav_cal_dav_client_get_vtodo_by_url_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	ServicesCalDavCalDavClientGetVtodoByUrlData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_get_vtodo_by_url_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_get_vtodo_by_url_co (ServicesCalDavCalDavClientGetVtodoByUrlData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = g_new0 (SoupStatus, 1);
	_data_->_tmp1_[0] = SOUP_STATUS_OK;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp2__length1 = 1;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "GET", _data_->url, "", NULL, NULL, _data_->cancellable, _data_->_tmp2_, (gint) 1, NULL, services_cal_dav_cal_dav_client_get_vtodo_by_url_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp2_ = (g_free (_data_->_tmp2_), NULL);
	_data_->_tmp0_ = _data_->_tmp4_;
	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_->_tmp5_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp5_;
	_g_free0 (_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 void
services_cal_dav_cal_dav_client_update_sync_token_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientUpdateSyncTokenData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientUpdateSyncTokenData, _data_);
}

void
services_cal_dav_cal_dav_client_update_sync_token (ServicesCalDAVCalDAVClient* self,
                                                   ObjectsProject* project,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ServicesCalDavCalDavClientUpdateSyncTokenData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientUpdateSyncTokenData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_update_sync_token_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	services_cal_dav_cal_dav_client_update_sync_token_co (_data_);
}

void
services_cal_dav_cal_dav_client_update_sync_token_finish (ServicesCalDAVCalDAVClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	ServicesCalDavCalDavClientUpdateSyncTokenData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
services_cal_dav_cal_dav_client_update_sync_token_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	ServicesCalDavCalDavClientUpdateSyncTokenData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_update_sync_token_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_update_sync_token_co (ServicesCalDavCalDavClientUpdateSyncTokenData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_debug (_data_->_tmp1_, "CalDAV", "Updating sync token");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = g_strdup ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"        <d:propfind xmlns:d=\"DAV:\">\n" \
"            <d:prop>\n" \
"                <d:sync-token/>\n" \
"            </d:prop>\n" \
"        </d:propfind>\n" \
"        ");
	_data_->xml = _data_->_tmp2_;
	_data_->_tmp3_ = objects_project_get_calendar_url (_data_->project);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_propfind ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_tmp4_, _data_->xml, "1", _data_->cancellable, services_cal_dav_cal_dav_client_update_sync_token_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp5_ = services_cal_dav_web_dav_client_propfind_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->multi_status = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->xml);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp6_ = services_cal_dav_web_dav_multi_status_responses (_data_->multi_status);
		_data_->_response_list = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->_response_list;
		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_response_size = _data_->_tmp9_;
		_data_->_response_index = -1;
		while (TRUE) {
			_data_->_response_index = _data_->_response_index + 1;
			_data_->_tmp10_ = _data_->_response_index;
			_data_->_tmp11_ = _data_->_response_size;
			if (!(_data_->_tmp10_ < _data_->_tmp11_)) {
				break;
			}
			_data_->_tmp12_ = _data_->_response_list;
			_data_->_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp12_, _data_->_response_index);
			_data_->response = (ServicesCalDAVWebDAVResponse*) _data_->_tmp13_;
			{
				_data_->_tmp14_ = _data_->response;
				_data_->_tmp15_ = services_cal_dav_web_dav_response_propstats (_data_->_tmp14_);
				_data_->_propstat_list = _data_->_tmp15_;
				_data_->_tmp16_ = _data_->_propstat_list;
				_data_->_tmp17_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp16_);
				_data_->_tmp18_ = _data_->_tmp17_;
				_data_->_propstat_size = _data_->_tmp18_;
				_data_->_propstat_index = -1;
				while (TRUE) {
					_data_->_propstat_index = _data_->_propstat_index + 1;
					_data_->_tmp19_ = _data_->_propstat_index;
					_data_->_tmp20_ = _data_->_propstat_size;
					if (!(_data_->_tmp19_ < _data_->_tmp20_)) {
						break;
					}
					_data_->_tmp21_ = _data_->_propstat_list;
					_data_->_tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp21_, _data_->_propstat_index);
					_data_->propstat = (ServicesCalDAVWebDAVPropStat*) _data_->_tmp22_;
					_data_->_tmp23_ = _data_->propstat;
					_data_->_tmp24_ = services_cal_dav_web_dav_prop_stat_get_status (_data_->_tmp23_);
					_data_->_tmp25_ = _data_->_tmp24_;
					if (_data_->_tmp25_ != SOUP_STATUS_OK) {
						_g_object_unref0 (_data_->propstat);
						continue;
					}
					_data_->_tmp26_ = _data_->propstat;
					_data_->_tmp27_ = services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (_data_->_tmp26_, "sync-token");
					_data_->sync_token = _data_->_tmp27_;
					_data_->_tmp28_ = _data_->sync_token;
					if (_data_->_tmp28_ != NULL) {
						_data_->_tmp29_ = _data_->sync_token;
						_data_->_tmp30_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _data_->_tmp29_);
						_data_->_tmp31_ = _data_->_tmp30_;
						_data_->_tmp32_ = _data_->_tmp31_;
						objects_project_set_sync_id (_data_->project, _data_->_tmp32_);
						_g_free0 (_data_->_tmp32_);
						objects_project_update_local (_data_->project);
					}
					_g_object_unref0 (_data_->sync_token);
					_g_object_unref0 (_data_->propstat);
				}
				_g_object_unref0 (_data_->_propstat_list);
			}
			_g_object_unref0 (_data_->response);
		}
		_g_object_unref0 (_data_->_response_list);
	}
	_g_object_unref0 (_data_->multi_status);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_create_project_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientCreateProjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientCreateProjectData, _data_);
}

void
services_cal_dav_cal_dav_client_create_project (ServicesCalDAVCalDAVClient* self,
                                                ObjectsProject* project,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	ServicesCalDavCalDavClientCreateProjectData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientCreateProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_create_project_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	services_cal_dav_cal_dav_client_create_project_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_create_project_finish (ServicesCalDAVCalDAVClient* self,
                                                       GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientCreateProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_create_project_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	ServicesCalDavCalDavClientCreateProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_create_project_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_create_project_co (ServicesCalDavCalDavClientCreateProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Creating project");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->project);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = objects_project_get_color_hex (_data_->project);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = g_strdup_printf ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"            <d:mkcol xmlns:d=\"DAV:\" xmlns:ical=\"http://apple.com/ns" \
"/ical/\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:cal=\"urn:ietf:para" \
"ms:xml:ns:caldav\">\n" \
"            <d:set>\n" \
"                <d:prop>\n" \
"                    <d:resourcetype>\n" \
"                        <d:collection/>\n" \
"                        <cal:calendar/>\n" \
"                    </d:resourcetype>\n" \
"                    <d:displayname>%s</d:displayname>\n" \
"                    <ical:calendar-color>%s</ical:calendar-color>\n" \
"                    <oc:calendar-enabled>1</oc:calendar-enabled>\n" \
"                    <cal:supported-calendar-component-set >\n" \
"                        <cal:comp name=\"VTODO\"/>\n" \
"                    </cal:supported-calendar-component-set>\n" \
"                </d:prop>\n" \
"            </d:set>\n" \
"        </d:mkcol>\n" \
"        ", _data_->_tmp3_, _data_->_tmp5_);
	_data_->xml = _data_->_tmp6_;
	_data_->_tmp7_ = objects_project_get_source (_data_->project);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = objects_source_get_caldav_data (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = objects_source_cal_dav_data_get_calendar_home_url (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->project);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_tmp15_ = g_uri_resolve_relative (_data_->_tmp12_, _data_->_tmp14_, G_URI_FLAGS_NONE, &_data_->_inner_error0_);
	_data_->calendar_url = _data_->_tmp15_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->xml);
		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_->_tmp16_ = _data_->calendar_url;
	if (!g_str_has_suffix (_data_->_tmp16_, "/")) {
		_data_->_tmp17_ = _data_->calendar_url;
		_data_->_tmp18_ = g_strconcat (_data_->_tmp17_, "/", NULL);
		_g_free0 (_data_->calendar_url);
		_data_->calendar_url = _data_->_tmp18_;
	}
	_data_->_tmp19_ = http_response_new ();
	_data_->response = _data_->_tmp19_;
	{
		_data_->_tmp20_ = _data_->calendar_url;
		_data_->_tmp21_ = g_new0 (SoupStatus, 2);
		_data_->_tmp21_[0] = SOUP_STATUS_CREATED;
		_data_->_tmp21_[1] = SOUP_STATUS_OK;
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp22__length1 = 2;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "MKCOL", _data_->_tmp20_, "application/xml", _data_->xml, NULL, NULL, _data_->_tmp22_, (gint) 2, NULL, services_cal_dav_cal_dav_client_create_project_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp23_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp24_ = _data_->_tmp23_;
		_g_free0 (_data_->_tmp24_);
		_data_->_tmp22_ = (g_free (_data_->_tmp22_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp25_ = _data_->calendar_url;
		objects_project_set_calendar_url (_data_->project, _data_->_tmp25_);
		_data_->_tmp26_ = _data_->response;
		http_response_set_status (_data_->_tmp26_, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp27_ = _data_->e;
		_data_->_tmp28_ = _data_->_tmp27_->message;
		if (string_contains (_data_->_tmp28_, "HTTP 403")) {
			_data_->_tmp29_ = services_log_service_get_default ();
			_data_->_tmp30_ = _data_->_tmp29_;
			services_log_service_warn (_data_->_tmp30_, "CalDAV", "Server does not allow creating calendars via CalDAV");
			_g_object_unref0 (_data_->_tmp30_);
			_data_->_tmp31_ = _data_->response;
			http_response_set_error_code (_data_->_tmp31_, 403);
			_data_->_tmp32_ = _data_->response;
			http_response_set_error (_data_->_tmp32_, _ ("This server does not allow creating projects via CalDAV. Please create" \
" it directly from your calendar provider's website."));
		} else {
			_data_->_tmp33_ = services_log_service_get_default ();
			_data_->_tmp34_ = _data_->_tmp33_;
			_data_->_tmp35_ = _data_->e;
			_data_->_tmp36_ = _data_->_tmp35_->message;
			_data_->_tmp37_ = g_strdup_printf ("Failed to create project: %s", _data_->_tmp36_);
			_data_->_tmp38_ = _data_->_tmp37_;
			services_log_service_error (_data_->_tmp34_, "CalDAV", _data_->_tmp38_);
			_g_free0 (_data_->_tmp38_);
			_g_object_unref0 (_data_->_tmp34_);
			_data_->_tmp39_ = _data_->response;
			_data_->_tmp40_ = _data_->e;
			http_response_set_error_code (_data_->_tmp39_, _data_->_tmp40_->code);
			_data_->_tmp41_ = _data_->response;
			_data_->_tmp42_ = _data_->e;
			_data_->_tmp43_ = _data_->_tmp42_->message;
			http_response_set_error (_data_->_tmp41_, _data_->_tmp43_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		_g_free0 (_data_->calendar_url);
		_g_free0 (_data_->xml);
		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_->result = _data_->response;
	_g_free0 (_data_->calendar_url);
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_update_project_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientUpdateProjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientUpdateProjectData, _data_);
}

void
services_cal_dav_cal_dav_client_update_project (ServicesCalDAVCalDAVClient* self,
                                                ObjectsProject* project,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	ServicesCalDavCalDavClientUpdateProjectData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientUpdateProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_update_project_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	services_cal_dav_cal_dav_client_update_project_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_update_project_finish (ServicesCalDAVCalDAVClient* self,
                                                       GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientUpdateProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_update_project_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	ServicesCalDavCalDavClientUpdateProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_update_project_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_update_project_co (ServicesCalDavCalDavClientUpdateProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Updating project");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->project);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = objects_project_get_color_hex (_data_->project);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = g_strdup_printf ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"        <d:propertyupdate xmlns:d=\"DAV:\" xmlns:ical=\"http://apple.c" \
"om/ns/ical/\">\n" \
"            <d:set>\n" \
"                <d:prop>\n" \
"                    <d:displayname>%s</d:displayname>\n" \
"                    <ical:calendar-color>%s</ical:calendar-color>\n" \
"                </d:prop>\n" \
"            </d:set>\n" \
"        </d:propertyupdate>\n" \
"        ", _data_->_tmp3_, _data_->_tmp5_);
	_data_->xml = _data_->_tmp6_;
	_data_->_tmp7_ = http_response_new ();
	_data_->response = _data_->_tmp7_;
	{
		_data_->_tmp8_ = objects_project_get_calendar_url (_data_->project);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = g_new0 (SoupStatus, 1);
		_data_->_tmp10_[0] = SOUP_STATUS_MULTI_STATUS;
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp11__length1 = 1;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "PROPPATCH", _data_->_tmp9_, "application/xml", _data_->xml, NULL, NULL, _data_->_tmp11_, (gint) 1, NULL, services_cal_dav_cal_dav_client_update_project_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp12_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_g_free0 (_data_->_tmp13_);
		_data_->_tmp11_ = (g_free (_data_->_tmp11_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		http_response_set_status (_data_->response, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp14_ = services_log_service_get_default ();
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = _data_->e;
		_data_->_tmp17_ = _data_->_tmp16_->message;
		_data_->_tmp18_ = g_strdup_printf ("Failed to update project: %s", _data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		services_log_service_error (_data_->_tmp15_, "CalDAV", _data_->_tmp19_);
		_g_free0 (_data_->_tmp19_);
		_g_object_unref0 (_data_->_tmp15_);
		_data_->_tmp20_ = _data_->e;
		http_response_set_error_code (_data_->response, _data_->_tmp20_->code);
		_data_->_tmp21_ = _data_->e;
		_data_->_tmp22_ = _data_->_tmp21_->message;
		http_response_set_error (_data_->response, _data_->_tmp22_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		_g_free0 (_data_->xml);
		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_->result = _data_->response;
	_g_free0 (_data_->xml);
	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
services_cal_dav_cal_dav_client_delete_project_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientDeleteProjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientDeleteProjectData, _data_);
}

void
services_cal_dav_cal_dav_client_delete_project (ServicesCalDAVCalDAVClient* self,
                                                ObjectsProject* project,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	ServicesCalDavCalDavClientDeleteProjectData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsProject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientDeleteProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_delete_project_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	services_cal_dav_cal_dav_client_delete_project_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_delete_project_finish (ServicesCalDAVCalDAVClient* self,
                                                       GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientDeleteProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_delete_project_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	ServicesCalDavCalDavClientDeleteProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_delete_project_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_delete_project_co (ServicesCalDavCalDavClientDeleteProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Deleting project");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = http_response_new ();
	_data_->response = _data_->_tmp2_;
	{
		_data_->_tmp3_ = objects_project_get_calendar_url (_data_->project);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = g_new0 (SoupStatus, 3);
		_data_->_tmp5_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp5_[1] = SOUP_STATUS_MULTI_STATUS;
		_data_->_tmp5_[2] = SOUP_STATUS_OK;
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp6__length1 = 3;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "DELETE", _data_->_tmp4_, "text/calendar", NULL, NULL, NULL, _data_->_tmp6_, (gint) 3, NULL, services_cal_dav_cal_dav_client_delete_project_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_g_free0 (_data_->_tmp8_);
		_data_->_tmp6_ = (g_free (_data_->_tmp6_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		http_response_set_status (_data_->response, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp9_ = _data_->e;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		if (string_contains (_data_->_tmp10_, "HTTP 403")) {
			_data_->_tmp11_ = services_log_service_get_default ();
			_data_->_tmp12_ = _data_->_tmp11_;
			services_log_service_warn (_data_->_tmp12_, "CalDAV", "Server does not allow deleting calendars via CalDAV");
			_g_object_unref0 (_data_->_tmp12_);
			http_response_set_error_code (_data_->response, 403);
			http_response_set_error (_data_->response, _ ("This server does not allow deleting projects via CalDAV. Please delete" \
" it directly from your calendar provider's website."));
		} else {
			_data_->_tmp13_ = _data_->e;
			_data_->_tmp14_ = _data_->_tmp13_->message;
			if (string_contains (_data_->_tmp14_, "HTTP 405")) {
				_data_->_tmp15_ = services_log_service_get_default ();
				_data_->_tmp16_ = _data_->_tmp15_;
				services_log_service_warn (_data_->_tmp16_, "CalDAV", "Server does not support project deletion via CalDAV");
				_g_object_unref0 (_data_->_tmp16_);
				http_response_set_error_code (_data_->response, 405);
				http_response_set_error (_data_->response, _ ("This server does not support deleting projects via CalDAV. Please dele" \
"te it from the server directly."));
			} else {
				_data_->_tmp17_ = services_log_service_get_default ();
				_data_->_tmp18_ = _data_->_tmp17_;
				_data_->_tmp19_ = _data_->e;
				_data_->_tmp20_ = _data_->_tmp19_->message;
				_data_->_tmp21_ = g_strdup_printf ("Failed to delete project: %s", _data_->_tmp20_);
				_data_->_tmp22_ = _data_->_tmp21_;
				services_log_service_error (_data_->_tmp18_, "CalDAV", _data_->_tmp22_);
				_g_free0 (_data_->_tmp22_);
				_g_object_unref0 (_data_->_tmp18_);
				_data_->_tmp23_ = _data_->e;
				http_response_set_error_code (_data_->response, _data_->_tmp23_->code);
				_data_->_tmp24_ = _data_->e;
				_data_->_tmp25_ = _data_->_tmp24_->message;
				http_response_set_error (_data_->response, _data_->_tmp25_);
			}
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		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_->result = _data_->response;
	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
services_cal_dav_cal_dav_client_add_item_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientAddItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientAddItemData, _data_);
}

void
services_cal_dav_cal_dav_client_add_item (ServicesCalDAVCalDAVClient* self,
                                          ObjectsItem* item,
                                          gboolean update,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	ServicesCalDavCalDavClientAddItemData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientAddItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_add_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_data_->update = update;
	services_cal_dav_cal_dav_client_add_item_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_add_item_finish (ServicesCalDAVCalDAVClient* self,
                                                 GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientAddItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
services_cal_dav_cal_dav_client_add_item_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	ServicesCalDavCalDavClientAddItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_add_item_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_add_item_co (ServicesCalDavCalDavClientAddItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->update) {
		_data_->_tmp0_ = "Updating item";
	} else {
		_data_->_tmp0_ = "Adding item";
	}
	_data_->_tmp1_ = services_log_service_get_default ();
	_data_->_tmp2_ = _data_->_tmp1_;
	services_log_service_info (_data_->_tmp2_, "CalDAV", _data_->_tmp0_);
	_g_object_unref0 (_data_->_tmp2_);
	if (_data_->update) {
		_data_->_tmp4_ = objects_item_get_ical_url (_data_->item);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = g_strdup (_data_->_tmp5_);
		_g_free0 (_data_->_tmp3_);
		_data_->_tmp3_ = _data_->_tmp6_;
	} else {
		_data_->_tmp7_ = objects_item_get_project (_data_->item);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp9_ = objects_project_get_calendar_url (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->item);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = g_strdup_printf ("%s.ics", _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp15_ = g_build_path ("/", _data_->_tmp10_, _data_->_tmp14_, NULL);
		_g_free0 (_data_->_tmp3_);
		_data_->_tmp3_ = _data_->_tmp15_;
		_g_free0 (_data_->_tmp14_);
	}
	_data_->_tmp16_ = _data_->_tmp3_;
	_data_->_tmp3_ = NULL;
	_data_->url = _data_->_tmp16_;
	_data_->_tmp17_ = objects_item_to_vtodo (_data_->item);
	_data_->body = _data_->_tmp17_;
	_data_->_tmp18__length1 = 0;
	_data_->__tmp18__size_ = 0;
	if (_data_->update) {
		_data_->_tmp19_ = g_new0 (SoupStatus, 3);
		_data_->_tmp19_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp19_[1] = SOUP_STATUS_CREATED;
		_data_->_tmp19_[2] = SOUP_STATUS_OK;
		_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
		_data_->_tmp18_ = _data_->_tmp19_;
		_data_->_tmp18__length1 = 3;
		_data_->__tmp18__size_ = _data_->_tmp18__length1;
	} else {
		_data_->_tmp20_ = g_new0 (SoupStatus, 2);
		_data_->_tmp20_[0] = SOUP_STATUS_CREATED;
		_data_->_tmp20_[1] = SOUP_STATUS_OK;
		_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
		_data_->_tmp18_ = _data_->_tmp20_;
		_data_->_tmp18__length1 = 2;
		_data_->__tmp18__size_ = _data_->_tmp18__length1;
	}
	_data_->_tmp21_ = _data_->_tmp18_;
	_data_->_tmp21__length1 = _data_->_tmp18__length1;
	_data_->_tmp18_ = NULL;
	_data_->_tmp18__length1 = 0;
	_data_->expected = _data_->_tmp21_;
	_data_->expected_length1 = _data_->_tmp21__length1;
	_data_->_expected_size_ = _data_->expected_length1;
	_data_->_tmp22_ = http_response_new ();
	_data_->response = _data_->_tmp22_;
	{
		_data_->headers = NULL;
		if (_data_->update) {
			_data_->_tmp25_ = objects_item_get_etag (_data_->item);
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_tmp24_ = _data_->_tmp26_ != NULL;
		} else {
			_data_->_tmp24_ = FALSE;
		}
		if (_data_->_tmp24_) {
			_data_->_tmp27_ = objects_item_get_etag (_data_->item);
			_data_->_tmp28_ = _data_->_tmp27_;
			_data_->_tmp23_ = g_strcmp0 (_data_->_tmp28_, "") != 0;
		} else {
			_data_->_tmp23_ = FALSE;
		}
		if (_data_->_tmp23_) {
			_data_->_tmp29_ = g_str_hash;
			_data_->_tmp30_ = g_str_equal;
			_data_->_tmp31_ = g_hash_table_new_full (_data_->_tmp29_, _data_->_tmp30_, _g_free0_, _g_free0_);
			_g_hash_table_unref0 (_data_->headers);
			_data_->headers = _data_->_tmp31_;
			_data_->_tmp32_ = _data_->headers;
			_data_->_tmp33_ = g_strdup ("If-Match");
			_data_->_tmp34_ = objects_item_get_etag (_data_->item);
			_data_->_tmp35_ = _data_->_tmp34_;
			_data_->_tmp36_ = g_strdup (_data_->_tmp35_);
			g_hash_table_insert (_data_->_tmp32_, _data_->_tmp33_, _data_->_tmp36_);
		}
		_data_->_tmp37_ = _data_->url;
		_data_->_tmp38_ = _data_->body;
		_data_->_tmp39_ = _data_->expected;
		_data_->_tmp39__length1 = _data_->expected_length1;
		_data_->_tmp40_ = _data_->headers;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "PUT", _data_->_tmp37_, "text/calendar", _data_->_tmp38_, NULL, NULL, _data_->_tmp39_, (gint) _data_->_tmp39__length1, _data_->_tmp40_, services_cal_dav_cal_dav_client_add_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp41_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp42_ = _data_->_tmp41_;
		_g_free0 (_data_->_tmp42_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_hash_table_unref0 (_data_->headers);
			goto __catch0_g_error;
		}
		_data_->_tmp44_ = services_cal_dav_web_dav_client_get_last_response_etag ((ServicesCalDAVWebDAVClient*) _data_->self);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp43_ = _data_->_tmp45_;
		if (_data_->_tmp43_ == NULL) {
			_data_->_tmp43_ = "";
		}
		_data_->_tmp46_ = _data_->url;
		_data_->_tmp47_ = _data_->body;
		_data_->_tmp48_ = util_generate_extra_data (_data_->_tmp46_, _data_->_tmp43_, _data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		objects_item_set_extra_data (_data_->item, _data_->_tmp49_);
		_g_free0 (_data_->_tmp49_);
		_data_->_tmp50_ = _data_->response;
		http_response_set_status (_data_->_tmp50_, TRUE);
		_g_hash_table_unref0 (_data_->headers);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp51_ = _data_->e;
		_data_->_tmp52_ = _data_->_tmp51_->message;
		if (string_contains (_data_->_tmp52_, "HTTP 412")) {
			_data_->_tmp53_ = services_log_service_get_default ();
			_data_->_tmp54_ = _data_->_tmp53_;
			services_log_service_warn (_data_->_tmp54_, "CalDAV", "Conflict detected (412), re-fetching item");
			_g_object_unref0 (_data_->_tmp54_);
			_data_->_tmp55_ = _data_->response;
			http_response_set_error_code (_data_->_tmp55_, 412);
			_data_->_tmp56_ = _data_->response;
			http_response_set_error (_data_->_tmp56_, _ ("Task was modified on another device. Please sync to get the latest ver" \
"sion."));
		} else {
			if (_data_->update) {
				_data_->_tmp57_ = "update";
			} else {
				_data_->_tmp57_ = "add";
			}
			_data_->_tmp58_ = services_log_service_get_default ();
			_data_->_tmp59_ = _data_->_tmp58_;
			_data_->_tmp60_ = _data_->e;
			_data_->_tmp61_ = _data_->_tmp60_->message;
			_data_->_tmp62_ = g_strdup_printf ("Failed to %s item: %s", _data_->_tmp57_, _data_->_tmp61_);
			_data_->_tmp63_ = _data_->_tmp62_;
			services_log_service_error (_data_->_tmp59_, "CalDAV", _data_->_tmp63_);
			_g_free0 (_data_->_tmp63_);
			_g_object_unref0 (_data_->_tmp59_);
			_data_->_tmp64_ = _data_->response;
			_data_->_tmp65_ = _data_->e;
			http_response_set_error_code (_data_->_tmp64_, _data_->_tmp65_->code);
			_data_->_tmp66_ = _data_->response;
			_data_->_tmp67_ = _data_->e;
			_data_->_tmp68_ = _data_->_tmp67_->message;
			http_response_set_error (_data_->_tmp66_, _data_->_tmp68_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		_data_->expected = (g_free (_data_->expected), NULL);
		_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
		_g_free0 (_data_->body);
		_g_free0 (_data_->url);
		_g_free0 (_data_->_tmp3_);
		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_->result = _data_->response;
	_data_->expected = (g_free (_data_->expected), NULL);
	_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
	_g_free0 (_data_->body);
	_g_free0 (_data_->url);
	_g_free0 (_data_->_tmp3_);
	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
services_cal_dav_cal_dav_client_complete_item_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientCompleteItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientCompleteItemData, _data_);
}

void
services_cal_dav_cal_dav_client_complete_item (ServicesCalDAVCalDAVClient* self,
                                               ObjectsItem* item,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	ServicesCalDavCalDavClientCompleteItemData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientCompleteItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_complete_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	services_cal_dav_cal_dav_client_complete_item_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_complete_item_finish (ServicesCalDAVCalDAVClient* self,
                                                      GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientCompleteItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_complete_item_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	ServicesCalDavCalDavClientCompleteItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_complete_item_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_complete_item_co (ServicesCalDavCalDavClientCompleteItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Completing item");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = objects_item_to_vtodo (_data_->item);
	_data_->body = _data_->_tmp2_;
	_data_->_tmp3_ = http_response_new ();
	_data_->response = _data_->_tmp3_;
	{
		_data_->headers = NULL;
		_data_->_tmp5_ = objects_item_get_etag (_data_->item);
		_data_->_tmp6_ = _data_->_tmp5_;
		if (_data_->_tmp6_ != NULL) {
			_data_->_tmp7_ = objects_item_get_etag (_data_->item);
			_data_->_tmp8_ = _data_->_tmp7_;
			_data_->_tmp4_ = g_strcmp0 (_data_->_tmp8_, "") != 0;
		} else {
			_data_->_tmp4_ = FALSE;
		}
		if (_data_->_tmp4_) {
			_data_->_tmp9_ = g_str_hash;
			_data_->_tmp10_ = g_str_equal;
			_data_->_tmp11_ = g_hash_table_new_full (_data_->_tmp9_, _data_->_tmp10_, _g_free0_, _g_free0_);
			_g_hash_table_unref0 (_data_->headers);
			_data_->headers = _data_->_tmp11_;
			_data_->_tmp12_ = _data_->headers;
			_data_->_tmp13_ = g_strdup ("If-Match");
			_data_->_tmp14_ = objects_item_get_etag (_data_->item);
			_data_->_tmp15_ = _data_->_tmp14_;
			_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
			g_hash_table_insert (_data_->_tmp12_, _data_->_tmp13_, _data_->_tmp16_);
		}
		_data_->_tmp17_ = objects_item_get_ical_url (_data_->item);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = _data_->body;
		_data_->_tmp20_ = g_new0 (SoupStatus, 2);
		_data_->_tmp20_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp20_[1] = SOUP_STATUS_CREATED;
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp21__length1 = 2;
		_data_->_tmp22_ = _data_->headers;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "PUT", _data_->_tmp18_, "text/calendar", _data_->_tmp19_, NULL, NULL, _data_->_tmp21_, (gint) 2, _data_->_tmp22_, services_cal_dav_cal_dav_client_complete_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp23_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp24_ = _data_->_tmp23_;
		_g_free0 (_data_->_tmp24_);
		_data_->_tmp21_ = (g_free (_data_->_tmp21_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_hash_table_unref0 (_data_->headers);
			goto __catch0_g_error;
		}
		_data_->_tmp26_ = services_cal_dav_web_dav_client_get_last_response_etag ((ServicesCalDAVWebDAVClient*) _data_->self);
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_tmp25_ = _data_->_tmp27_;
		if (_data_->_tmp25_ == NULL) {
			_data_->_tmp25_ = "";
		}
		_data_->_tmp28_ = objects_item_get_ical_url (_data_->item);
		_data_->_tmp29_ = _data_->_tmp28_;
		_data_->_tmp30_ = _data_->body;
		_data_->_tmp31_ = util_generate_extra_data (_data_->_tmp29_, _data_->_tmp25_, _data_->_tmp30_);
		_data_->_tmp32_ = _data_->_tmp31_;
		objects_item_set_extra_data (_data_->item, _data_->_tmp32_);
		_g_free0 (_data_->_tmp32_);
		_data_->_tmp33_ = _data_->response;
		http_response_set_status (_data_->_tmp33_, TRUE);
		_g_hash_table_unref0 (_data_->headers);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp34_ = _data_->e;
		_data_->_tmp35_ = _data_->_tmp34_->message;
		if (string_contains (_data_->_tmp35_, "HTTP 412")) {
			_data_->_tmp36_ = services_log_service_get_default ();
			_data_->_tmp37_ = _data_->_tmp36_;
			services_log_service_warn (_data_->_tmp37_, "CalDAV", "Conflict on complete (412), re-fetching ETag and retrying");
			_g_object_unref0 (_data_->_tmp37_);
			{
				_data_->_tmp38_ = g_cancellable_new ();
				_data_->retry_cancellable = _data_->_tmp38_;
				_data_->_tmp39_ = objects_item_get_ical_url (_data_->item);
				_data_->_tmp40_ = _data_->_tmp39_;
				_data_->_tmp41_ = _data_->retry_cancellable;
				_data_->_state_ = 2;
				services_cal_dav_cal_dav_client_get_vtodo_by_url (_data_->self, _data_->_tmp40_, _data_->_tmp41_, services_cal_dav_cal_dav_client_complete_item_ready, _data_);
				return FALSE;
				_state_2:
				_data_->_tmp42_ = services_cal_dav_cal_dav_client_get_vtodo_by_url_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
				_data_->vtodo_content = _data_->_tmp42_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->retry_cancellable);
					goto __catch1_g_error;
				}
				_data_->_tmp44_ = services_cal_dav_web_dav_client_get_last_response_etag ((ServicesCalDAVWebDAVClient*) _data_->self);
				_data_->_tmp45_ = _data_->_tmp44_;
				_data_->_tmp43_ = _data_->_tmp45_;
				if (_data_->_tmp43_ == NULL) {
					_data_->_tmp43_ = "";
				}
				_data_->_tmp46_ = g_strdup (_data_->_tmp43_);
				_data_->fresh_etag = _data_->_tmp46_;
				_data_->_tmp47_ = objects_item_get_ical_url (_data_->item);
				_data_->_tmp48_ = _data_->_tmp47_;
				_data_->_tmp49_ = _data_->fresh_etag;
				_data_->_tmp50_ = _data_->vtodo_content;
				_data_->_tmp51_ = util_generate_extra_data (_data_->_tmp48_, _data_->_tmp49_, _data_->_tmp50_);
				_data_->_tmp52_ = _data_->_tmp51_;
				objects_item_set_extra_data (_data_->item, _data_->_tmp52_);
				_g_free0 (_data_->_tmp52_);
				_data_->retry_headers = NULL;
				_data_->_tmp53_ = _data_->fresh_etag;
				if (g_strcmp0 (_data_->_tmp53_, "") != 0) {
					_data_->_tmp54_ = g_str_hash;
					_data_->_tmp55_ = g_str_equal;
					_data_->_tmp56_ = g_hash_table_new_full (_data_->_tmp54_, _data_->_tmp55_, _g_free0_, _g_free0_);
					_g_hash_table_unref0 (_data_->retry_headers);
					_data_->retry_headers = _data_->_tmp56_;
					_data_->_tmp57_ = _data_->retry_headers;
					_data_->_tmp58_ = g_strdup ("If-Match");
					_data_->_tmp59_ = _data_->fresh_etag;
					_data_->_tmp60_ = g_strdup (_data_->_tmp59_);
					g_hash_table_insert (_data_->_tmp57_, _data_->_tmp58_, _data_->_tmp60_);
				}
				_data_->_tmp61_ = objects_item_get_ical_url (_data_->item);
				_data_->_tmp62_ = _data_->_tmp61_;
				_data_->_tmp63_ = _data_->body;
				_data_->_tmp64_ = g_new0 (SoupStatus, 2);
				_data_->_tmp64_[0] = SOUP_STATUS_NO_CONTENT;
				_data_->_tmp64_[1] = SOUP_STATUS_CREATED;
				_data_->_tmp65_ = _data_->_tmp64_;
				_data_->_tmp65__length1 = 2;
				_data_->_tmp66_ = _data_->retry_headers;
				_data_->_state_ = 3;
				services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "PUT", _data_->_tmp62_, "text/calendar", _data_->_tmp63_, NULL, NULL, _data_->_tmp65_, (gint) 2, _data_->_tmp66_, services_cal_dav_cal_dav_client_complete_item_ready, _data_);
				return FALSE;
				_state_3:
				_data_->_tmp67_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
				_data_->_tmp68_ = _data_->_tmp67_;
				_g_free0 (_data_->_tmp68_);
				_data_->_tmp65_ = (g_free (_data_->_tmp65_), NULL);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_hash_table_unref0 (_data_->retry_headers);
					_g_free0 (_data_->fresh_etag);
					_g_free0 (_data_->vtodo_content);
					_g_object_unref0 (_data_->retry_cancellable);
					goto __catch1_g_error;
				}
				_data_->_tmp70_ = services_cal_dav_web_dav_client_get_last_response_etag ((ServicesCalDAVWebDAVClient*) _data_->self);
				_data_->_tmp71_ = _data_->_tmp70_;
				_data_->_tmp69_ = _data_->_tmp71_;
				if (_data_->_tmp69_ == NULL) {
					_data_->_tmp69_ = "";
				}
				_data_->_tmp72_ = objects_item_get_ical_url (_data_->item);
				_data_->_tmp73_ = _data_->_tmp72_;
				_data_->_tmp74_ = _data_->body;
				_data_->_tmp75_ = util_generate_extra_data (_data_->_tmp73_, _data_->_tmp69_, _data_->_tmp74_);
				_data_->_tmp76_ = _data_->_tmp75_;
				objects_item_set_extra_data (_data_->item, _data_->_tmp76_);
				_g_free0 (_data_->_tmp76_);
				_data_->_tmp77_ = _data_->response;
				http_response_set_status (_data_->_tmp77_, TRUE);
				_g_hash_table_unref0 (_data_->retry_headers);
				_g_free0 (_data_->fresh_etag);
				_g_free0 (_data_->vtodo_content);
				_g_object_unref0 (_data_->retry_cancellable);
			}
			goto __finally1;
			__catch1_g_error:
			{
				_data_->retry_error = _data_->_inner_error0_;
				_data_->_inner_error0_ = NULL;
				_data_->_tmp78_ = services_log_service_get_default ();
				_data_->_tmp79_ = _data_->_tmp78_;
				_data_->_tmp80_ = _data_->retry_error;
				_data_->_tmp81_ = _data_->_tmp80_->message;
				_data_->_tmp82_ = g_strdup_printf ("Retry complete failed: %s", _data_->_tmp81_);
				_data_->_tmp83_ = _data_->_tmp82_;
				services_log_service_error (_data_->_tmp79_, "CalDAV", _data_->_tmp83_);
				_g_free0 (_data_->_tmp83_);
				_g_object_unref0 (_data_->_tmp79_);
				_data_->_tmp84_ = _data_->response;
				http_response_set_error_code (_data_->_tmp84_, 412);
				_data_->_tmp85_ = _data_->response;
				http_response_set_error (_data_->_tmp85_, _ ("Task was modified on another device. Please sync to get the latest ver" \
"sion."));
				_g_error_free0 (_data_->retry_error);
			}
			__finally1:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_error_free0 (_data_->e);
				_http_response_unref0 (_data_->response);
				_g_free0 (_data_->body);
				g_critical ("file %s: line %d: unexpected 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;
			}
		} else {
			_data_->_tmp86_ = services_log_service_get_default ();
			_data_->_tmp87_ = _data_->_tmp86_;
			_data_->_tmp88_ = _data_->e;
			_data_->_tmp89_ = _data_->_tmp88_->message;
			_data_->_tmp90_ = g_strdup_printf ("Failed to complete item: %s", _data_->_tmp89_);
			_data_->_tmp91_ = _data_->_tmp90_;
			services_log_service_error (_data_->_tmp87_, "CalDAV", _data_->_tmp91_);
			_g_free0 (_data_->_tmp91_);
			_g_object_unref0 (_data_->_tmp87_);
			_data_->_tmp92_ = _data_->response;
			_data_->_tmp93_ = _data_->e;
			http_response_set_error_code (_data_->_tmp92_, _data_->_tmp93_->code);
			_data_->_tmp94_ = _data_->response;
			_data_->_tmp95_ = _data_->e;
			_data_->_tmp96_ = _data_->_tmp95_->message;
			http_response_set_error (_data_->_tmp94_, _data_->_tmp96_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		_g_free0 (_data_->body);
		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_->result = _data_->response;
	_g_free0 (_data_->body);
	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
services_cal_dav_cal_dav_client_move_item_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientMoveItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->destination_project);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientMoveItemData, _data_);
}

void
services_cal_dav_cal_dav_client_move_item (ServicesCalDAVCalDAVClient* self,
                                           ObjectsItem* item,
                                           ObjectsProject* destination_project,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	ServicesCalDavCalDavClientMoveItemData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsProject* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (destination_project != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientMoveItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_move_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_tmp2_ = _g_object_ref0 (destination_project);
	_g_object_unref0 (_data_->destination_project);
	_data_->destination_project = _tmp2_;
	services_cal_dav_cal_dav_client_move_item_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_move_item_finish (ServicesCalDAVCalDAVClient* self,
                                                  GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientMoveItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_move_item_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	ServicesCalDavCalDavClientMoveItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_move_item_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_move_item_co (ServicesCalDavCalDavClientMoveItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Moving item to another project");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = objects_project_get_calendar_url (_data_->destination_project);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->item);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = g_strdup_printf ("%s.ics", _data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = g_build_path ("/", _data_->_tmp3_, _data_->_tmp7_, NULL);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_free0 (_data_->_tmp7_);
	_data_->destination = _data_->_tmp9_;
	_data_->_tmp10_ = g_str_hash;
	_data_->_tmp11_ = g_str_equal;
	_data_->_tmp12_ = g_hash_table_new_full (_data_->_tmp10_, _data_->_tmp11_, _g_free0_, _g_free0_);
	_data_->headers = _data_->_tmp12_;
	_data_->_tmp13_ = g_strdup ("Destination");
	_data_->_tmp14_ = g_strdup (_data_->destination);
	g_hash_table_insert (_data_->headers, _data_->_tmp13_, _data_->_tmp14_);
	_data_->_tmp15_ = http_response_new ();
	_data_->response = _data_->_tmp15_;
	{
		_data_->_tmp16_ = objects_item_get_ical_url (_data_->item);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = g_new0 (SoupStatus, 2);
		_data_->_tmp18_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp18_[1] = SOUP_STATUS_CREATED;
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp19__length1 = 2;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "MOVE", _data_->_tmp17_, "", NULL, NULL, NULL, _data_->_tmp19_, (gint) 2, _data_->headers, services_cal_dav_cal_dav_client_move_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp20_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_g_free0 (_data_->_tmp21_);
		_data_->_tmp19_ = (g_free (_data_->_tmp19_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp22_ = objects_item_get_calendar_data (_data_->item);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = util_generate_extra_data (_data_->destination, "", _data_->_tmp23_);
		_data_->_tmp25_ = _data_->_tmp24_;
		objects_item_set_extra_data (_data_->item, _data_->_tmp25_);
		_g_free0 (_data_->_tmp25_);
		_data_->_tmp26_ = _data_->response;
		http_response_set_status (_data_->_tmp26_, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp29_ = _data_->e;
		_data_->_tmp30_ = _data_->_tmp29_->message;
		if (string_contains (_data_->_tmp30_, "HTTP 502")) {
			_data_->_tmp28_ = TRUE;
		} else {
			_data_->_tmp31_ = _data_->e;
			_data_->_tmp32_ = _data_->_tmp31_->message;
			_data_->_tmp28_ = string_contains (_data_->_tmp32_, "HTTP 405");
		}
		if (_data_->_tmp28_) {
			_data_->_tmp27_ = TRUE;
		} else {
			_data_->_tmp33_ = _data_->e;
			_data_->_tmp34_ = _data_->_tmp33_->message;
			_data_->_tmp27_ = string_contains (_data_->_tmp34_, "HTTP 501");
		}
		if (_data_->_tmp27_) {
			_data_->_tmp35_ = services_log_service_get_default ();
			_data_->_tmp36_ = _data_->_tmp35_;
			services_log_service_warn (_data_->_tmp36_, "CalDAV", "MOVE not supported, falling back to PUT+DELETE");
			_g_object_unref0 (_data_->_tmp36_);
			_data_->_state_ = 2;
			services_cal_dav_cal_dav_client_move_item_fallback (_data_->self, _data_->item, _data_->destination_project, _data_->destination, services_cal_dav_cal_dav_client_move_item_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp37_ = services_cal_dav_cal_dav_client_move_item_fallback_finish (_data_->self, _data_->_res_);
			_http_response_unref0 (_data_->response);
			_data_->response = _data_->_tmp37_;
		} else {
			_data_->_tmp38_ = services_log_service_get_default ();
			_data_->_tmp39_ = _data_->_tmp38_;
			_data_->_tmp40_ = _data_->e;
			_data_->_tmp41_ = _data_->_tmp40_->message;
			_data_->_tmp42_ = g_strdup_printf ("Failed to move item: %s", _data_->_tmp41_);
			_data_->_tmp43_ = _data_->_tmp42_;
			services_log_service_error (_data_->_tmp39_, "CalDAV", _data_->_tmp43_);
			_g_free0 (_data_->_tmp43_);
			_g_object_unref0 (_data_->_tmp39_);
			_data_->_tmp44_ = _data_->response;
			_data_->_tmp45_ = _data_->e;
			http_response_set_error_code (_data_->_tmp44_, _data_->_tmp45_->code);
			_data_->_tmp46_ = _data_->response;
			_data_->_tmp47_ = _data_->e;
			_data_->_tmp48_ = _data_->_tmp47_->message;
			http_response_set_error (_data_->_tmp46_, _data_->_tmp48_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		_g_hash_table_unref0 (_data_->headers);
		_g_free0 (_data_->destination);
		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_->result = _data_->response;
	_g_hash_table_unref0 (_data_->headers);
	_g_free0 (_data_->destination);
	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
services_cal_dav_cal_dav_client_move_item_fallback_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientMoveItemFallbackData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->destination_project);
	_g_free0 (_data_->destination);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientMoveItemFallbackData, _data_);
}

static void
services_cal_dav_cal_dav_client_move_item_fallback (ServicesCalDAVCalDAVClient* self,
                                                    ObjectsItem* item,
                                                    ObjectsProject* destination_project,
                                                    const gchar* destination,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	ServicesCalDavCalDavClientMoveItemFallbackData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsProject* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (destination_project != NULL);
	g_return_if_fail (destination != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientMoveItemFallbackData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_move_item_fallback_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_tmp2_ = _g_object_ref0 (destination_project);
	_g_object_unref0 (_data_->destination_project);
	_data_->destination_project = _tmp2_;
	_tmp3_ = g_strdup (destination);
	_g_free0 (_data_->destination);
	_data_->destination = _tmp3_;
	services_cal_dav_cal_dav_client_move_item_fallback_co (_data_);
}

static HttpResponse*
services_cal_dav_cal_dav_client_move_item_fallback_finish (ServicesCalDAVCalDAVClient* self,
                                                           GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientMoveItemFallbackData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_move_item_fallback_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_)
{
	ServicesCalDavCalDavClientMoveItemFallbackData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_move_item_fallback_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_move_item_fallback_co (ServicesCalDavCalDavClientMoveItemFallbackData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_item_to_vtodo (_data_->item);
	_data_->body = _data_->_tmp1_;
	{
		_data_->_tmp2_ = _data_->body;
		_data_->_tmp3_ = g_new0 (SoupStatus, 2);
		_data_->_tmp3_[0] = SOUP_STATUS_CREATED;
		_data_->_tmp3_[1] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp4__length1 = 2;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "PUT", _data_->destination, "text/calendar", _data_->_tmp2_, NULL, NULL, _data_->_tmp4_, (gint) 2, NULL, services_cal_dav_cal_dav_client_move_item_fallback_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_g_free0 (_data_->_tmp6_);
		_data_->_tmp4_ = (g_free (_data_->_tmp4_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp8_ = services_cal_dav_web_dav_client_get_last_response_etag ((ServicesCalDAVWebDAVClient*) _data_->self);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp7_ = _data_->_tmp9_;
		if (_data_->_tmp7_ == NULL) {
			_data_->_tmp7_ = "";
		}
		_data_->_tmp10_ = _data_->body;
		_data_->_tmp11_ = util_generate_extra_data (_data_->destination, _data_->_tmp7_, _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		objects_item_set_extra_data (_data_->item, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_data_->_tmp13_ = objects_item_get_ical_url (_data_->item);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp15_ = g_new0 (SoupStatus, 2);
		_data_->_tmp15_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp15_[1] = SOUP_STATUS_OK;
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp16__length1 = 2;
		_data_->_state_ = 2;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "DELETE", _data_->_tmp14_, "", NULL, NULL, NULL, _data_->_tmp16_, (gint) 2, NULL, services_cal_dav_cal_dav_client_move_item_fallback_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp17_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_g_free0 (_data_->_tmp18_);
		_data_->_tmp16_ = (g_free (_data_->_tmp16_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp19_ = _data_->response;
		http_response_set_status (_data_->_tmp19_, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp20_ = services_log_service_get_default ();
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = _data_->e;
		_data_->_tmp23_ = _data_->_tmp22_->message;
		_data_->_tmp24_ = g_strdup_printf ("Failed to move item (fallback): %s", _data_->_tmp23_);
		_data_->_tmp25_ = _data_->_tmp24_;
		services_log_service_error (_data_->_tmp21_, "CalDAV", _data_->_tmp25_);
		_g_free0 (_data_->_tmp25_);
		_g_object_unref0 (_data_->_tmp21_);
		_data_->_tmp26_ = _data_->response;
		_data_->_tmp27_ = _data_->e;
		http_response_set_error_code (_data_->_tmp26_, _data_->_tmp27_->code);
		_data_->_tmp28_ = _data_->response;
		_data_->_tmp29_ = _data_->e;
		_data_->_tmp30_ = _data_->_tmp29_->message;
		http_response_set_error (_data_->_tmp28_, _data_->_tmp30_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->body);
		_http_response_unref0 (_data_->response);
		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_->result = _data_->response;
	_g_free0 (_data_->body);
	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
services_cal_dav_cal_dav_client_delete_item_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientDeleteItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientDeleteItemData, _data_);
}

void
services_cal_dav_cal_dav_client_delete_item (ServicesCalDAVCalDAVClient* self,
                                             ObjectsItem* item,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	ServicesCalDavCalDavClientDeleteItemData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientDeleteItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_delete_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	services_cal_dav_cal_dav_client_delete_item_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_delete_item_finish (ServicesCalDAVCalDAVClient* self,
                                                    GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientDeleteItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_delete_item_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	ServicesCalDavCalDavClientDeleteItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_delete_item_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_delete_item_co (ServicesCalDavCalDavClientDeleteItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Deleting item");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = http_response_new ();
	_data_->response = _data_->_tmp2_;
	{
		_data_->_tmp3_ = objects_item_get_ical_url (_data_->item);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = g_new0 (SoupStatus, 2);
		_data_->_tmp5_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp5_[1] = SOUP_STATUS_OK;
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp6__length1 = 2;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "DELETE", _data_->_tmp4_, "", NULL, NULL, NULL, _data_->_tmp6_, (gint) 2, NULL, services_cal_dav_cal_dav_client_delete_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_g_free0 (_data_->_tmp8_);
		_data_->_tmp6_ = (g_free (_data_->_tmp6_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		http_response_set_status (_data_->response, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp9_ = services_log_service_get_default ();
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = _data_->e;
		_data_->_tmp12_ = _data_->_tmp11_->message;
		_data_->_tmp13_ = g_strdup_printf ("Failed to delete item: %s", _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		services_log_service_error (_data_->_tmp10_, "CalDAV", _data_->_tmp14_);
		_g_free0 (_data_->_tmp14_);
		_g_object_unref0 (_data_->_tmp10_);
		_data_->_tmp15_ = _data_->e;
		http_response_set_error_code (_data_->response, _data_->_tmp15_->code);
		_data_->_tmp16_ = _data_->e;
		_data_->_tmp17_ = _data_->_tmp16_->message;
		http_response_set_error (_data_->response, _data_->_tmp17_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		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_->result = _data_->response;
	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
services_cal_dav_cal_dav_client_add_section_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientAddSectionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->section);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientAddSectionData, _data_);
}

void
services_cal_dav_cal_dav_client_add_section (ServicesCalDAVCalDAVClient* self,
                                             ObjectsSection* section,
                                             gboolean update,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	ServicesCalDavCalDavClientAddSectionData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsSection* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientAddSectionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_add_section_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (section);
	_g_object_unref0 (_data_->section);
	_data_->section = _tmp1_;
	_data_->update = update;
	services_cal_dav_cal_dav_client_add_section_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_add_section_finish (ServicesCalDAVCalDAVClient* self,
                                                    GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientAddSectionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_add_section_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	ServicesCalDavCalDavClientAddSectionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_add_section_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_add_section_co (ServicesCalDavCalDavClientAddSectionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->update) {
		_data_->_tmp0_ = "Updating section";
	} else {
		_data_->_tmp0_ = "Adding section";
	}
	_data_->_tmp1_ = services_log_service_get_default ();
	_data_->_tmp2_ = _data_->_tmp1_;
	services_log_service_info (_data_->_tmp2_, "CalDAV", _data_->_tmp0_);
	_g_object_unref0 (_data_->_tmp2_);
	if (_data_->update) {
		_data_->_tmp4_ = objects_section_get_ical_url (_data_->section);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = g_strdup (_data_->_tmp5_);
		_g_free0 (_data_->_tmp3_);
		_data_->_tmp3_ = _data_->_tmp6_;
	} else {
		_data_->_tmp7_ = objects_section_get_project (_data_->section);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp9_ = objects_project_get_calendar_url (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->section);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = g_strdup_printf ("%s.ics", _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp15_ = g_build_path ("/", _data_->_tmp10_, _data_->_tmp14_, NULL);
		_g_free0 (_data_->_tmp3_);
		_data_->_tmp3_ = _data_->_tmp15_;
		_g_free0 (_data_->_tmp14_);
	}
	_data_->_tmp16_ = _data_->_tmp3_;
	_data_->_tmp3_ = NULL;
	_data_->url = _data_->_tmp16_;
	_data_->_tmp17_ = objects_section_to_vtodo (_data_->section);
	_data_->body = _data_->_tmp17_;
	_data_->_tmp18__length1 = 0;
	_data_->__tmp18__size_ = 0;
	if (_data_->update) {
		_data_->_tmp19_ = g_new0 (SoupStatus, 3);
		_data_->_tmp19_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp19_[1] = SOUP_STATUS_CREATED;
		_data_->_tmp19_[2] = SOUP_STATUS_OK;
		_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
		_data_->_tmp18_ = _data_->_tmp19_;
		_data_->_tmp18__length1 = 3;
		_data_->__tmp18__size_ = _data_->_tmp18__length1;
	} else {
		_data_->_tmp20_ = g_new0 (SoupStatus, 2);
		_data_->_tmp20_[0] = SOUP_STATUS_CREATED;
		_data_->_tmp20_[1] = SOUP_STATUS_OK;
		_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
		_data_->_tmp18_ = _data_->_tmp20_;
		_data_->_tmp18__length1 = 2;
		_data_->__tmp18__size_ = _data_->_tmp18__length1;
	}
	_data_->_tmp21_ = _data_->_tmp18_;
	_data_->_tmp21__length1 = _data_->_tmp18__length1;
	_data_->_tmp18_ = NULL;
	_data_->_tmp18__length1 = 0;
	_data_->expected = _data_->_tmp21_;
	_data_->expected_length1 = _data_->_tmp21__length1;
	_data_->_expected_size_ = _data_->expected_length1;
	_data_->_tmp22_ = http_response_new ();
	_data_->response = _data_->_tmp22_;
	{
		_data_->headers = NULL;
		if (_data_->update) {
			_data_->_tmp25_ = objects_section_get_etag (_data_->section);
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_tmp24_ = _data_->_tmp26_ != NULL;
		} else {
			_data_->_tmp24_ = FALSE;
		}
		if (_data_->_tmp24_) {
			_data_->_tmp27_ = objects_section_get_etag (_data_->section);
			_data_->_tmp28_ = _data_->_tmp27_;
			_data_->_tmp23_ = g_strcmp0 (_data_->_tmp28_, "") != 0;
		} else {
			_data_->_tmp23_ = FALSE;
		}
		if (_data_->_tmp23_) {
			_data_->_tmp29_ = g_str_hash;
			_data_->_tmp30_ = g_str_equal;
			_data_->_tmp31_ = g_hash_table_new_full (_data_->_tmp29_, _data_->_tmp30_, _g_free0_, _g_free0_);
			_g_hash_table_unref0 (_data_->headers);
			_data_->headers = _data_->_tmp31_;
			_data_->_tmp32_ = _data_->headers;
			_data_->_tmp33_ = g_strdup ("If-Match");
			_data_->_tmp34_ = objects_section_get_etag (_data_->section);
			_data_->_tmp35_ = _data_->_tmp34_;
			_data_->_tmp36_ = g_strdup (_data_->_tmp35_);
			g_hash_table_insert (_data_->_tmp32_, _data_->_tmp33_, _data_->_tmp36_);
		}
		_data_->_tmp37_ = _data_->url;
		_data_->_tmp38_ = _data_->body;
		_data_->_tmp39_ = _data_->expected;
		_data_->_tmp39__length1 = _data_->expected_length1;
		_data_->_tmp40_ = _data_->headers;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "PUT", _data_->_tmp37_, "text/calendar", _data_->_tmp38_, NULL, NULL, _data_->_tmp39_, (gint) _data_->_tmp39__length1, _data_->_tmp40_, services_cal_dav_cal_dav_client_add_section_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp41_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp42_ = _data_->_tmp41_;
		_g_free0 (_data_->_tmp42_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_hash_table_unref0 (_data_->headers);
			goto __catch0_g_error;
		}
		_data_->_tmp44_ = services_cal_dav_web_dav_client_get_last_response_etag ((ServicesCalDAVWebDAVClient*) _data_->self);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp43_ = _data_->_tmp45_;
		if (_data_->_tmp43_ == NULL) {
			_data_->_tmp43_ = "";
		}
		_data_->_tmp46_ = _data_->url;
		_data_->_tmp47_ = _data_->body;
		_data_->_tmp48_ = util_generate_extra_data (_data_->_tmp46_, _data_->_tmp43_, _data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		objects_section_set_extra_data (_data_->section, _data_->_tmp49_);
		_g_free0 (_data_->_tmp49_);
		_data_->_tmp50_ = _data_->response;
		http_response_set_status (_data_->_tmp50_, TRUE);
		_g_hash_table_unref0 (_data_->headers);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		if (_data_->update) {
			_data_->_tmp51_ = "update";
		} else {
			_data_->_tmp51_ = "add";
		}
		_data_->_tmp52_ = services_log_service_get_default ();
		_data_->_tmp53_ = _data_->_tmp52_;
		_data_->_tmp54_ = _data_->e;
		_data_->_tmp55_ = _data_->_tmp54_->message;
		_data_->_tmp56_ = g_strdup_printf ("Failed to %s section: %s", _data_->_tmp51_, _data_->_tmp55_);
		_data_->_tmp57_ = _data_->_tmp56_;
		services_log_service_error (_data_->_tmp53_, "CalDAV", _data_->_tmp57_);
		_g_free0 (_data_->_tmp57_);
		_g_object_unref0 (_data_->_tmp53_);
		_data_->_tmp58_ = _data_->response;
		_data_->_tmp59_ = _data_->e;
		http_response_set_error_code (_data_->_tmp58_, _data_->_tmp59_->code);
		_data_->_tmp60_ = _data_->response;
		_data_->_tmp61_ = _data_->e;
		_data_->_tmp62_ = _data_->_tmp61_->message;
		http_response_set_error (_data_->_tmp60_, _data_->_tmp62_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		_data_->expected = (g_free (_data_->expected), NULL);
		_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
		_g_free0 (_data_->body);
		_g_free0 (_data_->url);
		_g_free0 (_data_->_tmp3_);
		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_->result = _data_->response;
	_data_->expected = (g_free (_data_->expected), NULL);
	_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
	_g_free0 (_data_->body);
	_g_free0 (_data_->url);
	_g_free0 (_data_->_tmp3_);
	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
services_cal_dav_cal_dav_client_delete_section_data_free (gpointer _data)
{
	ServicesCalDavCalDavClientDeleteSectionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->section);
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavCalDavClientDeleteSectionData, _data_);
}

void
services_cal_dav_cal_dav_client_delete_section (ServicesCalDAVCalDAVClient* self,
                                                ObjectsSection* section,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	ServicesCalDavCalDavClientDeleteSectionData* _data_;
	ServicesCalDAVCalDAVClient* _tmp0_;
	ObjectsSection* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_data_ = g_slice_new0 (ServicesCalDavCalDavClientDeleteSectionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_cal_dav_cal_dav_client_delete_section_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (section);
	_g_object_unref0 (_data_->section);
	_data_->section = _tmp1_;
	services_cal_dav_cal_dav_client_delete_section_co (_data_);
}

HttpResponse*
services_cal_dav_cal_dav_client_delete_section_finish (ServicesCalDAVCalDAVClient* self,
                                                       GAsyncResult* _res_)
{
	HttpResponse* result;
	ServicesCalDavCalDavClientDeleteSectionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_cal_dav_cal_dav_client_delete_section_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	ServicesCalDavCalDavClientDeleteSectionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_cal_dav_client_delete_section_co (_data_);
}

static gboolean
services_cal_dav_cal_dav_client_delete_section_co (ServicesCalDavCalDavClientDeleteSectionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_log_service_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	services_log_service_info (_data_->_tmp1_, "CalDAV", "Deleting section");
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp2_ = http_response_new ();
	_data_->response = _data_->_tmp2_;
	{
		_data_->_tmp3_ = objects_section_get_ical_url (_data_->section);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = g_new0 (SoupStatus, 2);
		_data_->_tmp5_[0] = SOUP_STATUS_NO_CONTENT;
		_data_->_tmp5_[1] = SOUP_STATUS_OK;
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp6__length1 = 2;
		_data_->_state_ = 1;
		services_cal_dav_web_dav_client_send_request ((ServicesCalDAVWebDAVClient*) _data_->self, "DELETE", _data_->_tmp4_, "", NULL, NULL, NULL, _data_->_tmp6_, (gint) 2, NULL, services_cal_dav_cal_dav_client_delete_section_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = services_cal_dav_web_dav_client_send_request_finish ((ServicesCalDAVWebDAVClient*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_g_free0 (_data_->_tmp8_);
		_data_->_tmp6_ = (g_free (_data_->_tmp6_), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		http_response_set_status (_data_->response, TRUE);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp9_ = services_log_service_get_default ();
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = _data_->e;
		_data_->_tmp12_ = _data_->_tmp11_->message;
		_data_->_tmp13_ = g_strdup_printf ("Failed to delete section: %s", _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		services_log_service_error (_data_->_tmp10_, "CalDAV", _data_->_tmp14_);
		_g_free0 (_data_->_tmp14_);
		_g_object_unref0 (_data_->_tmp10_);
		_data_->_tmp15_ = _data_->e;
		http_response_set_error_code (_data_->response, _data_->_tmp15_->code);
		_data_->_tmp16_ = _data_->e;
		_data_->_tmp17_ = _data_->_tmp16_->message;
		http_response_set_error (_data_->response, _data_->_tmp17_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_http_response_unref0 (_data_->response);
		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_->result = _data_->response;
	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 gboolean
services_cal_dav_cal_dav_client_is_vtodo_calendar (ServicesCalDAVCalDAVClient* self,
                                                   GXmlDomElement* resourcetype,
                                                   GXmlDomElement* supported_calendar)
{
	gboolean is_calendar = FALSE;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (resourcetype == NULL) {
		result = FALSE;
		return result;
	}
	_tmp0_ = gxml_dom_element_get_elements_by_tag_name (resourcetype, "calendar");
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_dom_html_collection_get_length (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ > 0;
	_g_object_unref0 (_tmp1_);
	is_calendar = _tmp4_;
	if (!is_calendar) {
		result = FALSE;
		return result;
	}
	if (supported_calendar != NULL) {
		GXmlDomHTMLCollection* calendar_comps = NULL;
		GXmlDomHTMLCollection* _tmp5_;
		_tmp5_ = gxml_dom_element_get_elements_by_tag_name (supported_calendar, "comp");
		calendar_comps = _tmp5_;
		{
			GXmlDomHTMLCollection* _calendar_comp_list = NULL;
			GXmlDomHTMLCollection* _tmp6_;
			gint _calendar_comp_size = 0;
			GXmlDomHTMLCollection* _tmp7_;
			gint _tmp8_;
			gint _tmp9_;
			gint _calendar_comp_index = 0;
			_tmp6_ = calendar_comps;
			_calendar_comp_list = _tmp6_;
			_tmp7_ = _calendar_comp_list;
			_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
			_tmp9_ = _tmp8_;
			_calendar_comp_size = _tmp9_;
			_calendar_comp_index = -1;
			while (TRUE) {
				gint _tmp10_;
				gint _tmp11_;
				GXmlDomElement* calendar_comp = NULL;
				GXmlDomHTMLCollection* _tmp12_;
				gpointer _tmp13_;
				GXmlDomElement* _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				gboolean _tmp17_;
				_calendar_comp_index = _calendar_comp_index + 1;
				_tmp10_ = _calendar_comp_index;
				_tmp11_ = _calendar_comp_size;
				if (!(_tmp10_ < _tmp11_)) {
					break;
				}
				_tmp12_ = _calendar_comp_list;
				_tmp13_ = gee_list_get ((GeeList*) _tmp12_, _calendar_comp_index);
				calendar_comp = (GXmlDomElement*) _tmp13_;
				_tmp14_ = calendar_comp;
				_tmp15_ = gxml_dom_element_get_attribute (_tmp14_, "name");
				_tmp16_ = _tmp15_;
				_tmp17_ = g_strcmp0 (_tmp16_, "VTODO") == 0;
				_g_free0 (_tmp16_);
				if (_tmp17_) {
					result = TRUE;
					_g_object_unref0 (calendar_comp);
					_g_object_unref0 (calendar_comps);
					return result;
				}
				_g_object_unref0 (calendar_comp);
			}
		}
		_g_object_unref0 (calendar_comps);
	}
	result = FALSE;
	return result;
}

gboolean
services_cal_dav_cal_dav_client_is_deleted_calendar (ServicesCalDAVCalDAVClient* self,
                                                     GXmlDomElement* resourcetype)
{
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (resourcetype == NULL) {
		result = FALSE;
		return result;
	}
	_tmp0_ = gxml_dom_element_get_elements_by_tag_name (resourcetype, "deleted-calendar");
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_dom_html_collection_get_length (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ > 0;
	_g_object_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static void
services_cal_dav_cal_dav_client_class_init (ServicesCalDAVCalDAVClientClass * klass,
                                            gpointer klass_data)
{
	services_cal_dav_cal_dav_client_parent_class = g_type_class_peek_parent (klass);
}

static void
services_cal_dav_cal_dav_client_instance_init (ServicesCalDAVCalDAVClient * self,
                                               gpointer klass)
{
}

static GType
services_cal_dav_cal_dav_client_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesCalDAVCalDAVClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_cal_dav_cal_dav_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesCalDAVCalDAVClient), 0, (GInstanceInitFunc) services_cal_dav_cal_dav_client_instance_init, NULL };
	GType services_cal_dav_cal_dav_client_type_id;
	services_cal_dav_cal_dav_client_type_id = g_type_register_static (SERVICES_CAL_DAV_TYPE_WEB_DAV_CLIENT, "ServicesCalDAVCalDAVClient", &g_define_type_info, 0);
	return services_cal_dav_cal_dav_client_type_id;
}

GType
services_cal_dav_cal_dav_client_get_type (void)
{
	static volatile gsize services_cal_dav_cal_dav_client_type_id__once = 0;
	if (g_once_init_enter (&services_cal_dav_cal_dav_client_type_id__once)) {
		GType services_cal_dav_cal_dav_client_type_id;
		services_cal_dav_cal_dav_client_type_id = services_cal_dav_cal_dav_client_get_type_once ();
		g_once_init_leave (&services_cal_dav_cal_dav_client_type_id__once, services_cal_dav_cal_dav_client_type_id);
	}
	return services_cal_dav_cal_dav_client_type_id__once;
}

