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

#include "openpgp.h"
#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gee.h>

#define DINO_PLUGINS_OPEN_PGP_NS_URI "jabber:x"
#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  {
	DINO_PLUGINS_OPEN_PGP_FLAG_0_PROPERTY,
	DINO_PLUGINS_OPEN_PGP_FLAG_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_open_pgp_flag_properties[DINO_PLUGINS_OPEN_PGP_FLAG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer dino_plugins_open_pgp_flag_parent_class = NULL;
XmppFlagIdentity* dino_plugins_open_pgp_flag_IDENTITY = NULL;

static guint _xmpp_jid_hash_bare_func_gee_hash_data_func (gconstpointer v,
                                                   gpointer self);
static gboolean _xmpp_jid_equals_bare_func_gee_equal_data_func (gconstpointer a,
                                                         gconstpointer b,
                                                         gpointer self);
static gchar* dino_plugins_open_pgp_flag_real_get_ns (XmppXmppStreamFlag* base);
static gchar* dino_plugins_open_pgp_flag_real_get_id (XmppXmppStreamFlag* base);
static void dino_plugins_open_pgp_flag_finalize (GObject * obj);
static GType dino_plugins_open_pgp_flag_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static guint
_xmpp_jid_hash_bare_func_gee_hash_data_func (gconstpointer v,
                                             gpointer self)
{
	guint result;
	result = xmpp_jid_hash_bare_func ((XmppJid*) v);
	return result;
}

static gboolean
_xmpp_jid_equals_bare_func_gee_equal_data_func (gconstpointer a,
                                                gconstpointer b,
                                                gpointer self)
{
	gboolean result;
	result = xmpp_jid_equals_bare_func ((XmppJid*) a, (XmppJid*) b);
	return result;
}

gchar*
dino_plugins_open_pgp_flag_get_key_id (DinoPluginsOpenPgpFlag* self,
                                       XmppJid* jid)
{
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (jid != NULL, NULL);
	_tmp0_ = self->key_ids;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, jid);
	result = (gchar*) _tmp1_;
	return result;
}

void
dino_plugins_open_pgp_flag_set_key_id (DinoPluginsOpenPgpFlag* self,
                                       XmppJid* jid,
                                       const gchar* key)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (jid != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = self->key_ids;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, jid, key);
}

static gchar*
dino_plugins_open_pgp_flag_real_get_ns (XmppXmppStreamFlag* base)
{
	DinoPluginsOpenPgpFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (DinoPluginsOpenPgpFlag*) base;
	_tmp0_ = g_strdup (DINO_PLUGINS_OPEN_PGP_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
dino_plugins_open_pgp_flag_real_get_id (XmppXmppStreamFlag* base)
{
	DinoPluginsOpenPgpFlag * self;
	XmppFlagIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (DinoPluginsOpenPgpFlag*) base;
	_tmp0_ = dino_plugins_open_pgp_flag_IDENTITY;
	_tmp1_ = xmpp_flag_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

DinoPluginsOpenPgpFlag*
dino_plugins_open_pgp_flag_construct (GType object_type)
{
	DinoPluginsOpenPgpFlag * self = NULL;
	self = (DinoPluginsOpenPgpFlag*) xmpp_xmpp_stream_flag_construct (object_type);
	return self;
}

DinoPluginsOpenPgpFlag*
dino_plugins_open_pgp_flag_new (void)
{
	return dino_plugins_open_pgp_flag_construct (DINO_PLUGINS_OPEN_PGP_TYPE_FLAG);
}

static void
dino_plugins_open_pgp_flag_class_init (DinoPluginsOpenPgpFlagClass * klass,
                                       gpointer klass_data)
{
	XmppFlagIdentity* _tmp0_;
	dino_plugins_open_pgp_flag_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamFlagClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamFlag*)) dino_plugins_open_pgp_flag_real_get_ns;
	((XmppXmppStreamFlagClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamFlag*)) dino_plugins_open_pgp_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_open_pgp_flag_finalize;
	_tmp0_ = xmpp_flag_identity_new (DINO_PLUGINS_OPEN_PGP_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, DINO_PLUGINS_OPEN_PGP_NS_URI, "pgp");
	dino_plugins_open_pgp_flag_IDENTITY = _tmp0_;
}

static void
dino_plugins_open_pgp_flag_instance_init (DinoPluginsOpenPgpFlag * self,
                                          gpointer klass)
{
	GeeHashMap* _tmp0_;
	_tmp0_ = gee_hash_map_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _xmpp_jid_hash_bare_func_gee_hash_data_func, NULL, NULL, _xmpp_jid_equals_bare_func_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
	self->key_ids = _tmp0_;
}

static void
dino_plugins_open_pgp_flag_finalize (GObject * obj)
{
	DinoPluginsOpenPgpFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OPEN_PGP_TYPE_FLAG, DinoPluginsOpenPgpFlag);
	_g_object_unref0 (self->key_ids);
	G_OBJECT_CLASS (dino_plugins_open_pgp_flag_parent_class)->finalize (obj);
}

static GType
dino_plugins_open_pgp_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsOpenPgpFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_open_pgp_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsOpenPgpFlag), 0, (GInstanceInitFunc) dino_plugins_open_pgp_flag_instance_init, NULL };
	GType dino_plugins_open_pgp_flag_type_id;
	dino_plugins_open_pgp_flag_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_FLAG, "DinoPluginsOpenPgpFlag", &g_define_type_info, 0);
	return dino_plugins_open_pgp_flag_type_id;
}

GType
dino_plugins_open_pgp_flag_get_type (void)
{
	static volatile gsize dino_plugins_open_pgp_flag_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_open_pgp_flag_type_id__once)) {
		GType dino_plugins_open_pgp_flag_type_id;
		dino_plugins_open_pgp_flag_type_id = dino_plugins_open_pgp_flag_get_type_once ();
		g_once_init_leave (&dino_plugins_open_pgp_flag_type_id__once, dino_plugins_open_pgp_flag_type_id);
	}
	return dino_plugins_open_pgp_flag_type_id__once;
}

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

