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

#include "xmpp-vala.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <glib-object.h>
#include <stdio.h>
#include <gobject/gvaluecollector.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

#define XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC (xmpp_xmpp_log_node_log_desc_get_type ())
#define XMPP_XMPP_LOG_NODE_LOG_DESC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, XmppXmppLogNodeLogDesc))
#define XMPP_XMPP_LOG_NODE_LOG_DESC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, XmppXmppLogNodeLogDescClass))
#define XMPP_XMPP_LOG_IS_NODE_LOG_DESC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC))
#define XMPP_XMPP_LOG_IS_NODE_LOG_DESC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC))
#define XMPP_XMPP_LOG_NODE_LOG_DESC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, XmppXmppLogNodeLogDescClass))

typedef struct _XmppXmppLogNodeLogDesc XmppXmppLogNodeLogDesc;
typedef struct _XmppXmppLogNodeLogDescClass XmppXmppLogNodeLogDescClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_xmpp_log_node_log_desc_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xmpp_log_node_log_desc_unref (var), NULL)))
typedef struct _XmppXmppLogNodeLogDescPrivate XmppXmppLogNodeLogDescPrivate;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppXmppLogParamSpecNodeLogDesc XmppXmppLogParamSpecNodeLogDesc;
typedef struct _XmppParamSpecXmppLog XmppParamSpecXmppLog;

struct _XmppXmppLogPrivate {
	gboolean use_ansi;
	gboolean hide_ns;
	gchar* ident;
	gchar* desc;
	GeeList* descs;
};

struct _XmppXmppLogNodeLogDesc {
	GTypeInstance parent_instance;
	volatile int ref_count;
	XmppXmppLogNodeLogDescPrivate * priv;
	gchar* name;
};

struct _XmppXmppLogNodeLogDescClass {
	GTypeClass parent_class;
	void (*finalize) (XmppXmppLogNodeLogDesc *self);
};

struct _XmppXmppLogNodeLogDescPrivate {
	gchar* ns_uri;
	gchar* val;
	GeeMap* attrs;
	XmppXmppLogNodeLogDesc* inner;
};

struct _XmppXmppLogParamSpecNodeLogDesc {
	GParamSpec parent_instance;
};

struct _XmppParamSpecXmppLog {
	GParamSpec parent_instance;
};

static gint XmppXmppLog_private_offset;
static gpointer xmpp_xmpp_log_parent_class = NULL;
static gint XmppXmppLogNodeLogDesc_private_offset;
static gpointer xmpp_xmpp_log_node_log_desc_parent_class = NULL;

static gpointer xmpp_xmpp_log_node_log_desc_ref (gpointer instance);
static void xmpp_xmpp_log_node_log_desc_unref (gpointer instance);
static GParamSpec* xmpp_xmpp_log_param_spec_node_log_desc (const gchar* name,
                                                    const gchar* nick,
                                                    const gchar* blurb,
                                                    GType object_type,
                                                    GParamFlags flags) G_GNUC_UNUSED ;
static void xmpp_xmpp_log_value_set_node_log_desc (GValue* value,
                                            gpointer v_object) G_GNUC_UNUSED ;
static void xmpp_xmpp_log_value_take_node_log_desc (GValue* value,
                                             gpointer v_object) G_GNUC_UNUSED ;
static gpointer xmpp_xmpp_log_value_get_node_log_desc (const GValue* value) G_GNUC_UNUSED ;
static GType xmpp_xmpp_log_node_log_desc_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
gboolean isatty (gint fd);
static XmppXmppLogNodeLogDesc* xmpp_xmpp_log_node_log_desc_new (const gchar* desc);
static XmppXmppLogNodeLogDesc* xmpp_xmpp_log_node_log_desc_construct (GType object_type,
                                                               const gchar* desc);
static gboolean xmpp_xmpp_log_real_should_log_node (XmppXmppLog* self,
                                             XmppStanzaNode* node);
static gboolean xmpp_xmpp_log_node_log_desc_matches (XmppXmppLogNodeLogDesc* self,
                                              XmppStanzaNode* node);
static gboolean xmpp_xmpp_log_real_should_log_str (XmppXmppLog* self,
                                            const gchar* str);
static void xmpp_xmpp_log_node_log_desc_finalize (XmppXmppLogNodeLogDesc * obj);
static GType xmpp_xmpp_log_node_log_desc_get_type_once (void);
static void xmpp_xmpp_log_finalize (XmppXmppLog * obj);
static GType xmpp_xmpp_log_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xmpp_log_get_instance_private (XmppXmppLog* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXmppLog_private_offset);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

XmppXmppLog*
xmpp_xmpp_log_construct (GType object_type,
                         const gchar* ident,
                         const gchar* desc)
{
	XmppXmppLog* self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_;
	FILE* _tmp4_;
	self = (XmppXmppLog*) g_type_create_instance (object_type);
	_tmp0_ = ident;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->ident);
	self->priv->ident = _tmp1_;
	_tmp2_ = desc;
	if (_tmp2_ == NULL) {
		_tmp2_ = "";
	}
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->desc);
	self->priv->desc = _tmp3_;
	_tmp4_ = stderr;
	self->priv->use_ansi = isatty (fileno (_tmp4_));
	while (TRUE) {
		const gchar* _tmp5_;
		gchar* opt = NULL;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		GQuark _tmp17_ = 0U;
		static GQuark _tmp16_label0 = 0;
		static GQuark _tmp16_label1 = 0;
		static GQuark _tmp16_label2 = 0;
		static GQuark _tmp16_label3 = 0;
		_tmp5_ = self->priv->desc;
		if (!string_contains (_tmp5_, ";")) {
			break;
		}
		_tmp6_ = self->priv->desc;
		_tmp7_ = self->priv->desc;
		_tmp8_ = string_substring (_tmp6_, (glong) 0, (glong) string_index_of (_tmp7_, ";", 0));
		opt = _tmp8_;
		_tmp9_ = self->priv->desc;
		_tmp10_ = opt;
		_tmp11_ = strlen (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = string_substring (_tmp9_, (glong) (_tmp12_ + 1), (glong) -1);
		_g_free0 (self->priv->desc);
		self->priv->desc = _tmp13_;
		_tmp14_ = opt;
		_tmp15_ = _tmp14_;
		_tmp17_ = (NULL == _tmp15_) ? 0 : g_quark_from_string (_tmp15_);
		if (_tmp17_ == ((0 != _tmp16_label0) ? _tmp16_label0 : (_tmp16_label0 = g_quark_from_static_string ("ansi")))) {
			switch (0) {
				default:
				{
					self->priv->use_ansi = TRUE;
					break;
				}
			}
		} else if (_tmp17_ == ((0 != _tmp16_label1) ? _tmp16_label1 : (_tmp16_label1 = g_quark_from_static_string ("no-ansi")))) {
			switch (0) {
				default:
				{
					self->priv->use_ansi = FALSE;
					break;
				}
			}
		} else if (_tmp17_ == ((0 != _tmp16_label2) ? _tmp16_label2 : (_tmp16_label2 = g_quark_from_static_string ("hide-ns")))) {
			switch (0) {
				default:
				{
					self->priv->hide_ns = TRUE;
					break;
				}
			}
		} else if (_tmp17_ == ((0 != _tmp16_label3) ? _tmp16_label3 : (_tmp16_label3 = g_quark_from_static_string ("show-ns")))) {
			switch (0) {
				default:
				{
					self->priv->hide_ns = FALSE;
					break;
				}
			}
		}
		_g_free0 (opt);
	}
	if (g_strcmp0 (desc, "") != 0) {
		const gchar* _tmp18_;
		gchar** _tmp19_;
		gchar** _tmp20_;
		_tmp18_ = self->priv->desc;
		_tmp20_ = _tmp19_ = g_strsplit (_tmp18_, "|", 0);
		{
			gchar** d_collection = NULL;
			gint d_collection_length1 = 0;
			gint _d_collection_size_ = 0;
			gint d_it = 0;
			d_collection = _tmp20_;
			d_collection_length1 = _vala_array_length (_tmp19_);
			for (d_it = 0; d_it < d_collection_length1; d_it = d_it + 1) {
				gchar* _tmp21_;
				gchar* d = NULL;
				_tmp21_ = g_strdup (d_collection[d_it]);
				d = _tmp21_;
				{
					GeeList* _tmp22_;
					const gchar* _tmp23_;
					XmppXmppLogNodeLogDesc* _tmp24_;
					XmppXmppLogNodeLogDesc* _tmp25_;
					_tmp22_ = self->priv->descs;
					_tmp23_ = d;
					_tmp24_ = xmpp_xmpp_log_node_log_desc_new (_tmp23_);
					_tmp25_ = _tmp24_;
					gee_collection_add ((GeeCollection*) _tmp22_, _tmp25_);
					_xmpp_xmpp_log_node_log_desc_unref0 (_tmp25_);
					_g_free0 (d);
				}
			}
			d_collection = (_vala_array_free (d_collection, d_collection_length1, (GDestroyNotify) g_free), NULL);
		}
	}
	return self;
}

XmppXmppLog*
xmpp_xmpp_log_new (const gchar* ident,
                   const gchar* desc)
{
	return xmpp_xmpp_log_construct (XMPP_TYPE_XMPP_LOG, ident, desc);
}

static gboolean
xmpp_xmpp_log_real_should_log_node (XmppXmppLog* self,
                                    XmppStanzaNode* node)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp3_;
	gboolean result;
	g_return_val_if_fail (node != NULL, FALSE);
	_tmp1_ = self->priv->ident;
	if (g_strcmp0 (_tmp1_, "") == 0) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->desc;
		_tmp0_ = g_strcmp0 (_tmp2_, "") == 0;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp3_ = self->priv->desc;
	if (g_strcmp0 (_tmp3_, "all") == 0) {
		result = TRUE;
		return result;
	}
	{
		GeeList* _desc_list = NULL;
		GeeList* _tmp4_;
		gint _desc_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _desc_index = 0;
		_tmp4_ = self->priv->descs;
		_desc_list = _tmp4_;
		_tmp5_ = _desc_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_desc_size = _tmp7_;
		_desc_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			XmppXmppLogNodeLogDesc* desc = NULL;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			XmppXmppLogNodeLogDesc* _tmp12_;
			_desc_index = _desc_index + 1;
			_tmp8_ = _desc_index;
			_tmp9_ = _desc_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _desc_list;
			_tmp11_ = gee_list_get (_tmp10_, _desc_index);
			desc = (XmppXmppLogNodeLogDesc*) _tmp11_;
			_tmp12_ = desc;
			if (xmpp_xmpp_log_node_log_desc_matches (_tmp12_, node)) {
				result = TRUE;
				_xmpp_xmpp_log_node_log_desc_unref0 (desc);
				return result;
			}
			_xmpp_xmpp_log_node_log_desc_unref0 (desc);
		}
	}
	result = FALSE;
	return result;
}

gboolean
xmpp_xmpp_log_should_log_node (XmppXmppLog* self,
                               XmppStanzaNode* node)
{
	XmppXmppLogClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = XMPP_XMPP_LOG_GET_CLASS (self);
	if (_klass_->should_log_node) {
		return _klass_->should_log_node (self, node);
	}
	return FALSE;
}

static gboolean
xmpp_xmpp_log_real_should_log_str (XmppXmppLog* self,
                                   const gchar* str)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp3_;
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	_tmp1_ = self->priv->ident;
	if (g_strcmp0 (_tmp1_, "") == 0) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->desc;
		_tmp0_ = g_strcmp0 (_tmp2_, "") == 0;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp3_ = self->priv->desc;
	if (g_strcmp0 (_tmp3_, "all") == 0) {
		result = TRUE;
		return result;
	}
	{
		GeeList* _desc_list = NULL;
		GeeList* _tmp4_;
		gint _desc_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _desc_index = 0;
		_tmp4_ = self->priv->descs;
		_desc_list = _tmp4_;
		_tmp5_ = _desc_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_desc_size = _tmp7_;
		_desc_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			XmppXmppLogNodeLogDesc* desc = NULL;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			XmppXmppLogNodeLogDesc* _tmp12_;
			const gchar* _tmp13_;
			_desc_index = _desc_index + 1;
			_tmp8_ = _desc_index;
			_tmp9_ = _desc_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _desc_list;
			_tmp11_ = gee_list_get (_tmp10_, _desc_index);
			desc = (XmppXmppLogNodeLogDesc*) _tmp11_;
			_tmp12_ = desc;
			_tmp13_ = _tmp12_->name;
			if (g_strcmp0 (_tmp13_, "#text") == 0) {
				result = TRUE;
				_xmpp_xmpp_log_node_log_desc_unref0 (desc);
				return result;
			}
			_xmpp_xmpp_log_node_log_desc_unref0 (desc);
		}
	}
	result = FALSE;
	return result;
}

gboolean
xmpp_xmpp_log_should_log_str (XmppXmppLog* self,
                              const gchar* str)
{
	XmppXmppLogClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = XMPP_XMPP_LOG_GET_CLASS (self);
	if (_klass_->should_log_str) {
		return _klass_->should_log_str (self, str);
	}
	return FALSE;
}

static gchar*
g_date_time_to_string (GDateTime* self)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_format (self, "%FT%H:%M:%S%z");
	result = _tmp0_;
	return result;
}

void
xmpp_xmpp_log_node (XmppXmppLog* self,
                    const gchar* what,
                    XmppStanzaNode* node,
                    XmppXmppStream* stream)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (what != NULL);
	g_return_if_fail (node != NULL);
	g_return_if_fail (stream != NULL);
	if (xmpp_xmpp_log_should_log_node (self, node)) {
		const gchar* _tmp0_ = NULL;
		const gchar* _tmp1_ = NULL;
		gchar* _tmp2_ = NULL;
		FILE* _tmp5_;
		const gchar* _tmp6_;
		GThread* _tmp7_;
		GDateTime* _tmp8_;
		GDateTime* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		if (self->priv->use_ansi) {
			_tmp0_ = XMPP_XMPP_LOG_ANSI_COLOR_WHITE;
		} else {
			_tmp0_ = "";
		}
		if (self->priv->use_ansi) {
			_tmp1_ = XMPP_XMPP_LOG_ANSI_COLOR_END;
		} else {
			_tmp1_ = "";
		}
		if (self->priv->use_ansi) {
			gchar* _tmp3_;
			_tmp3_ = xmpp_stanza_node_to_ansi_string (node, self->priv->hide_ns, 0);
			_g_free0 (_tmp2_);
			_tmp2_ = _tmp3_;
		} else {
			gchar* _tmp4_;
			_tmp4_ = xmpp_stanza_entry_to_string ((XmppStanzaEntry*) node, 0);
			_g_free0 (_tmp2_);
			_tmp2_ = _tmp4_;
		}
		_tmp5_ = stderr;
		_tmp6_ = self->priv->ident;
		_tmp7_ = g_thread_self ();
		_tmp8_ = g_date_time_new_now_local ();
		_tmp9_ = _tmp8_;
		_tmp10_ = g_date_time_to_string (_tmp9_);
		_tmp11_ = _tmp10_;
		fprintf (_tmp5_, "%sXMPP %s [%s stream:%p thread:%p %s]%s\n%s\n", _tmp0_, what, _tmp6_, stream, _tmp7_, _tmp11_, _tmp1_, _tmp2_);
		_g_free0 (_tmp11_);
		_g_date_time_unref0 (_tmp9_);
		_g_free0 (_tmp2_);
	}
}

void
xmpp_xmpp_log_str (XmppXmppLog* self,
                   const gchar* what,
                   const gchar* str,
                   XmppXmppStream* stream)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (what != NULL);
	g_return_if_fail (str != NULL);
	g_return_if_fail (stream != NULL);
	if (xmpp_xmpp_log_should_log_str (self, str)) {
		const gchar* _tmp0_ = NULL;
		const gchar* _tmp1_ = NULL;
		FILE* _tmp2_;
		const gchar* _tmp3_;
		GThread* _tmp4_;
		GDateTime* _tmp5_;
		GDateTime* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		if (self->priv->use_ansi) {
			_tmp0_ = XMPP_XMPP_LOG_ANSI_COLOR_WHITE;
		} else {
			_tmp0_ = "";
		}
		if (self->priv->use_ansi) {
			_tmp1_ = XMPP_XMPP_LOG_ANSI_COLOR_END;
		} else {
			_tmp1_ = "";
		}
		_tmp2_ = stderr;
		_tmp3_ = self->priv->ident;
		_tmp4_ = g_thread_self ();
		_tmp5_ = g_date_time_new_now_local ();
		_tmp6_ = _tmp5_;
		_tmp7_ = g_date_time_to_string (_tmp6_);
		_tmp8_ = _tmp7_;
		fprintf (_tmp2_, "%sXMPP %s [%s stream:%p thread:%p %s]%s\n%s\n", _tmp0_, what, _tmp3_, stream, _tmp4_, _tmp8_, _tmp1_, str);
		_g_free0 (_tmp8_);
		_g_date_time_unref0 (_tmp6_);
	}
}

static inline gpointer
xmpp_xmpp_log_node_log_desc_get_instance_private (XmppXmppLogNodeLogDesc* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXmppLogNodeLogDesc_private_offset);
}

static XmppXmppLogNodeLogDesc*
xmpp_xmpp_log_node_log_desc_construct (GType object_type,
                                       const gchar* desc)
{
	XmppXmppLogNodeLogDesc* self = NULL;
	gchar* d = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean _tmp29_ = FALSE;
	gboolean _tmp30_ = FALSE;
	const gchar* _tmp31_;
	const gchar* _tmp39_;
	const gchar* _tmp55_;
	g_return_val_if_fail (desc != NULL, NULL);
	self = (XmppXmppLogNodeLogDesc*) g_type_create_instance (object_type);
	_tmp0_ = g_strdup (desc);
	d = _tmp0_;
	_tmp1_ = d;
	if (string_contains (_tmp1_, "[")) {
		gint start = 0;
		const gchar* _tmp2_;
		gint end = 0;
		const gchar* _tmp3_;
		gchar* attrs = NULL;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar** _tmp14_;
		gchar** _tmp15_;
		_tmp2_ = d;
		start = string_index_of (_tmp2_, "[", 0);
		_tmp3_ = d;
		end = string_index_of (_tmp3_, "]", 0);
		_tmp4_ = d;
		_tmp5_ = string_substring (_tmp4_, (glong) (start + 1), (glong) ((end - start) - 1));
		attrs = _tmp5_;
		_tmp6_ = d;
		_tmp7_ = string_substring (_tmp6_, (glong) 0, (glong) start);
		_tmp8_ = _tmp7_;
		_tmp9_ = d;
		_tmp10_ = string_substring (_tmp9_, (glong) (end + 1), (glong) -1);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strconcat (_tmp8_, _tmp11_, NULL);
		_g_free0 (d);
		d = _tmp12_;
		_g_free0 (_tmp11_);
		_g_free0 (_tmp8_);
		_tmp13_ = attrs;
		_tmp15_ = _tmp14_ = g_strsplit (_tmp13_, ",", 0);
		{
			gchar** attr_collection = NULL;
			gint attr_collection_length1 = 0;
			gint _attr_collection_size_ = 0;
			gint attr_it = 0;
			attr_collection = _tmp15_;
			attr_collection_length1 = _vala_array_length (_tmp14_);
			for (attr_it = 0; attr_it < attr_collection_length1; attr_it = attr_it + 1) {
				gchar* _tmp16_;
				gchar* attr = NULL;
				_tmp16_ = g_strdup (attr_collection[attr_it]);
				attr = _tmp16_;
				{
					const gchar* _tmp17_;
					_tmp17_ = attr;
					if (string_contains (_tmp17_, "=")) {
						gchar* key = NULL;
						const gchar* _tmp18_;
						const gchar* _tmp19_;
						gchar* _tmp20_;
						gchar* val = NULL;
						const gchar* _tmp21_;
						const gchar* _tmp22_;
						gchar* _tmp23_;
						GeeMap* _tmp24_;
						const gchar* _tmp25_;
						const gchar* _tmp26_;
						_tmp18_ = attr;
						_tmp19_ = attr;
						_tmp20_ = string_substring (_tmp18_, (glong) 0, (glong) string_index_of (_tmp19_, "=", 0));
						key = _tmp20_;
						_tmp21_ = attr;
						_tmp22_ = attr;
						_tmp23_ = string_substring (_tmp21_, (glong) (string_index_of (_tmp22_, "=", 0) + 1), (glong) -1);
						val = _tmp23_;
						_tmp24_ = self->priv->attrs;
						_tmp25_ = key;
						_tmp26_ = val;
						gee_map_set (_tmp24_, _tmp25_, _tmp26_);
						_g_free0 (val);
						_g_free0 (key);
					} else {
						GeeMap* _tmp27_;
						const gchar* _tmp28_;
						_tmp27_ = self->priv->attrs;
						_tmp28_ = attr;
						gee_map_set (_tmp27_, _tmp28_, NULL);
					}
					_g_free0 (attr);
				}
			}
			attr_collection = (_vala_array_free (attr_collection, attr_collection_length1, (GDestroyNotify) g_free), NULL);
		}
		_g_free0 (attrs);
	}
	_tmp31_ = d;
	if (string_contains (_tmp31_, ":")) {
		const gchar* _tmp32_;
		_tmp32_ = d;
		_tmp30_ = string_index_of (_tmp32_, "{", 0) == 0;
	} else {
		_tmp30_ = FALSE;
	}
	if (_tmp30_) {
		const gchar* _tmp33_;
		_tmp33_ = d;
		_tmp29_ = string_index_of (_tmp33_, "}", 0) != -1;
	} else {
		_tmp29_ = FALSE;
	}
	if (_tmp29_) {
		gint end = 0;
		const gchar* _tmp34_;
		const gchar* _tmp35_;
		gchar* _tmp36_;
		const gchar* _tmp37_;
		gchar* _tmp38_;
		_tmp34_ = d;
		end = string_index_of (_tmp34_, "}", 0);
		_tmp35_ = d;
		_tmp36_ = string_substring (_tmp35_, (glong) 1, (glong) (end - 1));
		_g_free0 (self->priv->ns_uri);
		self->priv->ns_uri = _tmp36_;
		_tmp37_ = d;
		_tmp38_ = string_substring (_tmp37_, (glong) (end + 2), (glong) -1);
		_g_free0 (d);
		d = _tmp38_;
	}
	_tmp39_ = d;
	if (string_contains (_tmp39_, ".")) {
		const gchar* _tmp40_;
		const gchar* _tmp41_;
		gchar* _tmp42_;
		gchar* _tmp43_;
		XmppXmppLogNodeLogDesc* _tmp44_;
		const gchar* _tmp45_;
		const gchar* _tmp46_;
		gchar* _tmp47_;
		_tmp40_ = d;
		_tmp41_ = d;
		_tmp42_ = string_substring (_tmp40_, (glong) (string_index_of (_tmp41_, ".", 0) + 1), (glong) -1);
		_tmp43_ = _tmp42_;
		_tmp44_ = xmpp_xmpp_log_node_log_desc_new (_tmp43_);
		_xmpp_xmpp_log_node_log_desc_unref0 (self->priv->inner);
		self->priv->inner = _tmp44_;
		_g_free0 (_tmp43_);
		_tmp45_ = d;
		_tmp46_ = d;
		_tmp47_ = string_substring (_tmp45_, (glong) 0, (glong) string_index_of (_tmp46_, ".", 0));
		_g_free0 (d);
		d = _tmp47_;
	} else {
		const gchar* _tmp48_;
		_tmp48_ = d;
		if (string_contains (_tmp48_, "=")) {
			const gchar* _tmp49_;
			const gchar* _tmp50_;
			gchar* _tmp51_;
			const gchar* _tmp52_;
			const gchar* _tmp53_;
			gchar* _tmp54_;
			_tmp49_ = d;
			_tmp50_ = d;
			_tmp51_ = string_substring (_tmp49_, (glong) string_index_of (_tmp50_, "=", 0), (glong) -1);
			_g_free0 (self->priv->val);
			self->priv->val = _tmp51_;
			_tmp52_ = d;
			_tmp53_ = d;
			_tmp54_ = string_substring (_tmp52_, (glong) 0, (glong) string_index_of (_tmp53_, "=", 0));
			_g_free0 (d);
			d = _tmp54_;
		}
	}
	_tmp55_ = d;
	if (g_strcmp0 (_tmp55_, "") != 0) {
		const gchar* _tmp56_;
		gchar* _tmp57_;
		_tmp56_ = d;
		_tmp57_ = g_strdup (_tmp56_);
		_g_free0 (self->name);
		self->name = _tmp57_;
	}
	_g_free0 (d);
	return self;
}

static XmppXmppLogNodeLogDesc*
xmpp_xmpp_log_node_log_desc_new (const gchar* desc)
{
	return xmpp_xmpp_log_node_log_desc_construct (XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, desc);
}

static gboolean
xmpp_xmpp_log_node_log_desc_matches (XmppXmppLogNodeLogDesc* self,
                                     XmppStanzaNode* node)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_;
	XmppXmppLogNodeLogDesc* _tmp40_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (node != NULL, FALSE);
	_tmp1_ = self->name;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp2_ = ((XmppStanzaEntry*) node)->name;
		_tmp3_ = self->name;
		_tmp0_ = g_strcmp0 (_tmp2_, _tmp3_) != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp5_ = self->priv->ns_uri;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = ((XmppStanzaEntry*) node)->ns_uri;
		_tmp7_ = self->priv->ns_uri;
		_tmp4_ = g_strcmp0 (_tmp6_, _tmp7_) != 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		result = FALSE;
		return result;
	}
	_tmp9_ = self->priv->val;
	if (_tmp9_ != NULL) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = ((XmppStanzaEntry*) node)->val;
		_tmp11_ = self->priv->val;
		_tmp8_ = g_strcmp0 (_tmp10_, _tmp11_) != 0;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		result = FALSE;
		return result;
	}
	{
		GeeIterator* _pair_it = NULL;
		GeeMap* _tmp12_;
		GeeSet* _tmp13_;
		GeeSet* _tmp14_;
		GeeSet* _tmp15_;
		GeeIterator* _tmp16_;
		GeeIterator* _tmp17_;
		_tmp12_ = self->priv->attrs;
		_tmp13_ = gee_map_get_entries (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = _tmp14_;
		_tmp16_ = gee_iterable_iterator ((GeeIterable*) _tmp15_);
		_tmp17_ = _tmp16_;
		_g_object_unref0 (_tmp15_);
		_pair_it = _tmp17_;
		while (TRUE) {
			GeeIterator* _tmp18_;
			GeeMapEntry* pair = NULL;
			GeeIterator* _tmp19_;
			gpointer _tmp20_;
			gboolean _tmp21_ = FALSE;
			GeeMapEntry* _tmp22_;
			gconstpointer _tmp23_;
			gconstpointer _tmp24_;
			_tmp18_ = _pair_it;
			if (!gee_iterator_next (_tmp18_)) {
				break;
			}
			_tmp19_ = _pair_it;
			_tmp20_ = gee_iterator_get (_tmp19_);
			pair = (GeeMapEntry*) _tmp20_;
			_tmp22_ = pair;
			_tmp23_ = gee_map_entry_get_value (_tmp22_);
			_tmp24_ = _tmp23_;
			if (((const gchar*) _tmp24_) == NULL) {
				GeeMapEntry* _tmp25_;
				gconstpointer _tmp26_;
				gconstpointer _tmp27_;
				const gchar* _tmp28_;
				_tmp25_ = pair;
				_tmp26_ = gee_map_entry_get_key (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = xmpp_stanza_node_get_attribute (node, (const gchar*) _tmp27_, NULL);
				_tmp21_ = _tmp28_ == NULL;
			} else {
				_tmp21_ = FALSE;
			}
			if (_tmp21_) {
				result = FALSE;
				_g_object_unref0 (pair);
				_g_object_unref0 (_pair_it);
				return result;
			} else {
				gboolean _tmp29_ = FALSE;
				GeeMapEntry* _tmp30_;
				gconstpointer _tmp31_;
				gconstpointer _tmp32_;
				_tmp30_ = pair;
				_tmp31_ = gee_map_entry_get_value (_tmp30_);
				_tmp32_ = _tmp31_;
				if (((const gchar*) _tmp32_) != NULL) {
					GeeMapEntry* _tmp33_;
					gconstpointer _tmp34_;
					gconstpointer _tmp35_;
					GeeMapEntry* _tmp36_;
					gconstpointer _tmp37_;
					gconstpointer _tmp38_;
					const gchar* _tmp39_;
					_tmp33_ = pair;
					_tmp34_ = gee_map_entry_get_value (_tmp33_);
					_tmp35_ = _tmp34_;
					_tmp36_ = pair;
					_tmp37_ = gee_map_entry_get_key (_tmp36_);
					_tmp38_ = _tmp37_;
					_tmp39_ = xmpp_stanza_node_get_attribute (node, (const gchar*) _tmp38_, NULL);
					_tmp29_ = g_strcmp0 ((const gchar*) _tmp35_, _tmp39_) != 0;
				} else {
					_tmp29_ = FALSE;
				}
				if (_tmp29_) {
					result = FALSE;
					_g_object_unref0 (pair);
					_g_object_unref0 (_pair_it);
					return result;
				}
			}
			_g_object_unref0 (pair);
		}
		_g_object_unref0 (_pair_it);
	}
	_tmp40_ = self->priv->inner;
	if (_tmp40_ == NULL) {
		result = TRUE;
		return result;
	}
	{
		GeeList* _snode_list = NULL;
		GeeList* _tmp41_;
		gint _snode_size = 0;
		GeeList* _tmp42_;
		gint _tmp43_;
		gint _tmp44_;
		gint _snode_index = 0;
		_tmp41_ = xmpp_stanza_node_get_all_subnodes (node);
		_snode_list = _tmp41_;
		_tmp42_ = _snode_list;
		_tmp43_ = gee_collection_get_size ((GeeCollection*) _tmp42_);
		_tmp44_ = _tmp43_;
		_snode_size = _tmp44_;
		_snode_index = -1;
		while (TRUE) {
			gint _tmp45_;
			gint _tmp46_;
			XmppStanzaNode* snode = NULL;
			GeeList* _tmp47_;
			gpointer _tmp48_;
			XmppXmppLogNodeLogDesc* _tmp49_;
			XmppStanzaNode* _tmp50_;
			_snode_index = _snode_index + 1;
			_tmp45_ = _snode_index;
			_tmp46_ = _snode_size;
			if (!(_tmp45_ < _tmp46_)) {
				break;
			}
			_tmp47_ = _snode_list;
			_tmp48_ = gee_list_get (_tmp47_, _snode_index);
			snode = (XmppStanzaNode*) _tmp48_;
			_tmp49_ = self->priv->inner;
			_tmp50_ = snode;
			if (xmpp_xmpp_log_node_log_desc_matches (G_TYPE_CHECK_INSTANCE_CAST (_tmp49_, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, XmppXmppLogNodeLogDesc), _tmp50_)) {
				result = TRUE;
				_xmpp_stanza_entry_unref0 (snode);
				_g_object_unref0 (_snode_list);
				return result;
			}
			_xmpp_stanza_entry_unref0 (snode);
		}
		_g_object_unref0 (_snode_list);
	}
	result = FALSE;
	return result;
}

static void
xmpp_xmpp_log_value_node_log_desc_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xmpp_log_value_node_log_desc_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xmpp_log_node_log_desc_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xmpp_log_value_node_log_desc_copy_value (const GValue* src_value,
                                              GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xmpp_log_node_log_desc_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xmpp_log_value_node_log_desc_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xmpp_log_value_node_log_desc_collect_value (GValue* value,
                                                 guint n_collect_values,
                                                 GTypeCValue* collect_values,
                                                 guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXmppLogNodeLogDesc * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xmpp_log_node_log_desc_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xmpp_log_value_node_log_desc_lcopy_value (const GValue* value,
                                               guint n_collect_values,
                                               GTypeCValue* collect_values,
                                               guint collect_flags)
{
	XmppXmppLogNodeLogDesc ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xmpp_log_node_log_desc_ref (value->data[0].v_pointer);
	}
	return NULL;
}

static GParamSpec*
xmpp_xmpp_log_param_spec_node_log_desc (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags)
{
	XmppXmppLogParamSpecNodeLogDesc* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

static gpointer
xmpp_xmpp_log_value_get_node_log_desc (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC), NULL);
	return value->data[0].v_pointer;
}

static void
xmpp_xmpp_log_value_set_node_log_desc (GValue* value,
                                       gpointer v_object)
{
	XmppXmppLogNodeLogDesc * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xmpp_log_node_log_desc_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xmpp_log_node_log_desc_unref (old);
	}
}

static void
xmpp_xmpp_log_value_take_node_log_desc (GValue* value,
                                        gpointer v_object)
{
	XmppXmppLogNodeLogDesc * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xmpp_log_node_log_desc_unref (old);
	}
}

static void
xmpp_xmpp_log_node_log_desc_class_init (XmppXmppLogNodeLogDescClass * klass,
                                        gpointer klass_data)
{
	xmpp_xmpp_log_node_log_desc_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppLogNodeLogDescClass *) klass)->finalize = xmpp_xmpp_log_node_log_desc_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXmppLogNodeLogDesc_private_offset);
}

static void
xmpp_xmpp_log_node_log_desc_instance_init (XmppXmppLogNodeLogDesc * self,
                                           gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = xmpp_xmpp_log_node_log_desc_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->attrs = (GeeMap*) _tmp0_;
	self->ref_count = 1;
}

static void
xmpp_xmpp_log_node_log_desc_finalize (XmppXmppLogNodeLogDesc * obj)
{
	XmppXmppLogNodeLogDesc * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, XmppXmppLogNodeLogDesc);
	g_signal_handlers_destroy (self);
	_g_free0 (self->name);
	_g_free0 (self->priv->ns_uri);
	_g_free0 (self->priv->val);
	_g_object_unref0 (self->priv->attrs);
	_xmpp_xmpp_log_node_log_desc_unref0 (self->priv->inner);
}

static GType
xmpp_xmpp_log_node_log_desc_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xmpp_log_value_node_log_desc_init, xmpp_xmpp_log_value_node_log_desc_free_value, xmpp_xmpp_log_value_node_log_desc_copy_value, xmpp_xmpp_log_value_node_log_desc_peek_pointer, "p", xmpp_xmpp_log_value_node_log_desc_collect_value, "p", xmpp_xmpp_log_value_node_log_desc_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXmppLogNodeLogDescClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xmpp_log_node_log_desc_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXmppLogNodeLogDesc), 0, (GInstanceInitFunc) xmpp_xmpp_log_node_log_desc_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xmpp_log_node_log_desc_type_id;
	xmpp_xmpp_log_node_log_desc_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXmppLogNodeLogDesc", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXmppLogNodeLogDesc_private_offset = g_type_add_instance_private (xmpp_xmpp_log_node_log_desc_type_id, sizeof (XmppXmppLogNodeLogDescPrivate));
	return xmpp_xmpp_log_node_log_desc_type_id;
}

static GType
xmpp_xmpp_log_node_log_desc_get_type (void)
{
	static volatile gsize xmpp_xmpp_log_node_log_desc_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xmpp_log_node_log_desc_type_id__once)) {
		GType xmpp_xmpp_log_node_log_desc_type_id;
		xmpp_xmpp_log_node_log_desc_type_id = xmpp_xmpp_log_node_log_desc_get_type_once ();
		g_once_init_leave (&xmpp_xmpp_log_node_log_desc_type_id__once, xmpp_xmpp_log_node_log_desc_type_id);
	}
	return xmpp_xmpp_log_node_log_desc_type_id__once;
}

static gpointer
xmpp_xmpp_log_node_log_desc_ref (gpointer instance)
{
	XmppXmppLogNodeLogDesc * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
xmpp_xmpp_log_node_log_desc_unref (gpointer instance)
{
	XmppXmppLogNodeLogDesc * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XMPP_LOG_NODE_LOG_DESC_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
xmpp_value_xmpp_log_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_value_xmpp_log_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xmpp_log_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_value_xmpp_log_copy_value (const GValue* src_value,
                                GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xmpp_log_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_value_xmpp_log_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_value_xmpp_log_collect_value (GValue* value,
                                   guint n_collect_values,
                                   GTypeCValue* collect_values,
                                   guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXmppLog * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xmpp_log_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_value_xmpp_log_lcopy_value (const GValue* value,
                                 guint n_collect_values,
                                 GTypeCValue* collect_values,
                                 guint collect_flags)
{
	XmppXmppLog ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xmpp_log_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_param_spec_xmpp_log (const gchar* name,
                          const gchar* nick,
                          const gchar* blurb,
                          GType object_type,
                          GParamFlags flags)
{
	XmppParamSpecXmppLog* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_TYPE_XMPP_LOG), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_value_get_xmpp_log (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_XMPP_LOG), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_value_set_xmpp_log (GValue* value,
                         gpointer v_object)
{
	XmppXmppLog * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_XMPP_LOG));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_TYPE_XMPP_LOG));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xmpp_log_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xmpp_log_unref (old);
	}
}

void
xmpp_value_take_xmpp_log (GValue* value,
                          gpointer v_object)
{
	XmppXmppLog * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_XMPP_LOG));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_TYPE_XMPP_LOG));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xmpp_log_unref (old);
	}
}

static void
xmpp_xmpp_log_class_init (XmppXmppLogClass * klass,
                          gpointer klass_data)
{
	xmpp_xmpp_log_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppLogClass *) klass)->finalize = xmpp_xmpp_log_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXmppLog_private_offset);
	((XmppXmppLogClass *) klass)->should_log_node = (gboolean (*) (XmppXmppLog*, XmppStanzaNode*)) xmpp_xmpp_log_real_should_log_node;
	((XmppXmppLogClass *) klass)->should_log_str = (gboolean (*) (XmppXmppLog*, const gchar*)) xmpp_xmpp_log_real_should_log_str;
}

static void
xmpp_xmpp_log_instance_init (XmppXmppLog * self,
                             gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = xmpp_xmpp_log_get_instance_private (self);
	self->priv->hide_ns = TRUE;
	_tmp0_ = gee_array_list_new (XMPP_XMPP_LOG_TYPE_NODE_LOG_DESC, (GBoxedCopyFunc) xmpp_xmpp_log_node_log_desc_ref, (GDestroyNotify) xmpp_xmpp_log_node_log_desc_unref, NULL, NULL, NULL);
	self->priv->descs = (GeeList*) _tmp0_;
	self->ref_count = 1;
}

static void
xmpp_xmpp_log_finalize (XmppXmppLog * obj)
{
	XmppXmppLog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_TYPE_XMPP_LOG, XmppXmppLog);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->ident);
	_g_free0 (self->priv->desc);
	_g_object_unref0 (self->priv->descs);
}

static GType
xmpp_xmpp_log_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_value_xmpp_log_init, xmpp_value_xmpp_log_free_value, xmpp_value_xmpp_log_copy_value, xmpp_value_xmpp_log_peek_pointer, "p", xmpp_value_xmpp_log_collect_value, "p", xmpp_value_xmpp_log_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXmppLogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xmpp_log_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXmppLog), 0, (GInstanceInitFunc) xmpp_xmpp_log_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xmpp_log_type_id;
	xmpp_xmpp_log_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXmppLog", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXmppLog_private_offset = g_type_add_instance_private (xmpp_xmpp_log_type_id, sizeof (XmppXmppLogPrivate));
	return xmpp_xmpp_log_type_id;
}

GType
xmpp_xmpp_log_get_type (void)
{
	static volatile gsize xmpp_xmpp_log_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xmpp_log_type_id__once)) {
		GType xmpp_xmpp_log_type_id;
		xmpp_xmpp_log_type_id = xmpp_xmpp_log_get_type_once ();
		g_once_init_leave (&xmpp_xmpp_log_type_id__once, xmpp_xmpp_log_type_id);
	}
	return xmpp_xmpp_log_type_id__once;
}

gpointer
xmpp_xmpp_log_ref (gpointer instance)
{
	XmppXmppLog * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xmpp_log_unref (gpointer instance)
{
	XmppXmppLog * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XMPP_LOG_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

