/* imap-copy-command.c generated by valac 0.56.3, the Vala compiler
 * generated from imap-copy-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 <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

enum  {
	GEARY_IMAP_COPY_COMMAND_0_PROPERTY,
	GEARY_IMAP_COPY_COMMAND_NUM_PROPERTIES
};
static GParamSpec* geary_imap_copy_command_properties[GEARY_IMAP_COPY_COMMAND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer geary_imap_copy_command_parent_class = NULL;

static GType geary_imap_copy_command_get_type_once (void);

GearyImapCopyCommand*
geary_imap_copy_command_construct (GType object_type,
                                   GearyImapMessageSet* message_set,
                                   GearyImapMailboxSpecifier* destination,
                                   GCancellable* should_send)
{
	GearyImapCopyCommand * self = NULL;
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GearyImapListParameter* _tmp3_;
	GearyImapListParameter* _tmp4_;
	GearyImapParameter* _tmp5_;
	GearyImapParameter* _tmp6_;
	GearyImapListParameter* _tmp7_;
	GearyImapListParameter* _tmp8_;
	GearyImapParameter* _tmp9_;
	GearyImapParameter* _tmp10_;
	g_return_val_if_fail (GEARY_IMAP_IS_MESSAGE_SET (message_set), NULL);
	g_return_val_if_fail (GEARY_IMAP_IS_MAILBOX_SPECIFIER (destination), NULL);
	g_return_val_if_fail ((should_send == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (should_send, g_cancellable_get_type ()), NULL);
	_tmp1_ = geary_imap_message_set_get_is_uid (message_set);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		_tmp0_ = GEARY_IMAP_COPY_COMMAND_UID_NAME;
	} else {
		_tmp0_ = GEARY_IMAP_COPY_COMMAND_NAME;
	}
	self = (GearyImapCopyCommand*) geary_imap_command_construct (object_type, _tmp0_, NULL, (gint) 0, should_send);
	_tmp3_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp4_ = _tmp3_;
	_tmp5_ = geary_imap_message_set_to_parameter (message_set);
	_tmp6_ = _tmp5_;
	geary_imap_list_parameter_add (_tmp4_, _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp8_ = _tmp7_;
	_tmp9_ = geary_imap_mailbox_specifier_to_parameter (destination);
	_tmp10_ = _tmp9_;
	geary_imap_list_parameter_add (_tmp8_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	return self;
}

GearyImapCopyCommand*
geary_imap_copy_command_new (GearyImapMessageSet* message_set,
                             GearyImapMailboxSpecifier* destination,
                             GCancellable* should_send)
{
	return geary_imap_copy_command_construct (GEARY_IMAP_TYPE_COPY_COMMAND, message_set, destination, should_send);
}

static void
geary_imap_copy_command_class_init (GearyImapCopyCommandClass * klass,
                                    gpointer klass_data)
{
	geary_imap_copy_command_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_copy_command_instance_init (GearyImapCopyCommand * self,
                                       gpointer klass)
{
}

/**
 * See [[http://tools.ietf.org/html/rfc3501#section-6.4.7]]
 */
 G_GNUC_NO_INLINE static GType
geary_imap_copy_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapCopyCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_copy_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapCopyCommand), 0, (GInstanceInitFunc) geary_imap_copy_command_instance_init, NULL };
	GType geary_imap_copy_command_type_id;
	geary_imap_copy_command_type_id = g_type_register_static (GEARY_IMAP_TYPE_COMMAND, "GearyImapCopyCommand", &g_define_type_info, 0);
	return geary_imap_copy_command_type_id;
}

GType
geary_imap_copy_command_get_type (void)
{
	static gsize geary_imap_copy_command_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_copy_command_type_id__once)) {
		GType geary_imap_copy_command_type_id;
		geary_imap_copy_command_type_id = geary_imap_copy_command_get_type_once ();
		g_once_init_leave (&geary_imap_copy_command_type_id__once, geary_imap_copy_command_type_id);
	}
	return geary_imap_copy_command_type_id__once;
}

