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

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

#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_MODULE_0_PROPERTY,
	XMPP_ROSTER_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_roster_module_properties[XMPP_ROSTER_MODULE_NUM_PROPERTIES];
#define _xmpp_roster_item_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_roster_item_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _XmppRosterModuleOnIqSetData XmppRosterModuleOnIqSetData;
enum  {
	XMPP_ROSTER_MODULE_RECEIVED_ROSTER_SIGNAL,
	XMPP_ROSTER_MODULE_PRE_GET_ROSTER_SIGNAL,
	XMPP_ROSTER_MODULE_ITEM_REMOVED_SIGNAL,
	XMPP_ROSTER_MODULE_ITEM_UPDATED_SIGNAL,
	XMPP_ROSTER_MODULE_MUTUAL_SUBSCRIPTION_SIGNAL,
	XMPP_ROSTER_MODULE_NUM_SIGNALS
};
static guint xmpp_roster_module_signals[XMPP_ROSTER_MODULE_NUM_SIGNALS] = {0};

struct _XmppRosterModuleOnIqSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppRosterModule* self;
	XmppXmppStream* stream;
	XmppIqStanza* iq;
	XmppStanzaNode* query_node;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppJid* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	XmppFlagIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppBindFlag* _tmp8_;
	XmppJid* _tmp9_;
	XmppJid* _tmp10_;
	XmppJid* _tmp11_;
	XmppJid* _tmp12_;
	gboolean _tmp13_;
	XmppJid* _tmp14_;
	XmppJid* _tmp15_;
	XmppJid* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	XmppRosterFlag* flag;
	XmppFlagIdentity* _tmp19_;
	gpointer _tmp20_;
	XmppRosterItem* item;
	XmppStanzaNode* _tmp21_;
	XmppStanzaNode* _tmp22_;
	XmppStanzaNode* _tmp23_;
	XmppRosterItem* _tmp24_;
	XmppRosterItem* _tmp25_;
	XmppRosterItem* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	GQuark _tmp31_;
	XmppRosterFlag* _tmp32_;
	GeeHashMap* _tmp33_;
	XmppRosterItem* _tmp34_;
	XmppJid* _tmp35_;
	XmppJid* _tmp36_;
	XmppRosterItem* _tmp37_;
	gboolean is_new;
	XmppRosterItem* old;
	XmppRosterFlag* _tmp38_;
	XmppRosterItem* _tmp39_;
	XmppJid* _tmp40_;
	XmppJid* _tmp41_;
	XmppRosterItem* _tmp42_;
	gboolean _tmp43_;
	XmppRosterItem* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	gboolean _tmp47_;
	XmppRosterItem* _tmp48_;
	XmppRosterItem* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	XmppRosterFlag* _tmp52_;
	GeeHashMap* _tmp53_;
	XmppRosterItem* _tmp54_;
	XmppJid* _tmp55_;
	XmppJid* _tmp56_;
	XmppRosterItem* _tmp57_;
	XmppRosterItem* _tmp58_;
	XmppRosterItem* _tmp59_;
	XmppJid* _tmp60_;
	XmppJid* _tmp61_;
};

static gpointer xmpp_roster_module_parent_class = NULL;
XmppModuleIdentity* xmpp_roster_module_IDENTITY = NULL;
static XmppIqHandlerIface * xmpp_roster_module_xmpp_iq_handler_parent_iface = NULL;

static void xmpp_roster_module_roster_set (XmppRosterModule* self,
                                    XmppXmppStream* stream,
                                    XmppRosterItem* roster_item);
static void xmpp_roster_module_real_on_iq_set_data_free (gpointer _data);
static void xmpp_roster_module_real_on_iq_set (XmppIqHandler* base,
                                        XmppXmppStream* stream,
                                        XmppIqStanza* iq,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static gboolean xmpp_roster_module_real_on_iq_set_co (XmppRosterModuleOnIqSetData* _data_);
static void xmpp_roster_module_real_attach (XmppXmppStreamModule* base,
                                     XmppXmppStream* stream);
static void xmpp_roster_module_roster_get (XmppRosterModule* self,
                                    XmppXmppStream* stream);
static void _xmpp_roster_module_roster_get_xmpp_presence_module_initial_presence_sent (XmppPresenceModule* _sender,
                                                                                XmppXmppStream* stream,
                                                                                XmppPresenceStanza* presence,
                                                                                gpointer self);
static void xmpp_roster_module_real_detach (XmppXmppStreamModule* base,
                                     XmppXmppStream* stream);
static gchar* xmpp_roster_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_roster_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_roster_module_on_roster_get_received (XmppXmppStream* stream,
                                                XmppIqStanza* iq);
static void _xmpp_roster_module_on_roster_get_received_xmpp_iq_module_on_result (XmppXmppStream* stream,
                                                                          XmppIqStanza* iq,
                                                                          gpointer self);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closure,
                                                         GValue * return_value,
                                                         guint n_param_values,
                                                         const GValue * param_values,
                                                         gpointer invocation_hint,
                                                         gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT (GClosure * closure,
                                                                   GValue * return_value,
                                                                   guint n_param_values,
                                                                   const GValue * param_values,
                                                                   gpointer invocation_hint,
                                                                   gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data);
static void xmpp_roster_module_finalize (GObject * obj);
static GType xmpp_roster_module_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
xmpp_roster_module_add_jid (XmppRosterModule* self,
                            XmppXmppStream* stream,
                            XmppJid* jid,
                            const gchar* handle)
{
	XmppRosterItem* roster_item = NULL;
	XmppRosterItem* _tmp0_;
	XmppRosterItem* _tmp1_;
	XmppRosterItem* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	_tmp0_ = xmpp_roster_item_new ();
	roster_item = _tmp0_;
	_tmp1_ = roster_item;
	xmpp_roster_item_set_jid (_tmp1_, jid);
	if (handle != NULL) {
		XmppRosterItem* _tmp2_;
		_tmp2_ = roster_item;
		xmpp_roster_item_set_name (_tmp2_, handle);
	}
	_tmp3_ = roster_item;
	xmpp_roster_module_roster_set (self, stream, _tmp3_);
	_xmpp_roster_item_unref0 (roster_item);
}

void
xmpp_roster_module_remove_jid (XmppRosterModule* self,
                               XmppXmppStream* stream,
                               XmppJid* jid)
{
	XmppRosterItem* roster_item = NULL;
	XmppRosterItem* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	_tmp0_ = xmpp_roster_item_new ();
	roster_item = _tmp0_;
	xmpp_roster_item_set_jid (roster_item, jid);
	xmpp_roster_item_set_subscription (roster_item, XMPP_ROSTER_ITEM_SUBSCRIPTION_REMOVE);
	xmpp_roster_module_roster_set (self, stream, roster_item);
	_xmpp_roster_item_unref0 (roster_item);
}

/**
     * Set a handle for a jid
     * @param   handle  Handle to be set. If null, any handle will be removed.
     */
static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

void
xmpp_roster_module_set_jid_handle (XmppRosterModule* self,
                                   XmppXmppStream* stream,
                                   XmppJid* jid,
                                   const gchar* handle)
{
	XmppRosterFlag* flag = NULL;
	XmppFlagIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppRosterItem* _tmp2_ = NULL;
	XmppRosterFlag* _tmp3_;
	XmppRosterItem* _tmp4_;
	XmppRosterItem* item = NULL;
	XmppRosterItem* _tmp7_;
	const gchar* _tmp8_ = NULL;
	XmppRosterItem* _tmp9_;
	XmppRosterItem* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (jid != NULL);
	_tmp0_ = xmpp_roster_flag_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_flag (stream, XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	flag = (XmppRosterFlag*) _tmp1_;
	_tmp3_ = flag;
	_tmp4_ = xmpp_roster_flag_get_item (_tmp3_, jid);
	_tmp2_ = _tmp4_;
	if (_tmp2_ == NULL) {
		XmppJid* _tmp5_;
		XmppRosterItem* _tmp6_ = NULL;
		_tmp5_ = _xmpp_jid_ref0 (jid);
		_tmp6_ = xmpp_roster_item_new ();
		xmpp_roster_item_set_jid (_tmp6_, _tmp5_);
		_xmpp_jid_unref0 (_tmp5_);
		_xmpp_roster_item_unref0 (_tmp2_);
		_tmp2_ = _tmp6_;
	}
	_tmp7_ = _tmp2_;
	_tmp2_ = NULL;
	item = _tmp7_;
	if (handle != NULL) {
		_tmp8_ = handle;
	} else {
		_tmp8_ = "";
	}
	_tmp9_ = item;
	xmpp_roster_item_set_name (_tmp9_, _tmp8_);
	_tmp10_ = item;
	xmpp_roster_module_roster_set (self, stream, _tmp10_);
	_xmpp_roster_item_unref0 (item);
	_xmpp_roster_item_unref0 (_tmp2_);
	_g_object_unref0 (flag);
}

static void
xmpp_roster_module_real_on_iq_set_data_free (gpointer _data)
{
	XmppRosterModuleOnIqSetData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->iq);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppRosterModuleOnIqSetData, _data_);
}

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

static void
xmpp_roster_module_real_on_iq_set (XmppIqHandler* base,
                                   XmppXmppStream* stream,
                                   XmppIqStanza* iq,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	XmppRosterModule * self;
	XmppRosterModuleOnIqSetData* _data_;
	XmppRosterModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppIqStanza* _tmp2_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	self = (XmppRosterModule*) base;
	_data_ = g_slice_new0 (XmppRosterModuleOnIqSetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_roster_module_real_on_iq_set_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _g_object_ref0 (iq);
	_g_object_unref0 (_data_->iq);
	_data_->iq = _tmp2_;
	xmpp_roster_module_real_on_iq_set_co (_data_);
}

static void
xmpp_roster_module_on_iq_set_finish (XmppIqHandler* base,
                                     GAsyncResult* _res_)
{
	XmppRosterModuleOnIqSetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
xmpp_roster_module_real_on_iq_set_co (XmppRosterModuleOnIqSetData* _data_)
{
	static GQuark _tmp30_label0 = 0;
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((XmppStanza*) _data_->iq)->stanza;
	_data_->_tmp1_ = xmpp_stanza_node_get_subnode (_data_->_tmp0_, "query", XMPP_ROSTER_NS_URI, FALSE);
	_data_->query_node = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->query_node;
	if (_data_->_tmp2_ == NULL) {
		_xmpp_stanza_entry_unref0 (_data_->query_node);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = xmpp_stanza_get_from ((XmppStanza*) _data_->iq);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = xmpp_bind_flag_IDENTITY;
	_data_->_tmp7_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp6_);
	_data_->_tmp8_ = (XmppBindFlag*) _data_->_tmp7_;
	_data_->_tmp9_ = _data_->_tmp8_->my_jid;
	_data_->_tmp10_ = xmpp_jid_get_bare_jid (_data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = !xmpp_jid_equals (_data_->_tmp5_, _data_->_tmp12_);
	_xmpp_jid_unref0 (_data_->_tmp12_);
	_g_object_unref0 (_data_->_tmp8_);
	_xmpp_jid_unref0 (_data_->_tmp5_);
	if (_data_->_tmp13_) {
		_data_->_tmp14_ = xmpp_stanza_get_from ((XmppStanza*) _data_->iq);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp17_ = xmpp_jid_to_string (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		g_warning ("module.vala:51: Received alleged roster push from %s, ignoring", _data_->_tmp18_);
		_g_free0 (_data_->_tmp18_);
		_xmpp_jid_unref0 (_data_->_tmp16_);
		_xmpp_stanza_entry_unref0 (_data_->query_node);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp19_ = xmpp_roster_flag_IDENTITY;
	_data_->_tmp20_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp19_);
	_data_->flag = (XmppRosterFlag*) _data_->_tmp20_;
	_data_->_tmp21_ = _data_->query_node;
	_data_->_tmp22_ = xmpp_stanza_node_get_subnode (_data_->_tmp21_, "item", XMPP_ROSTER_NS_URI, FALSE);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = xmpp_roster_item_new_from_stanza_node (_data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	_xmpp_stanza_entry_unref0 (_data_->_tmp23_);
	_data_->item = _data_->_tmp25_;
	_data_->_tmp26_ = _data_->item;
	_data_->_tmp27_ = xmpp_roster_item_get_subscription (_data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	_data_->_tmp31_ = 0U;
	_data_->_tmp29_ = _data_->_tmp28_;
	_data_->_tmp31_ = (NULL == _data_->_tmp29_) ? 0 : g_quark_from_string (_data_->_tmp29_);
	if (_data_->_tmp31_ == ((0 != _tmp30_label0) ? _tmp30_label0 : (_tmp30_label0 = g_quark_from_static_string (XMPP_ROSTER_ITEM_SUBSCRIPTION_REMOVE)))) {
		switch (0) {
			default:
			{
				_data_->_tmp32_ = _data_->flag;
				_data_->_tmp33_ = _data_->_tmp32_->roster_items;
				_data_->_tmp34_ = _data_->item;
				_data_->_tmp35_ = xmpp_roster_item_get_jid (_data_->_tmp34_);
				_data_->_tmp36_ = _data_->_tmp35_;
				gee_abstract_map_unset ((GeeAbstractMap*) _data_->_tmp33_, _data_->_tmp36_, NULL);
				_data_->_tmp37_ = _data_->item;
				g_signal_emit (_data_->self, xmpp_roster_module_signals[XMPP_ROSTER_MODULE_ITEM_REMOVED_SIGNAL], 0, _data_->stream, _data_->_tmp37_, _data_->iq);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				_data_->is_new = FALSE;
				_data_->_tmp38_ = _data_->flag;
				_data_->_tmp39_ = _data_->item;
				_data_->_tmp40_ = xmpp_roster_item_get_jid (_data_->_tmp39_);
				_data_->_tmp41_ = _data_->_tmp40_;
				_data_->_tmp42_ = xmpp_roster_flag_get_item (_data_->_tmp38_, _data_->_tmp41_);
				_data_->old = _data_->_tmp42_;
				_data_->_tmp44_ = _data_->item;
				_data_->_tmp45_ = xmpp_roster_item_get_subscription (_data_->_tmp44_);
				_data_->_tmp46_ = _data_->_tmp45_;
				if (g_strcmp0 (_data_->_tmp46_, XMPP_ROSTER_ITEM_SUBSCRIPTION_BOTH) == 0) {
					_data_->_tmp48_ = _data_->old;
					if (_data_->_tmp48_ == NULL) {
						_data_->_tmp47_ = TRUE;
					} else {
						_data_->_tmp49_ = _data_->old;
						_data_->_tmp50_ = xmpp_roster_item_get_subscription (_data_->_tmp49_);
						_data_->_tmp51_ = _data_->_tmp50_;
						_data_->_tmp47_ = g_strcmp0 (_data_->_tmp51_, XMPP_ROSTER_ITEM_SUBSCRIPTION_BOTH) == 0;
					}
					_data_->_tmp43_ = _data_->_tmp47_;
				} else {
					_data_->_tmp43_ = FALSE;
				}
				_data_->is_new = _data_->_tmp43_;
				_data_->_tmp52_ = _data_->flag;
				_data_->_tmp53_ = _data_->_tmp52_->roster_items;
				_data_->_tmp54_ = _data_->item;
				_data_->_tmp55_ = xmpp_roster_item_get_jid (_data_->_tmp54_);
				_data_->_tmp56_ = _data_->_tmp55_;
				_data_->_tmp57_ = _data_->item;
				gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp53_, _data_->_tmp56_, _data_->_tmp57_);
				_data_->_tmp58_ = _data_->item;
				g_signal_emit (_data_->self, xmpp_roster_module_signals[XMPP_ROSTER_MODULE_ITEM_UPDATED_SIGNAL], 0, _data_->stream, _data_->_tmp58_, _data_->iq);
				if (_data_->is_new) {
					_data_->_tmp59_ = _data_->item;
					_data_->_tmp60_ = xmpp_roster_item_get_jid (_data_->_tmp59_);
					_data_->_tmp61_ = _data_->_tmp60_;
					g_signal_emit (_data_->self, xmpp_roster_module_signals[XMPP_ROSTER_MODULE_MUTUAL_SUBSCRIPTION_SIGNAL], 0, _data_->stream, _data_->_tmp61_);
				}
				_xmpp_roster_item_unref0 (_data_->old);
				break;
			}
		}
	}
	_xmpp_roster_item_unref0 (_data_->item);
	_g_object_unref0 (_data_->flag);
	_xmpp_stanza_entry_unref0 (_data_->query_node);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_xmpp_roster_module_roster_get_xmpp_presence_module_initial_presence_sent (XmppPresenceModule* _sender,
                                                                           XmppXmppStream* stream,
                                                                           XmppPresenceStanza* presence,
                                                                           gpointer self)
{
	xmpp_roster_module_roster_get ((XmppRosterModule*) self, stream);
}

static void
xmpp_roster_module_real_attach (XmppXmppStreamModule* base,
                                XmppXmppStream* stream)
{
	XmppRosterModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppIqModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppPresenceModule* _tmp5_;
	XmppRosterFlag* _tmp6_;
	XmppRosterFlag* _tmp7_;
	self = (XmppRosterModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_iq_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppIqModule*) _tmp1_;
	xmpp_iq_module_register_for_namespace (_tmp2_, XMPP_ROSTER_NS_URI, (XmppIqHandler*) self);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_presence_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_PRESENCE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppPresenceModule*) _tmp4_;
	g_signal_connect_object (_tmp5_, "initial-presence-sent", (GCallback) _xmpp_roster_module_roster_get_xmpp_presence_module_initial_presence_sent, self, 0);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = xmpp_roster_flag_new ();
	_tmp7_ = _tmp6_;
	xmpp_xmpp_stream_add_flag (stream, (XmppXmppStreamFlag*) _tmp7_);
	_g_object_unref0 (_tmp7_);
}

static void
xmpp_roster_module_real_detach (XmppXmppStreamModule* base,
                                XmppXmppStream* stream)
{
	XmppRosterModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppPresenceModule* _tmp2_;
	guint _tmp3_;
	self = (XmppRosterModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_presence_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_PRESENCE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppPresenceModule*) _tmp1_;
	g_signal_parse_name ("initial-presence-sent", XMPP_PRESENCE_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_module_roster_get_xmpp_presence_module_initial_presence_sent, self);
	_g_object_unref0 (_tmp2_);
}

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

static gchar*
xmpp_roster_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppRosterModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppRosterModule*) base;
	_tmp0_ = xmpp_roster_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
_xmpp_roster_module_on_roster_get_received_xmpp_iq_module_on_result (XmppXmppStream* stream,
                                                                     XmppIqStanza* iq,
                                                                     gpointer self)
{
	xmpp_roster_module_on_roster_get_received (stream, iq);
}

static void
xmpp_roster_module_roster_get (XmppRosterModule* self,
                               XmppXmppStream* stream)
{
	XmppFlagIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppRosterFlag* _tmp2_;
	gchar* _tmp3_;
	XmppStanzaNode* query_node = NULL;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppIqStanza* iq = NULL;
	XmppFlagIdentity* _tmp8_;
	gpointer _tmp9_;
	XmppRosterFlag* _tmp10_;
	const gchar* _tmp11_;
	XmppIqStanza* _tmp12_;
	XmppIqStanza* _tmp13_;
	XmppModuleIdentity* _tmp14_;
	gpointer _tmp15_;
	XmppIqModule* _tmp16_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_roster_flag_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_flag (stream, XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppRosterFlag*) _tmp1_;
	_tmp3_ = xmpp_random_uuid ();
	_g_free0 (_tmp2_->iq_id);
	_tmp2_->iq_id = _tmp3_;
	_g_object_unref0 (_tmp2_);
	_tmp4_ = xmpp_stanza_node_new_build ("query", XMPP_ROSTER_NS_URI, NULL, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_stanza_node_add_self_xmlns (_tmp5_);
	_tmp7_ = _tmp6_;
	_xmpp_stanza_entry_unref0 (_tmp5_);
	query_node = _tmp7_;
	_tmp8_ = xmpp_roster_flag_IDENTITY;
	_tmp9_ = xmpp_xmpp_stream_get_flag (stream, XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp8_);
	_tmp10_ = (XmppRosterFlag*) _tmp9_;
	_tmp11_ = _tmp10_->iq_id;
	_tmp12_ = xmpp_iq_stanza_new_get (query_node, _tmp11_);
	_tmp13_ = _tmp12_;
	_g_object_unref0 (_tmp10_);
	iq = _tmp13_;
	g_signal_emit (self, xmpp_roster_module_signals[XMPP_ROSTER_MODULE_PRE_GET_ROSTER_SIGNAL], 0, stream, iq);
	_tmp14_ = xmpp_iq_module_IDENTITY;
	_tmp15_ = xmpp_xmpp_stream_get_module (stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp14_);
	_tmp16_ = (XmppIqModule*) _tmp15_;
	xmpp_iq_module_send_iq (_tmp16_, stream, iq, _xmpp_roster_module_on_roster_get_received_xmpp_iq_module_on_result, NULL, NULL, G_PRIORITY_DEFAULT);
	_g_object_unref0 (_tmp16_);
	_g_object_unref0 (iq);
	_xmpp_stanza_entry_unref0 (query_node);
}

static void
xmpp_roster_module_on_roster_get_received (XmppXmppStream* stream,
                                           XmppIqStanza* iq)
{
	XmppRosterFlag* flag = NULL;
	XmppFlagIdentity* _tmp0_;
	gpointer _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	XmppRosterFlag* _tmp4_;
	const gchar* _tmp5_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (iq != NULL);
	_tmp0_ = xmpp_roster_flag_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_flag (stream, XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	flag = (XmppRosterFlag*) _tmp1_;
	_tmp2_ = xmpp_stanza_get_id ((XmppStanza*) iq);
	_tmp3_ = _tmp2_;
	_tmp4_ = flag;
	_tmp5_ = _tmp4_->iq_id;
	if (g_strcmp0 (_tmp3_, _tmp5_) == 0) {
		XmppStanzaNode* query_node = NULL;
		XmppStanzaNode* _tmp6_;
		XmppStanzaNode* _tmp7_;
		XmppStanzaNode* _tmp8_;
		XmppModuleIdentity* _tmp26_;
		gpointer _tmp27_;
		XmppRosterModule* _tmp28_;
		XmppRosterFlag* _tmp29_;
		GeeHashMap* _tmp30_;
		GeeCollection* _tmp31_;
		GeeCollection* _tmp32_;
		GeeCollection* _tmp33_;
		_tmp6_ = ((XmppStanza*) iq)->stanza;
		_tmp7_ = xmpp_stanza_node_get_subnode (_tmp6_, "query", XMPP_ROSTER_NS_URI, FALSE);
		query_node = _tmp7_;
		_tmp8_ = query_node;
		if (_tmp8_ != NULL) {
			{
				GeeList* _item_node_list = NULL;
				XmppStanzaNode* _tmp9_;
				GeeList* _tmp10_;
				gint _item_node_size = 0;
				GeeList* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				gint _item_node_index = 0;
				_tmp9_ = query_node;
				_tmp10_ = _tmp9_->sub_nodes;
				_item_node_list = _tmp10_;
				_tmp11_ = _item_node_list;
				_tmp12_ = gee_collection_get_size ((GeeCollection*) _tmp11_);
				_tmp13_ = _tmp12_;
				_item_node_size = _tmp13_;
				_item_node_index = -1;
				while (TRUE) {
					gint _tmp14_;
					gint _tmp15_;
					XmppStanzaNode* item_node = NULL;
					GeeList* _tmp16_;
					gpointer _tmp17_;
					XmppRosterItem* item = NULL;
					XmppStanzaNode* _tmp18_;
					XmppRosterItem* _tmp19_;
					XmppRosterFlag* _tmp20_;
					GeeHashMap* _tmp21_;
					XmppRosterItem* _tmp22_;
					XmppJid* _tmp23_;
					XmppJid* _tmp24_;
					XmppRosterItem* _tmp25_;
					_item_node_index = _item_node_index + 1;
					_tmp14_ = _item_node_index;
					_tmp15_ = _item_node_size;
					if (!(_tmp14_ < _tmp15_)) {
						break;
					}
					_tmp16_ = _item_node_list;
					_tmp17_ = gee_list_get (_tmp16_, _item_node_index);
					item_node = (XmppStanzaNode*) _tmp17_;
					_tmp18_ = item_node;
					_tmp19_ = xmpp_roster_item_new_from_stanza_node (_tmp18_);
					item = _tmp19_;
					_tmp20_ = flag;
					_tmp21_ = _tmp20_->roster_items;
					_tmp22_ = item;
					_tmp23_ = xmpp_roster_item_get_jid (_tmp22_);
					_tmp24_ = _tmp23_;
					_tmp25_ = item;
					gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, _tmp24_, _tmp25_);
					_xmpp_roster_item_unref0 (item);
					_xmpp_stanza_entry_unref0 (item_node);
				}
			}
		}
		_tmp26_ = xmpp_roster_module_IDENTITY;
		_tmp27_ = xmpp_xmpp_stream_get_module (stream, XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp26_);
		_tmp28_ = (XmppRosterModule*) _tmp27_;
		_tmp29_ = flag;
		_tmp30_ = _tmp29_->roster_items;
		_tmp31_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = _tmp32_;
		g_signal_emit (_tmp28_, xmpp_roster_module_signals[XMPP_ROSTER_MODULE_RECEIVED_ROSTER_SIGNAL], 0, stream, _tmp33_, iq);
		_g_object_unref0 (_tmp33_);
		_g_object_unref0 (_tmp28_);
		_xmpp_stanza_entry_unref0 (query_node);
	}
	_g_object_unref0 (flag);
}

static void
xmpp_roster_module_roster_set (XmppRosterModule* self,
                               XmppXmppStream* stream,
                               XmppRosterItem* roster_item)
{
	XmppStanzaNode* query_node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	XmppStanzaNode* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppIqStanza* iq = NULL;
	XmppIqStanza* _tmp7_;
	XmppModuleIdentity* _tmp8_;
	gpointer _tmp9_;
	XmppIqModule* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (roster_item != NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("query", XMPP_ROSTER_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = roster_item->stanza_node;
	_tmp5_ = xmpp_stanza_node_put_node (_tmp3_, _tmp4_);
	_tmp6_ = _tmp5_;
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	query_node = _tmp6_;
	_tmp7_ = xmpp_iq_stanza_new_set (query_node, NULL);
	iq = _tmp7_;
	_tmp8_ = xmpp_iq_module_IDENTITY;
	_tmp9_ = xmpp_xmpp_stream_get_module (stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp8_);
	_tmp10_ = (XmppIqModule*) _tmp9_;
	xmpp_iq_module_send_iq (_tmp10_, stream, iq, NULL, NULL, NULL, G_PRIORITY_DEFAULT);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (iq);
	_xmpp_stanza_entry_unref0 (query_node);
}

XmppRosterModule*
xmpp_roster_module_construct (GType object_type)
{
	XmppRosterModule * self = NULL;
	self = (XmppRosterModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppRosterModule*
xmpp_roster_module_new (void)
{
	return xmpp_roster_module_construct (XMPP_ROSTER_TYPE_MODULE);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), g_value_get_object (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT (GClosure * closure,
                                                              GValue * return_value,
                                                              guint n_param_values,
                                                              const GValue * param_values,
                                                              gpointer invocation_hint,
                                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), xmpp_roster_value_get_item (param_values + 2), g_value_get_object (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_XMPP_JID) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_XMPP_JID callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_XMPP_JID) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), xmpp_value_get_jid (param_values + 2), data2);
}

static void
xmpp_roster_module_class_init (XmppRosterModuleClass * klass,
                               gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_roster_module_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_roster_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_roster_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_roster_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_roster_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_roster_module_finalize;
	xmpp_roster_module_signals[XMPP_ROSTER_MODULE_RECEIVED_ROSTER_SIGNAL] = g_signal_new ("received-roster", XMPP_ROSTER_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT, G_TYPE_NONE, 3, XMPP_TYPE_XMPP_STREAM, GEE_TYPE_COLLECTION, XMPP_IQ_TYPE_STANZA);
	xmpp_roster_module_signals[XMPP_ROSTER_MODULE_PRE_GET_ROSTER_SIGNAL] = g_signal_new ("pre-get-roster", XMPP_ROSTER_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_IQ_TYPE_STANZA);
	xmpp_roster_module_signals[XMPP_ROSTER_MODULE_ITEM_REMOVED_SIGNAL] = g_signal_new ("item-removed", XMPP_ROSTER_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT, G_TYPE_NONE, 3, XMPP_TYPE_XMPP_STREAM, XMPP_ROSTER_TYPE_ITEM, XMPP_IQ_TYPE_STANZA);
	xmpp_roster_module_signals[XMPP_ROSTER_MODULE_ITEM_UPDATED_SIGNAL] = g_signal_new ("item-updated", XMPP_ROSTER_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_ROSTER_ITEM_OBJECT, G_TYPE_NONE, 3, XMPP_TYPE_XMPP_STREAM, XMPP_ROSTER_TYPE_ITEM, XMPP_IQ_TYPE_STANZA);
	xmpp_roster_module_signals[XMPP_ROSTER_MODULE_MUTUAL_SUBSCRIPTION_SIGNAL] = g_signal_new ("mutual-subscription", XMPP_ROSTER_TYPE_MODULE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_XMPP_JID, G_TYPE_NONE, 2, XMPP_TYPE_XMPP_STREAM, XMPP_TYPE_JID);
	_tmp0_ = xmpp_module_identity_new (XMPP_ROSTER_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_ROSTER_NS_URI, "roster_module");
	xmpp_roster_module_IDENTITY = _tmp0_;
}

static void
xmpp_roster_module_xmpp_iq_handler_interface_init (XmppIqHandlerIface * iface,
                                                   gpointer iface_data)
{
	xmpp_roster_module_xmpp_iq_handler_parent_iface = g_type_interface_peek_parent (iface);
	iface->on_iq_set = (void (*) (XmppIqHandler*, XmppXmppStream*, XmppIqStanza*, GAsyncReadyCallback, gpointer)) xmpp_roster_module_real_on_iq_set;
	iface->on_iq_set_finish = (void (*) (XmppIqHandler*, GAsyncResult*)) xmpp_roster_module_on_iq_set_finish;
}

static void
xmpp_roster_module_instance_init (XmppRosterModule * self,
                                  gpointer klass)
{
	self->interested_resource = TRUE;
}

static void
xmpp_roster_module_finalize (GObject * obj)
{
	XmppRosterModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_ROSTER_TYPE_MODULE, XmppRosterModule);
	G_OBJECT_CLASS (xmpp_roster_module_parent_class)->finalize (obj);
}

static GType
xmpp_roster_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppRosterModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_roster_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppRosterModule), 0, (GInstanceInitFunc) xmpp_roster_module_instance_init, NULL };
	static const GInterfaceInfo xmpp_iq_handler_info = { (GInterfaceInitFunc) xmpp_roster_module_xmpp_iq_handler_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType xmpp_roster_module_type_id;
	xmpp_roster_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppRosterModule", &g_define_type_info, 0);
	g_type_add_interface_static (xmpp_roster_module_type_id, XMPP_IQ_TYPE_HANDLER, &xmpp_iq_handler_info);
	return xmpp_roster_module_type_id;
}

GType
xmpp_roster_module_get_type (void)
{
	static volatile gsize xmpp_roster_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_roster_module_type_id__once)) {
		GType xmpp_roster_module_type_id;
		xmpp_roster_module_type_id = xmpp_roster_module_get_type_once ();
		g_once_init_leave (&xmpp_roster_module_type_id__once, xmpp_roster_module_type_id);
	}
	return xmpp_roster_module_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;
}

