/* WebDAVClient.c generated by valac 0.56.19, the Vala compiler
 * generated from WebDAVClient.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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <libsoup/soup.h>
#include <gio/gio.h>
#include <gxml/gxml.h>
#include <gee.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_WEB_DAV_CLIENT_0_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_CLIENT_LAST_RESPONSE_ETAG_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_CLIENT_NUM_PROPERTIES
};
static GParamSpec* services_cal_dav_web_dav_client_properties[SERVICES_CAL_DAV_WEB_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))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ServicesCalDavWebDavClientPropfindData ServicesCalDavWebDavClientPropfindData;
typedef struct _ServicesCalDavWebDavClientReportData ServicesCalDavWebDavClientReportData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block15Data Block15Data;
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _ServicesCalDavWebDavClientSendRequestData ServicesCalDavWebDavClientSendRequestData;
enum  {
	SERVICES_CAL_DAV_WEB_DAV_MULTI_STATUS_0_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_MULTI_STATUS_NUM_PROPERTIES
};
static GParamSpec* services_cal_dav_web_dav_multi_status_properties[SERVICES_CAL_DAV_WEB_DAV_MULTI_STATUS_NUM_PROPERTIES];
enum  {
	SERVICES_CAL_DAV_WEB_DAV_RESPONSE_0_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_RESPONSE_HREF_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_RESPONSE_STATUS_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_RESPONSE_NUM_PROPERTIES
};
static GParamSpec* services_cal_dav_web_dav_response_properties[SERVICES_CAL_DAV_WEB_DAV_RESPONSE_NUM_PROPERTIES];
enum  {
	SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_0_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_STATUS_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_PROP_PROPERTY,
	SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_NUM_PROPERTIES
};
static GParamSpec* services_cal_dav_web_dav_prop_stat_properties[SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_NUM_PROPERTIES];

struct _ServicesCalDAVWebDAVClientPrivate {
	gchar* _last_response_etag;
};

struct _ServicesCalDavWebDavClientPropfindData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVWebDAVClient* self;
	gchar* url;
	gchar* xml;
	gchar* depth;
	GCancellable* cancellable;
	ServicesCalDAVWebDAVMultiStatus* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	SoupStatus* _tmp5_;
	SoupStatus* _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ServicesCalDAVWebDAVMultiStatus* _tmp9_;
	ServicesCalDAVWebDAVMultiStatus* _tmp10_;
	ServicesCalDAVWebDAVMultiStatus* _tmp11_;
	GError* _inner_error0_;
};

struct _ServicesCalDavWebDavClientReportData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVWebDAVClient* self;
	gchar* url;
	gchar* xml;
	gchar* depth;
	GCancellable* cancellable;
	ServicesCalDAVWebDAVMultiStatus* result;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	SoupStatus* _tmp5_;
	SoupStatus* _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ServicesCalDAVWebDAVMultiStatus* _tmp9_;
	ServicesCalDAVWebDAVMultiStatus* _tmp10_;
	ServicesCalDAVWebDAVMultiStatus* _tmp11_;
	GError* _inner_error0_;
};

struct _Block15Data {
	int _ref_count_;
	ServicesCalDAVWebDAVClient* self;
	SoupMessage* msg;
	gchar* content_type;
	gchar* body;
	gpointer _async_data_;
};

struct _ServicesCalDavWebDavClientSendRequestData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalDAVWebDAVClient* self;
	gchar* method;
	gchar* url;
	gchar* content_type;
	gchar* body;
	gchar* depth;
	GCancellable* cancellable;
	SoupStatus* expected_statuses;
	gint expected_statuses_length1;
	GHashTable* extra_headers;
	gchar* result;
	Block15Data* _data15_;
	gchar* abs_url;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* _tmp4_;
	GError* _tmp5_;
	ServicesLogService* _tmp6_;
	ServicesLogService* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	SoupMessage* _tmp12_;
	SoupMessage* _tmp13_;
	SoupMessageHeaders* _tmp14_;
	SoupMessageHeaders* _tmp15_;
	SoupMessage* _tmp16_;
	SoupMessage* _tmp17_;
	SoupMessage* _tmp18_;
	SoupMessage* _tmp19_;
	SoupMessageHeaders* _tmp20_;
	SoupMessageHeaders* _tmp21_;
	GList* _tmp22_;
	GList* key_collection;
	GList* key_it;
	const gchar* key;
	SoupMessage* _tmp23_;
	SoupMessageHeaders* _tmp24_;
	SoupMessageHeaders* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	gconstpointer _tmp28_;
	SoupMessage* _tmp29_;
	guint8* _tmp30_;
	gint _tmp30__length1;
	gint _tmp31_;
	guint8* _tmp32_;
	gint _tmp32__length1;
	GBytes* _tmp33_;
	GBytes* _tmp34_;
	GBytes* response;
	GBytes* _tmp35_;
	SoupSession* _tmp36_;
	SoupMessage* _tmp37_;
	GBytes* _tmp38_;
	GBytes* _tmp39_;
	GError* e;
	GError* _tmp40_;
	ServicesLogService* _tmp41_;
	ServicesLogService* _tmp42_;
	GError* _tmp43_;
	GError* _tmp44_;
	GError* _tmp45_;
	const gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	GError* _tmp49_;
	GError* _tmp50_;
	gboolean ok;
	SoupStatus* code_collection;
	gint code_collection_length1;
	gint _code_collection_size_;
	gint code_it;
	SoupStatus code;
	SoupMessage* _tmp51_;
	guint _tmp52_;
	guint _tmp53_;
	gchar* response_text;
	GBytes* _tmp54_;
	gsize _tmp55_;
	guint8* _tmp56_;
	gchar* _tmp57_;
	const gchar* _tmp58_;
	SoupMessage* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	ServicesLogService* _tmp62_;
	ServicesLogService* _tmp63_;
	const gchar* _tmp64_;
	SoupMessage* _tmp65_;
	guint _tmp66_;
	guint _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	const gchar* _tmp70_;
	SoupMessage* _tmp71_;
	const gchar* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	const gchar* _tmp75_;
	const gchar* _tmp76_;
	SoupMessage* _tmp77_;
	guint _tmp78_;
	guint _tmp79_;
	gchar* _tmp80_;
	gchar* _tmp81_;
	GError* _tmp82_;
	GError* _tmp83_;
	guint8* response_data;
	GBytes* _tmp84_;
	gsize _tmp85_;
	guint8* _tmp86_;
	guint8* _tmp87_;
	gint _tmp87__length1;
	gint response_data_length1;
	gint _response_data_size_;
	SoupMessage* _tmp88_;
	SoupMessageHeaders* _tmp89_;
	SoupMessageHeaders* _tmp90_;
	const gchar* _tmp91_;
	guint8* _tmp92_;
	gint _tmp92__length1;
	gchar* _tmp93_;
	GError* _inner_error0_;
};

struct _ServicesCalDAVWebDAVMultiStatusPrivate {
	GXmlDomElement* root;
	gchar* xml_content;
};

struct _ServicesCalDAVWebDAVResponsePrivate {
	gchar* _href;
	SoupStatus _status;
	GXmlDomElement* element;
};

struct _ServicesCalDAVWebDAVPropStatPrivate {
	SoupStatus _status;
	GXmlDomElement* _prop;
};

static gint ServicesCalDAVWebDAVClient_private_offset;
static gpointer services_cal_dav_web_dav_client_parent_class = NULL;
static gint ServicesCalDAVWebDAVMultiStatus_private_offset;
static gpointer services_cal_dav_web_dav_multi_status_parent_class = NULL;
static gint ServicesCalDAVWebDAVResponse_private_offset;
static gpointer services_cal_dav_web_dav_response_parent_class = NULL;
static gint ServicesCalDAVWebDAVPropStat_private_offset;
static gpointer services_cal_dav_web_dav_prop_stat_parent_class = NULL;

static void services_cal_dav_web_dav_client_propfind_data_free (gpointer _data);
static gboolean services_cal_dav_web_dav_client_propfind_co (ServicesCalDavWebDavClientPropfindData* _data_);
static void services_cal_dav_web_dav_client_propfind_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static void services_cal_dav_web_dav_client_report_data_free (gpointer _data);
static gboolean services_cal_dav_web_dav_client_report_co (ServicesCalDavWebDavClientReportData* _data_);
static void services_cal_dav_web_dav_client_report_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void services_cal_dav_web_dav_client_send_request_data_free (gpointer _data);
static gboolean services_cal_dav_web_dav_client_send_request_co (ServicesCalDavWebDavClientSendRequestData* _data_);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
static gboolean __lambda31_ (ServicesCalDAVWebDAVClient* self,
                      SoupAuth* auth,
                      gboolean retrying);
static gboolean ___lambda31__soup_message_authenticate (SoupMessage* _sender,
                                                 SoupAuth* auth,
                                                 gboolean retrying,
                                                 gpointer self);
static void __lambda32_ (Block15Data* _data15_);
static void ___lambda32__soup_message_restarted (SoupMessage* _sender,
                                          gpointer self);
static gboolean ___lambda33_ (ServicesCalDAVWebDAVClient* self);
static gboolean ____lambda33__soup_message_accept_certificate (SoupMessage* _sender,
                                                        GTlsCertificate* tls_peer_certificate,
                                                        GTlsCertificateFlags tls_peer_errors,
                                                        gpointer self);
static void services_cal_dav_web_dav_client_send_request_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_);
static guint8* _vala_array_dup2 (guint8* self,
                          gssize length);
static void _vala_array_add1 (guint8* * array,
                       gint* length,
                       gint* size,
                       guint8 value);
static void services_cal_dav_web_dav_client_set_last_response_etag (ServicesCalDAVWebDAVClient* self,
                                                             const gchar* value);
static void services_cal_dav_web_dav_client_finalize (GObject * obj);
static GType services_cal_dav_web_dav_client_get_type_once (void);
static void _vala_services_cal_dav_web_dav_client_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void _vala_services_cal_dav_web_dav_client_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec);
static void services_cal_dav_web_dav_multi_status_finalize (GObject * obj);
static GType services_cal_dav_web_dav_multi_status_get_type_once (void);
static void services_cal_dav_web_dav_response_parse_href (ServicesCalDAVWebDAVResponse* self);
static void services_cal_dav_web_dav_response_parse_status (ServicesCalDAVWebDAVResponse* self);
static void services_cal_dav_web_dav_response_set_href (ServicesCalDAVWebDAVResponse* self,
                                                 const gchar* value);
static SoupStatus services_cal_dav_web_dav_response_parse_status_line (ServicesCalDAVWebDAVResponse* self,
                                                                const gchar* status_line);
static void services_cal_dav_web_dav_response_set_status (ServicesCalDAVWebDAVResponse* self,
                                                   SoupStatus value);
static void services_cal_dav_web_dav_response_finalize (GObject * obj);
static GType services_cal_dav_web_dav_response_get_type_once (void);
static void _vala_services_cal_dav_web_dav_response_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_services_cal_dav_web_dav_response_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);
static SoupStatus services_cal_dav_web_dav_prop_stat_parse_status_line (ServicesCalDAVWebDAVPropStat* self,
                                                                 const gchar* status_line);
static void services_cal_dav_web_dav_prop_stat_set_status (ServicesCalDAVWebDAVPropStat* self,
                                                    SoupStatus value);
static void services_cal_dav_web_dav_prop_stat_set_prop (ServicesCalDAVWebDAVPropStat* self,
                                                  GXmlDomElement* value);
static void services_cal_dav_web_dav_prop_stat_finalize (GObject * obj);
static GType services_cal_dav_web_dav_prop_stat_get_type_once (void);
static void _vala_services_cal_dav_web_dav_prop_stat_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_services_cal_dav_web_dav_prop_stat_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
services_cal_dav_web_dav_client_get_instance_private (ServicesCalDAVWebDAVClient* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesCalDAVWebDAVClient_private_offset);
}

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

ServicesCalDAVWebDAVClient*
services_cal_dav_web_dav_client_construct (GType object_type,
                                           SoupSession* session,
                                           const gchar* base_url,
                                           const gchar* username,
                                           const gchar* password,
                                           gboolean ignore_ssl)
{
	ServicesCalDAVWebDAVClient * self = NULL;
	SoupSession* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	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 = (ServicesCalDAVWebDAVClient*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (session);
	_g_object_unref0 (self->session);
	self->session = _tmp0_;
	_tmp1_ = g_strdup (base_url);
	_g_free0 (self->base_url);
	self->base_url = _tmp1_;
	_tmp2_ = g_strdup (username);
	_g_free0 (self->username);
	self->username = _tmp2_;
	_tmp3_ = g_strdup (password);
	_g_free0 (self->password);
	self->password = _tmp3_;
	self->ignore_ssl = ignore_ssl;
	return self;
}

ServicesCalDAVWebDAVClient*
services_cal_dav_web_dav_client_new (SoupSession* session,
                                     const gchar* base_url,
                                     const gchar* username,
                                     const gchar* password,
                                     gboolean ignore_ssl)
{
	return services_cal_dav_web_dav_client_construct (SERVICES_CAL_DAV_TYPE_WEB_DAV_CLIENT, session, base_url, username, password, ignore_ssl);
}

void
services_cal_dav_web_dav_client_cleanup (ServicesCalDAVWebDAVClient* self)
{
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	SoupSession* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_log_service_get_default ();
	_tmp1_ = _tmp0_;
	services_log_service_info (_tmp1_, "WebDAV", "Cleaning up session");
	_g_object_unref0 (_tmp1_);
	_tmp2_ = self->session;
	if (_tmp2_ != NULL) {
		SoupSession* _tmp3_;
		_tmp3_ = self->session;
		soup_session_abort (_tmp3_);
	}
}

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

gchar*
services_cal_dav_web_dav_client_get_absolute_url (ServicesCalDAVWebDAVClient* self,
                                                  const gchar* href)
{
	gchar* abs_url = NULL;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (href != NULL, NULL);
	abs_url = NULL;
	{
		gchar* _tmp0_ = NULL;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = self->base_url;
		_tmp2_ = g_uri_resolve_relative (_tmp1_, href, G_URI_FLAGS_NONE, &_inner_error0_);
		_tmp0_ = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = string_to_string (_tmp0_);
		_tmp4_ = g_strdup (_tmp3_);
		_g_free0 (abs_url);
		abs_url = _tmp4_;
		_g_free0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		ServicesLogService* _tmp5_;
		ServicesLogService* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = services_log_service_get_default ();
		_tmp6_ = _tmp5_;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		_tmp9_ = g_strdup_printf ("Failed to resolve relative url: %s", _tmp8_);
		_tmp10_ = _tmp9_;
		services_log_service_error (_tmp6_, "WebDAV", _tmp10_);
		_g_free0 (_tmp10_);
		_g_object_unref0 (_tmp6_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (abs_url);
		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 NULL;
	}
	result = abs_url;
	return result;
}

static void
services_cal_dav_web_dav_client_propfind_data_free (gpointer _data)
{
	ServicesCalDavWebDavClientPropfindData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_free0 (_data_->xml);
	_g_free0 (_data_->depth);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavWebDavClientPropfindData, _data_);
}

void
services_cal_dav_web_dav_client_propfind (ServicesCalDAVWebDAVClient* self,
                                          const gchar* url,
                                          const gchar* xml,
                                          const gchar* depth,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	ServicesCalDavWebDavClientPropfindData* _data_;
	ServicesCalDAVWebDAVClient* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GCancellable* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	g_return_if_fail (xml != NULL);
	g_return_if_fail (depth != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavWebDavClientPropfindData);
	_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_web_dav_client_propfind_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp1_;
	_tmp2_ = g_strdup (xml);
	_g_free0 (_data_->xml);
	_data_->xml = _tmp2_;
	_tmp3_ = g_strdup (depth);
	_g_free0 (_data_->depth);
	_data_->depth = _tmp3_;
	_tmp4_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	services_cal_dav_web_dav_client_propfind_co (_data_);
}

ServicesCalDAVWebDAVMultiStatus*
services_cal_dav_web_dav_client_propfind_finish (ServicesCalDAVWebDAVClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error)
{
	ServicesCalDAVWebDAVMultiStatus* result;
	ServicesCalDavWebDavClientPropfindData* _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_web_dav_client_propfind_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	ServicesCalDavWebDavClientPropfindData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_web_dav_client_propfind_co (_data_);
}

static gboolean
services_cal_dav_web_dav_client_propfind_co (ServicesCalDavWebDavClientPropfindData* _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_;
	_data_->_tmp2_ = g_strdup_printf ("PROPFIND request (depth: %s)", _data_->depth);
	_data_->_tmp3_ = _data_->_tmp2_;
	services_log_service_debug (_data_->_tmp1_, "WebDAV", _data_->_tmp3_);
	_g_free0 (_data_->_tmp3_);
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp5_ = g_new0 (SoupStatus, 1);
	_data_->_tmp5_[0] = SOUP_STATUS_MULTI_STATUS;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp6__length1 = 1;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_send_request (_data_->self, "PROPFIND", _data_->url, "application/xml", _data_->xml, _data_->depth, _data_->cancellable, _data_->_tmp6_, (gint) 1, NULL, services_cal_dav_web_dav_client_propfind_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = services_cal_dav_web_dav_client_send_request_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp6_ = (g_free (_data_->_tmp6_), NULL);
	_data_->_tmp4_ = _data_->_tmp8_;
	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_->_tmp10_ = services_cal_dav_web_dav_multi_status_new_from_string (_data_->_tmp4_, &_data_->_inner_error0_);
	_data_->_tmp9_ = _data_->_tmp10_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->_tmp4_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = _data_->_tmp9_;
	_data_->_tmp9_ = NULL;
	_data_->result = _data_->_tmp11_;
	_g_object_unref0 (_data_->_tmp9_);
	_g_free0 (_data_->_tmp4_);
	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_web_dav_client_report_data_free (gpointer _data)
{
	ServicesCalDavWebDavClientReportData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_free0 (_data_->xml);
	_g_free0 (_data_->depth);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavWebDavClientReportData, _data_);
}

void
services_cal_dav_web_dav_client_report (ServicesCalDAVWebDAVClient* self,
                                        const gchar* url,
                                        const gchar* xml,
                                        const gchar* depth,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	ServicesCalDavWebDavClientReportData* _data_;
	ServicesCalDAVWebDAVClient* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GCancellable* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	g_return_if_fail (xml != NULL);
	g_return_if_fail (depth != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (ServicesCalDavWebDavClientReportData);
	_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_web_dav_client_report_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp1_;
	_tmp2_ = g_strdup (xml);
	_g_free0 (_data_->xml);
	_data_->xml = _tmp2_;
	_tmp3_ = g_strdup (depth);
	_g_free0 (_data_->depth);
	_data_->depth = _tmp3_;
	_tmp4_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	services_cal_dav_web_dav_client_report_co (_data_);
}

ServicesCalDAVWebDAVMultiStatus*
services_cal_dav_web_dav_client_report_finish (ServicesCalDAVWebDAVClient* self,
                                               GAsyncResult* _res_,
                                               GError** error)
{
	ServicesCalDAVWebDAVMultiStatus* result;
	ServicesCalDavWebDavClientReportData* _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_web_dav_client_report_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	ServicesCalDavWebDavClientReportData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_web_dav_client_report_co (_data_);
}

static gboolean
services_cal_dav_web_dav_client_report_co (ServicesCalDavWebDavClientReportData* _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_;
	_data_->_tmp2_ = g_strdup_printf ("REPORT request (depth: %s)", _data_->depth);
	_data_->_tmp3_ = _data_->_tmp2_;
	services_log_service_debug (_data_->_tmp1_, "WebDAV", _data_->_tmp3_);
	_g_free0 (_data_->_tmp3_);
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp5_ = g_new0 (SoupStatus, 1);
	_data_->_tmp5_[0] = SOUP_STATUS_MULTI_STATUS;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp6__length1 = 1;
	_data_->_state_ = 1;
	services_cal_dav_web_dav_client_send_request (_data_->self, "REPORT", _data_->url, "application/xml", _data_->xml, _data_->depth, _data_->cancellable, _data_->_tmp6_, (gint) 1, NULL, services_cal_dav_web_dav_client_report_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = services_cal_dav_web_dav_client_send_request_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp6_ = (g_free (_data_->_tmp6_), NULL);
	_data_->_tmp4_ = _data_->_tmp8_;
	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_->_tmp10_ = services_cal_dav_web_dav_multi_status_new_from_string (_data_->_tmp4_, &_data_->_inner_error0_);
	_data_->_tmp9_ = _data_->_tmp10_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->_tmp4_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = _data_->_tmp9_;
	_data_->_tmp9_ = NULL;
	_data_->result = _data_->_tmp11_;
	_g_object_unref0 (_data_->_tmp9_);
	_g_free0 (_data_->_tmp4_);
	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_web_dav_client_send_request_data_free (gpointer _data)
{
	ServicesCalDavWebDavClientSendRequestData* _data_;
	_data_ = _data;
	_g_free0 (_data_->method);
	_g_free0 (_data_->url);
	_g_free0 (_data_->depth);
	_g_object_unref0 (_data_->cancellable);
	_g_hash_table_unref0 (_data_->extra_headers);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalDavWebDavClientSendRequestData, _data_);
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

void
services_cal_dav_web_dav_client_send_request (ServicesCalDAVWebDAVClient* self,
                                              const gchar* method,
                                              const gchar* url,
                                              const gchar* content_type,
                                              const gchar* body,
                                              const gchar* depth,
                                              GCancellable* cancellable,
                                              SoupStatus* expected_statuses,
                                              gint expected_statuses_length1,
                                              GHashTable* extra_headers,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	ServicesCalDavWebDavClientSendRequestData* _data_;
	ServicesCalDAVWebDAVClient* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GCancellable* _tmp6_;
	GHashTable* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (method != NULL);
	g_return_if_fail (url != NULL);
	g_return_if_fail (content_type != NULL);
	_data_ = g_slice_new0 (ServicesCalDavWebDavClientSendRequestData);
	_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_web_dav_client_send_request_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (method);
	_g_free0 (_data_->method);
	_data_->method = _tmp1_;
	_tmp2_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp2_;
	_tmp3_ = g_strdup (content_type);
	_g_free0 (_data_->content_type);
	_data_->content_type = _tmp3_;
	_tmp4_ = g_strdup (body);
	_g_free0 (_data_->body);
	_data_->body = _tmp4_;
	_tmp5_ = g_strdup (depth);
	_g_free0 (_data_->depth);
	_data_->depth = _tmp5_;
	_tmp6_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp6_;
	_data_->expected_statuses = expected_statuses;
	_data_->expected_statuses_length1 = expected_statuses_length1;
	_tmp7_ = _g_hash_table_ref0 (extra_headers);
	_g_hash_table_unref0 (_data_->extra_headers);
	_data_->extra_headers = _tmp7_;
	services_cal_dav_web_dav_client_send_request_co (_data_);
}

gchar*
services_cal_dav_web_dav_client_send_request_finish (ServicesCalDAVWebDAVClient* self,
                                                     GAsyncResult* _res_,
                                                     GError** error)
{
	gchar* result;
	ServicesCalDavWebDavClientSendRequestData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		ServicesCalDAVWebDAVClient* self;
		self = _data15_->self;
		_g_object_unref0 (_data15_->msg);
		_g_free0 (_data15_->content_type);
		_g_free0 (_data15_->body);
		_g_object_unref0 (self);
		g_slice_free (Block15Data, _data15_);
	}
}

static gboolean
__lambda31_ (ServicesCalDAVWebDAVClient* self,
             SoupAuth* auth,
             gboolean retrying)
{
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ServicesLogService* _tmp9_;
	ServicesLogService* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gboolean result;
	g_return_val_if_fail (auth != NULL, FALSE);
	if (retrying) {
		ServicesLogService* _tmp0_;
		ServicesLogService* _tmp1_;
		_tmp0_ = services_log_service_get_default ();
		_tmp1_ = _tmp0_;
		services_log_service_error (_tmp1_, "WebDAV", "Authentication failed, not retrying");
		_g_object_unref0 (_tmp1_);
		result = FALSE;
		return result;
	}
	_tmp3_ = soup_auth_get_scheme_name (auth);
	_tmp4_ = _tmp3_;
	if (g_strcmp0 (_tmp4_, "Digest") == 0) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp5_ = soup_auth_get_scheme_name (auth);
		_tmp6_ = _tmp5_;
		_tmp2_ = g_strcmp0 (_tmp6_, "Basic") == 0;
	}
	if (_tmp2_) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp7_ = self->username;
		_tmp8_ = self->password;
		soup_auth_authenticate (auth, _tmp7_, _tmp8_);
		result = TRUE;
		return result;
	}
	_tmp9_ = services_log_service_get_default ();
	_tmp10_ = _tmp9_;
	_tmp11_ = soup_auth_get_scheme_name (auth);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strdup_printf ("Unsupported auth schema: %s", _tmp12_);
	_tmp14_ = _tmp13_;
	services_log_service_warn (_tmp10_, "WebDAV", _tmp14_);
	_g_free0 (_tmp14_);
	_g_object_unref0 (_tmp10_);
	result = FALSE;
	return result;
}

static gboolean
___lambda31__soup_message_authenticate (SoupMessage* _sender,
                                        SoupAuth* auth,
                                        gboolean retrying,
                                        gpointer self)
{
	gboolean result;
	result = __lambda31_ ((ServicesCalDAVWebDAVClient*) self, auth, retrying);
	return result;
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static void
__lambda32_ (Block15Data* _data15_)
{
	ServicesCalDAVWebDAVClient* self;
	self = _data15_->self;
	if (_data15_->body != NULL) {
		SoupMessage* _tmp0_;
		guint8* _tmp1_;
		gint _tmp1__length1;
		gint _tmp2_ = 0;
		guint8* _tmp3_;
		gint _tmp3__length1;
		GBytes* _tmp4_;
		GBytes* _tmp5_;
		_tmp0_ = _data15_->msg;
		_tmp1_ = string_get_data (_data15_->body, &_tmp2_);
		_tmp1__length1 = _tmp2_;
		_tmp3_ = _tmp1_;
		_tmp3__length1 = _tmp1__length1;
		_tmp4_ = g_bytes_new (_tmp3_, _tmp3__length1);
		_tmp5_ = _tmp4_;
		soup_message_set_request_body_from_bytes (_tmp0_, _data15_->content_type, _tmp5_);
		_g_bytes_unref0 (_tmp5_);
	}
}

static void
___lambda32__soup_message_restarted (SoupMessage* _sender,
                                     gpointer self)
{
	__lambda32_ (self);
}

static gboolean
___lambda33_ (ServicesCalDAVWebDAVClient* self)
{
	gboolean result;
	result = TRUE;
	return result;
}

static gboolean
____lambda33__soup_message_accept_certificate (SoupMessage* _sender,
                                               GTlsCertificate* tls_peer_certificate,
                                               GTlsCertificateFlags tls_peer_errors,
                                               gpointer self)
{
	gboolean result;
	result = ___lambda33_ ((ServicesCalDAVWebDAVClient*) self);
	return result;
}

static void
services_cal_dav_web_dav_client_send_request_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_)
{
	ServicesCalDavWebDavClientSendRequestData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_cal_dav_web_dav_client_send_request_co (_data_);
}

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

static guint8*
_vala_array_dup2 (guint8* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
_vala_array_add1 (guint8* * array,
                  gint* length,
                  gint* size,
                  guint8 value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (guint8, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static gboolean
services_cal_dav_web_dav_client_send_request_co (ServicesCalDavWebDavClientSendRequestData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data15_ = g_slice_new0 (Block15Data);
	_data_->_data15_->_ref_count_ = 1;
	_data_->_data15_->self = g_object_ref (_data_->self);
	_g_free0 (_data_->_data15_->content_type);
	_data_->_data15_->content_type = _data_->content_type;
	_g_free0 (_data_->_data15_->body);
	_data_->_data15_->body = _data_->body;
	_data_->_data15_->_async_data_ = _data_;
	_data_->_tmp0_ = services_cal_dav_web_dav_client_get_absolute_url (_data_->self, _data_->url);
	_data_->abs_url = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->abs_url;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = g_strdup_printf ("Invalid URL: %s", _data_->url);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_g_free0 (_data_->_tmp3_);
		_data_->_inner_error0_ = _data_->_tmp5_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->abs_url);
		block15_data_unref (_data_->_data15_);
		_data_->_data15_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = services_log_service_get_default ();
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->abs_url;
	_data_->_tmp9_ = g_strdup_printf ("%s %s", _data_->method, _data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	services_log_service_debug (_data_->_tmp7_, "WebDAV", _data_->_tmp10_);
	_g_free0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp7_);
	_data_->_tmp11_ = _data_->abs_url;
	_data_->_tmp12_ = soup_message_new (_data_->method, _data_->_tmp11_);
	_data_->_data15_->msg = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->_data15_->msg;
	_data_->_tmp14_ = soup_message_get_request_headers (_data_->_tmp13_);
	_data_->_tmp15_ = _data_->_tmp14_;
	soup_message_headers_append (_data_->_tmp15_, "User-Agent", CONSTANTS_SOUP_USER_AGENT);
	_data_->_tmp16_ = _data_->_data15_->msg;
	g_signal_connect_object (_data_->_tmp16_, "authenticate", (GCallback) ___lambda31__soup_message_authenticate, _data_->self, 0);
	_data_->_tmp17_ = _data_->_data15_->msg;
	g_signal_connect_data (_data_->_tmp17_, "restarted", (GCallback) ___lambda32__soup_message_restarted, block15_data_ref (_data_->_data15_), (GClosureNotify) block15_data_unref, 0);
	if (_data_->self->ignore_ssl) {
		_data_->_tmp18_ = _data_->_data15_->msg;
		g_signal_connect_object (_data_->_tmp18_, "accept-certificate", (GCallback) ____lambda33__soup_message_accept_certificate, _data_->self, 0);
	}
	if (_data_->depth != NULL) {
		_data_->_tmp19_ = _data_->_data15_->msg;
		_data_->_tmp20_ = soup_message_get_request_headers (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		soup_message_headers_replace (_data_->_tmp21_, "Depth", _data_->depth);
	}
	if (_data_->extra_headers != NULL) {
		_data_->_tmp22_ = g_hash_table_get_keys (_data_->extra_headers);
		{
			_data_->key_collection = _data_->_tmp22_;
			for (_data_->key_it = _data_->key_collection; _data_->key_it != NULL; _data_->key_it = _data_->key_it->next) {
				_data_->key = (const gchar*) _data_->key_it->data;
				{
					_data_->_tmp23_ = _data_->_data15_->msg;
					_data_->_tmp24_ = soup_message_get_request_headers (_data_->_tmp23_);
					_data_->_tmp25_ = _data_->_tmp24_;
					_data_->_tmp26_ = _data_->key;
					_data_->_tmp27_ = _data_->key;
					_data_->_tmp28_ = g_hash_table_lookup (_data_->extra_headers, _data_->_tmp27_);
					soup_message_headers_replace (_data_->_tmp25_, _data_->_tmp26_, (const gchar*) _data_->_tmp28_);
				}
			}
			(_data_->key_collection == NULL) ? NULL : (_data_->key_collection = (g_list_free (_data_->key_collection), NULL));
		}
	}
	if (_data_->_data15_->body != NULL) {
		_data_->_tmp29_ = _data_->_data15_->msg;
		_data_->_tmp31_ = 0;
		_data_->_tmp30_ = string_get_data (_data_->_data15_->body, &_data_->_tmp31_);
		_data_->_tmp30__length1 = _data_->_tmp31_;
		_data_->_tmp32_ = _data_->_tmp30_;
		_data_->_tmp32__length1 = _data_->_tmp30__length1;
		_data_->_tmp33_ = g_bytes_new (_data_->_tmp32_, _data_->_tmp32__length1);
		_data_->_tmp34_ = _data_->_tmp33_;
		soup_message_set_request_body_from_bytes (_data_->_tmp29_, _data_->_data15_->content_type, _data_->_tmp34_);
		_g_bytes_unref0 (_data_->_tmp34_);
	}
	{
		_data_->_tmp36_ = _data_->self->session;
		_data_->_tmp37_ = _data_->_data15_->msg;
		_data_->_state_ = 1;
		soup_session_send_and_read_async (_data_->_tmp36_, _data_->_tmp37_, G_PRIORITY_DEFAULT, _data_->cancellable, services_cal_dav_web_dav_client_send_request_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp38_ = soup_session_send_and_read_finish (_data_->_tmp36_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp35_ = _data_->_tmp38_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp39_ = _data_->_tmp35_;
		_data_->_tmp35_ = NULL;
		_g_bytes_unref0 (_data_->response);
		_data_->response = _data_->_tmp39_;
		_g_bytes_unref0 (_data_->_tmp35_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp40_ = _data_->e;
		if (g_error_matches (_data_->_tmp40_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
			_data_->_tmp41_ = services_log_service_get_default ();
			_data_->_tmp42_ = _data_->_tmp41_;
			services_log_service_info (_data_->_tmp42_, "WebDAV", "Request cancelled");
			_g_object_unref0 (_data_->_tmp42_);
			_data_->_tmp43_ = _data_->e;
			_data_->_tmp44_ = _g_error_copy0 (_data_->_tmp43_);
			_data_->_inner_error0_ = _data_->_tmp44_;
			_g_error_free0 (_data_->e);
			goto __finally0;
		}
		_data_->_tmp45_ = _data_->e;
		_data_->_tmp46_ = _data_->_tmp45_->message;
		_data_->_tmp47_ = g_strdup_printf ("Request failed: %s", _data_->_tmp46_);
		_data_->_tmp48_ = _data_->_tmp47_;
		_data_->_tmp49_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp48_);
		_data_->_tmp50_ = _data_->_tmp49_;
		_g_free0 (_data_->_tmp48_);
		_data_->_inner_error0_ = _data_->_tmp50_;
		_g_error_free0 (_data_->e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_bytes_unref0 (_data_->response);
		_g_free0 (_data_->abs_url);
		block15_data_unref (_data_->_data15_);
		_data_->_data15_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->ok = FALSE;
	{
		_data_->code_collection_length1 = 0;
		_data_->_code_collection_size_ = 0;
		_data_->code_collection = _data_->expected_statuses;
		_data_->code_collection_length1 = _data_->expected_statuses_length1;
		for (_data_->code_it = 0; _data_->code_it < _data_->code_collection_length1; _data_->code_it = _data_->code_it + 1) {
			_data_->code = _data_->code_collection[_data_->code_it];
			{
				_data_->_tmp51_ = _data_->_data15_->msg;
				g_object_get (_data_->_tmp51_, "status-code", &_data_->_tmp52_, NULL);
				_data_->_tmp53_ = _data_->_tmp52_;
				if (_data_->_tmp53_ == ((guint) _data_->code)) {
					_data_->ok = TRUE;
					break;
				}
			}
		}
	}
	if (!_data_->ok) {
		_data_->_tmp54_ = _data_->response;
		_data_->_tmp55_ = 0;
		_data_->_tmp56_ = g_bytes_get_data (_data_->_tmp54_, &_data_->_tmp55_);
		_data_->_tmp57_ = g_strdup ((const gchar*) _data_->_tmp56_);
		_data_->response_text = _data_->_tmp57_;
		_data_->_tmp59_ = _data_->_data15_->msg;
		_data_->_tmp60_ = soup_message_get_reason_phrase (_data_->_tmp59_);
		_data_->_tmp61_ = _data_->_tmp60_;
		_data_->_tmp58_ = _data_->_tmp61_;
		if (_data_->_tmp58_ == NULL) {
			_data_->_tmp58_ = "";
		}
		_data_->_tmp62_ = services_log_service_get_default ();
		_data_->_tmp63_ = _data_->_tmp62_;
		_data_->_tmp64_ = _data_->abs_url;
		_data_->_tmp65_ = _data_->_data15_->msg;
		g_object_get (_data_->_tmp65_, "status-code", &_data_->_tmp66_, NULL);
		_data_->_tmp67_ = _data_->_tmp66_;
		_data_->_tmp68_ = g_strdup_printf ("%s %s failed: HTTP %u %s", _data_->method, _data_->_tmp64_, _data_->_tmp67_, _data_->_tmp58_);
		_data_->_tmp69_ = _data_->_tmp68_;
		services_log_service_error (_data_->_tmp63_, "WebDAV", _data_->_tmp69_);
		_g_free0 (_data_->_tmp69_);
		_g_object_unref0 (_data_->_tmp63_);
		_data_->_tmp71_ = _data_->_data15_->msg;
		_data_->_tmp72_ = soup_message_get_reason_phrase (_data_->_tmp71_);
		_data_->_tmp73_ = _data_->_tmp72_;
		_data_->_tmp70_ = _data_->_tmp73_;
		if (_data_->_tmp70_ == NULL) {
			_data_->_tmp70_ = "";
		}
		_data_->_tmp75_ = _data_->response_text;
		_data_->_tmp74_ = _data_->_tmp75_;
		if (_data_->_tmp74_ == NULL) {
			_data_->_tmp74_ = "";
		}
		_data_->_tmp76_ = _data_->abs_url;
		_data_->_tmp77_ = _data_->_data15_->msg;
		g_object_get (_data_->_tmp77_, "status-code", &_data_->_tmp78_, NULL);
		_data_->_tmp79_ = _data_->_tmp78_;
		_data_->_tmp80_ = g_strdup_printf ("%s %s failed: HTTP %u %s\n%s", _data_->method, _data_->_tmp76_, _data_->_tmp79_, _data_->_tmp70_, _data_->_tmp74_);
		_data_->_tmp81_ = _data_->_tmp80_;
		_data_->_tmp82_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp81_);
		_data_->_tmp83_ = _data_->_tmp82_;
		_g_free0 (_data_->_tmp81_);
		_data_->_inner_error0_ = _data_->_tmp83_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->response_text);
		_g_bytes_unref0 (_data_->response);
		_g_free0 (_data_->abs_url);
		block15_data_unref (_data_->_data15_);
		_data_->_data15_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp84_ = _data_->response;
	_data_->_tmp85_ = 0;
	_data_->_tmp86_ = g_bytes_get_data (_data_->_tmp84_, &_data_->_tmp85_);
	_data_->_tmp87_ = (_data_->_tmp86_ != NULL) ? _vala_array_dup2 (_data_->_tmp86_, _data_->_tmp85_) : _data_->_tmp86_;
	_data_->_tmp87__length1 = _data_->_tmp85_;
	_data_->response_data = _data_->_tmp87_;
	_data_->response_data_length1 = _data_->_tmp87__length1;
	_data_->_response_data_size_ = _data_->response_data_length1;
	_vala_array_add1 (&_data_->response_data, &_data_->response_data_length1, &_data_->_response_data_size_, (guint8) '\0');
	_data_->_tmp88_ = _data_->_data15_->msg;
	_data_->_tmp89_ = soup_message_get_response_headers (_data_->_tmp88_);
	_data_->_tmp90_ = _data_->_tmp89_;
	_data_->_tmp91_ = soup_message_headers_get_one (_data_->_tmp90_, "ETag");
	services_cal_dav_web_dav_client_set_last_response_etag (_data_->self, _data_->_tmp91_);
	_data_->_tmp92_ = _data_->response_data;
	_data_->_tmp92__length1 = _data_->response_data_length1;
	_data_->_tmp93_ = g_strdup ((const gchar*) _data_->_tmp92_);
	_data_->result = _data_->_tmp93_;
	_data_->response_data = (g_free (_data_->response_data), NULL);
	_g_bytes_unref0 (_data_->response);
	_g_free0 (_data_->abs_url);
	block15_data_unref (_data_->_data15_);
	_data_->_data15_ = 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;
}

const gchar*
services_cal_dav_web_dav_client_get_last_response_etag (ServicesCalDAVWebDAVClient* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_last_response_etag;
	result = _tmp0_;
	return result;
}

static void
services_cal_dav_web_dav_client_set_last_response_etag (ServicesCalDAVWebDAVClient* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_cal_dav_web_dav_client_get_last_response_etag (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_last_response_etag);
		self->priv->_last_response_etag = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_cal_dav_web_dav_client_properties[SERVICES_CAL_DAV_WEB_DAV_CLIENT_LAST_RESPONSE_ETAG_PROPERTY]);
	}
}

static void
services_cal_dav_web_dav_client_class_init (ServicesCalDAVWebDAVClientClass * klass,
                                            gpointer klass_data)
{
	services_cal_dav_web_dav_client_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesCalDAVWebDAVClient_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_services_cal_dav_web_dav_client_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_services_cal_dav_web_dav_client_set_property;
	G_OBJECT_CLASS (klass)->finalize = services_cal_dav_web_dav_client_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CAL_DAV_WEB_DAV_CLIENT_LAST_RESPONSE_ETAG_PROPERTY, services_cal_dav_web_dav_client_properties[SERVICES_CAL_DAV_WEB_DAV_CLIENT_LAST_RESPONSE_ETAG_PROPERTY] = g_param_spec_string ("last-response-etag", "last-response-etag", "last-response-etag", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
services_cal_dav_web_dav_client_instance_init (ServicesCalDAVWebDAVClient * self,
                                               gpointer klass)
{
	self->priv = services_cal_dav_web_dav_client_get_instance_private (self);
	self->priv->_last_response_etag = NULL;
}

static void
services_cal_dav_web_dav_client_finalize (GObject * obj)
{
	ServicesCalDAVWebDAVClient * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_CAL_DAV_TYPE_WEB_DAV_CLIENT, ServicesCalDAVWebDAVClient);
	_g_object_unref0 (self->session);
	_g_free0 (self->username);
	_g_free0 (self->password);
	_g_free0 (self->base_url);
	_g_free0 (self->priv->_last_response_etag);
	G_OBJECT_CLASS (services_cal_dav_web_dav_client_parent_class)->finalize (obj);
}

static GType
services_cal_dav_web_dav_client_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesCalDAVWebDAVClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_cal_dav_web_dav_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesCalDAVWebDAVClient), 0, (GInstanceInitFunc) services_cal_dav_web_dav_client_instance_init, NULL };
	GType services_cal_dav_web_dav_client_type_id;
	services_cal_dav_web_dav_client_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesCalDAVWebDAVClient", &g_define_type_info, 0);
	ServicesCalDAVWebDAVClient_private_offset = g_type_add_instance_private (services_cal_dav_web_dav_client_type_id, sizeof (ServicesCalDAVWebDAVClientPrivate));
	return services_cal_dav_web_dav_client_type_id;
}

GType
services_cal_dav_web_dav_client_get_type (void)
{
	static volatile gsize services_cal_dav_web_dav_client_type_id__once = 0;
	if (g_once_init_enter (&services_cal_dav_web_dav_client_type_id__once)) {
		GType services_cal_dav_web_dav_client_type_id;
		services_cal_dav_web_dav_client_type_id = services_cal_dav_web_dav_client_get_type_once ();
		g_once_init_leave (&services_cal_dav_web_dav_client_type_id__once, services_cal_dav_web_dav_client_type_id);
	}
	return services_cal_dav_web_dav_client_type_id__once;
}

static void
_vala_services_cal_dav_web_dav_client_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	ServicesCalDAVWebDAVClient * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_CAL_DAV_TYPE_WEB_DAV_CLIENT, ServicesCalDAVWebDAVClient);
	switch (property_id) {
		case SERVICES_CAL_DAV_WEB_DAV_CLIENT_LAST_RESPONSE_ETAG_PROPERTY:
		g_value_set_string (value, services_cal_dav_web_dav_client_get_last_response_etag (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_services_cal_dav_web_dav_client_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec)
{
	ServicesCalDAVWebDAVClient * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_CAL_DAV_TYPE_WEB_DAV_CLIENT, ServicesCalDAVWebDAVClient);
	switch (property_id) {
		case SERVICES_CAL_DAV_WEB_DAV_CLIENT_LAST_RESPONSE_ETAG_PROPERTY:
		services_cal_dav_web_dav_client_set_last_response_etag (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
services_cal_dav_web_dav_multi_status_get_instance_private (ServicesCalDAVWebDAVMultiStatus* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesCalDAVWebDAVMultiStatus_private_offset);
}

ServicesCalDAVWebDAVMultiStatus*
services_cal_dav_web_dav_multi_status_construct_from_string (GType object_type,
                                                             const gchar* xml,
                                                             GError** error)
{
	ServicesCalDAVWebDAVMultiStatus * self = NULL;
	gchar* _tmp0_;
	GXmlXDocument* _tmp1_ = NULL;
	GXmlXDocument* _tmp2_;
	GXmlDomElement* _tmp3_;
	GXmlDomElement* _tmp4_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (xml != NULL, NULL);
	self = (ServicesCalDAVWebDAVMultiStatus*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (xml);
	_g_free0 (self->priv->xml_content);
	self->priv->xml_content = _tmp0_;
	_tmp2_ = gxml_xdocument_new_from_string (xml, 0, &_inner_error0_);
	_tmp1_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp3_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) _tmp1_);
	_tmp4_ = _tmp3_;
	_g_object_unref0 (self->priv->root);
	self->priv->root = _tmp4_;
	_g_object_unref0 (_tmp1_);
	return self;
}

ServicesCalDAVWebDAVMultiStatus*
services_cal_dav_web_dav_multi_status_new_from_string (const gchar* xml,
                                                       GError** error)
{
	return services_cal_dav_web_dav_multi_status_construct_from_string (SERVICES_CAL_DAV_TYPE_WEB_DAV_MULTI_STATUS, xml, error);
}

void
services_cal_dav_web_dav_multi_status_debug_print (ServicesCalDAVWebDAVMultiStatus* self)
{
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_log_service_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->xml_content;
	_tmp3_ = g_strdup_printf ("Response XML: %s", _tmp2_);
	_tmp4_ = _tmp3_;
	services_log_service_debug (_tmp1_, "WebDAV", _tmp4_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (_tmp1_);
}

GeeArrayList*
services_cal_dav_web_dav_multi_status_responses (ServicesCalDAVWebDAVMultiStatus* self)
{
	GeeArrayList* list = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (SERVICES_CAL_DAV_TYPE_WEB_DAV_RESPONSE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	list = _tmp0_;
	{
		GXmlDomHTMLCollection* _resp_list = NULL;
		GXmlDomElement* _tmp1_;
		GXmlDomHTMLCollection* _tmp2_;
		gint _resp_size = 0;
		GXmlDomHTMLCollection* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _resp_index = 0;
		_tmp1_ = self->priv->root;
		_tmp2_ = gxml_dom_element_get_elements_by_tag_name (_tmp1_, "response");
		_resp_list = _tmp2_;
		_tmp3_ = _resp_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_resp_size = _tmp5_;
		_resp_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomElement* resp = NULL;
			GXmlDomHTMLCollection* _tmp8_;
			gpointer _tmp9_;
			GeeArrayList* _tmp10_;
			GXmlDomElement* _tmp11_;
			ServicesCalDAVWebDAVResponse* _tmp12_;
			ServicesCalDAVWebDAVResponse* _tmp13_;
			_resp_index = _resp_index + 1;
			_tmp6_ = _resp_index;
			_tmp7_ = _resp_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _resp_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _resp_index);
			resp = (GXmlDomElement*) _tmp9_;
			_tmp10_ = list;
			_tmp11_ = resp;
			_tmp12_ = services_cal_dav_web_dav_response_new (_tmp11_);
			_tmp13_ = _tmp12_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp13_);
			_g_object_unref0 (_tmp13_);
			_g_object_unref0 (resp);
		}
		_g_object_unref0 (_resp_list);
	}
	result = list;
	return result;
}

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

gchar*
services_cal_dav_web_dav_multi_status_get_first_text_content_by_tag_name (ServicesCalDAVWebDAVMultiStatus* self,
                                                                          const gchar* tag_name)
{
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (tag_name != NULL, NULL);
	{
		GXmlDomHTMLCollection* _h_list = NULL;
		GXmlDomElement* _tmp0_;
		GXmlDomHTMLCollection* _tmp1_;
		gint _h_size = 0;
		GXmlDomHTMLCollection* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _h_index = 0;
		_tmp0_ = self->priv->root;
		_tmp1_ = gxml_dom_element_get_elements_by_tag_name (_tmp0_, tag_name);
		_h_list = _tmp1_;
		_tmp2_ = _h_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_h_size = _tmp4_;
		_h_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			GXmlDomElement* h = NULL;
			GXmlDomHTMLCollection* _tmp7_;
			gpointer _tmp8_;
			gchar* text = NULL;
			GXmlDomElement* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gboolean _tmp15_ = FALSE;
			const gchar* _tmp16_;
			_h_index = _h_index + 1;
			_tmp5_ = _h_index;
			_tmp6_ = _h_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _h_list;
			_tmp8_ = gee_list_get ((GeeList*) _tmp7_, _h_index);
			h = (GXmlDomElement*) _tmp8_;
			_tmp9_ = h;
			_tmp10_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = _tmp11_;
			_tmp13_ = string_strip (_tmp12_);
			_tmp14_ = _tmp13_;
			_g_free0 (_tmp12_);
			text = _tmp14_;
			_tmp16_ = text;
			if (_tmp16_ != NULL) {
				const gchar* _tmp17_;
				gint _tmp18_;
				gint _tmp19_;
				_tmp17_ = text;
				_tmp18_ = strlen (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp15_ = _tmp19_ > 0;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				result = text;
				_g_object_unref0 (h);
				_g_object_unref0 (_h_list);
				return result;
			}
			_g_free0 (text);
			_g_object_unref0 (h);
		}
		_g_object_unref0 (_h_list);
	}
	result = NULL;
	return result;
}

ServicesCalDAVWebDAVMultiStatus*
services_cal_dav_web_dav_multi_status_construct (GType object_type)
{
	ServicesCalDAVWebDAVMultiStatus * self = NULL;
	self = (ServicesCalDAVWebDAVMultiStatus*) g_object_new (object_type, NULL);
	return self;
}

ServicesCalDAVWebDAVMultiStatus*
services_cal_dav_web_dav_multi_status_new (void)
{
	return services_cal_dav_web_dav_multi_status_construct (SERVICES_CAL_DAV_TYPE_WEB_DAV_MULTI_STATUS);
}

static void
services_cal_dav_web_dav_multi_status_class_init (ServicesCalDAVWebDAVMultiStatusClass * klass,
                                                  gpointer klass_data)
{
	services_cal_dav_web_dav_multi_status_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesCalDAVWebDAVMultiStatus_private_offset);
	G_OBJECT_CLASS (klass)->finalize = services_cal_dav_web_dav_multi_status_finalize;
}

static void
services_cal_dav_web_dav_multi_status_instance_init (ServicesCalDAVWebDAVMultiStatus * self,
                                                     gpointer klass)
{
	self->priv = services_cal_dav_web_dav_multi_status_get_instance_private (self);
}

static void
services_cal_dav_web_dav_multi_status_finalize (GObject * obj)
{
	ServicesCalDAVWebDAVMultiStatus * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_CAL_DAV_TYPE_WEB_DAV_MULTI_STATUS, ServicesCalDAVWebDAVMultiStatus);
	_g_object_unref0 (self->priv->root);
	_g_free0 (self->priv->xml_content);
	G_OBJECT_CLASS (services_cal_dav_web_dav_multi_status_parent_class)->finalize (obj);
}

static GType
services_cal_dav_web_dav_multi_status_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesCalDAVWebDAVMultiStatusClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_cal_dav_web_dav_multi_status_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesCalDAVWebDAVMultiStatus), 0, (GInstanceInitFunc) services_cal_dav_web_dav_multi_status_instance_init, NULL };
	GType services_cal_dav_web_dav_multi_status_type_id;
	services_cal_dav_web_dav_multi_status_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesCalDAVWebDAVMultiStatus", &g_define_type_info, 0);
	ServicesCalDAVWebDAVMultiStatus_private_offset = g_type_add_instance_private (services_cal_dav_web_dav_multi_status_type_id, sizeof (ServicesCalDAVWebDAVMultiStatusPrivate));
	return services_cal_dav_web_dav_multi_status_type_id;
}

GType
services_cal_dav_web_dav_multi_status_get_type (void)
{
	static volatile gsize services_cal_dav_web_dav_multi_status_type_id__once = 0;
	if (g_once_init_enter (&services_cal_dav_web_dav_multi_status_type_id__once)) {
		GType services_cal_dav_web_dav_multi_status_type_id;
		services_cal_dav_web_dav_multi_status_type_id = services_cal_dav_web_dav_multi_status_get_type_once ();
		g_once_init_leave (&services_cal_dav_web_dav_multi_status_type_id__once, services_cal_dav_web_dav_multi_status_type_id);
	}
	return services_cal_dav_web_dav_multi_status_type_id__once;
}

static inline gpointer
services_cal_dav_web_dav_response_get_instance_private (ServicesCalDAVWebDAVResponse* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesCalDAVWebDAVResponse_private_offset);
}

ServicesCalDAVWebDAVResponse*
services_cal_dav_web_dav_response_construct (GType object_type,
                                             GXmlDomElement* element)
{
	ServicesCalDAVWebDAVResponse * self = NULL;
	GXmlDomElement* _tmp0_;
	g_return_val_if_fail (element != NULL, NULL);
	self = (ServicesCalDAVWebDAVResponse*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (element);
	_g_object_unref0 (self->priv->element);
	self->priv->element = _tmp0_;
	services_cal_dav_web_dav_response_parse_href (self);
	services_cal_dav_web_dav_response_parse_status (self);
	return self;
}

ServicesCalDAVWebDAVResponse*
services_cal_dav_web_dav_response_new (GXmlDomElement* element)
{
	return services_cal_dav_web_dav_response_construct (SERVICES_CAL_DAV_TYPE_WEB_DAV_RESPONSE, element);
}

static void
services_cal_dav_web_dav_response_parse_href (ServicesCalDAVWebDAVResponse* self)
{
	g_return_if_fail (self != NULL);
	{
		GXmlDomHTMLCollection* _h_list = NULL;
		GXmlDomElement* _tmp0_;
		GXmlDomHTMLCollection* _tmp1_;
		gint _h_size = 0;
		GXmlDomHTMLCollection* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _h_index = 0;
		_tmp0_ = self->priv->element;
		_tmp1_ = gxml_dom_element_get_elements_by_tag_name (_tmp0_, "href");
		_h_list = _tmp1_;
		_tmp2_ = _h_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_h_size = _tmp4_;
		_h_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			GXmlDomElement* h = NULL;
			GXmlDomHTMLCollection* _tmp7_;
			gpointer _tmp8_;
			gchar* text = NULL;
			GXmlDomElement* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gboolean _tmp15_ = FALSE;
			const gchar* _tmp16_;
			_h_index = _h_index + 1;
			_tmp5_ = _h_index;
			_tmp6_ = _h_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _h_list;
			_tmp8_ = gee_list_get ((GeeList*) _tmp7_, _h_index);
			h = (GXmlDomElement*) _tmp8_;
			_tmp9_ = h;
			_tmp10_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = _tmp11_;
			_tmp13_ = string_strip (_tmp12_);
			_tmp14_ = _tmp13_;
			_g_free0 (_tmp12_);
			text = _tmp14_;
			_tmp16_ = text;
			if (_tmp16_ != NULL) {
				const gchar* _tmp17_;
				gint _tmp18_;
				gint _tmp19_;
				_tmp17_ = text;
				_tmp18_ = strlen (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp15_ = _tmp19_ > 0;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				const gchar* _tmp20_;
				_tmp20_ = text;
				services_cal_dav_web_dav_response_set_href (self, _tmp20_);
				_g_free0 (text);
				_g_object_unref0 (h);
				break;
			}
			_g_free0 (text);
			_g_object_unref0 (h);
		}
		_g_object_unref0 (_h_list);
	}
}

static void
services_cal_dav_web_dav_response_parse_status (ServicesCalDAVWebDAVResponse* self)
{
	g_return_if_fail (self != NULL);
	{
		GXmlDomHTMLCollection* _s_list = NULL;
		GXmlDomElement* _tmp0_;
		GXmlDomHTMLCollection* _tmp1_;
		gint _s_size = 0;
		GXmlDomHTMLCollection* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _s_index = 0;
		_tmp0_ = self->priv->element;
		_tmp1_ = gxml_dom_element_get_elements_by_tag_name (_tmp0_, "status");
		_s_list = _tmp1_;
		_tmp2_ = _s_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_s_size = _tmp4_;
		_s_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			GXmlDomElement* s = NULL;
			GXmlDomHTMLCollection* _tmp7_;
			gpointer _tmp8_;
			gchar* text = NULL;
			GXmlDomElement* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gboolean _tmp15_ = FALSE;
			const gchar* _tmp16_;
			_s_index = _s_index + 1;
			_tmp5_ = _s_index;
			_tmp6_ = _s_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _s_list;
			_tmp8_ = gee_list_get ((GeeList*) _tmp7_, _s_index);
			s = (GXmlDomElement*) _tmp8_;
			_tmp9_ = s;
			_tmp10_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = _tmp11_;
			_tmp13_ = string_strip (_tmp12_);
			_tmp14_ = _tmp13_;
			_g_free0 (_tmp12_);
			text = _tmp14_;
			_tmp16_ = text;
			if (_tmp16_ != NULL) {
				const gchar* _tmp17_;
				gint _tmp18_;
				gint _tmp19_;
				_tmp17_ = text;
				_tmp18_ = strlen (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp15_ = _tmp19_ > 0;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				const gchar* _tmp20_;
				_tmp20_ = text;
				services_cal_dav_web_dav_response_set_status (self, services_cal_dav_web_dav_response_parse_status_line (self, _tmp20_));
				_g_free0 (text);
				_g_object_unref0 (s);
				break;
			}
			_g_free0 (text);
			_g_object_unref0 (s);
		}
		_g_object_unref0 (_s_list);
	}
}

static SoupStatus
services_cal_dav_web_dav_response_parse_status_line (ServicesCalDAVWebDAVResponse* self,
                                                     const gchar* status_line)
{
	SoupHTTPVersion ver = 0;
	guint code = 0U;
	gchar* reason = NULL;
	SoupHTTPVersion _tmp0_ = 0;
	guint _tmp1_ = 0U;
	gchar* _tmp2_ = NULL;
	gboolean _tmp3_;
	SoupStatus result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (status_line != NULL, 0);
	_tmp3_ = soup_headers_parse_status_line (status_line, &_tmp0_, &_tmp1_, &_tmp2_);
	ver = _tmp0_;
	code = _tmp1_;
	_g_free0 (reason);
	reason = _tmp2_;
	if (_tmp3_) {
		result = (SoupStatus) code;
		_g_free0 (reason);
		return result;
	}
	result = SOUP_STATUS_NONE;
	_g_free0 (reason);
	return result;
}

GeeArrayList*
services_cal_dav_web_dav_response_propstats (ServicesCalDAVWebDAVResponse* self)
{
	GeeArrayList* results = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (SERVICES_CAL_DAV_TYPE_WEB_DAV_PROP_STAT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	results = _tmp0_;
	{
		GXmlDomHTMLCollection* _ps_list = NULL;
		GXmlDomElement* _tmp1_;
		GXmlDomHTMLCollection* _tmp2_;
		gint _ps_size = 0;
		GXmlDomHTMLCollection* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _ps_index = 0;
		_tmp1_ = self->priv->element;
		_tmp2_ = gxml_dom_element_get_elements_by_tag_name (_tmp1_, "propstat");
		_ps_list = _tmp2_;
		_tmp3_ = _ps_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_ps_size = _tmp5_;
		_ps_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomElement* ps = NULL;
			GXmlDomHTMLCollection* _tmp8_;
			gpointer _tmp9_;
			GeeArrayList* _tmp10_;
			GXmlDomElement* _tmp11_;
			ServicesCalDAVWebDAVPropStat* _tmp12_;
			ServicesCalDAVWebDAVPropStat* _tmp13_;
			_ps_index = _ps_index + 1;
			_tmp6_ = _ps_index;
			_tmp7_ = _ps_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _ps_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _ps_index);
			ps = (GXmlDomElement*) _tmp9_;
			_tmp10_ = results;
			_tmp11_ = ps;
			_tmp12_ = services_cal_dav_web_dav_prop_stat_new (_tmp11_);
			_tmp13_ = _tmp12_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp13_);
			_g_object_unref0 (_tmp13_);
			_g_object_unref0 (ps);
		}
		_g_object_unref0 (_ps_list);
	}
	result = results;
	return result;
}

const gchar*
services_cal_dav_web_dav_response_get_href (ServicesCalDAVWebDAVResponse* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_href;
	result = _tmp0_;
	return result;
}

static void
services_cal_dav_web_dav_response_set_href (ServicesCalDAVWebDAVResponse* self,
                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_cal_dav_web_dav_response_get_href (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_href);
		self->priv->_href = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_cal_dav_web_dav_response_properties[SERVICES_CAL_DAV_WEB_DAV_RESPONSE_HREF_PROPERTY]);
	}
}

SoupStatus
services_cal_dav_web_dav_response_get_status (ServicesCalDAVWebDAVResponse* self)
{
	SoupStatus result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_status;
	return result;
}

static void
services_cal_dav_web_dav_response_set_status (ServicesCalDAVWebDAVResponse* self,
                                              SoupStatus value)
{
	SoupStatus old_value;
	g_return_if_fail (self != NULL);
	old_value = services_cal_dav_web_dav_response_get_status (self);
	if (old_value != value) {
		self->priv->_status = value;
		g_object_notify_by_pspec ((GObject *) self, services_cal_dav_web_dav_response_properties[SERVICES_CAL_DAV_WEB_DAV_RESPONSE_STATUS_PROPERTY]);
	}
}

static void
services_cal_dav_web_dav_response_class_init (ServicesCalDAVWebDAVResponseClass * klass,
                                              gpointer klass_data)
{
	services_cal_dav_web_dav_response_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesCalDAVWebDAVResponse_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_services_cal_dav_web_dav_response_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_services_cal_dav_web_dav_response_set_property;
	G_OBJECT_CLASS (klass)->finalize = services_cal_dav_web_dav_response_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CAL_DAV_WEB_DAV_RESPONSE_HREF_PROPERTY, services_cal_dav_web_dav_response_properties[SERVICES_CAL_DAV_WEB_DAV_RESPONSE_HREF_PROPERTY] = g_param_spec_string ("href", "href", "href", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CAL_DAV_WEB_DAV_RESPONSE_STATUS_PROPERTY, services_cal_dav_web_dav_response_properties[SERVICES_CAL_DAV_WEB_DAV_RESPONSE_STATUS_PROPERTY] = g_param_spec_enum ("status", "status", "status", soup_status_get_type (), SOUP_STATUS_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
services_cal_dav_web_dav_response_instance_init (ServicesCalDAVWebDAVResponse * self,
                                                 gpointer klass)
{
	self->priv = services_cal_dav_web_dav_response_get_instance_private (self);
	self->priv->_status = SOUP_STATUS_NONE;
}

static void
services_cal_dav_web_dav_response_finalize (GObject * obj)
{
	ServicesCalDAVWebDAVResponse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_CAL_DAV_TYPE_WEB_DAV_RESPONSE, ServicesCalDAVWebDAVResponse);
	_g_free0 (self->priv->_href);
	_g_object_unref0 (self->priv->element);
	G_OBJECT_CLASS (services_cal_dav_web_dav_response_parent_class)->finalize (obj);
}

static GType
services_cal_dav_web_dav_response_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesCalDAVWebDAVResponseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_cal_dav_web_dav_response_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesCalDAVWebDAVResponse), 0, (GInstanceInitFunc) services_cal_dav_web_dav_response_instance_init, NULL };
	GType services_cal_dav_web_dav_response_type_id;
	services_cal_dav_web_dav_response_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesCalDAVWebDAVResponse", &g_define_type_info, 0);
	ServicesCalDAVWebDAVResponse_private_offset = g_type_add_instance_private (services_cal_dav_web_dav_response_type_id, sizeof (ServicesCalDAVWebDAVResponsePrivate));
	return services_cal_dav_web_dav_response_type_id;
}

GType
services_cal_dav_web_dav_response_get_type (void)
{
	static volatile gsize services_cal_dav_web_dav_response_type_id__once = 0;
	if (g_once_init_enter (&services_cal_dav_web_dav_response_type_id__once)) {
		GType services_cal_dav_web_dav_response_type_id;
		services_cal_dav_web_dav_response_type_id = services_cal_dav_web_dav_response_get_type_once ();
		g_once_init_leave (&services_cal_dav_web_dav_response_type_id__once, services_cal_dav_web_dav_response_type_id);
	}
	return services_cal_dav_web_dav_response_type_id__once;
}

static void
_vala_services_cal_dav_web_dav_response_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	ServicesCalDAVWebDAVResponse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_CAL_DAV_TYPE_WEB_DAV_RESPONSE, ServicesCalDAVWebDAVResponse);
	switch (property_id) {
		case SERVICES_CAL_DAV_WEB_DAV_RESPONSE_HREF_PROPERTY:
		g_value_set_string (value, services_cal_dav_web_dav_response_get_href (self));
		break;
		case SERVICES_CAL_DAV_WEB_DAV_RESPONSE_STATUS_PROPERTY:
		g_value_set_enum (value, services_cal_dav_web_dav_response_get_status (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_services_cal_dav_web_dav_response_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	ServicesCalDAVWebDAVResponse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_CAL_DAV_TYPE_WEB_DAV_RESPONSE, ServicesCalDAVWebDAVResponse);
	switch (property_id) {
		case SERVICES_CAL_DAV_WEB_DAV_RESPONSE_HREF_PROPERTY:
		services_cal_dav_web_dav_response_set_href (self, g_value_get_string (value));
		break;
		case SERVICES_CAL_DAV_WEB_DAV_RESPONSE_STATUS_PROPERTY:
		services_cal_dav_web_dav_response_set_status (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
services_cal_dav_web_dav_prop_stat_get_instance_private (ServicesCalDAVWebDAVPropStat* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesCalDAVWebDAVPropStat_private_offset);
}

ServicesCalDAVWebDAVPropStat*
services_cal_dav_web_dav_prop_stat_construct (GType object_type,
                                              GXmlDomElement* element)
{
	ServicesCalDAVWebDAVPropStat * self = NULL;
	GXmlDomHTMLCollection* status_list = NULL;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GXmlDomHTMLCollection* prop_list = NULL;
	GXmlDomHTMLCollection* _tmp18_;
	GXmlDomHTMLCollection* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	g_return_val_if_fail (element != NULL, NULL);
	self = (ServicesCalDAVWebDAVPropStat*) g_object_new (object_type, NULL);
	_tmp0_ = gxml_dom_element_get_elements_by_tag_name (element, "status");
	status_list = _tmp0_;
	_tmp1_ = status_list;
	_tmp2_ = gxml_dom_html_collection_get_length (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == 1) {
		gchar* text = NULL;
		GXmlDomHTMLCollection* _tmp4_;
		gpointer _tmp5_;
		GXmlDomElement* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gboolean _tmp12_ = FALSE;
		const gchar* _tmp13_;
		_tmp4_ = status_list;
		_tmp5_ = gee_list_get ((GeeList*) _tmp4_, 0);
		_tmp6_ = (GXmlDomElement*) _tmp5_;
		_tmp7_ = gxml_dom_node_get_text_content ((GXmlDomNode*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = string_strip (_tmp9_);
		_tmp11_ = _tmp10_;
		_g_free0 (_tmp9_);
		_g_object_unref0 (_tmp6_);
		text = _tmp11_;
		_tmp13_ = text;
		if (_tmp13_ != NULL) {
			const gchar* _tmp14_;
			gint _tmp15_;
			gint _tmp16_;
			_tmp14_ = text;
			_tmp15_ = strlen (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp12_ = _tmp16_ > 0;
		} else {
			_tmp12_ = FALSE;
		}
		if (_tmp12_) {
			const gchar* _tmp17_;
			_tmp17_ = text;
			services_cal_dav_web_dav_prop_stat_set_status (self, services_cal_dav_web_dav_prop_stat_parse_status_line (self, _tmp17_));
		}
		_g_free0 (text);
	}
	_tmp18_ = gxml_dom_element_get_elements_by_tag_name (element, "prop");
	prop_list = _tmp18_;
	_tmp19_ = prop_list;
	_tmp20_ = gxml_dom_html_collection_get_length (_tmp19_);
	_tmp21_ = _tmp20_;
	if (_tmp21_ == 1) {
		GXmlDomHTMLCollection* _tmp22_;
		gpointer _tmp23_;
		GXmlDomElement* _tmp24_;
		_tmp22_ = prop_list;
		_tmp23_ = gee_list_get ((GeeList*) _tmp22_, 0);
		_tmp24_ = (GXmlDomElement*) _tmp23_;
		services_cal_dav_web_dav_prop_stat_set_prop (self, _tmp24_);
		_g_object_unref0 (_tmp24_);
	}
	_g_object_unref0 (prop_list);
	_g_object_unref0 (status_list);
	return self;
}

ServicesCalDAVWebDAVPropStat*
services_cal_dav_web_dav_prop_stat_new (GXmlDomElement* element)
{
	return services_cal_dav_web_dav_prop_stat_construct (SERVICES_CAL_DAV_TYPE_WEB_DAV_PROP_STAT, element);
}

static SoupStatus
services_cal_dav_web_dav_prop_stat_parse_status_line (ServicesCalDAVWebDAVPropStat* self,
                                                      const gchar* status_line)
{
	SoupHTTPVersion ver = 0;
	guint code = 0U;
	gchar* reason = NULL;
	SoupHTTPVersion _tmp0_ = 0;
	guint _tmp1_ = 0U;
	gchar* _tmp2_ = NULL;
	gboolean _tmp3_;
	SoupStatus result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (status_line != NULL, 0);
	_tmp3_ = soup_headers_parse_status_line (status_line, &_tmp0_, &_tmp1_, &_tmp2_);
	ver = _tmp0_;
	code = _tmp1_;
	_g_free0 (reason);
	reason = _tmp2_;
	if (_tmp3_) {
		result = (SoupStatus) code;
		_g_free0 (reason);
		return result;
	}
	result = SOUP_STATUS_NONE;
	_g_free0 (reason);
	return result;
}

GXmlDomElement*
services_cal_dav_web_dav_prop_stat_get_first_prop_with_tagname (ServicesCalDAVWebDAVPropStat* self,
                                                                const gchar* tagname)
{
	GXmlDomElement* _tmp0_;
	GXmlDomElement* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (tagname != NULL, NULL);
	_tmp0_ = self->priv->_prop;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	{
		GXmlDomHTMLCollection* _e_list = NULL;
		GXmlDomElement* _tmp1_;
		GXmlDomHTMLCollection* _tmp2_;
		gint _e_size = 0;
		GXmlDomHTMLCollection* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _e_index = 0;
		_tmp1_ = self->priv->_prop;
		_tmp2_ = gxml_dom_element_get_elements_by_tag_name (_tmp1_, tagname);
		_e_list = _tmp2_;
		_tmp3_ = _e_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_e_size = _tmp5_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomElement* e = NULL;
			GXmlDomHTMLCollection* _tmp8_;
			gpointer _tmp9_;
			_e_index = _e_index + 1;
			_tmp6_ = _e_index;
			_tmp7_ = _e_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _e_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _e_index);
			e = (GXmlDomElement*) _tmp9_;
			result = e;
			_g_object_unref0 (_e_list);
			return result;
		}
		_g_object_unref0 (_e_list);
	}
	result = NULL;
	return result;
}

SoupStatus
services_cal_dav_web_dav_prop_stat_get_status (ServicesCalDAVWebDAVPropStat* self)
{
	SoupStatus result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_status;
	return result;
}

static void
services_cal_dav_web_dav_prop_stat_set_status (ServicesCalDAVWebDAVPropStat* self,
                                               SoupStatus value)
{
	SoupStatus old_value;
	g_return_if_fail (self != NULL);
	old_value = services_cal_dav_web_dav_prop_stat_get_status (self);
	if (old_value != value) {
		self->priv->_status = value;
		g_object_notify_by_pspec ((GObject *) self, services_cal_dav_web_dav_prop_stat_properties[SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_STATUS_PROPERTY]);
	}
}

GXmlDomElement*
services_cal_dav_web_dav_prop_stat_get_prop (ServicesCalDAVWebDAVPropStat* self)
{
	GXmlDomElement* result;
	GXmlDomElement* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_prop;
	result = _tmp0_;
	return result;
}

static void
services_cal_dav_web_dav_prop_stat_set_prop (ServicesCalDAVWebDAVPropStat* self,
                                             GXmlDomElement* value)
{
	GXmlDomElement* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_cal_dav_web_dav_prop_stat_get_prop (self);
	if (old_value != value) {
		GXmlDomElement* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_prop);
		self->priv->_prop = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_cal_dav_web_dav_prop_stat_properties[SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_PROP_PROPERTY]);
	}
}

static void
services_cal_dav_web_dav_prop_stat_class_init (ServicesCalDAVWebDAVPropStatClass * klass,
                                               gpointer klass_data)
{
	services_cal_dav_web_dav_prop_stat_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesCalDAVWebDAVPropStat_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_services_cal_dav_web_dav_prop_stat_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_services_cal_dav_web_dav_prop_stat_set_property;
	G_OBJECT_CLASS (klass)->finalize = services_cal_dav_web_dav_prop_stat_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_STATUS_PROPERTY, services_cal_dav_web_dav_prop_stat_properties[SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_STATUS_PROPERTY] = g_param_spec_enum ("status", "status", "status", soup_status_get_type (), 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_PROP_PROPERTY, services_cal_dav_web_dav_prop_stat_properties[SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_PROP_PROPERTY] = g_param_spec_object ("prop", "prop", "prop", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
services_cal_dav_web_dav_prop_stat_instance_init (ServicesCalDAVWebDAVPropStat * self,
                                                  gpointer klass)
{
	self->priv = services_cal_dav_web_dav_prop_stat_get_instance_private (self);
}

static void
services_cal_dav_web_dav_prop_stat_finalize (GObject * obj)
{
	ServicesCalDAVWebDAVPropStat * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_CAL_DAV_TYPE_WEB_DAV_PROP_STAT, ServicesCalDAVWebDAVPropStat);
	_g_object_unref0 (self->priv->_prop);
	G_OBJECT_CLASS (services_cal_dav_web_dav_prop_stat_parent_class)->finalize (obj);
}

static GType
services_cal_dav_web_dav_prop_stat_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesCalDAVWebDAVPropStatClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_cal_dav_web_dav_prop_stat_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesCalDAVWebDAVPropStat), 0, (GInstanceInitFunc) services_cal_dav_web_dav_prop_stat_instance_init, NULL };
	GType services_cal_dav_web_dav_prop_stat_type_id;
	services_cal_dav_web_dav_prop_stat_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesCalDAVWebDAVPropStat", &g_define_type_info, 0);
	ServicesCalDAVWebDAVPropStat_private_offset = g_type_add_instance_private (services_cal_dav_web_dav_prop_stat_type_id, sizeof (ServicesCalDAVWebDAVPropStatPrivate));
	return services_cal_dav_web_dav_prop_stat_type_id;
}

GType
services_cal_dav_web_dav_prop_stat_get_type (void)
{
	static volatile gsize services_cal_dav_web_dav_prop_stat_type_id__once = 0;
	if (g_once_init_enter (&services_cal_dav_web_dav_prop_stat_type_id__once)) {
		GType services_cal_dav_web_dav_prop_stat_type_id;
		services_cal_dav_web_dav_prop_stat_type_id = services_cal_dav_web_dav_prop_stat_get_type_once ();
		g_once_init_leave (&services_cal_dav_web_dav_prop_stat_type_id__once, services_cal_dav_web_dav_prop_stat_type_id);
	}
	return services_cal_dav_web_dav_prop_stat_type_id__once;
}

static void
_vala_services_cal_dav_web_dav_prop_stat_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	ServicesCalDAVWebDAVPropStat * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_CAL_DAV_TYPE_WEB_DAV_PROP_STAT, ServicesCalDAVWebDAVPropStat);
	switch (property_id) {
		case SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_STATUS_PROPERTY:
		g_value_set_enum (value, services_cal_dav_web_dav_prop_stat_get_status (self));
		break;
		case SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_PROP_PROPERTY:
		g_value_set_object (value, services_cal_dav_web_dav_prop_stat_get_prop (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_services_cal_dav_web_dav_prop_stat_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	ServicesCalDAVWebDAVPropStat * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_CAL_DAV_TYPE_WEB_DAV_PROP_STAT, ServicesCalDAVWebDAVPropStat);
	switch (property_id) {
		case SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_STATUS_PROPERTY:
		services_cal_dav_web_dav_prop_stat_set_status (self, g_value_get_enum (value));
		break;
		case SERVICES_CAL_DAV_WEB_DAV_PROP_STAT_PROP_PROPERTY:
		services_cal_dav_web_dav_prop_stat_set_prop (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

