/* imap-envelope.c generated by valac 0.56.19, the Vala compiler
 * generated from imap-envelope.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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.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_ENVELOPE_0_PROPERTY,
	GEARY_IMAP_ENVELOPE_SENT_PROPERTY,
	GEARY_IMAP_ENVELOPE_SUBJECT_PROPERTY,
	GEARY_IMAP_ENVELOPE_FROM_PROPERTY,
	GEARY_IMAP_ENVELOPE_SENDER_PROPERTY,
	GEARY_IMAP_ENVELOPE_REPLY_TO_PROPERTY,
	GEARY_IMAP_ENVELOPE_TO_PROPERTY,
	GEARY_IMAP_ENVELOPE_CC_PROPERTY,
	GEARY_IMAP_ENVELOPE_BCC_PROPERTY,
	GEARY_IMAP_ENVELOPE_IN_REPLY_TO_PROPERTY,
	GEARY_IMAP_ENVELOPE_MESSAGE_ID_PROPERTY,
	GEARY_IMAP_ENVELOPE_NUM_PROPERTIES
};
static GParamSpec* geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_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))

struct _GearyImapEnvelopePrivate {
	GearyRFC822Date* _sent;
	GearyRFC822Subject* _subject;
	GearyRFC822MailboxAddresses* _from;
	GearyRFC822MailboxAddresses* _sender;
	GearyRFC822MailboxAddresses* _reply_to;
	GearyRFC822MailboxAddresses* _to;
	GearyRFC822MailboxAddresses* _cc;
	GearyRFC822MailboxAddresses* _bcc;
	GearyRFC822MessageIDList* _in_reply_to;
	GearyRFC822MessageID* _message_id;
};

static gint GearyImapEnvelope_private_offset;
static gpointer geary_imap_envelope_parent_class = NULL;
static GearyImapMessageDataIface * geary_imap_envelope_geary_imap_message_data_parent_iface = NULL;

static void geary_imap_envelope_set_sent (GearyImapEnvelope* self,
                                   GearyRFC822Date* value);
static void geary_imap_envelope_set_subject (GearyImapEnvelope* self,
                                      GearyRFC822Subject* value);
static void geary_imap_envelope_set_from (GearyImapEnvelope* self,
                                   GearyRFC822MailboxAddresses* value);
static void geary_imap_envelope_set_sender (GearyImapEnvelope* self,
                                     GearyRFC822MailboxAddresses* value);
static void geary_imap_envelope_set_reply_to (GearyImapEnvelope* self,
                                       GearyRFC822MailboxAddresses* value);
static void geary_imap_envelope_set_to (GearyImapEnvelope* self,
                                 GearyRFC822MailboxAddresses* value);
static void geary_imap_envelope_set_cc (GearyImapEnvelope* self,
                                 GearyRFC822MailboxAddresses* value);
static void geary_imap_envelope_set_bcc (GearyImapEnvelope* self,
                                  GearyRFC822MailboxAddresses* value);
static void geary_imap_envelope_set_in_reply_to (GearyImapEnvelope* self,
                                          GearyRFC822MessageIDList* value);
static void geary_imap_envelope_set_message_id (GearyImapEnvelope* self,
                                         GearyRFC822MessageID* value);
static gchar* geary_imap_envelope_real_to_string (GearyMessageDataAbstractMessageData* base);
static void geary_imap_envelope_finalize (GObject * obj);
static GType geary_imap_envelope_get_type_once (void);
static void _vala_geary_imap_envelope_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_geary_imap_envelope_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);

static inline gpointer
geary_imap_envelope_get_instance_private (GearyImapEnvelope* self)
{
	return G_STRUCT_MEMBER_P (self, GearyImapEnvelope_private_offset);
}

GearyRFC822Date*
geary_imap_envelope_get_sent (GearyImapEnvelope* self)
{
	GearyRFC822Date* result;
	GearyRFC822Date* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_sent;
	result = _tmp0_;
	return result;
}

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

static void
geary_imap_envelope_set_sent (GearyImapEnvelope* self,
                              GearyRFC822Date* value)
{
	GearyRFC822Date* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_sent (self);
	if (old_value != value) {
		GearyRFC822Date* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sent);
		self->priv->_sent = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_SENT_PROPERTY]);
	}
}

GearyRFC822Subject*
geary_imap_envelope_get_subject (GearyImapEnvelope* self)
{
	GearyRFC822Subject* result;
	GearyRFC822Subject* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_subject;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_subject (GearyImapEnvelope* self,
                                 GearyRFC822Subject* value)
{
	GearyRFC822Subject* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_subject (self);
	if (old_value != value) {
		GearyRFC822Subject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_subject);
		self->priv->_subject = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_SUBJECT_PROPERTY]);
	}
}

GearyRFC822MailboxAddresses*
geary_imap_envelope_get_from (GearyImapEnvelope* self)
{
	GearyRFC822MailboxAddresses* result;
	GearyRFC822MailboxAddresses* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_from;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_from (GearyImapEnvelope* self,
                              GearyRFC822MailboxAddresses* value)
{
	GearyRFC822MailboxAddresses* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_from (self);
	if (old_value != value) {
		GearyRFC822MailboxAddresses* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_from);
		self->priv->_from = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_FROM_PROPERTY]);
	}
}

GearyRFC822MailboxAddresses*
geary_imap_envelope_get_sender (GearyImapEnvelope* self)
{
	GearyRFC822MailboxAddresses* result;
	GearyRFC822MailboxAddresses* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_sender;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_sender (GearyImapEnvelope* self,
                                GearyRFC822MailboxAddresses* value)
{
	GearyRFC822MailboxAddresses* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_sender (self);
	if (old_value != value) {
		GearyRFC822MailboxAddresses* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sender);
		self->priv->_sender = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_SENDER_PROPERTY]);
	}
}

GearyRFC822MailboxAddresses*
geary_imap_envelope_get_reply_to (GearyImapEnvelope* self)
{
	GearyRFC822MailboxAddresses* result;
	GearyRFC822MailboxAddresses* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_reply_to;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_reply_to (GearyImapEnvelope* self,
                                  GearyRFC822MailboxAddresses* value)
{
	GearyRFC822MailboxAddresses* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_reply_to (self);
	if (old_value != value) {
		GearyRFC822MailboxAddresses* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_reply_to);
		self->priv->_reply_to = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_REPLY_TO_PROPERTY]);
	}
}

GearyRFC822MailboxAddresses*
geary_imap_envelope_get_to (GearyImapEnvelope* self)
{
	GearyRFC822MailboxAddresses* result;
	GearyRFC822MailboxAddresses* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_to;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_to (GearyImapEnvelope* self,
                            GearyRFC822MailboxAddresses* value)
{
	GearyRFC822MailboxAddresses* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_to (self);
	if (old_value != value) {
		GearyRFC822MailboxAddresses* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_to);
		self->priv->_to = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_TO_PROPERTY]);
	}
}

GearyRFC822MailboxAddresses*
geary_imap_envelope_get_cc (GearyImapEnvelope* self)
{
	GearyRFC822MailboxAddresses* result;
	GearyRFC822MailboxAddresses* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_cc;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_cc (GearyImapEnvelope* self,
                            GearyRFC822MailboxAddresses* value)
{
	GearyRFC822MailboxAddresses* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_cc (self);
	if (old_value != value) {
		GearyRFC822MailboxAddresses* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_cc);
		self->priv->_cc = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_CC_PROPERTY]);
	}
}

GearyRFC822MailboxAddresses*
geary_imap_envelope_get_bcc (GearyImapEnvelope* self)
{
	GearyRFC822MailboxAddresses* result;
	GearyRFC822MailboxAddresses* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_bcc;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_bcc (GearyImapEnvelope* self,
                             GearyRFC822MailboxAddresses* value)
{
	GearyRFC822MailboxAddresses* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_bcc (self);
	if (old_value != value) {
		GearyRFC822MailboxAddresses* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_bcc);
		self->priv->_bcc = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_BCC_PROPERTY]);
	}
}

GearyRFC822MessageIDList*
geary_imap_envelope_get_in_reply_to (GearyImapEnvelope* self)
{
	GearyRFC822MessageIDList* result;
	GearyRFC822MessageIDList* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_in_reply_to;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_in_reply_to (GearyImapEnvelope* self,
                                     GearyRFC822MessageIDList* value)
{
	GearyRFC822MessageIDList* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_in_reply_to (self);
	if (old_value != value) {
		GearyRFC822MessageIDList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_in_reply_to);
		self->priv->_in_reply_to = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_IN_REPLY_TO_PROPERTY]);
	}
}

GearyRFC822MessageID*
geary_imap_envelope_get_message_id (GearyImapEnvelope* self)
{
	GearyRFC822MessageID* result;
	GearyRFC822MessageID* _tmp0_;
	g_return_val_if_fail (GEARY_IMAP_IS_ENVELOPE (self), NULL);
	_tmp0_ = self->priv->_message_id;
	result = _tmp0_;
	return result;
}

static void
geary_imap_envelope_set_message_id (GearyImapEnvelope* self,
                                    GearyRFC822MessageID* value)
{
	GearyRFC822MessageID* old_value;
	g_return_if_fail (GEARY_IMAP_IS_ENVELOPE (self));
	old_value = geary_imap_envelope_get_message_id (self);
	if (old_value != value) {
		GearyRFC822MessageID* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_message_id);
		self->priv->_message_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_MESSAGE_ID_PROPERTY]);
	}
}

GearyImapEnvelope*
geary_imap_envelope_construct (GType object_type,
                               GearyRFC822Date* sent,
                               GearyRFC822Subject* subject,
                               GearyRFC822MailboxAddresses* from,
                               GearyRFC822MailboxAddresses* sender,
                               GearyRFC822MailboxAddresses* reply_to,
                               GearyRFC822MailboxAddresses* to,
                               GearyRFC822MailboxAddresses* cc,
                               GearyRFC822MailboxAddresses* bcc,
                               GearyRFC822MessageIDList* in_reply_to,
                               GearyRFC822MessageID* message_id)
{
	GearyImapEnvelope * self = NULL;
	g_return_val_if_fail ((sent == NULL) || GEARY_RF_C822_IS_DATE (sent), NULL);
	g_return_val_if_fail (GEARY_RF_C822_IS_SUBJECT (subject), NULL);
	g_return_val_if_fail (GEARY_RF_C822_IS_MAILBOX_ADDRESSES (from), NULL);
	g_return_val_if_fail (GEARY_RF_C822_IS_MAILBOX_ADDRESSES (sender), NULL);
	g_return_val_if_fail (GEARY_RF_C822_IS_MAILBOX_ADDRESSES (reply_to), NULL);
	g_return_val_if_fail ((to == NULL) || GEARY_RF_C822_IS_MAILBOX_ADDRESSES (to), NULL);
	g_return_val_if_fail ((cc == NULL) || GEARY_RF_C822_IS_MAILBOX_ADDRESSES (cc), NULL);
	g_return_val_if_fail ((bcc == NULL) || GEARY_RF_C822_IS_MAILBOX_ADDRESSES (bcc), NULL);
	g_return_val_if_fail ((in_reply_to == NULL) || GEARY_RF_C822_IS_MESSAGE_ID_LIST (in_reply_to), NULL);
	g_return_val_if_fail ((message_id == NULL) || GEARY_RF_C822_IS_MESSAGE_ID (message_id), NULL);
	self = (GearyImapEnvelope*) geary_message_data_abstract_message_data_construct (object_type);
	geary_imap_envelope_set_sent (self, sent);
	geary_imap_envelope_set_subject (self, subject);
	geary_imap_envelope_set_from (self, from);
	geary_imap_envelope_set_sender (self, sender);
	geary_imap_envelope_set_reply_to (self, reply_to);
	geary_imap_envelope_set_to (self, to);
	geary_imap_envelope_set_cc (self, cc);
	geary_imap_envelope_set_bcc (self, bcc);
	geary_imap_envelope_set_in_reply_to (self, in_reply_to);
	geary_imap_envelope_set_message_id (self, message_id);
	return self;
}

GearyImapEnvelope*
geary_imap_envelope_new (GearyRFC822Date* sent,
                         GearyRFC822Subject* subject,
                         GearyRFC822MailboxAddresses* from,
                         GearyRFC822MailboxAddresses* sender,
                         GearyRFC822MailboxAddresses* reply_to,
                         GearyRFC822MailboxAddresses* to,
                         GearyRFC822MailboxAddresses* cc,
                         GearyRFC822MailboxAddresses* bcc,
                         GearyRFC822MessageIDList* in_reply_to,
                         GearyRFC822MessageID* message_id)
{
	return geary_imap_envelope_construct (GEARY_IMAP_TYPE_ENVELOPE, sent, subject, from, sender, reply_to, to, cc, bcc, in_reply_to, message_id);
}

static gchar*
geary_imap_envelope_real_to_string (GearyMessageDataAbstractMessageData* base)
{
	GearyImapEnvelope * self;
	gchar* _tmp0_ = NULL;
	GearyRFC822Date* _tmp1_;
	GearyRFC822MailboxAddresses* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GearyRFC822Subject* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, GEARY_IMAP_TYPE_ENVELOPE, GearyImapEnvelope);
	_tmp1_ = self->priv->_sent;
	if (_tmp1_ != NULL) {
		GearyRFC822Date* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = self->priv->_sent;
		_tmp3_ = geary_message_data_abstract_message_data_to_string (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEARY_MESSAGE_DATA_TYPE_ABSTRACT_MESSAGE_DATA, GearyMessageDataAbstractMessageData));
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp3_;
	} else {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("(no date)");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = self->priv->_from;
	_tmp6_ = geary_message_data_abstract_message_data_to_string (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEARY_MESSAGE_DATA_TYPE_ABSTRACT_MESSAGE_DATA, GearyMessageDataAbstractMessageData));
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->_subject;
	_tmp9_ = geary_message_data_abstract_message_data_to_string (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GEARY_MESSAGE_DATA_TYPE_ABSTRACT_MESSAGE_DATA, GearyMessageDataAbstractMessageData));
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strdup_printf ("[%s] %s: \"%s\"", _tmp0_, _tmp7_, _tmp10_);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp10_);
	_g_free0 (_tmp7_);
	result = _tmp12_;
	_g_free0 (_tmp0_);
	return result;
}

static void
geary_imap_envelope_class_init (GearyImapEnvelopeClass * klass,
                                gpointer klass_data)
{
	geary_imap_envelope_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GearyImapEnvelope_private_offset);
	((GearyMessageDataAbstractMessageDataClass *) klass)->to_string = (gchar* (*) (GearyMessageDataAbstractMessageData*)) geary_imap_envelope_real_to_string;
	G_OBJECT_CLASS (klass)->get_property = _vala_geary_imap_envelope_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_geary_imap_envelope_set_property;
	G_OBJECT_CLASS (klass)->finalize = geary_imap_envelope_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_SENT_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_SENT_PROPERTY] = g_param_spec_object ("sent", "sent", "sent", GEARY_RF_C822_TYPE_DATE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_SUBJECT_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_SUBJECT_PROPERTY] = g_param_spec_object ("subject", "subject", "subject", GEARY_RF_C822_TYPE_SUBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_FROM_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_FROM_PROPERTY] = g_param_spec_object ("from", "from", "from", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_SENDER_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_SENDER_PROPERTY] = g_param_spec_object ("sender", "sender", "sender", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_REPLY_TO_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_REPLY_TO_PROPERTY] = g_param_spec_object ("reply-to", "reply-to", "reply-to", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_TO_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_TO_PROPERTY] = g_param_spec_object ("to", "to", "to", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_CC_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_CC_PROPERTY] = g_param_spec_object ("cc", "cc", "cc", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_BCC_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_BCC_PROPERTY] = g_param_spec_object ("bcc", "bcc", "bcc", GEARY_RF_C822_TYPE_MAILBOX_ADDRESSES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_IN_REPLY_TO_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_IN_REPLY_TO_PROPERTY] = g_param_spec_object ("in-reply-to", "in-reply-to", "in-reply-to", GEARY_RF_C822_TYPE_MESSAGE_ID_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEARY_IMAP_ENVELOPE_MESSAGE_ID_PROPERTY, geary_imap_envelope_properties[GEARY_IMAP_ENVELOPE_MESSAGE_ID_PROPERTY] = g_param_spec_object ("message-id", "message-id", "message-id", GEARY_RF_C822_TYPE_MESSAGE_ID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
geary_imap_envelope_geary_imap_message_data_interface_init (GearyImapMessageDataIface * iface,
                                                            gpointer iface_data)
{
	geary_imap_envelope_geary_imap_message_data_parent_iface = g_type_interface_peek_parent (iface);
}

static void
geary_imap_envelope_instance_init (GearyImapEnvelope * self,
                                   gpointer klass)
{
	self->priv = geary_imap_envelope_get_instance_private (self);
}

static void
geary_imap_envelope_finalize (GObject * obj)
{
	GearyImapEnvelope * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEARY_IMAP_TYPE_ENVELOPE, GearyImapEnvelope);
	_g_object_unref0 (self->priv->_sent);
	_g_object_unref0 (self->priv->_subject);
	_g_object_unref0 (self->priv->_from);
	_g_object_unref0 (self->priv->_sender);
	_g_object_unref0 (self->priv->_reply_to);
	_g_object_unref0 (self->priv->_to);
	_g_object_unref0 (self->priv->_cc);
	_g_object_unref0 (self->priv->_bcc);
	_g_object_unref0 (self->priv->_in_reply_to);
	_g_object_unref0 (self->priv->_message_id);
	G_OBJECT_CLASS (geary_imap_envelope_parent_class)->finalize (obj);
}

/**
 * A representation of the IMAP ENVELOPE data.
 *
 * See [[http://tools.ietf.org/html/rfc3501#section-7.4.2]]
 */
 G_GNUC_NO_INLINE static GType
geary_imap_envelope_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapEnvelopeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_envelope_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapEnvelope), 0, (GInstanceInitFunc) geary_imap_envelope_instance_init, NULL };
	static const GInterfaceInfo geary_imap_message_data_info = { (GInterfaceInitFunc) geary_imap_envelope_geary_imap_message_data_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_imap_envelope_type_id;
	geary_imap_envelope_type_id = g_type_register_static (GEARY_MESSAGE_DATA_TYPE_ABSTRACT_MESSAGE_DATA, "GearyImapEnvelope", &g_define_type_info, 0);
	g_type_add_interface_static (geary_imap_envelope_type_id, GEARY_IMAP_TYPE_MESSAGE_DATA, &geary_imap_message_data_info);
	GearyImapEnvelope_private_offset = g_type_add_instance_private (geary_imap_envelope_type_id, sizeof (GearyImapEnvelopePrivate));
	return geary_imap_envelope_type_id;
}

GType
geary_imap_envelope_get_type (void)
{
	static gsize geary_imap_envelope_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_envelope_type_id__once)) {
		GType geary_imap_envelope_type_id;
		geary_imap_envelope_type_id = geary_imap_envelope_get_type_once ();
		g_once_init_leave (&geary_imap_envelope_type_id__once, geary_imap_envelope_type_id);
	}
	return geary_imap_envelope_type_id__once;
}

static void
_vala_geary_imap_envelope_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	GearyImapEnvelope * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEARY_IMAP_TYPE_ENVELOPE, GearyImapEnvelope);
	switch (property_id) {
		case GEARY_IMAP_ENVELOPE_SENT_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_sent (self));
		break;
		case GEARY_IMAP_ENVELOPE_SUBJECT_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_subject (self));
		break;
		case GEARY_IMAP_ENVELOPE_FROM_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_from (self));
		break;
		case GEARY_IMAP_ENVELOPE_SENDER_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_sender (self));
		break;
		case GEARY_IMAP_ENVELOPE_REPLY_TO_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_reply_to (self));
		break;
		case GEARY_IMAP_ENVELOPE_TO_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_to (self));
		break;
		case GEARY_IMAP_ENVELOPE_CC_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_cc (self));
		break;
		case GEARY_IMAP_ENVELOPE_BCC_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_bcc (self));
		break;
		case GEARY_IMAP_ENVELOPE_IN_REPLY_TO_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_in_reply_to (self));
		break;
		case GEARY_IMAP_ENVELOPE_MESSAGE_ID_PROPERTY:
		g_value_set_object (value, geary_imap_envelope_get_message_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_geary_imap_envelope_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	GearyImapEnvelope * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEARY_IMAP_TYPE_ENVELOPE, GearyImapEnvelope);
	switch (property_id) {
		case GEARY_IMAP_ENVELOPE_SENT_PROPERTY:
		geary_imap_envelope_set_sent (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_SUBJECT_PROPERTY:
		geary_imap_envelope_set_subject (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_FROM_PROPERTY:
		geary_imap_envelope_set_from (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_SENDER_PROPERTY:
		geary_imap_envelope_set_sender (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_REPLY_TO_PROPERTY:
		geary_imap_envelope_set_reply_to (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_TO_PROPERTY:
		geary_imap_envelope_set_to (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_CC_PROPERTY:
		geary_imap_envelope_set_cc (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_BCC_PROPERTY:
		geary_imap_envelope_set_bcc (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_IN_REPLY_TO_PROPERTY:
		geary_imap_envelope_set_in_reply_to (self, g_value_get_object (value));
		break;
		case GEARY_IMAP_ENVELOPE_MESSAGE_ID_PROPERTY:
		geary_imap_envelope_set_message_id (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

