cpw.nader.asynclogging-3: 3e7cad56: Removed the logger data property/getter/.

morshed.nader at gmail.com morshed.nader at gmail.com
Thu Jan 13 01:25:49 EST 2011


----------------------------------------------------------------------
Revision: 3e7cad56af326c87bc5402e955a65577347dd431
Parent:   c8ab97b3849dbd87e18bc4fd0aa5653d179bc615
Author:   morshed.nader at gmail.com
Date:     01/12/11 17:46:49
Branch:   im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/3e7cad56af326c87bc5402e955a65577347dd431

Changelog: 

Removed the logger data property/getter/setter from PurpleLog, now that we use PurpleCommonLog
Cleaned up log_reader more and got adium and msn compiling without errors, still more to go, though

Changes against parent c8ab97b3849dbd87e18bc4fd0aa5653d179bc615

  patched  libpurple/log.c
  patched  libpurple/log.h
  patched  libpurple/plugins/Makefile.mingw
  patched  libpurple/plugins/log_reader.c

-------------- next part --------------
============================================================
--- libpurple/log.c	50b511d8bfb743f8ceb7da59e2e0627b23c4bfa3
+++ libpurple/log.c	e26ceb2392532e8a56857213df6e387bc6c2f44e
@@ -62,7 +62,6 @@ enum {
 	PROP_LOG_ACCOUNT,
 	PROP_LOG_TIME,
 	PROP_LOG_CONV,
-	PROP_LOG_LOGGER_DATA,
 	PROP_LOG_TM,
 	LAST_PROP
 };
@@ -78,7 +77,6 @@ struct _PurpleLogPrivate {
 	PurpleAccount *account;       /**< The account this log is taking place on */
 	time_t time;                  /**< The time this conversation started, converted to the local timezone */
 	PurpleConversation *conv;     /**< The conversation being logged */
-	gpointer logger_data;         /**< Data used by the log logger */
 	struct tm *tm;                /**< The time this conversation started */
 };
 
@@ -334,14 +332,6 @@ purple_log_class_init(PurpleLogClass *cl
 //			PURPLE_TYPE_CONVERSATION,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE);
 
-	properties[PROP_LOG_LOGGER_DATA] =
-		//Ideally should be g_param_spec_object
-		g_param_spec_pointer("logger-data",
-			"Logger Data",
-			"Data used by loggers", //better description
-//			PURPLE_TYPE_CONVERSATION,
-			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE);
-
 	properties[PROP_LOG_TM] =
 		g_param_spec_boxed("tm",
 			"Time (tm)",
@@ -370,10 +360,6 @@ purple_log_class_init(PurpleLogClass *cl
 		properties[PROP_LOG_CONV]);
 
 	g_object_class_install_property(gobject_class,
-		PROP_LOG_LOGGER_DATA,
-		properties[PROP_LOG_LOGGER_DATA]);
-
-	g_object_class_install_property(gobject_class,
 		PROP_LOG_TM,
 		properties[PROP_LOG_TM]);
 
@@ -390,7 +376,6 @@ purple_log_init(PurpleLog *log)
 	priv->account = NULL;
 	priv->time = 0;
 	priv->conv = NULL;
-	priv->logger_data = NULL;
 	//These needed?
 	priv->tm = NULL;
 }
@@ -398,12 +383,9 @@ purple_log_set_property(GObject *object,
 static void
 purple_log_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
-	PurpleLog *log = PURPLE_LOG(object);
+	// PurpleLog *log = PURPLE_LOG(object);
 
 	switch (prop_id) {
-	case PROP_LOG_LOGGER_DATA:
-		purple_log_set_logger_data(log, g_value_get_pointer(value));
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
 		break;
@@ -433,9 +415,6 @@ purple_log_get_property(GObject *object,
 		//g_value_set_object
 		g_value_set_pointer(value, purple_log_get_conversation(log));
 		break;
-	case PROP_LOG_LOGGER_DATA:
-		g_value_set_pointer(value, purple_log_get_logger_data(log));
-		break;
 	case PROP_LOG_TM:
 		g_value_set_boxed(value, purple_log_get_tm(log));
 		break;
@@ -445,16 +424,6 @@ purple_log_get_property(GObject *object,
 	}
 }
 
-void
-purple_log_set_logger_data(PurpleLog *log, gpointer logger_data)
-{
-	g_return_if_fail(PURPLE_IS_LOG(log));
-
-	PURPLE_LOG_GET_PRIVATE(log)->logger_data = logger_data;
-
-	g_object_notify(G_OBJECT(log), "logger-data");
-}
-
 PurpleLogChatType
 purple_log_get_chat_type(const PurpleLog *log)
 {
@@ -495,14 +464,6 @@ purple_log_get_conversation(const Purple
 	return PURPLE_LOG_GET_PRIVATE(log)->conv;
 }
 
-gpointer
-purple_log_get_logger_data(const PurpleLog *log)
-{
-	g_return_val_if_fail(PURPLE_IS_LOG(log), NULL);
-
-	return PURPLE_LOG_GET_PRIVATE(log)->logger_data;
-}
-
 G_CONST_RETURN struct tm *
 purple_log_get_tm(const PurpleLog *log)
 {
============================================================
--- libpurple/log.h	7c23301992187dbcaad13ad078a54fae1b0507da
+++ libpurple/log.h	03673b32ba5145644f989fc6100eeb0bd0ad1fd9
@@ -259,8 +259,6 @@ PurpleConversation *purple_log_get_conve
 //
 PurpleConversation *purple_log_get_conversation(const PurpleLog *log);
 //
-gpointer purple_log_get_logger_data(const PurpleLog *log);
-//
 G_CONST_RETURN struct tm *purple_log_get_tm(const PurpleLog *log);
 //
 gchar *_log_get_timestamp(PurpleLog *log, time_t when);
============================================================
--- libpurple/plugins/log_reader.c	5d23fafd05fad811fd30da43fddb5fb92d2c2090
+++ libpurple/plugins/log_reader.c	359188c50cf002bc1a1fbd0b6378fbfaa2058a9e
@@ -13,7 +13,7 @@
 #include "xmlnode.h"
 
 /* This must be the last Purple header included. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 #include "win32dep.h"
 #endif
 
@@ -29,17 +29,18 @@ enum name_guesses {
 };
 
 /* Some common functions. */
-static int
-get_month(const char *month)
+static gint
+get_month(const gchar *month)
 {
-	int iter;
-	const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+	guint iter;
+	const gchar *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
 		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL};
-	for (iter = 0; months[iter]; iter++) {
+
+	for (iter = 0; months[iter] != NULL; iter++)
 		if (strcmp(month, months[iter]) == 0)
-			break;
-	}
-	return iter;
+			return iter;
+
+	return -1;
 }
 
 
@@ -85,51 +86,35 @@ struct _PurpleAdiumLogPrivate {
 	AdiumLogType type;
 };
 
-static void
-purple_adium_log_class_init(PurpleAdiumLogClass *class)
-{
-	GObjectClass *gobject_class = G_OBJECT_CLASS(class);
-	PurpleLogClass *log_class = PURPLE_LOG_CLASS(class);
-
-	log_class->logger_name = _("Adium");
-	log_class->logger_id = "adium";
-
-	g_type_class_add_private(gobject_class, sizeof(PurpleAdiumLogPrivate));
-}
-
-static void
-purple_adium_log_init(PurpleAdiumLog *adium_log)
-{
-}
-
 static GList *
-purple_adium_log_list(PurpleLogChatType chat_type, const char *sn, PurpleAccount *account)
+purple_adium_log_list(PurpleLog *log, PurpleLogChatType chat_type, const gchar *sn, PurpleAccount *account, GCancellable *cancellable, GError **error)
 {
-	GList *list = NULL;
-	const char *logdir;
 	PurplePlugin *plugin;
 	PurplePluginProtocolInfo *prpl_info;
-	char *prpl_name;
-	char *temp;
-	char *path;
 	GDir *dir;
+	GList *list = NULL;
+	const gchar *file, *logdir;
+	gchar *prpl_name, *temp, *path;
 
-	g_return_val_if_fail(sn != NULL, NULL);
-	g_return_val_if_fail(account != NULL, NULL);
-
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/adium/log_directory");
 
 	/* By clearing the log directory path, this logger can be (effectively) disabled. */
-	if (!logdir || !*logdir)
+	if (logdir == NULL || *logdir == 0) {
+		//error?
 		return NULL;
+	}
 
 	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
-	if (!plugin)
+
+	if (plugin == NULL) {
 		return NULL;
+	}
 
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin);
-	if (!prpl_info->list_icon)
+
+	if (prpl_info->list_icon == NULL) {
 		return NULL;
+	}
 
 	prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1);
 
@@ -137,137 +122,140 @@ purple_adium_log_list(PurpleLogChatType 
 	path = g_build_filename(logdir, temp, sn, NULL);
 	g_free(temp);
 
-	dir = g_dir_open(path, 0, NULL);
-	if (dir) {
-		const gchar *file;
+	dir = g_dir_open(path, 0, error);
 
-		while ((file = g_dir_read_name(dir))) {
-			if (!purple_str_has_prefix(file, sn))
-				continue;
-			if (purple_str_has_suffix(file, ".html") || purple_str_has_suffix(file, ".AdiumHTMLLog")) {
-				struct tm tm;
-				const char *date = file;
+	if (dir == NULL)
+		return NULL;
 
-				date += strlen(sn) + 2;
-				if (sscanf(date, "%u|%u|%u",
-						&tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) {
+	while ((file = g_dir_read_name(dir))) {
+		if (!purple_str_has_prefix(file, sn))
+			continue;
+		if (purple_str_has_suffix(file, ".html") || purple_str_has_suffix(file, ".AdiumHTMLLog")) {
+			struct tm tm;
+			const gchar *date = file;
 
-					purple_debug_error("Adium log parse",
-					                   "Filename timestamp parsing error\n");
-				} else {
-					char *filename = g_build_filename(path, file, NULL);
-					FILE *handle = g_fopen(filename, "rb");
-					char contents[57];   /* XXX: This is really inflexible. */
-					char *contents2;
-					struct purple_adium_log_data *data;
-					size_t rd;
-					PurpleLog *log;
+			date += strlen(sn) + 2;
+			if (sscanf(date, "%u|%u|%u",
+					&tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) {
 
-					if (!handle) {
-						g_free(filename);
-						continue;
-					}
+				purple_debug_error("Adium log parse",
+					"Filename timestamp parsing error\n");
+			} else {
+				PurpleAdiumLogPrivate *priv;
+				PurpleLog *log;
+				GFile *file;
+				gchar *filename = g_build_filename(path, file, NULL);
+				FILE *handle = g_fopen(filename, "rb");
+				gchar contents[57];   /* XXX: This is really inflexible. */
+				gchar *contents2;
+				size_t rd;
 
-					rd = fread(contents, 1, 56, handle) == 0;
-					fclose(handle);
-					contents[rd] = '\0';
+				if (!handle) {
+					g_free(filename);
+					continue;
+				}
 
-					/* XXX: This is fairly inflexible. */
-					contents2 = contents;
-					while (*contents2 && *contents2 != '>')
-						contents2++;
-					if (*contents2)
-						contents2++;
-					while (*contents2 && *contents2 != '>')
-						contents2++;
-					if (*contents2)
-						contents2++;
+				rd = fread(contents, 1, 56, handle) == 0;
+				fclose(handle);
+				contents[rd] = '\0';
 
-					if (sscanf(contents2, "%u.%u.%u",
-							&tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) {
+				/* XXX: This is fairly inflexible. */
+				contents2 = contents;
+				while (*contents2 && *contents2 != '>')
+					contents2++;
+				if (*contents2)
+					contents2++;
+				while (*contents2 && *contents2 != '>')
+					contents2++;
+				if (*contents2)
+					contents2++;
 
-						purple_debug_error("Adium log parse ",
-						                   "Contents timestamp parsing error\n");
-						g_free(filename);
-						continue;
-					}
+				if (sscanf(contents2, "%u.%u.%u",
+						&tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) {
 
-					data = g_new0(struct purple_adium_log_data, 1);
-					data->path = filename;
-					data->type = ADIUM_HTML;
+					purple_debug_error("Adium log parse",
+						"Contents timestamp parsing error\n");
+					g_free(filename);
+					continue;
+				}
 
-					tm.tm_year -= 1900;
-					tm.tm_mon  -= 1;
+				tm.tm_year -= 1900;
+				tm.tm_mon  -= 1;
 
-					/* XXX: Look into this later... Should we pass in a struct tm? */
-					log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL);
-					log->logger = purple_adium_log;
-					log->logger_data = data;
+				/* XXX: Look into this later... Should we pass in a struct tm? */
+				log = purple_common_log_new(PURPLE_TYPE_ADIUM_LOG, PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL);
+				file = g_file_new_for_path(filename);
+				purple_common_log_set_file(PURPLE_COMMON_LOG(log), file);
+				g_object_unref(file);
 
-					list = g_list_prepend(list, log);
-				}
-			} else if (purple_str_has_suffix(file, ".adiumLog")) {
-				struct tm tm;
-				const char *date = file;
+				priv = PURPLE_ADIUM_LOG_GET_PRIVATE(log);
+				priv->type = ADIUM_HTML;
 
-				date += strlen(sn) + 2;
-				if (sscanf(date, "%u|%u|%u",
-						&tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) {
+				list = g_list_prepend(list, log);
+			}
+		} else if (purple_str_has_suffix(file, ".adiumLog")) {
+			struct tm tm;
+			const gchar *date = file;
 
-					purple_debug_error("Adium log parse",
-					                   "Filename timestamp parsing error\n");
-				} else {
-					char *filename = g_build_filename(path, file, NULL);
-					FILE *handle = g_fopen(filename, "rb");
-					char contents[14];   /* XXX: This is really inflexible. */
-					char *contents2;
-					struct purple_adium_log_data *data;
-					PurpleLog *log;
-					size_t rd;
+			date += strlen(sn) + 2;
+			if (sscanf(date, "%u|%u|%u",
+					&tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) {
 
-					if (!handle) {
-						g_free(filename);
-						continue;
-					}
+				purple_debug_error("Adium log parse",
+								   "Filename timestamp parsing error\n");
+			} else {
+				PurpleAdiumLogPrivate *priv;
+				PurpleLog *log;
+				GFile *file;
+				gchar *filename = g_build_filename(path, file, NULL);
+				FILE *handle = g_fopen(filename, "rb");
+				gchar contents[14];   /* XXX: This is really inflexible. */
+				gchar *contents2;
+				size_t rd;
 
-					rd = fread(contents, 1, 13, handle);
-					fclose(handle);
-					contents[rd] = '\0';
+				if (!handle) {
+					g_free(filename);
+					continue;
+				}
 
-					contents2 = contents;
-					while (*contents2 && *contents2 != '(')
-						contents2++;
-					if (*contents2)
-						contents2++;
+				rd = fread(contents, 1, 13, handle);
+				fclose(handle);
+				contents[rd] = '\0';
 
-					if (sscanf(contents2, "%u.%u.%u",
-							&tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) {
+				contents2 = contents;
+				while (*contents2 && *contents2 != '(')
+					contents2++;
+				if (*contents2)
+					contents2++;
 
-						purple_debug_error("Adium log parse",
-						                   "Contents timestamp parsing error\n");
-						g_free(filename);
-						continue;
-					}
+				if (sscanf(contents2, "%u.%u.%u",
+						&tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) {
 
-					tm.tm_year -= 1900;
-					tm.tm_mon  -= 1;
+					purple_debug_error("Adium log parse",
+									   "Contents timestamp parsing error\n");
+					g_free(filename);
+					continue;
+				}
 
-					data = g_new0(struct purple_adium_log_data, 1);
-					data->path = filename;
-					data->type = ADIUM_TEXT;
+				tm.tm_year -= 1900;
+				tm.tm_mon  -= 1;
 
-					/* XXX: Look into this later... Should we pass in a struct tm? */
-					log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL);
-					log->logger = purple_adium_log;
-					log->logger_data = data;
+				/* XXX: Look into this later... Should we pass in a struct tm? */
+				log = purple_common_log_new(PURPLE_TYPE_ADIUM_LOG,
+					PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL);
+				file = g_file_new_for_path(filename);
+				purple_common_log_set_file(PURPLE_COMMON_LOG(log), file);
+				g_object_unref(file);
 
-					list = g_list_prepend(list, log);
-				}
+				priv = PURPLE_ADIUM_LOG_GET_PRIVATE(log);
+				priv->type = ADIUM_HTML;
+
+				list = g_list_prepend(list, log);
 			}
 		}
-		g_dir_close(dir);
 	}
 
+	g_dir_close(dir);
 	g_free(prpl_name);
 	g_free(path);
 
@@ -275,34 +263,33 @@ static gchar *
 }
 
 static gchar *
-purple_adium_log_read (PurpleLog *log, PurpleLogReadFlags *flags)
+purple_adium_log_read(PurpleLog *log, PurpleLogReadFlags *flags, GCancellable *cancellable, GError **error)
 {
-	PurpleAdiumLogPrivate *priv = PURPLE_ADIUM_LOG_GET_PRIVATE(adium_log);
-	GError *error = NULL;
-	gchar *read = NULL;
+	PurpleAdiumLogPrivate *priv = PURPLE_ADIUM_LOG_GET_PRIVATE(log);
+	GFile *file;
+	gchar *read;
 
 	/* XXX: TODO: We probably want to set PURPLE_LOG_READ_NO_NEWLINE
 	 * XXX: TODO: for HTML logs. */
 	if (flags != NULL)
 		*flags = 0;
 
-	g_return_val_if_fail(log != NULL, g_strdup(""));
+	file = purple_common_log_get_file(PURPLE_COMMON_LOG(log));
 
-	data = log->logger_data;
+	if (file == NULL) {
+		g_set_error_literal(error,
+			G_IO_ERROR,
+			G_IO_ERROR_FAILED,
+			_("Unable to find log path"));
 
-	g_return_val_if_fail(data->path != NULL, g_strdup(""));
-
-	purple_debug_info("Adium log read", "Reading %s\n", data->path);
-	if (!g_file_get_contents(data->path, &read, NULL, &error)) {
-		purple_debug_error("Adium log read", "Error reading log: %s\n",
-					   (error && error->message) ? error->message : "Unknown error");
-		if (error)
-			g_error_free(error);
-		return g_strdup("");
+		return NULL;
 	}
 
-	if (data->type != ADIUM_HTML) {
-		char *escaped = g_markup_escape_text(read, -1);
+	if (!g_file_load_contents(file, cancellable, &read, NULL, NULL, error))
+		return NULL;
+
+	if (priv->type != ADIUM_HTML) {
+		gchar *escaped = g_markup_escape_text(read, -1);
 		g_free(read);
 		read = escaped;
 	}
@@ -311,10 +298,9 @@ purple_adium_log_read (PurpleLog *log, P
 	/* This problem only seems to show up on Windows.
 	 * The BOM is displaying as a space at the beginning of the log.
 	 */
-	if (purple_str_has_prefix(read, "\xef\xbb\xbf"))
-	{
+	if (purple_str_has_prefix(read, "\xef\xbb\xbf")) {
 		/* FIXME: This feels so wrong... */
-		char *temp = g_strdup(&(read[3]));
+		gchar *temp = g_strdup(read + 3);
 		g_free(read);
 		read = temp;
 	}
@@ -328,29 +314,24 @@ purple_adium_log_read (PurpleLog *log, P
 	return read;
 }
 
-static gssize
-purple_adium_log_size(PurpleLog *log, GCancellable *cancellable, GError **error)
+static void
+purple_adium_log_class_init(PurpleAdiumLogClass *class)
 {
-	PurpleAdiumLogPrivate *priv = PURPLE_ADIUM_LOG_GET_PRIVATE(adium_log);
-	gchar *text;
-	size_t size;
+	GObjectClass *gobject_class = G_OBJECT_CLASS(class);
+	PurpleLogClass *log_class = PURPLE_LOG_CLASS(class);
 
-	if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) {
-		struct stat st;
+	log_class->logger_name = _("Adium");
+	log_class->logger_id = "adium";
 
-		if (!priv->path || stat(priv->path, &st))
-			st.st_size = 0;
+	log_class->list_fn = purple_adium_log_list;
+	log_class->read_fn = purple_adium_log_read;
 
-		return st.st_size;
-	}
+	g_type_class_add_private(gobject_class, sizeof(PurpleAdiumLogPrivate));
+}
 
-	// WHAT THE FUCK
-	text = purple_adium_log_read(log, NULL);
-	size = strlen(text);
-	g_free(text);
-	// WHAT THE FUCK
-
-	return size;
+static void
+purple_adium_log_init(PurpleAdiumLog *adium_log)
+{
 }
 
 /*****************************************************************************
@@ -367,13 +348,15 @@ struct fire_logger_data {
 struct fire_logger_data {
 };
 
-static GList *fire_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account)
+static GList *
+fire_logger_list(PurpleLogType type, const gchar *sn, PurpleAccount *account)
 {
 	/* TODO: Do something here. */
 	return NULL;
 }
 
-static char * fire_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
+static gchar *
+fire_logger_read(PurpleLog *log, PurpleLogReadFlags *flags)
 {
 	struct fire_logger_data *data;
 
@@ -385,7 +368,8 @@ static char * fire_logger_read (PurpleLo
 	return g_strdup("");
 }
 
-static int fire_logger_size (PurpleLog *log)
+static int
+fire_logger_size(PurpleLog *log)
 {
 	g_return_val_if_fail(log != NULL, 0);
 
@@ -396,7 +380,8 @@ static int fire_logger_size (PurpleLog *
 	return 0;
 }
 
-static void fire_logger_finalize(PurpleLog *log)
+static void
+fire_logger_finalize(PurpleLog *log)
 {
 	g_return_if_fail(log != NULL);
 
@@ -419,13 +404,15 @@ struct messenger_plus_logger_data {
 struct messenger_plus_logger_data {
 };
 
-static GList *messenger_plus_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account)
+static GList *
+messenger_plus_logger_list(PurpleLogType type, const gchar *sn, PurpleAccount *account)
 {
 	/* TODO: Do something here. */
 	return NULL;
 }
 
-static char * messenger_plus_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
+static gchar *
+messenger_plus_logger_read(PurpleLog *log, PurpleLogReadFlags *flags)
 {
 	struct messenger_plus_logger_data *data = log->logger_data;
 
@@ -437,7 +424,8 @@ static char * messenger_plus_logger_read
 	return g_strdup("");
 }
 
-static int messenger_plus_logger_size (PurpleLog *log)
+static gssize
+messenger_plus_logger_size(PurpleLog *log)
 {
 	g_return_val_if_fail(log != NULL, 0);
 
@@ -448,7 +436,8 @@ static int messenger_plus_logger_size (P
 	return 0;
 }
 
-static void messenger_plus_logger_finalize(PurpleLog *log)
+static void
+messenger_plus_logger_finalize(PurpleLog *log)
 {
 	g_return_if_fail(log != NULL);
 
@@ -465,37 +454,51 @@ static void messenger_plus_logger_finali
  * MSN Messenger message histories in the log viewer transparently.
  */
 
-static PurpleLogLogger *msn_logger;
+#define PURPLE_TYPE_MSN_LOG         (purple_msn_log_get_type())
+#define PURPLE_MSN_LOG(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), PURPLE_TYPE_MSN_LOG, PurpleMsnLog))
+#define PURPLE_MSN_LOG_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), PURPLE_TYPE_MSN_LOG, PurpleMsnLogClass))
+#define PURPLE_IS_MSN_LOG(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), PURPLE_TYPE_MSN_LOG))
+#define PURPLE_IS_MSN_LOG_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE((k), PURPLE_TYPE_MSN_LOG))
+#define PURPLE_MSN_LOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), PURPLE_TYPE_MSN_LOG, PurpleMsnLogClass))
 
-struct msn_logger_data {
+typedef struct _PurpleMsnLog        PurpleMsnLog;
+typedef struct _PurpleMsnLogClass   PurpleMsnLogClass;
+
+struct _PurpleMsnLog {
+	PurpleCommonLog parent_instance;
+};
+
+struct _PurpleMsnLogClass {
+	PurpleCommonLogClass parent_class;
+};
+
+GType purple_msn_log_get_type(void);
+
+
+G_DEFINE_TYPE (PurpleMsnLog, purple_msn_log, PURPLE_TYPE_COMMON_LOG)
+
+#define PURPLE_MSN_LOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), PURPLE_TYPE_MSN_LOG, PurpleMsnLogPrivate))
+typedef struct _PurpleMsnLogPrivate PurpleMsnLogPrivate;
+
+struct _PurpleMsnLogPrivate {
+	GString *text;
 	xmlnode *root;
 	xmlnode *message;
-	const char *session_id;
-	int last_log;
-	GString *text;
+	const gchar *session_id;
+	gboolean last_log;
 };
 
 /* This function is really confusing.  It makes baby rlaager cry...
    In other news: "You lost a lot of blood but we found most of it."
  */
-static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out)
+static time_t
+msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out)
 {
-	const char *datetime;
-	static struct tm tm2;
-	time_t stamp;
-	const char *date;
-	const char *time;
-	int month;
-	int day;
-	int year;
-	int hour;
-	int min;
-	int sec;
-	char am_pm;
-	char *str;
-	static struct tm tm;
-	time_t t;
-	time_t diff;
+	const gchar *date, *datetime, *time;
+	gint month, day, year, hour, min, sec;
+	gchar am_pm, *str;
+	static struct tm tm, tm2;
+	time_t stamp, t, diff;
 
 #ifndef G_DISABLE_CHECKS
 	if (message != NULL)
@@ -643,26 +646,24 @@ static time_t msn_logger_parse_timestamp
 	return stamp;
 }
 
-static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account)
+static GList *
+purple_msn_log_list(PurpleLog *log, PurpleLogChatType chat_type, const gchar *sn, PurpleAccount *account, GCancellable *cancellable, GError **error)
 {
-	GList *list = NULL;
-	char *username;
+	PurpleMsnLogPrivate *priv = NULL;
 	PurpleBuddy *buddy;
-	const char *logdir;
-	const char *savedfilename = NULL;
-	char *logfile;
-	char *path;
-	GError *error = NULL;
-	gchar *contents = NULL;
+	GFile *file;
+	GList *list = NULL;
+	const gchar *logdir;
+	const gchar *old_session_id = "";
+	const gchar *savedfilename = NULL;
+	gchar *logfile;
+	gchar *path;
+	gchar *read;
+	gchar *username;
 	gsize length;
 	xmlnode *root;
 	xmlnode *message;
-	const char *old_session_id = "";
-	struct msn_logger_data *data = NULL;
 
-	g_return_val_if_fail(sn != NULL, NULL);
-	g_return_val_if_fail(account != NULL, NULL);
-
 	if (strcmp(account->protocol_id, "prpl-msn"))
 		return NULL;
 
@@ -714,7 +715,7 @@ static GList *msn_logger_list(PurpleLogT
 
 	if (!g_file_test(path, G_FILE_TEST_EXISTS)) {
 		gboolean found = FALSE;
-		char *at_sign;
+		gchar *at_sign;
 		GDir *dir;
 
 		g_free(path);
@@ -743,7 +744,7 @@ static GList *msn_logger_list(PurpleLogT
 			const gchar *name;
 
 			while ((name = g_dir_read_name(dir))) {
-				const char *c = name;
+				const gchar *c = name;
 
 				if (!purple_str_has_prefix(c, username))
 					continue;
@@ -759,7 +760,7 @@ static GList *msn_logger_list(PurpleLogT
 				path = g_build_filename(logdir, name, NULL);
 				/* The !c makes sure we got to the end of the while loop above. */
 				if (!*c && g_file_test(path, G_FILE_TEST_IS_DIR)) {
-					char *history_path = g_build_filename(
+					gchar *history_path = g_build_filename(
 						path,  "History", NULL);
 					if (g_file_test(history_path, G_FILE_TEST_IS_DIR)) {
 						purple_account_set_string(account,
@@ -797,7 +798,7 @@ static GList *msn_logger_list(PurpleLogT
 			const gchar *name;
 
 			while ((name = g_dir_read_name(dir))) {
-				const char *c = name;
+				const gchar *c = name;
 
 				if (!purple_str_has_prefix(c, username))
 					continue;
@@ -835,14 +836,15 @@ static GList *msn_logger_list(PurpleLogT
 		logfile = NULL; /* No sense saving the obvious buddy at domain.com. */
 	}
 
-	purple_debug_info("MSN log read", "Reading %s\n", path);
-	if (!g_file_get_contents(path, &contents, &length, &error)) {
+	file = g_file_new_for_path(path);
+
+	if (!g_file_load_contents(file, cancellable, &read, &length, NULL, error)) {
 		g_free(path);
-		purple_debug_error("MSN log read", "Error reading log\n");
-		if (error)
-			g_error_free(error);
+		g_object_unref(file);
 		return list;
 	}
+
+	g_object_unref(file);
 	g_free(path);
 
 	/* Reading the file was successful...
@@ -857,14 +859,15 @@ static GList *msn_logger_list(PurpleLogT
 		g_free(logfile);
 	}
 
-	root = xmlnode_from_str(contents, length);
-	g_free(contents);
+	root = xmlnode_from_str(read, length);
+	g_free(read);
+
 	if (!root)
 		return list;
 
 	for (message = xmlnode_get_child(root, "Message"); message;
 			message = xmlnode_get_next_twin(message)) {
-		const char *session_id;
+		const gchar *session_id;
 
 		session_id = xmlnode_get_attrib(message, "SessionID");
 		if (!session_id) {
@@ -878,82 +881,78 @@ static GList *msn_logger_list(PurpleLogT
 			 * The session ID differs from the last message.
 			 * Thus, this is the start of a new conversation.
 			 */
+			PurpleLog *log;
 			struct tm *tm;
 			time_t stamp;
-			PurpleLog *log;
 
-			data = g_new0(struct msn_logger_data, 1);
-			data->root = root;
-			data->message = message;
-			data->session_id = session_id;
-			data->text = NULL;
-			data->last_log = FALSE;
-
 			stamp = msn_logger_parse_timestamp(message, &tm);
 
-			log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, stamp, tm);
-			log->logger = msn_logger;
-			log->logger_data = data;
+			log = purple_common_log_new(PURPLE_TYPE_MSN_LOG,
+				PURPLE_LOG_IM, sn, account, NULL, stamp, tm);
 
+			priv = PURPLE_MSN_LOG_GET_PRIVATE(log);
+			priv->root = root;
+			priv->message = message;
+			priv->session_id = session_id;
+			priv->text = NULL;
+			priv->last_log = FALSE;
+			
 			list = g_list_prepend(list, log);
 		}
+
 		old_session_id = session_id;
 	}
 
-	if (data)
-		data->last_log = TRUE;
+	if (priv != NULL)
+		priv->last_log = TRUE;
 
 	return g_list_reverse(list);
 }
 
-static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
+static gchar *
+purple_msn_log_read(PurpleLog *log, PurpleLogReadFlags *flags, GCancellable *cancellable, GError **error)
 {
-	struct msn_logger_data *data;
+	PurpleAccount *account = purple_log_get_account(log);
+	PurpleMsnLogPrivate *priv;
 	GString *text = NULL;
 	xmlnode *message;
 
 	if (flags != NULL)
 		*flags = PURPLE_LOG_READ_NO_NEWLINE;
-	g_return_val_if_fail(log != NULL, g_strdup(""));
 
-	data = log->logger_data;
+	priv = PURPLE_MSN_LOG_GET_PRIVATE(log);
 
-	if (data->text) {
+	if (priv->text != NULL) {
 		/* The GTK code which displays the logs g_free()s whatever is
 		 * returned from this function. Thus, we can't reuse the str
 		 * part of the GString. The only solution is to free it and
 		 * start over.
 		 */
-		g_string_free(data->text, FALSE);
+		g_string_free(priv->text, FALSE);
 	}
 
-	text = g_string_new("");
-
-	if (!data->root || !data->message || !data->session_id) {
+	if (priv->root == NULL || priv->message == NULL || priv->session_id == NULL) {
 		/* Something isn't allocated correctly. */
-		purple_debug_error("MSN log parse",
-		                   "Error parsing message: %s\n", "Internal variables inconsistent");
-		data->text = text;
+		g_set_error_literal(error,
+			G_IO_ERROR,
+			G_IO_ERROR_FAILED,
+			_("Internal variables inconsistent"));
 
-		return text->str;
+		return NULL;
 	}
 
-	for (message = data->message; message;
-			message = xmlnode_get_next_twin(message)) {
+	text = g_string_new("");
 
-		const char *new_session_id;
-		xmlnode *text_node;
-		const char *from_name = NULL;
-		const char *to_name = NULL;
-		xmlnode *from;
-		xmlnode *to;
+	for (message = priv->message; message != NULL;
+		message = xmlnode_get_next_twin(message))
+	{
+		xmlnode *text_node, *from, *to;
+		const gchar *new_session_id, *from_name = NULL;
+		const gchar *to_name = NULL, *their_name, *style;
+		gchar *timestamp, *tmp;
 		enum name_guesses name_guessed = NAME_GUESS_UNKNOWN;
-		const char *their_name;
-		time_t time_unix;
 		struct tm *tm;
-		char *timestamp;
-		char *tmp;
-		const char *style;
+		time_t time_unix;
 
 		new_session_id = xmlnode_get_attrib(message, "SessionID");
 
@@ -964,7 +963,7 @@ static char * msn_logger_read (PurpleLog
 			break;
 		}
 
-		if (strcmp(new_session_id, data->session_id)) {
+		if (strcmp(new_session_id, priv->session_id)) {
 			/* The session ID differs from the first message.
 			 * Thus, this is the start of a new conversation.
 			 */
@@ -972,26 +971,30 @@ static char * msn_logger_read (PurpleLog
 		}
 
 		text_node = xmlnode_get_child(message, "Text");
-		if (!text_node)
+
+		if (text_node == NULL)
 			continue;
 
 		from = xmlnode_get_child(message, "From");
-		if (from) {
+
+		if (from != NULL) {
 			xmlnode *user = xmlnode_get_child(from, "User");
 
-			if (user) {
+			if (user != NULL) {
 				from_name = xmlnode_get_attrib(user, "FriendlyName");
 
 				/* This saves a check later. */
-				if (!*from_name)
+				if (*from_name == 0)
 					from_name = NULL;
 			}
 		}
 
 		to = xmlnode_get_child(message, "To");
-		if (to) {
+
+		if (to != NULL) {
 			xmlnode *user = xmlnode_get_child(to, "User");
-			if (user) {
+
+			if (user != NULL) {
 				to_name = xmlnode_get_attrib(user, "FriendlyName");
 
 				/* This saves a check later. */
@@ -1001,27 +1004,25 @@ static char * msn_logger_read (PurpleLog
 		}
 
 		their_name = from_name;
+
 		if (from_name && purple_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) {
-			const char *friendly_name = purple_connection_get_display_name(log->account->gc);
+			const gchar *friendly_name = purple_connection_get_display_name(account->gc);
+			const gchar *name = purple_log_get_name(log);
 
 			if (friendly_name != NULL) {
-				int friendly_name_length = strlen(friendly_name);
-				const char *alias;
-				int alias_length;
-				PurpleBuddy *buddy = purple_find_buddy(log->account, log->name);
-				gboolean from_name_matches;
-				gboolean to_name_matches;
+				PurpleBuddy *buddy = purple_find_buddy(account, name);
+				const gchar *alias;
+				gint friendly_name_length = strlen(friendly_name);
+				gint alias_length;
+				gboolean from_name_matches, to_name_matches;
 
-				if (buddy)
+				if (buddy != NULL)
 					their_name = purple_buddy_get_alias(buddy);
 
-				if (log->account->alias)
-				{
-					alias = log->account->alias;
+				if (account->alias) {
+					alias = account->alias;
 					alias_length = strlen(alias);
-				}
-				else
-				{
+				} else {
 					alias = "";
 					alias_length = 0;
 				}
@@ -1032,30 +1033,29 @@ static char * msn_logger_read (PurpleLog
 				 * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$
 				 */
 				from_name_matches = (purple_str_has_prefix(from_name, friendly_name) &&
-				                      !isalnum(*(from_name + friendly_name_length))) ||
-				                     (purple_str_has_prefix(from_name, alias) &&
-				                      !isalnum(*(from_name + alias_length)));
+						!isalnum(*(from_name + friendly_name_length))) ||
+					(purple_str_has_prefix(from_name, alias) &&
+						!isalnum(*(from_name + alias_length)));
 
 				to_name_matches = to_name != NULL && (
-				                   (purple_str_has_prefix(to_name, friendly_name) &&
-				                    !isalnum(*(to_name + friendly_name_length))) ||
-				                   (purple_str_has_prefix(to_name, alias) &&
-				                    !isalnum(*(to_name + alias_length))));
+					(purple_str_has_prefix(to_name, friendly_name) &&
+						!isalnum(*(to_name + friendly_name_length))) ||
+					(purple_str_has_prefix(to_name, alias) &&
+						!isalnum(*(to_name + alias_length))));
 
 				if (from_name_matches) {
-					if (!to_name_matches) {
+					if (!to_name_matches)
 						name_guessed = NAME_GUESS_ME;
-					}
 				} else if (to_name_matches) {
 					name_guessed = NAME_GUESS_THEM;
 				} else {
-					if (buddy) {
-						const char *server_alias = NULL;
-						char *alias = g_strdup(purple_buddy_get_alias(buddy));
-						char *temp;
+					if (buddy != NULL) {
+						const gchar *server_alias = NULL;
+						gchar *alias = g_strdup(purple_buddy_get_alias(buddy));
+						gchar *temp;
 
 						/* "Truncate" the string at the first non-alphanumeric
-						 * character. The idea is to relax the comparison.
+						 * gcharacter. The idea is to relax the comparison.
 						 */
 						for (temp = alias; *temp ; temp++) {
 							if (!isalnum(*temp)) {
@@ -1098,22 +1098,16 @@ static char * msn_logger_read (PurpleLog
 							 * this test, "match" is defined as:
 							 * ^friendly_name([^a-zA-Z0-9].*)?$
 							 */
-							from_name_matches = (purple_str_has_prefix(
-									from_name,
-									server_alias) &&
-									!isalnum(*(from_name +
-									friendly_name_length)));
+							from_name_matches = purple_str_has_prefix(from_name, server_alias) &&
+								!isalnum(*(from_name + friendly_name_length));
 
-							to_name_matches = to_name && (
-									(purple_str_has_prefix(
-									to_name, server_alias) &&
-									!isalnum(*(to_name +
-									friendly_name_length))));
+							to_name_matches = to_name &&
+								(purple_str_has_prefix(to_name, server_alias) &&
+									!isalnum(*(to_name + friendly_name_length)));
 
 							if (from_name_matches) {
-								if (!to_name_matches) {
+								if (!to_name_matches)
 									name_guessed = NAME_GUESS_THEM;
-								}
 							} else if (to_name_matches) {
 								name_guessed = NAME_GUESS_ME;
 							}
@@ -1125,15 +1119,16 @@ static char * msn_logger_read (PurpleLog
 
 		if (name_guessed != NAME_GUESS_UNKNOWN) {
 			text = g_string_append(text, "<span style=\"color: #");
+
 			if (name_guessed == NAME_GUESS_ME)
 				text = g_string_append(text, "16569E");
 			else
 				text = g_string_append(text, "A82F2F");
+
 			text = g_string_append(text, ";\">");
 		}
 
 		time_unix = msn_logger_parse_timestamp(message, &tm);
-
 		timestamp = g_strdup_printf("<font size=\"2\">(%02u:%02u:%02u)</font> ",
 				tm->tm_hour, tm->tm_min, tm->tm_sec);
 		text = g_string_append(text, timestamp);
@@ -1143,10 +1138,10 @@ static char * msn_logger_read (PurpleLog
 			text = g_string_append(text, "<b>");
 
 			if (name_guessed == NAME_GUESS_ME) {
-				if (log->account->alias)
-					text = g_string_append(text, log->account->alias);
+				if (account->alias)
+					text = g_string_append(text, account->alias);
 				else
-					text = g_string_append(text, log->account->username);
+					text = g_string_append(text, account->username);
 			}
 			else if (name_guessed == NAME_GUESS_THEM)
 				text = g_string_append(text, their_name);
@@ -1160,8 +1155,8 @@ static char * msn_logger_read (PurpleLog
 			text = g_string_append(text, "</span>");
 
 		style = xmlnode_get_attrib(text_node, "Style");
+		tmp = xmlnode_get_data(text_node);
 
-		tmp = xmlnode_get_data(text_node);
 		if (style && *style) {
 			text = g_string_append(text, "<span style=\"");
 			text = g_string_append(text, style);
@@ -1172,49 +1167,59 @@ static char * msn_logger_read (PurpleLog
 			text = g_string_append(text, tmp);
 			text = g_string_append(text, "<br>");
 		}
+
 		g_free(tmp);
 	}
 
-	data->text = text;
+	priv->text = text;
 
 	return text->str;
 }
 
-static int msn_logger_size (PurpleLog *log)
+static void
+purple_msn_log_finalize(GObject *object)
 {
-	char *text;
-	size_t size;
+	PurpleMsnLogPrivate *priv = PURPLE_MSN_LOG_GET_PRIVATE(object);
 
-	g_return_val_if_fail(log != NULL, 0);
+	if (priv->last_log)
+		xmlnode_free(priv->root);
 
-	if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes"))
-		return 0;
+	if (priv->text)
+		g_string_free(priv->text, FALSE);
 
-	text = msn_logger_read(log, NULL);
-	size = strlen(text);
-	g_free(text);
+	G_OBJECT_CLASS(purple_msn_log_parent_class)->finalize(object);
+}
 
-	return size;
-}
 
-static void msn_logger_finalize(PurpleLog *log)
+static void
+purple_msn_log_class_init(PurpleMsnLogClass *class)
 {
-	struct msn_logger_data *data;
+	GObjectClass *gobject_class = G_OBJECT_CLASS(class);
+	PurpleLogClass *log_class = PURPLE_LOG_CLASS(class);
 
-	g_return_if_fail(log != NULL);
+	log_class->logger_name = _("MSN Messenger");
+	log_class->logger_id = "msn";
 
-	data = log->logger_data;
+	log_class->list_fn = purple_msn_log_list;
+	log_class->read_fn = purple_msn_log_read;
 
-	if (data->last_log)
-		xmlnode_free(data->root);
+	gobject_class->finalize = purple_msn_log_finalize;
 
-	if (data->text)
-		g_string_free(data->text, FALSE);
+	g_type_class_add_private(gobject_class, sizeof(PurpleMsnLogPrivate));
+}
 
-	g_free(data);
+static void
+purple_msn_log_init(PurpleMsnLog *msn_log)
+{
+	PurpleMsnLogPrivate *priv = PURPLE_MSN_LOG_GET_PRIVATE(msn_log);
+
+	priv->text = NULL;
+	priv->root = NULL;
+	priv->message = NULL;
+	priv->session_id = NULL;
+	priv->last_log = FALSE;
 }
 
-
 /*****************************************************************************
  * Trillian Logger                                                           *
  *****************************************************************************/
@@ -1227,22 +1232,23 @@ struct trillian_logger_data {
 static void trillian_logger_finalize(PurpleLog *log);
 
 struct trillian_logger_data {
-	char *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list */
+	gchar *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list */
 	int offset;
 	int length;
-	char *their_nickname;
+	gchar *their_nickname;
 };
 
-static GList *trillian_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account)
+static GList *
+trillian_logger_list(PurpleLogType type, const gchar *sn, PurpleAccount *account)
 {
 	GList *list = NULL;
-	const char *logdir;
+	const gchar *logdir;
 	PurplePlugin *plugin;
 	PurplePluginProtocolInfo *prpl_info;
-	char *prpl_name;
-	const char *buddy_name;
-	char *filename;
-	char *path;
+	gchar *prpl_name;
+	const gchar *buddy_name;
+	gchar *filename;
+	gchar *path;
 	GError *error = NULL;
 	gchar *contents = NULL;
 	gsize length;
@@ -1334,8 +1340,8 @@ static GList *trillian_logger_list(Purpl
 				 * beginning of the file can be overwritten with a UTF-8
 				 * byte order mark.  Yes, it's weird.
 				 */
-				char *their_nickname = line;
-				char *timestamp;
+				gchar *their_nickname = line;
+				gchar *timestamp;
 
 				if (data && !data->length)
 					data->length = last_line_offset - data->offset;
@@ -1354,7 +1360,7 @@ static GList *trillian_logger_list(Purpl
 					timestamp++;
 
 				if (*timestamp == ')') {
-					char *month;
+					gchar *month;
 					struct tm tm;
 
 					*timestamp = '\0';
@@ -1427,16 +1433,16 @@ static GList *trillian_logger_list(Purpl
 	return g_list_reverse(list);
 }
 
-static char * trillian_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
+static gchar * trillian_logger_read (PurpleLog *log, PurpleLogReadFlags *flags)
 {
 	struct trillian_logger_data *data;
-	char *read;
+	gchar *read;
 	FILE *file;
 	PurpleBuddy *buddy;
-	char *escaped;
+	gchar *escaped;
 	GString *formatted;
-	char *c;
-	const char *line;
+	gchar *c;
+	const gchar *line;
 
 	if (flags != NULL)
 		*flags = PURPLE_LOG_READ_NO_NEWLINE;
@@ -1478,8 +1484,8 @@ static char * trillian_logger_read (Purp
 	line = read;
 	while (c)
 	{
-		const char *link;
-		const char *footer = NULL;
+		const gchar *link;
+		const gchar *footer = NULL;
 		GString *temp = NULL;
 
 		if ((c = strstr(c, "\n")))
@@ -1502,13 +1508,13 @@ static char * trillian_logger_read (Purp
 		 */
 		while (line && (link = strstr(line, "(Link: ")))
 		{
-			const char *tmp = link;
+			const gchar *tmp = link;
 
 			link += 7;
 			if (*link)
 			{
-				char *end_paren;
-				char *space;
+				gchar *end_paren;
+				gchar *space;
 
 				if (!(end_paren = strstr(link, ")")))
 				{
@@ -1565,7 +1571,7 @@ static char * trillian_logger_read (Purp
 		}
 
 		if (*line == '[') {
-			const char *timestamp;
+			const gchar *timestamp;
 
 			if ((timestamp = strstr(line, "]"))) {
 				line++;
@@ -1597,7 +1603,7 @@ static char * trillian_logger_read (Purp
 					g_string_append(formatted, "</b>");
 					footer = NULL;
 				} else if (strstr(line, " signed off ")) {
-					const char *alias = NULL;
+					const gchar *alias = NULL;
 
 					if (buddy != NULL)
 						alias = purple_buddy_get_alias(buddy);
@@ -1611,7 +1617,7 @@ static char * trillian_logger_read (Purp
 					}
 					line = "";
 				} else if (strstr(line, " signed on ")) {
-					const char *alias = NULL;
+					const gchar *alias = NULL;
 
 					if (buddy != NULL)
 						alias = purple_buddy_get_alias(buddy);
@@ -1676,7 +1682,7 @@ static char * trillian_logger_read (Purp
 				}
 			} else if (purple_str_has_prefix(line, data->their_nickname)) {
 				if (buddy != NULL) {
-					const char *alias = purple_buddy_get_alias(buddy);
+					const gchar *alias = purple_buddy_get_alias(buddy);
 
 					if (alias != NULL) {
 						line += strlen(data->their_nickname) + 2;
@@ -1686,9 +1692,9 @@ static char * trillian_logger_read (Purp
 					}
 				}
 			} else {
-				const char *line2 = strstr(line, ":");
+				const gchar *line2 = strstr(line, ":");
 				if (line2) {
-					const char *acct_name;
+					const gchar *acct_name;
 					line2++;
 					line = line2;
 					acct_name = purple_account_get_alias(log->account);
@@ -1716,17 +1722,18 @@ static char * trillian_logger_read (Purp
 
 	g_free(read);
 
-	/* XXX: TODO: What can we do about removing \r characters?
+	/* XXX: TODO: What can we do about removing \r gcharacters?
 	 * XXX: TODO: and will that allow us to avoid this
 	 * XXX: TODO: g_strchomp(), or is that unrelated? */
 	/* XXX: TODO: Avoid this g_strchomp() */
 	return g_strchomp(g_string_free(formatted, FALSE));
 }
 
-static int trillian_logger_size (PurpleLog *log)
+static int
+trillian_logger_size(PurpleLog *log)
 {
 	struct trillian_logger_data *data;
-	char *text;
+	gchar *text;
 	size_t size;
 
 	g_return_val_if_fail(log != NULL, 0);
@@ -1744,7 +1751,8 @@ static int trillian_logger_size (PurpleL
 	return size;
 }
 
-static void trillian_logger_finalize(PurpleLog *log)
+static void
+trillian_logger_finalize(PurpleLog *log)
 {
 	struct trillian_logger_data *data;
 
@@ -1775,29 +1783,30 @@ struct qip_logger_data {
 
 struct qip_logger_data {
 
-	char *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list  */
+	gchar *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list  */
 	int offset;
 	int length;
 };
 
-static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account)
+static GList *
+qip_logger_list(PurpleLogType type, const gchar *sn, PurpleAccount *account)
 {
 	GList *list = NULL;
-	const char *logdir;
+	const gchar *logdir;
 	PurplePlugin *plugin;
 	PurplePluginProtocolInfo *prpl_info;
-	char *username;
-	char *filename;
-	char *path;
-	char *contents;
+	gchar *username;
+	gchar *filename;
+	gchar *path;
+	gchar *contents;
 	struct qip_logger_data *data = NULL;
 	struct tm prev_tm;
 	struct tm tm;
 	gboolean prev_tm_init = FALSE;
 	gboolean main_cycle = TRUE;
-	char *c;
-	char *start_log;
-	char *new_line = NULL;
+	gchar *c;
+	gchar *start_log;
+	gchar *new_line = NULL;
 	int offset = 0;
 	GError *error;
 
@@ -1851,7 +1860,7 @@ static GList *qip_logger_list(PurpleLogT
 			if (purple_str_has_prefix(c, QIP_LOG_IN_MESSAGE) ||
 				purple_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) {
 
-				char *tmp;
+				gchar *tmp;
 
 				new_line = c;
 
@@ -1859,7 +1868,7 @@ static GList *qip_logger_list(PurpleLogT
 				c = strstr(c, "\n");
 				c++;
 
-				/* Find the last '(' character. */
+				/* Find the last '(' gcharacter. */
 				if ((tmp = strstr(c, "\n")) != NULL) {
 					while (*tmp && *tmp != '(') --tmp;
 					c = tmp;
@@ -1871,7 +1880,7 @@ static GList *qip_logger_list(PurpleLogT
 				}
 
 				if (c != NULL) {
-					const char *timestamp = ++c;
+					const gchar *timestamp = ++c;
 
 					/*  Parse the time, day, month and year  */
 					if (sscanf(timestamp, "%u:%u:%u %u/%u/%u",
@@ -1942,16 +1951,17 @@ static GList *qip_logger_list(PurpleLogT
 	return g_list_reverse(list);
 }
 
-static char *qip_logger_read(PurpleLog *log, PurpleLogReadFlags *flags)
+static gchar *
+qip_logger_read(PurpleLog *log, PurpleLogReadFlags *flags)
 {
 	struct qip_logger_data *data;
 	PurpleBuddy *buddy;
 	GString *formatted;
-	char *c;
-	const char *line;
+	gchar *c;
+	const gchar *line;
 	gchar *contents;
 	GError *error;
-	char *utf8_string;
+	gchar *utf8_string;
 	FILE *file;
 
 	if (flags != NULL)
@@ -2005,8 +2015,8 @@ static char *qip_logger_read(PurpleLog *
 		if (purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC) ||
 		    purple_str_has_prefix(line, QIP_LOG_OUT_MESSAGE_ESC)) {
 
-			char *tmp;
-			const char *buddy_name;
+			gchar *tmp;
+			const gchar *buddy_name;
 
 			is_in_message = purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC);
 
@@ -2016,7 +2026,7 @@ static char *qip_logger_read(PurpleLog *
 			/* XXX: Do we need buddy_name when we have buddy->alias? */
 			buddy_name = ++c;
 
-			/* Find the last '(' character. */
+			/* Find the last '(' gcharacter. */
 			if ((tmp = strstr(c, "\n")) != NULL) {
 				while (*tmp && *tmp != '(') --tmp;
 				c = tmp;
@@ -2028,7 +2038,7 @@ static char *qip_logger_read(PurpleLog *
 			}
 
 			if (c != NULL) {
-				const char *timestamp = c;
+				const gchar *timestamp = c;
 				int hour;
 				int min;
 				int sec;
@@ -2049,7 +2059,7 @@ static char *qip_logger_read(PurpleLog *
 					g_string_append(formatted, "</font> ");
 
 					if (is_in_message) {
-						const char *alias = NULL;
+						const gchar *alias = NULL;
 
 						if (buddy_name != NULL && buddy != NULL &&
 						    (alias = purple_buddy_get_alias(buddy)))
@@ -2059,7 +2069,7 @@ static char *qip_logger_read(PurpleLog *
 								"<b>%s</b></span>: ", alias);
 						}
 					} else {
-						const char *acct_name;
+						const gchar *acct_name;
 						acct_name = purple_account_get_alias(log->account);
 						if (!acct_name)
 							acct_name = purple_account_get_username(log->account);
@@ -2094,10 +2104,11 @@ static char *qip_logger_read(PurpleLog *
 	return g_strchomp(g_string_free(formatted, FALSE));
 }
 
-static int qip_logger_size (PurpleLog *log)
+static int
+qip_logger_size(PurpleLog *log)
 {
 	struct qip_logger_data *data;
-	char *text;
+	gchar *text;
 	size_t size;
 
 	g_return_val_if_fail(log != NULL, 0);
@@ -2115,7 +2126,8 @@ static int qip_logger_size (PurpleLog *l
 	return size;
 }
 
-static void qip_logger_finalize(PurpleLog *log)
+static void
+qip_logger_finalize(PurpleLog *log)
 {
 	struct qip_logger_data *data;
 
@@ -2138,20 +2150,21 @@ struct amsn_logger_data {
 static PurpleLogLogger *amsn_logger;
 
 struct amsn_logger_data {
-	char *path;
-	int offset;
-	int length;
+	gchar *path;
+	gint offset;
+	gint length;
 };
 
 #define AMSN_LOG_CONV_START "|\"LRED[Conversation started on "
 #define AMSN_LOG_CONV_END "|\"LRED[You have closed the window on "
 #define AMSN_LOG_CONV_EXTRA "01 Aug 2001 00:00:00]"
 
-static GList *amsn_logger_parse_file(char *filename, const char *sn, PurpleAccount *account)
+static GList *
+amsn_logger_parse_file(gchar *filename, const gchar *sn, PurpleAccount *account)
 {
 	GList *list = NULL;
 	GError *error;
-	char *contents;
+	gchar *contents;
 	struct amsn_logger_data *data;
 	PurpleLog *log;
 
@@ -2165,14 +2178,14 @@ static GList *amsn_logger_parse_file(cha
 		if (error)
 			g_error_free(error);
 	} else {
-		char *c = contents;
+		gchar *c = contents;
 		gboolean found_start = FALSE;
-		char *start_log = c;
+		gchar *start_log = c;
 		int offset = 0;
 		struct tm tm;
 		while (c && *c) {
 			if (purple_str_has_prefix(c, AMSN_LOG_CONV_START)) {
-				char month[4];
+				gchar month[4];
 				if (sscanf(c + strlen(AMSN_LOG_CONV_START),
 				           "%u %3s %u %u:%u:%u",
 				           &tm.tm_mday, (char*)&month, &tm.tm_year,
@@ -2247,16 +2260,17 @@ static GList *amsn_logger_parse_file(cha
 
 /* `log_dir`/username at hotmail.com/logs/buddyname at hotmail.com.log */
 /* `log_dir`/username at hotmail.com/logs/Month Year/buddyname at hotmail.com.log */
-static GList *amsn_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account)
+static GList *
+purple_amsn_log_list(PurpleLog *log, PurpleLogChatType chat_type, const gchar *sn, PurpleAccount *account, GCancellable *cancellable, GError **error)
 {
 	GList *list = NULL;
-	const char *logdir;
-	char *username;
-	char *log_path;
-	char *buddy_log;
-	char *filename;
+	const gchar *logdir;
+	gchar *username;
+	gchar *log_path;
+	gchar *buddy_log;
+	gchar *filename;
 	GDir *dir;
-	const char *name;
+	const gchar *name;
 
 	logdir = purple_prefs_get_string("/plugins/core/log_reader/amsn/log_directory");
 
@@ -2327,14 +2341,15 @@ static GList *amsn_logger_list(PurpleLog
 /* Really it's |"L, but the string's been escaped */
 #define AMSN_LOG_FORMAT_TAG "|&quot;L"
 
-static char *amsn_logger_read(PurpleLog *log, PurpleLogReadFlags *flags)
+static gchar *
+amsn_logger_read(PurpleLog *log, PurpleLogReadFlags *flags)
 {
 	struct amsn_logger_data *data;
 	FILE *file;
-	char *contents;
-	char *escaped;
+	gchar *contents;
+	gchar *escaped;
 	GString *formatted;
-	char *start;
+	gchar *start;
 	gboolean in_span = FALSE;
 
 	if (flags != NULL)
@@ -2367,9 +2382,9 @@ static char *amsn_logger_read(PurpleLog 
 
 	start = contents;
 	while (start && *start) {
-		char *end;
-		char *old_tag;
-		char *tag;
+		gchar *end;
+		gchar *old_tag;
+		gchar *tag;
 		end = strstr(start, "\n");
 		if (!end)
 			break;
@@ -2393,7 +2408,7 @@ static char *amsn_logger_read(PurpleLog 
 			}
 			if (*tag == 'C') {
 				/* |"LCxxxxxx is a hex colour */
-				char colour[7];
+				gchar colour[7];
 				strncpy(colour, tag + 1, 6);
 				colour[6] = '\0';
 				g_string_append_printf(formatted, "<span style=\"color: #%s;\">", colour);
@@ -2436,10 +2451,11 @@ static char *amsn_logger_read(PurpleLog 
 	return g_string_free(formatted, FALSE);
 }
 
-static int amsn_logger_size(PurpleLog *log)
+static int
+amsn_logger_size(PurpleLog *log)
 {
 	struct amsn_logger_data *data;
-	char *text;
+	gchar *text;
 	int size;
 
 	g_return_val_if_fail(log != NULL, 0);
@@ -2457,7 +2473,8 @@ static int amsn_logger_size(PurpleLog *l
 	return size;
 }
 
-static void amsn_logger_finalize(PurpleLog *log)
+static void
+amsn_logger_finalize(PurpleLog *log)
 {
 	struct amsn_logger_data *data;
 
@@ -2478,10 +2495,11 @@ init_plugin(PurplePlugin *plugin)
 
 }
 
-static void log_reader_init_prefs(void) {
-	char *path;
-#ifdef _WIN32
-	char *folder;
+static void
+log_reader_init_prefs(void) {
+	gchar *path;
+#ifdef G_OS_WIN32
+	gchar *folder;
 	gboolean found = FALSE;
 #endif
 
@@ -2498,7 +2516,7 @@ static void log_reader_init_prefs(void) 
 	purple_prefs_add_none("/plugins/core/log_reader/adium");
 
 	/* Calculate default Adium log directory. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", "");
 #else
 	path = g_build_filename(purple_home_dir(), "Library", "Application Support",
@@ -2512,7 +2530,7 @@ static void log_reader_init_prefs(void) 
 	purple_prefs_add_none("/plugins/core/log_reader/fire");
 
 	/* Calculate default Fire log directory. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", "");
 #else
 	path = g_build_filename(purple_home_dir(), "Library", "Application Support",
@@ -2526,7 +2544,7 @@ static void log_reader_init_prefs(void) 
 	purple_prefs_add_none("/plugins/core/log_reader/messenger_plus");
 
 	/* Calculate default Messenger Plus! log directory. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PERSONAL);
 	if (folder) {
@@ -2546,7 +2564,7 @@ static void log_reader_init_prefs(void) 
 	purple_prefs_add_none("/plugins/core/log_reader/msn");
 
 	/* Calculate default MSN message history directory. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PERSONAL);
 	if (folder) {
@@ -2565,15 +2583,15 @@ static void log_reader_init_prefs(void) 
 	/* Add Trillian log directory preference. */
 	purple_prefs_add_none("/plugins/core/log_reader/trillian");
 
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	/* XXX: While a major hack, this is the most reliable way I could
 	 * think of to determine the Trillian installation directory.
 	 */
 
 	path = NULL;
 	if ((folder = wpurple_read_reg_string(HKEY_CLASSES_ROOT, "Trillian.SkinZip\\shell\\Add\\command\\", NULL))) {
-		char *value = folder;
-		char *temp;
+		gchar *value = folder;
+		gchar *temp;
 
 		/* Break apart buffer. */
 		if (*value == '"') {
@@ -2597,7 +2615,7 @@ static void log_reader_init_prefs(void) 
 	}
 
 	if (!path) {
-		char *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES);
+		gchar *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES);
 		if (folder) {
 			path = g_build_filename(folder, "Trillian",
 			                        "users", "default", "talk.ini", NULL);
@@ -2621,7 +2639,7 @@ static void log_reader_init_prefs(void) 
 			if (error)
 				g_error_free(error);
 		} else {
-			char *logdir = g_key_file_get_string(key_file, "Logging", "Directory", &error);
+			gchar *logdir = g_key_file_get_string(key_file, "Logging", "Directory", &error);
 			if (error) {
 				purple_debug_error("Trillian talk.ini read",
 				                   "Error reading Directory value from Logging section\n");
@@ -2648,7 +2666,7 @@ static void log_reader_init_prefs(void) 
 			if (error)
 				g_error_free(error);
 		} else {
-			char *cursor, *line;
+			gchar *cursor, *line;
 			line = cursor = contents;
 			while (*cursor) {
 				if (*cursor == '\n') {
@@ -2688,7 +2706,7 @@ static void log_reader_init_prefs(void) 
 			"/plugins/core/log_reader/trillian/log_directory", path ? path : "");
 		g_free(path);
 	}
-#else /* !defined(_WIN32) */
+#else /* !defined(G_OS_WIN32) */
 	/* TODO: At some point, this could attempt to parse talk.ini
 	 * TODO: from the default Trillian install directory on the
 	 * TODO: Windows mount point. */
@@ -2706,7 +2724,7 @@ static void log_reader_init_prefs(void) 
 	purple_prefs_add_none("/plugins/core/log_reader/qip");
 
 	/* Calculate default QIP log directory. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES);
 	if (folder) {
@@ -2724,7 +2742,7 @@ static void log_reader_init_prefs(void) 
 	purple_prefs_add_none("/plugins/core/log_reader/amsn");
 
 	/* Calculate default aMSN log directory. */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 	path = NULL;
 	folder = wpurple_get_special_folder(CSIDL_PROFILE); /* Silly aMSN, not using CSIDL_APPDATA */
 	if (folder) {
============================================================
--- libpurple/plugins/Makefile.mingw	3f82da8af389ddfab2842bf352efc37b9c81e164
+++ libpurple/plugins/Makefile.mingw	b69cc263e177e5e0c8baec69e31c6672976cfbb4
@@ -64,7 +64,7 @@ plugins: \
 		buddynote.dll \
 		idle.dll \
 		joinpart.dll \
-#		log_reader.dll \
+		log_reader.dll \
 		newline.dll \
 		offlinemsg.dll \
 		psychic.dll \


More information about the Commits mailing list