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

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

#define XMPP_ROSTER_VERSIONING_MODULE_NS_URI_FEATURE "urn:xmpp:features:rosterver"
#define XMPP_ROSTER_NS_URI "jabber:iq:roster"
#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  {
	XMPP_ROSTER_VERSIONING_MODULE_0_PROPERTY,
	XMPP_ROSTER_VERSIONING_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_roster_versioning_module_properties[XMPP_ROSTER_VERSIONING_MODULE_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 _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _xmpp_roster_item_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_roster_item_unref (var), NULL)))

struct _XmppRosterVersioningModulePrivate {
	XmppRosterStorage* storage;
};

static gint XmppRosterVersioningModule_private_offset;
static gpointer xmpp_roster_versioning_module_parent_class = NULL;
XmppModuleIdentity* xmpp_roster_versioning_module_IDENTITY = NULL;

static void xmpp_roster_versioning_module_real_attach (XmppXmppStreamModule* base,
                                                XmppXmppStream* stream);
static void xmpp_roster_versioning_module_on_pre_get_roster (XmppRosterVersioningModule* self,
                                                      XmppXmppStream* stream,
                                                      XmppIqStanza* iq);
static void _xmpp_roster_versioning_module_on_pre_get_roster_xmpp_roster_module_pre_get_roster (XmppRosterModule* _sender,
                                                                                         XmppXmppStream* stream,
                                                                                         XmppIqStanza* iq,
                                                                                         gpointer self);
static void xmpp_roster_versioning_module_on_received_roster (XmppRosterVersioningModule* self,
                                                       XmppXmppStream* stream,
                                                       GeeCollection* roster,
                                                       XmppIqStanza* iq);
static void _xmpp_roster_versioning_module_on_received_roster_xmpp_roster_module_received_roster (XmppRosterModule* _sender,
                                                                                           XmppXmppStream* stream,
                                                                                           GeeCollection* roster,
                                                                                           XmppIqStanza* stanza,
                                                                                           gpointer self);
static void xmpp_roster_versioning_module_on_item_updated (XmppRosterVersioningModule* self,
                                                    XmppXmppStream* stream,
                                                    XmppRosterItem* item,
                                                    XmppIqStanza* iq);
static void _xmpp_roster_versioning_module_on_item_updated_xmpp_roster_module_item_updated (XmppRosterModule* _sender,
                                                                                     XmppXmppStream* stream,
                                                                                     XmppRosterItem* item,
                                                                                     XmppIqStanza* iq,
                                                                                     gpointer self);
static void xmpp_roster_versioning_module_on_item_removed (XmppRosterVersioningModule* self,
                                                    XmppXmppStream* stream,
                                                    XmppRosterItem* item,
                                                    XmppIqStanza* iq);
static void _xmpp_roster_versioning_module_on_item_removed_xmpp_roster_module_item_removed (XmppRosterModule* _sender,
                                                                                     XmppXmppStream* stream,
                                                                                     XmppRosterItem* item,
                                                                                     XmppIqStanza* iq,
                                                                                     gpointer self);
static void xmpp_roster_versioning_module_real_detach (XmppXmppStreamModule* base,
                                                XmppXmppStream* stream);
static gchar* xmpp_roster_versioning_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_roster_versioning_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_roster_versioning_module_finalize (GObject * obj);
static GType xmpp_roster_versioning_module_get_type_once (void);
static GType xmpp_roster_storage_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_roster_versioning_module_get_instance_private (XmppRosterVersioningModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppRosterVersioningModule_private_offset);
}

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

XmppRosterVersioningModule*
xmpp_roster_versioning_module_construct (GType object_type,
                                         XmppRosterStorage* storage)
{
	XmppRosterVersioningModule * self = NULL;
	XmppRosterStorage* _tmp0_;
	g_return_val_if_fail (storage != NULL, NULL);
	self = (XmppRosterVersioningModule*) xmpp_xmpp_stream_module_construct (object_type);
	_tmp0_ = _g_object_ref0 (storage);
	_g_object_unref0 (self->priv->storage);
	self->priv->storage = _tmp0_;
	return self;
}

XmppRosterVersioningModule*
xmpp_roster_versioning_module_new (XmppRosterStorage* storage)
{
	return xmpp_roster_versioning_module_construct (XMPP_ROSTER_TYPE_VERSIONING_MODULE, storage);
}

static void
_xmpp_roster_versioning_module_on_pre_get_roster_xmpp_roster_module_pre_get_roster (XmppRosterModule* _sender,
                                                                                    XmppXmppStream* stream,
                                                                                    XmppIqStanza* iq,
                                                                                    gpointer self)
{
	xmpp_roster_versioning_module_on_pre_get_roster ((XmppRosterVersioningModule*) self, stream, iq);
}

static void
_xmpp_roster_versioning_module_on_received_roster_xmpp_roster_module_received_roster (XmppRosterModule* _sender,
                                                                                      XmppXmppStream* stream,
                                                                                      GeeCollection* roster,
                                                                                      XmppIqStanza* stanza,
                                                                                      gpointer self)
{
	xmpp_roster_versioning_module_on_received_roster ((XmppRosterVersioningModule*) self, stream, roster, stanza);
}

static void
_xmpp_roster_versioning_module_on_item_updated_xmpp_roster_module_item_updated (XmppRosterModule* _sender,
                                                                                XmppXmppStream* stream,
                                                                                XmppRosterItem* item,
                                                                                XmppIqStanza* iq,
                                                                                gpointer self)
{
	xmpp_roster_versioning_module_on_item_updated ((XmppRosterVersioningModule*) self, stream, item, iq);
}

static void
_xmpp_roster_versioning_module_on_item_removed_xmpp_roster_module_item_removed (XmppRosterModule* _sender,
                                                                                XmppXmppStream* stream,
                                                                                XmppRosterItem* item,
                                                                                XmppIqStanza* iq,
                                                                                gpointer self)
{
	xmpp_roster_versioning_module_on_item_removed ((XmppRosterVersioningModule*) self, stream, item, iq);
}

static void
xmpp_roster_versioning_module_real_attach (XmppXmppStreamModule* base,
                                           XmppXmppStream* stream)
{
	XmppRosterVersioningModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppRosterModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppRosterModule* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppRosterModule* _tmp8_;
	XmppModuleIdentity* _tmp9_;
	gpointer _tmp10_;
	XmppRosterModule* _tmp11_;
	self = (XmppRosterVersioningModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_roster_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppRosterModule*) _tmp1_;
	g_signal_connect_object (_tmp2_, "pre-get-roster", (GCallback) _xmpp_roster_versioning_module_on_pre_get_roster_xmpp_roster_module_pre_get_roster, self, 0);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_roster_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppRosterModule*) _tmp4_;
	g_signal_connect_object (_tmp5_, "received-roster", (GCallback) _xmpp_roster_versioning_module_on_received_roster_xmpp_roster_module_received_roster, self, 0);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = xmpp_roster_module_IDENTITY;
	_tmp7_ = xmpp_xmpp_stream_get_module (stream, XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp6_);
	_tmp8_ = (XmppRosterModule*) _tmp7_;
	g_signal_connect_object (_tmp8_, "item-updated", (GCallback) _xmpp_roster_versioning_module_on_item_updated_xmpp_roster_module_item_updated, self, 0);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = xmpp_roster_module_IDENTITY;
	_tmp10_ = xmpp_xmpp_stream_get_module (stream, XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp9_);
	_tmp11_ = (XmppRosterModule*) _tmp10_;
	g_signal_connect_object (_tmp11_, "item-removed", (GCallback) _xmpp_roster_versioning_module_on_item_removed_xmpp_roster_module_item_removed, self, 0);
	_g_object_unref0 (_tmp11_);
}

static void
xmpp_roster_versioning_module_real_detach (XmppXmppStreamModule* base,
                                           XmppXmppStream* stream)
{
	XmppRosterVersioningModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppRosterModule* _tmp2_;
	guint _tmp3_;
	self = (XmppRosterVersioningModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_roster_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppRosterModule*) _tmp1_;
	g_signal_parse_name ("pre-get-roster", XMPP_ROSTER_TYPE_MODULE, &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _xmpp_roster_versioning_module_on_pre_get_roster_xmpp_roster_module_pre_get_roster, self);
	_g_object_unref0 (_tmp2_);
}

static gchar*
xmpp_roster_versioning_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppRosterVersioningModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppRosterVersioningModule*) base;
	_tmp0_ = g_strdup (XMPP_ROSTER_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_roster_versioning_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppRosterVersioningModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppRosterVersioningModule*) base;
	_tmp0_ = xmpp_roster_versioning_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_roster_versioning_module_on_pre_get_roster (XmppRosterVersioningModule* self,
                                                 XmppXmppStream* stream,
                                                 XmppIqStanza* iq)
{
	XmppStanzaNode* ver_feature = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	_tmp0_ = xmpp_xmpp_stream_get_features (stream);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_get_subnode (_tmp1_, "ver", XMPP_ROSTER_VERSIONING_MODULE_NS_URI_FEATURE, FALSE);
	ver_feature = _tmp2_;
	_tmp3_ = ver_feature;
	if (_tmp3_ != NULL) {
		gchar* _tmp4_ = NULL;
		XmppRosterStorage* _tmp5_;
		gchar* _tmp6_;
		XmppStanzaNode* _tmp8_;
		XmppStanzaNode* _tmp9_;
		XmppStanzaNode* _tmp10_;
		_tmp5_ = self->priv->storage;
		_tmp6_ = xmpp_roster_storage_get_roster_version (_tmp5_);
		_tmp4_ = _tmp6_;
		if (_tmp4_ == NULL) {
			gchar* _tmp7_;
			_tmp7_ = g_strdup ("");
			_g_free0 (_tmp4_);
			_tmp4_ = _tmp7_;
		}
		_tmp8_ = ((XmppStanza*) iq)->stanza;
		_tmp9_ = xmpp_stanza_node_get_subnode (_tmp8_, "query", XMPP_ROSTER_NS_URI, FALSE);
		_tmp10_ = _tmp9_;
		xmpp_stanza_node_set_attribute (_tmp10_, "ver", _tmp4_, NULL);
		_xmpp_stanza_entry_unref0 (_tmp10_);
		_g_free0 (_tmp4_);
	}
	_xmpp_stanza_entry_unref0 (ver_feature);
}

static void
xmpp_roster_versioning_module_on_received_roster (XmppRosterVersioningModule* self,
                                                  XmppXmppStream* stream,
                                                  GeeCollection* roster,
                                                  XmppIqStanza* iq)
{
	gchar* ver = NULL;
	XmppStanzaNode* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	gboolean _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (roster != NULL);
	g_return_if_fail (iq != NULL);
	_tmp0_ = ((XmppStanza*) iq)->stanza;
	_tmp1_ = xmpp_stanza_node_get_deep_attribute (_tmp0_, XMPP_ROSTER_NS_URI ":query", XMPP_ROSTER_NS_URI ":ver", NULL);
	_tmp2_ = g_strdup (_tmp1_);
	ver = _tmp2_;
	_tmp3_ = ver;
	if (_tmp3_ != NULL) {
		XmppRosterStorage* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = self->priv->storage;
		_tmp5_ = ver;
		xmpp_roster_storage_set_roster_version (_tmp4_, _tmp5_);
	}
	_tmp6_ = ((XmppStanza*) iq)->stanza;
	_tmp7_ = xmpp_stanza_node_get_subnode (_tmp6_, "query", XMPP_ROSTER_NS_URI, FALSE);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_ != NULL;
	_xmpp_stanza_entry_unref0 (_tmp8_);
	if (_tmp9_) {
		XmppRosterStorage* _tmp10_;
		_tmp10_ = self->priv->storage;
		xmpp_roster_storage_set_roster (_tmp10_, roster);
	} else {
		XmppRosterFlag* flag = NULL;
		XmppFlagIdentity* _tmp11_;
		gpointer _tmp12_;
		_tmp11_ = xmpp_roster_flag_IDENTITY;
		_tmp12_ = xmpp_xmpp_stream_get_flag (stream, XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp11_);
		flag = (XmppRosterFlag*) _tmp12_;
		{
			GeeIterator* _item_it = NULL;
			XmppRosterStorage* _tmp13_;
			GeeCollection* _tmp14_;
			GeeCollection* _tmp15_;
			GeeIterator* _tmp16_;
			GeeIterator* _tmp17_;
			_tmp13_ = self->priv->storage;
			_tmp14_ = xmpp_roster_storage_get_roster (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = gee_iterable_iterator ((GeeIterable*) _tmp15_);
			_tmp17_ = _tmp16_;
			_g_object_unref0 (_tmp15_);
			_item_it = _tmp17_;
			while (TRUE) {
				GeeIterator* _tmp18_;
				XmppRosterItem* item = NULL;
				GeeIterator* _tmp19_;
				gpointer _tmp20_;
				XmppRosterFlag* _tmp21_;
				GeeHashMap* _tmp22_;
				XmppRosterItem* _tmp23_;
				XmppJid* _tmp24_;
				XmppJid* _tmp25_;
				XmppRosterItem* _tmp26_;
				_tmp18_ = _item_it;
				if (!gee_iterator_next (_tmp18_)) {
					break;
				}
				_tmp19_ = _item_it;
				_tmp20_ = gee_iterator_get (_tmp19_);
				item = (XmppRosterItem*) _tmp20_;
				_tmp21_ = flag;
				_tmp22_ = _tmp21_->roster_items;
				_tmp23_ = item;
				_tmp24_ = xmpp_roster_item_get_jid (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = item;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp22_, _tmp25_, _tmp26_);
				_xmpp_roster_item_unref0 (item);
			}
			_g_object_unref0 (_item_it);
		}
		_g_object_unref0 (flag);
	}
	_g_free0 (ver);
}

static void
xmpp_roster_versioning_module_on_item_updated (XmppRosterVersioningModule* self,
                                               XmppXmppStream* stream,
                                               XmppRosterItem* item,
                                               XmppIqStanza* iq)
{
	gchar* ver = NULL;
	XmppStanzaNode* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	XmppRosterStorage* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (iq != NULL);
	_tmp0_ = ((XmppStanza*) iq)->stanza;
	_tmp1_ = xmpp_stanza_node_get_deep_attribute (_tmp0_, XMPP_ROSTER_NS_URI ":query", XMPP_ROSTER_NS_URI ":ver", NULL);
	_tmp2_ = g_strdup (_tmp1_);
	ver = _tmp2_;
	_tmp3_ = ver;
	if (_tmp3_ != NULL) {
		XmppRosterStorage* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = self->priv->storage;
		_tmp5_ = ver;
		xmpp_roster_storage_set_roster_version (_tmp4_, _tmp5_);
	}
	_tmp6_ = self->priv->storage;
	xmpp_roster_storage_set_item (_tmp6_, item);
	_g_free0 (ver);
}

static void
xmpp_roster_versioning_module_on_item_removed (XmppRosterVersioningModule* self,
                                               XmppXmppStream* stream,
                                               XmppRosterItem* item,
                                               XmppIqStanza* iq)
{
	gchar* ver = NULL;
	XmppStanzaNode* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	XmppRosterStorage* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (iq != NULL);
	_tmp0_ = ((XmppStanza*) iq)->stanza;
	_tmp1_ = xmpp_stanza_node_get_deep_attribute (_tmp0_, XMPP_ROSTER_NS_URI ":query", XMPP_ROSTER_NS_URI ":ver", NULL);
	_tmp2_ = g_strdup (_tmp1_);
	ver = _tmp2_;
	_tmp3_ = ver;
	if (_tmp3_ != NULL) {
		XmppRosterStorage* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = self->priv->storage;
		_tmp5_ = ver;
		xmpp_roster_storage_set_roster_version (_tmp4_, _tmp5_);
	}
	_tmp6_ = self->priv->storage;
	xmpp_roster_storage_remove_item (_tmp6_, item);
	_g_free0 (ver);
}

static void
xmpp_roster_versioning_module_class_init (XmppRosterVersioningModuleClass * klass,
                                          gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_roster_versioning_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppRosterVersioningModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_roster_versioning_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_roster_versioning_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_roster_versioning_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_roster_versioning_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_roster_versioning_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_ROSTER_NS_URI, "roster_versioning");
	xmpp_roster_versioning_module_IDENTITY = _tmp0_;
}

static void
xmpp_roster_versioning_module_instance_init (XmppRosterVersioningModule * self,
                                             gpointer klass)
{
	self->priv = xmpp_roster_versioning_module_get_instance_private (self);
}

static void
xmpp_roster_versioning_module_finalize (GObject * obj)
{
	XmppRosterVersioningModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_ROSTER_TYPE_VERSIONING_MODULE, XmppRosterVersioningModule);
	_g_object_unref0 (self->priv->storage);
	G_OBJECT_CLASS (xmpp_roster_versioning_module_parent_class)->finalize (obj);
}

static GType
xmpp_roster_versioning_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppRosterVersioningModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_roster_versioning_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppRosterVersioningModule), 0, (GInstanceInitFunc) xmpp_roster_versioning_module_instance_init, NULL };
	GType xmpp_roster_versioning_module_type_id;
	xmpp_roster_versioning_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppRosterVersioningModule", &g_define_type_info, 0);
	XmppRosterVersioningModule_private_offset = g_type_add_instance_private (xmpp_roster_versioning_module_type_id, sizeof (XmppRosterVersioningModulePrivate));
	return xmpp_roster_versioning_module_type_id;
}

GType
xmpp_roster_versioning_module_get_type (void)
{
	static volatile gsize xmpp_roster_versioning_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_roster_versioning_module_type_id__once)) {
		GType xmpp_roster_versioning_module_type_id;
		xmpp_roster_versioning_module_type_id = xmpp_roster_versioning_module_get_type_once ();
		g_once_init_leave (&xmpp_roster_versioning_module_type_id__once, xmpp_roster_versioning_module_type_id);
	}
	return xmpp_roster_versioning_module_type_id__once;
}

gchar*
xmpp_roster_storage_get_roster_version (XmppRosterStorage* self)
{
	XmppRosterStorageIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_ROSTER_STORAGE_GET_INTERFACE (self);
	if (_iface_->get_roster_version) {
		return _iface_->get_roster_version (self);
	}
	return NULL;
}

GeeCollection*
xmpp_roster_storage_get_roster (XmppRosterStorage* self)
{
	XmppRosterStorageIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_ROSTER_STORAGE_GET_INTERFACE (self);
	if (_iface_->get_roster) {
		return _iface_->get_roster (self);
	}
	return NULL;
}

void
xmpp_roster_storage_set_roster_version (XmppRosterStorage* self,
                                        const gchar* version)
{
	XmppRosterStorageIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = XMPP_ROSTER_STORAGE_GET_INTERFACE (self);
	if (_iface_->set_roster_version) {
		_iface_->set_roster_version (self, version);
	}
}

void
xmpp_roster_storage_set_roster (XmppRosterStorage* self,
                                GeeCollection* items)
{
	XmppRosterStorageIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = XMPP_ROSTER_STORAGE_GET_INTERFACE (self);
	if (_iface_->set_roster) {
		_iface_->set_roster (self, items);
	}
}

void
xmpp_roster_storage_set_item (XmppRosterStorage* self,
                              XmppRosterItem* item)
{
	XmppRosterStorageIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = XMPP_ROSTER_STORAGE_GET_INTERFACE (self);
	if (_iface_->set_item) {
		_iface_->set_item (self, item);
	}
}

void
xmpp_roster_storage_remove_item (XmppRosterStorage* self,
                                 XmppRosterItem* item)
{
	XmppRosterStorageIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = XMPP_ROSTER_STORAGE_GET_INTERFACE (self);
	if (_iface_->remove_item) {
		_iface_->remove_item (self, item);
	}
}

static void
xmpp_roster_storage_default_init (XmppRosterStorageIface * iface,
                                  gpointer iface_data)
{
}

static GType
xmpp_roster_storage_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppRosterStorageIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_roster_storage_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType xmpp_roster_storage_type_id;
	xmpp_roster_storage_type_id = g_type_register_static (G_TYPE_INTERFACE, "XmppRosterStorage", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (xmpp_roster_storage_type_id, G_TYPE_OBJECT);
	return xmpp_roster_storage_type_id;
}

GType
xmpp_roster_storage_get_type (void)
{
	static volatile gsize xmpp_roster_storage_type_id__once = 0;
	if (g_once_init_enter (&xmpp_roster_storage_type_id__once)) {
		GType xmpp_roster_storage_type_id;
		xmpp_roster_storage_type_id = xmpp_roster_storage_get_type_once ();
		g_once_init_leave (&xmpp_roster_storage_type_id__once, xmpp_roster_storage_type_id);
	}
	return xmpp_roster_storage_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;
}

