/* imap-append-command.c generated by valac 0.56.19, the Vala compiler
 * generated from imap-append-command.vala, do not modify */

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

#include "geary-engine.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <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  {
	GEARY_IMAP_APPEND_COMMAND_0_PROPERTY,
	GEARY_IMAP_APPEND_COMMAND_NUM_PROPERTIES
};
static GParamSpec* geary_imap_append_command_properties[GEARY_IMAP_APPEND_COMMAND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer geary_imap_append_command_parent_class = NULL;

static GType geary_imap_append_command_get_type_once (void);

GearyImapAppendCommand*
geary_imap_append_command_construct (GType object_type,
                                     GearyImapMailboxSpecifier* mailbox,
                                     GearyImapMessageFlags* flags,
                                     GearyImapInternalDate* internal_date,
                                     GearyMemoryBuffer* message,
                                     GCancellable* should_send)
{
	GearyImapAppendCommand * self = NULL;
	GearyImapListParameter* _tmp0_;
	GearyImapListParameter* _tmp1_;
	GearyImapParameter* _tmp2_;
	GearyImapParameter* _tmp3_;
	gboolean _tmp4_ = FALSE;
	GearyImapListParameter* _tmp15_;
	GearyImapListParameter* _tmp16_;
	GearyImapLiteralParameter* _tmp17_;
	GearyImapLiteralParameter* _tmp18_;
	g_return_val_if_fail (GEARY_IMAP_IS_MAILBOX_SPECIFIER (mailbox), NULL);
	g_return_val_if_fail ((flags == NULL) || GEARY_IMAP_IS_MESSAGE_FLAGS (flags), NULL);
	g_return_val_if_fail ((internal_date == NULL) || GEARY_IMAP_IS_INTERNAL_DATE (internal_date), NULL);
	g_return_val_if_fail (GEARY_MEMORY_IS_BUFFER (message), NULL);
	g_return_val_if_fail ((should_send == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (should_send, g_cancellable_get_type ()), NULL);
	self = (GearyImapAppendCommand*) geary_imap_command_construct (object_type, GEARY_IMAP_APPEND_COMMAND_NAME, NULL, (gint) 0, should_send);
	_tmp0_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp1_ = _tmp0_;
	_tmp2_ = geary_imap_mailbox_specifier_to_parameter (mailbox);
	_tmp3_ = _tmp2_;
	geary_imap_list_parameter_add (_tmp1_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	if (flags != NULL) {
		gint _tmp5_;
		gint _tmp6_;
		_tmp5_ = geary_imap_flags_get_size (G_TYPE_CHECK_INSTANCE_CAST (flags, GEARY_IMAP_TYPE_FLAGS, GearyImapFlags));
		_tmp6_ = _tmp5_;
		_tmp4_ = _tmp6_ > 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		GearyImapListParameter* _tmp7_;
		GearyImapListParameter* _tmp8_;
		GearyImapParameter* _tmp9_;
		GearyImapParameter* _tmp10_;
		_tmp7_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
		_tmp8_ = _tmp7_;
		_tmp9_ = geary_imap_flags_to_parameter (G_TYPE_CHECK_INSTANCE_CAST (flags, GEARY_IMAP_TYPE_FLAGS, GearyImapFlags));
		_tmp10_ = _tmp9_;
		geary_imap_list_parameter_add (_tmp8_, _tmp10_);
		_g_object_unref0 (_tmp10_);
	}
	if (internal_date != NULL) {
		GearyImapListParameter* _tmp11_;
		GearyImapListParameter* _tmp12_;
		GearyImapParameter* _tmp13_;
		GearyImapParameter* _tmp14_;
		_tmp11_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
		_tmp12_ = _tmp11_;
		_tmp13_ = geary_imap_internal_date_to_parameter (internal_date);
		_tmp14_ = _tmp13_;
		geary_imap_list_parameter_add (_tmp12_, _tmp14_);
		_g_object_unref0 (_tmp14_);
	}
	_tmp15_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp16_ = _tmp15_;
	_tmp17_ = geary_imap_literal_parameter_new (message);
	_tmp18_ = _tmp17_;
	geary_imap_list_parameter_add (_tmp16_, G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, GEARY_IMAP_TYPE_PARAMETER, GearyImapParameter));
	_g_object_unref0 (_tmp18_);
	return self;
}

GearyImapAppendCommand*
geary_imap_append_command_new (GearyImapMailboxSpecifier* mailbox,
                               GearyImapMessageFlags* flags,
                               GearyImapInternalDate* internal_date,
                               GearyMemoryBuffer* message,
                               GCancellable* should_send)
{
	return geary_imap_append_command_construct (GEARY_IMAP_TYPE_APPEND_COMMAND, mailbox, flags, internal_date, message, should_send);
}

static void
geary_imap_append_command_class_init (GearyImapAppendCommandClass * klass,
                                      gpointer klass_data)
{
	geary_imap_append_command_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_append_command_instance_init (GearyImapAppendCommand * self,
                                         gpointer klass)
{
}

/**
 * A representation of the IMAP APPEND command.
 *
 * See [[http://tools.ietf.org/html/rfc3501#section-6.3.11]]
 */
 G_GNUC_NO_INLINE static GType
geary_imap_append_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapAppendCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_append_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapAppendCommand), 0, (GInstanceInitFunc) geary_imap_append_command_instance_init, NULL };
	GType geary_imap_append_command_type_id;
	geary_imap_append_command_type_id = g_type_register_static (GEARY_IMAP_TYPE_COMMAND, "GearyImapAppendCommand", &g_define_type_info, 0);
	return geary_imap_append_command_type_id;
}

GType
geary_imap_append_command_get_type (void)
{
	static gsize geary_imap_append_command_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_append_command_type_id__once)) {
		GType geary_imap_append_command_type_id;
		geary_imap_append_command_type_id = geary_imap_append_command_get_type_once ();
		g_once_init_leave (&geary_imap_append_command_type_id__once, geary_imap_append_command_type_id);
	}
	return geary_imap_append_command_type_id__once;
}

