changeset 27833:1dd0e007514d

propagate from branch 'im.pidgin.pidgin' (head d94973707853b3f6b84dc446eac68f7fd4c9370d) to branch 'im.pidgin.pidgin.yaz' (head 7f53253b5393ba6ccdf4051ce39db9ad151f52bc)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 06 May 2008 07:58:54 +0000
parents b8f28a250c22 (current diff) 66914f306712 (diff)
children 8b269348e97b
files autogen.sh libpurple/conversation.c libpurple/notify.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/switchboard.c libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo_filexfer.c pidgin/gtkblist.c pidgin/gtkconv.c pidgin/gtkimhtml.c pidgin/gtkprefs.c
diffstat 55 files changed, 669 insertions(+), 428 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Tue May 06 07:51:03 2008 +0000
+++ b/COPYRIGHT	Tue May 06 07:58:54 2008 +0000
@@ -263,6 +263,7 @@
 John Moody
 Tim Mooney
 Sergio Moretto
+Andrei Mozzhuhin
 Christian Muise
 Richard Nelson
 Dennis Nezic
--- a/ChangeLog	Tue May 06 07:51:03 2008 +0000
+++ b/ChangeLog	Tue May 06 07:58:54 2008 +0000
@@ -7,6 +7,10 @@
 	* IRC now displays ban lists in-channel for joined channels.
 	* Fixed a bug where the list of loaded plugins would get removed when
 	  switching between different operating systems.
+	* Fix reception of IRC PART without a part message on Undernet
+	  (fixes a problem with litter in the channel user list).
+	* IRC no longer crashes on /list on servers which erroneously omit
+	  RPL_LISTSTART.
 
 	Pidgin:
 	* The typing notification in the conversation history can be disabled or
@@ -24,6 +28,10 @@
 	  workspaces the "Present" option should.
 	* Add a preference to set Escape as the keyboard shortcut for closing
 	  the conversation window.
+	* Add an option in the context menu to disable smileys in the selected
+	  text in the conversation history/log viewer. This should help people who
+	  regularly paste code in conversations.
+	* Add a preference to choose the minimum size of the text input.
 
 	General:
 	* The configure script now dies on more absent dependencies.  The
@@ -36,6 +44,9 @@
 	* The Contact Availability Prediction plugin must now be explicitly
 	  enabled.  Use the --enable-cap argument to configure to enable it.
 
+	Finch:
+	* New default binding ctrl+x to open context menus.
+
 version 2.4.1 (03/31/2008):
 	http://developer.pidgin.im/query?status=closed&milestone=2.4.1
 
--- a/autogen.sh	Tue May 06 07:51:03 2008 +0000
+++ b/autogen.sh	Tue May 06 07:58:54 2008 +0000
@@ -79,17 +79,23 @@
 	CMD=$1
 	shift
 
+	OUTPUT=`mktemp autogen-XXXX`
+
 	printf "%s" "running ${CMD} ${@}... "
-	OUTPUT=`${CMD} ${@} 2>&1`
+	${CMD} ${@} >${OUTPUT} 2>&1
+
 	if [ $? != 0 ] ; then
 		echo "failed."
-		echo ${OUTPUT}
+		cat ${OUTPUT}
+		rm -f ${OUTPUT}
 		exit 1
 	else
 		echo "done."
-		if [ x"${OUTPUT}" != x"" ] ; then
-			echo ${OUTPUT}
+		if [ `stat --printf="%s" ${OUTPUT}` -ge 0 ] ; then
+			cat ${OUTPUT}
 		fi
+
+		rm -f ${OUTPUT}
 	fi
 }
 
--- a/finch/gntblist.c	Tue May 06 07:51:03 2008 +0000
+++ b/finch/gntblist.c	Tue May 06 07:58:54 2008 +0000
@@ -644,6 +644,32 @@
 }
 
 static void
+join_chat(PurpleChat *chat)
+{
+	PurpleAccount *account = purple_chat_get_account(chat);
+	const char *name;
+	PurpleConversation *conv;
+	const char *alias;
+
+	/* This hack here is to work around the fact that there's no good way of
+	 * getting the actual name of a chat. I don't understand why we return
+	 * the alias for a chat when all we want is the name. */
+	alias = chat->alias;
+	chat->alias = NULL;
+	name = purple_chat_get_name(chat);
+	conv = purple_find_conversation_with_account(
+			PURPLE_CONV_TYPE_CHAT, name, account);
+	chat->alias = (char *)alias;
+
+	if (!conv || purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
+		serv_join_chat(purple_account_get_connection(account),
+				purple_chat_get_components(chat));
+	} else if (conv) {
+		purple_conversation_present(conv);
+	}
+}
+
+static void
 add_chat_cb(void *data, PurpleRequestFields *allfields)
 {
 	PurpleAccount *account;
@@ -682,8 +708,9 @@
 		purple_blist_add_chat(chat, grp, NULL);
 		purple_blist_alias_chat(chat, alias);
 		purple_blist_node_set_bool((PurpleBlistNode*)chat, "gnt-autojoin", autojoin);
-		if (autojoin)
-			serv_join_chat(purple_account_get_connection(purple_chat_get_account(chat)), purple_chat_get_components(chat));
+		if (autojoin) {
+			join_chat(chat);
+		}
 	}
 }
 
@@ -710,6 +737,7 @@
 
 	field = purple_request_field_string_new("group", _("Group"), grp ? purple_group_get_name(grp) : NULL, FALSE);
 	purple_request_field_group_add_field(group, field);
+	purple_request_field_set_type_hint(field, "group");
 
 	field = purple_request_field_bool_new("autojoin", _("Auto-join"), FALSE);
 	purple_request_field_group_add_field(group, field);
@@ -944,7 +972,7 @@
 
 	if (!node)
 		return;
-	
+
 	if (PURPLE_BLIST_NODE_IS_CONTACT(node))
 		node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node);
 
@@ -967,8 +995,7 @@
 	}
 	else if (PURPLE_BLIST_NODE_IS_CHAT(node))
 	{
-		PurpleChat *chat = (PurpleChat*)node;
-		serv_join_chat(purple_account_get_connection(purple_chat_get_account(chat)), purple_chat_get_components(chat));
+		join_chat((PurpleChat*)node);
 	}
 }
 
@@ -2752,6 +2779,68 @@
 }
 
 static void
+view_log_select_cb(gpointer data, PurpleRequestFields *fields)
+{
+	PurpleAccount *account;
+	const char *name;
+	PurpleBuddy *buddy;
+	PurpleContact *contact;
+
+	account = purple_request_fields_get_account(fields, "account");
+	name = purple_request_fields_get_string(fields,  "screenname");
+
+	buddy = purple_find_buddy(account, name);
+	if (buddy) {
+		contact = purple_buddy_get_contact(buddy);
+	} else {
+		contact = NULL;
+	}
+
+	if (contact) {
+		finch_log_show_contact(contact);
+	} else {
+		finch_log_show(PURPLE_LOG_IM, name, account);
+	}
+}
+
+static void
+view_log_cb(GntMenuItem *item, gpointer n)
+{
+	PurpleRequestFields *fields;
+	PurpleRequestFieldGroup *group;
+	PurpleRequestField *field;
+
+	fields = purple_request_fields_new();
+
+	group = purple_request_field_group_new(NULL);
+	purple_request_fields_add_group(fields, group);
+
+	field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE);
+	purple_request_field_set_type_hint(field, "screenname-all");
+	purple_request_field_set_required(field, TRUE);
+	purple_request_field_group_add_field(group, field);
+
+	field = purple_request_field_account_new("account", _("Account"), NULL);
+	purple_request_field_set_type_hint(field, "account");
+	purple_request_field_set_visible(field,
+		(purple_accounts_get_all() != NULL &&
+		 purple_accounts_get_all()->next != NULL));
+	purple_request_field_set_required(field, TRUE);
+	purple_request_field_group_add_field(group, field);
+	purple_request_field_account_set_show_all(field, TRUE);
+
+	purple_request_fields(purple_get_blist(), _("View Log"),
+						NULL,
+						_("Please enter the username or alias of the person "
+						  "whose log you would like to view."),
+						fields,
+						_("OK"), G_CALLBACK(view_log_select_cb),
+						_("Cancel"), NULL,
+						NULL, NULL, NULL,
+						NULL);
+}
+
+static void
 menu_add_buddy_cb(GntMenuItem *item, gpointer null)
 {
 	purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
@@ -2811,6 +2900,11 @@
 	gnt_menu_add_item(GNT_MENU(sub), item);
 	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), join_chat_select, NULL);
 
+	item = gnt_menuitem_new(_("View Log..."));
+	gnt_menuitem_set_id(GNT_MENU_ITEM(item), "view-log");
+	gnt_menu_add_item(GNT_MENU(sub), item);
+	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), view_log_cb, NULL);
+
 	item = gnt_menuitem_new(_("Show"));
 	gnt_menu_add_item(GNT_MENU(sub), item);
 	subsub = gnt_menu_new(GNT_MENU_POPUP);
--- a/finch/gntnotify.c	Tue May 06 07:51:03 2008 +0000
+++ b/finch/gntnotify.c	Tue May 06 07:58:54 2008 +0000
@@ -29,6 +29,7 @@
 #include <gntlabel.h>
 #include <gnttree.h>
 #include <gntutils.h>
+#include <gntwindow.h>
 
 #include "finch.h"
 
@@ -66,8 +67,7 @@
 			break;
 	}
 
-	window = gnt_box_new(FALSE, TRUE);
-	gnt_box_set_toplevel(GNT_BOX(window), TRUE);
+	window = gnt_window_box_new(FALSE, TRUE);
 	gnt_box_set_title(GNT_BOX(window), title);
 	gnt_box_set_fill(GNT_BOX(window), FALSE);
 	gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
@@ -420,6 +420,12 @@
 	return tree;
 }
 
+static void *
+finch_notify_uri(const char *url)
+{
+	return finch_notify_message(PURPLE_NOTIFY_URI, _("URI"), url, NULL);
+}
+
 static PurpleNotifyUiOps ops = 
 {
 	finch_notify_message,
@@ -429,7 +435,7 @@
 	finch_notify_searchresults,
 	finch_notify_sr_new_rows,
 	finch_notify_userinfo,
-	NULL,                     /* notify_uri is of low-priority to me. --sadrul */
+	finch_notify_uri,
 	finch_close_notify,       /* The rest of the notify-uiops return a GntWidget.
                                      These widgets should be destroyed from here. */
 	NULL,
--- a/finch/gntrequest.c	Tue May 06 07:51:03 2008 +0000
+++ b/finch/gntrequest.c	Tue May 06 07:58:54 2008 +0000
@@ -98,6 +98,8 @@
  * cb: the callback
  * data: data for the callback
  * (text, primary-callback) pairs, ended by a NULL
+ *
+ * The cancellation callback should be the last callback sent.
  */
 static GntWidget *
 setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...)
@@ -122,6 +124,8 @@
 		g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data);
 	}
 
+	g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE));
+
 	va_end(list);
 	return box;
 }
@@ -300,7 +304,7 @@
 	{
 		PurpleRequestFieldGroup *group = list->data;
 		GList *fields = purple_request_field_group_get_fields(group);
-		
+
 		for (; fields ; fields = fields->next)
 		{
 			PurpleRequestField *field = fields->data;
@@ -369,7 +373,8 @@
 
 	purple_notify_close_with_handle(button);
 
-	if (!purple_request_fields_all_required_filled(fields)) {
+	if (!g_object_get_data(G_OBJECT(button), "cancellation-function") &&
+			!purple_request_fields_all_required_filled(fields)) {
 		purple_notify_error(button, _("Error"),
 				_("You must fill all the required fields."),
 				_("The required fields are underlined."));
@@ -653,7 +658,7 @@
 	}
 
 	g_object_set_data(G_OBJECT(window), "fields", allfields);
-	
+
 	return window;
 }
 
--- a/finch/libgnt/gntwidget.c	Tue May 06 07:51:03 2008 +0000
+++ b/finch/libgnt/gntwidget.c	Tue May 06 07:58:54 2008 +0000
@@ -257,6 +257,7 @@
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "context-menu", context_menu,
 				GNT_KEY_POPUP, NULL);
 	gnt_bindable_register_binding(GNT_BINDABLE_CLASS(klass), "context-menu", GNT_KEY_F11, NULL);
+	gnt_bindable_register_binding(GNT_BINDABLE_CLASS(klass), "context-menu", GNT_KEY_CTRL_X, NULL);
 
 	gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));
 	GNTDEBUG;
--- a/finch/libgnt/gntwm.c	Tue May 06 07:51:03 2008 +0000
+++ b/finch/libgnt/gntwm.c	Tue May 06 07:58:54 2008 +0000
@@ -1516,7 +1516,7 @@
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-window", help_for_window,
 				"\033" "|", NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-start", ignore_keys_start,
-				GNT_KEY_CTRL_G, NULL);
+				NULL, NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-end", ignore_keys_end,
 				"\033" GNT_KEY_CTRL_G, NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next-urgent", window_next_urgent,
--- a/libpurple/conversation.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/conversation.c	Tue May 06 07:58:54 2008 +0000
@@ -817,14 +817,27 @@
 
 	g_return_val_if_fail(name != NULL, NULL);
 
+	switch (type) {
+		case PURPLE_CONV_TYPE_IM:
+			cnv = purple_get_ims();
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			cnv = purple_get_chats();
+			break;
+		case PURPLE_CONV_TYPE_ANY:
+			cnv = purple_get_conversations();
+			break;
+		default:
+			g_return_val_if_reached(NULL);
+	}
+
 	name1 = g_strdup(purple_normalize(account, name));
 
-	for (cnv = purple_get_conversations(); cnv != NULL; cnv = cnv->next) {
+	for (; cnv != NULL; cnv = cnv->next) {
 		c = (PurpleConversation *)cnv->data;
 		name2 = purple_normalize(account, purple_conversation_get_name(c));
 
-		if (((type == PURPLE_CONV_TYPE_ANY) || (type == purple_conversation_get_type(c))) &&
-				(account == purple_conversation_get_account(c)) &&
+		if ((account == purple_conversation_get_account(c)) &&
 				!purple_utf8_strcasecmp(name1, name2)) {
 
 			break;
--- a/libpurple/idle.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/idle.c	Tue May 06 07:58:54 2008 +0000
@@ -252,7 +252,7 @@
 	PurpleAccount *account;
 
 	account = purple_connection_get_account(gc);
-	set_account_unidle(account);
+	idled_accts = g_list_remove(idled_accts, account);
 }
 
 static void
--- a/libpurple/log.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/log.c	Tue May 06 07:58:54 2008 +0000
@@ -667,6 +667,18 @@
 purple_log_uninit(void)
 {
 	purple_signals_unregister_by_instance(purple_log_get_handle());
+
+	purple_log_logger_remove(html_logger);
+	purple_log_logger_free(html_logger);
+	html_logger = NULL;
+
+	purple_log_logger_remove(txt_logger);
+	purple_log_logger_free(txt_logger);
+	txt_logger = NULL;
+
+	purple_log_logger_remove(old_logger);
+	purple_log_logger_free(old_logger);
+	old_logger = NULL;
 }
 
 /****************************************************************************
--- a/libpurple/notify.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/notify.c	Tue May 06 07:58:54 2008 +0000
@@ -66,35 +66,27 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_message != NULL) {
-		PurpleNotifyInfo *info;
+		void *ui_handle = ops->notify_message(type, title, primary,
+											  secondary);
+		if (ui_handle != NULL) {
 
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_MESSAGE;
-		info->handle    = handle;
-		info->ui_handle = ops->notify_message(type, title, primary,
-											  secondary);
-		info->cb = cb;
-		info->cb_user_data = user_data;
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type = PURPLE_NOTIFY_MESSAGE;
+			info->handle = handle;
+			info->ui_handle = ui_handle;
+			info->cb = cb;
+			info->cb_user_data = user_data;
 
-		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			if (info->cb != NULL)
-				info->cb(info->cb_user_data);
-
-			g_free(info);
-
-			return NULL;
 		}
 
-	} else {
-		if (cb != NULL)
-			cb(user_data);
 	}
 
+	if (cb != NULL)
+		cb(user_data);
+
 	return NULL;
 }
 
@@ -108,36 +100,30 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_email != NULL) {
-		PurpleNotifyInfo *info;
-
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_EMAIL;
-		info->handle    = handle;
+		void *ui_handle;
 
 		purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification",
-							subject, from, to, url);
+						   subject, from, to, url);
+
+		ui_handle = ops->notify_email(handle, subject, from, to, url);
+
+		if (ui_handle != NULL) {
 
-		info->ui_handle = ops->notify_email(handle, subject, from, to, url);
-		info->cb = cb;
-		info->cb_user_data = user_data;
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type = PURPLE_NOTIFY_EMAIL;
+			info->handle = handle;
+			info->ui_handle = ui_handle;
+			info->cb = cb;
+			info->cb_user_data = user_data;
 
-		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			if (info->cb != NULL)
-				info->cb(info->cb_user_data);
-
-			g_free(info);
+		}
+	}
 
-			return NULL;
-		}
-	} else {
-		if (cb != NULL)
-			cb(user_data);
-	}
+	if (cb != NULL)
+		cb(user_data);
 
 	return NULL;
 }
@@ -162,39 +148,32 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_emails != NULL) {
-		PurpleNotifyInfo *info;
-
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_EMAILS;
-		info->handle    = handle;
+		void *ui_handle;
 
 		purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification",
 							subjects, froms, tos, urls, count);
 
-		info->ui_handle = ops->notify_emails(handle, count, detailed, subjects,
+		ui_handle = ops->notify_emails(handle, count, detailed, subjects,
 											 froms, tos, urls);
-		info->cb = cb;
-		info->cb_user_data = user_data;
 
-		if (info->ui_handle != NULL) {
+		if (ui_handle != NULL) {
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type = PURPLE_NOTIFY_EMAILS;
+			info->handle = handle;
+			info->ui_handle = ui_handle;
+			info->cb = cb;
+			info->cb_user_data = user_data;
+
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			if (info->cb != NULL)
-				info->cb(info->cb_user_data);
-
-			g_free(info);
-
-			return NULL;
 		}
 
-	} else {
-		if (cb != NULL)
-			cb(user_data);
 	}
 
+	if (cb != NULL)
+		cb(user_data);
+
 	return NULL;
 }
 
@@ -210,34 +189,25 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_formatted != NULL) {
-		PurpleNotifyInfo *info;
+		void *ui_handle = ops->notify_formatted(title, primary, secondary, text);
+
+		if (ui_handle != NULL) {
 
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_FORMATTED;
-		info->handle    = handle;
-		info->ui_handle = ops->notify_formatted(title, primary, secondary, text);
-		info->cb = cb;
-		info->cb_user_data = user_data;
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type = PURPLE_NOTIFY_FORMATTED;
+			info->handle = handle;
+			info->ui_handle = ui_handle;
+			info->cb = cb;
+			info->cb_user_data = user_data;
 
-		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			if (info->cb != NULL)
-				info->cb(info->cb_user_data);
-
-			g_free(info);
-
-			return NULL;
 		}
-
-	} else {
-		if (cb != NULL)
-			cb(user_data);
 	}
 
+	if (cb != NULL)
+		cb(user_data);
 	return NULL;
 }
 
@@ -252,34 +222,25 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_searchresults != NULL) {
-		PurpleNotifyInfo *info;
+		void *ui_handle = ops->notify_searchresults(gc, title, primary,
+													secondary, results, user_data);
+		if (ui_handle != NULL) {
 
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_SEARCHRESULTS;
-		info->handle    = gc;
-		info->ui_handle = ops->notify_searchresults(gc, title, primary,
-													secondary, results, user_data);
-		info->cb = cb;
-		info->cb_user_data = user_data;
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type      = PURPLE_NOTIFY_SEARCHRESULTS;
+			info->handle    = gc;
+			info->ui_handle = ui_handle;
+			info->cb = cb;
+			info->cb_user_data = user_data;
 
-		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			if (info->cb != NULL)
-				info->cb(info->cb_user_data);
-
-			g_free(info);
+		}
+	}
 
-			return NULL;
-		}
-
-	} else {
-		if (cb != NULL)
-			cb(user_data);
-	}
+	if (cb != NULL)
+		cb(user_data);
 
 	return NULL;
 }
@@ -449,11 +410,7 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_userinfo != NULL) {
-		PurpleNotifyInfo *info;
-
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_USERINFO;
-		info->handle    = gc;
+		void *ui_handle;
 
 		purple_signal_emit(purple_notify_get_handle(), "displaying-userinfo",
 						 purple_connection_get_account(gc), who, user_info);
@@ -461,28 +418,25 @@
 		g_return_val_if_fail(g_utf8_validate(who, -1, NULL), NULL); //yaz
 		g_return_val_if_fail(g_utf8_validate(user_info, -1, NULL), NULL); //yaz
 
-		info->ui_handle = ops->notify_userinfo(gc, who, user_info);
-		info->cb = cb;
-		info->cb_user_data = user_data;
+		ui_handle = ops->notify_userinfo(gc, who, user_info);
+
+		if (ui_handle != NULL) {
 
-		if (info->ui_handle != NULL) {
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type = PURPLE_NOTIFY_USERINFO;
+			info->handle = gc;
+			info->ui_handle = ui_handle;
+			info->cb = cb;
+			info->cb_user_data = user_data;
+
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			if (info->cb != NULL)
-				info->cb(info->cb_user_data);
-
-			g_free(info);
+		}
+	}
 
-			return NULL;
-		}
-
-	} else {
-		if (cb != NULL)
-			cb(user_data);
-	}
+	if (cb != NULL)
+		cb(user_data);
 
 	return NULL;
 }
@@ -708,22 +662,19 @@
 	ops = purple_notify_get_ui_ops();
 
 	if (ops != NULL && ops->notify_uri != NULL) {
-		PurpleNotifyInfo *info;
+
+		void *ui_handle = ops->notify_uri(uri);
+
+		if (ui_handle != NULL) {
 
-		info            = g_new0(PurpleNotifyInfo, 1);
-		info->type      = PURPLE_NOTIFY_URI;
-		info->handle    = handle;
-		info->ui_handle = ops->notify_uri(uri);
+			PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
+			info->type = PURPLE_NOTIFY_URI;
+			info->handle = handle;
+			info->ui_handle = ui_handle;
 
-		if (info->ui_handle != NULL) {
 			handles = g_list_append(handles, info);
 
 			return info->ui_handle;
-
-		} else {
-			g_free(info);
-
-			return NULL;
 		}
 	}
 
--- a/libpurple/plugins/log_reader.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/plugins/log_reader.c	Tue May 06 07:58:54 2008 +0000
@@ -2789,14 +2789,34 @@
 	g_return_val_if_fail(plugin != NULL, FALSE);
 
 	purple_log_logger_remove(adium_logger);
+	purple_log_logger_free(adium_logger);
+	adium_logger = NULL;
+
 #if 0
 	purple_log_logger_remove(fire_logger);
+	purple_log_logger_free(fire_logger);
+	fire_logger = NULL;
+
 	purple_log_logger_remove(messenger_plus_logger);
+	purple_log_logger_free(messenger_plus_logger);
+	messenger_plus_logger = NULL;
 #endif
+
 	purple_log_logger_remove(msn_logger);
+	purple_log_logger_free(msn_logger);
+	msn_logger = NULL;
+
 	purple_log_logger_remove(trillian_logger);
+	purple_log_logger_free(trillian_logger);
+	trillian_logger = NULL;
+
 	purple_log_logger_remove(qip_logger);
+	purple_log_logger_free(qip_logger);
+	qip_logger = NULL;
+
 	purple_log_logger_remove(amsn_logger);
+	purple_log_logger_free(amsn_logger);
+	amsn_logger = NULL;
 
 	return TRUE;
 }
--- a/libpurple/protocols/irc/msgs.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/irc/msgs.c	Tue May 06 07:58:54 2008 +0000
@@ -422,6 +422,11 @@
 		if (!args[0] || !args[1] || !args[2] || !args[3])
 			return;
 
+		if (!purple_roomlist_get_in_progress(irc->roomlist)) {
+			purple_debug_warning("irc", "Buggy server didn't send RPL_LISTSTART.\n");
+			purple_roomlist_set_in_progress(irc->roomlist, TRUE);
+		}
+
 		room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL);
 		purple_roomlist_room_add_field(irc->roomlist, room, args[1]);
 		purple_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10)));
@@ -1015,14 +1020,18 @@
 {
 	PurpleConnection *gc = purple_account_get_connection(irc->account);
 	PurpleConversation *convo;
-	char *nick, *msg;
+	char *nick, *msg, *channel;
 
 	if (!args || !args[0] || !gc)
 		return;
 
-	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
+	/* Undernet likes to :-quote the channel name, for no good reason
+         * that I can see.  This catches that. */
+	channel = (args[0][0] == ':') ? &args[0][1] : args[0];
+
+	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, channel, irc->account);
 	if (!convo) {
-		purple_debug(PURPLE_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]);
+		purple_debug(PURPLE_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", channel);
 		return;
 	}
 
@@ -1033,7 +1042,7 @@
                                       (args[1] && *args[1]) ? ": " : "",
 									  (escaped && *escaped) ? escaped : "");
 		g_free(escaped);
-		purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 		serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)));
 	} else {
--- a/libpurple/protocols/jabber/auth.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/jabber/auth.c	Tue May 06 07:58:54 2008 +0000
@@ -382,6 +382,10 @@
 					if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
 						g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
 					}
+					/* Remove space which separated this mech from the next */
+					if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) {
+						g_string_erase(js->sasl_mechs, 0, 1);	
+					}
 					again = TRUE;
 				}
 
@@ -1112,12 +1116,18 @@
 			if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
 				g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
 			}
+			/* Remove space which separated this mech from the next */
+			if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) {
+				g_string_erase(js->sasl_mechs, 0, 1);	
+			}			
 		}
-
-		sasl_dispose(&js->sasl);
-
-		jabber_auth_start_cyrus(js);
-		return;
+		if (strlen(js->sasl_mechs->str)) {
+			/* If we have remaining mechs to try, do so */
+			sasl_dispose(&js->sasl);
+			
+			jabber_auth_start_cyrus(js);
+			return;
+		}
 	}
 #endif
 	msg = jabber_parse_error(js, packet, &reason);
--- a/libpurple/protocols/jabber/roster.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/jabber/roster.c	Tue May 06 07:58:54 2008 +0000
@@ -329,11 +329,20 @@
 
 	jb = jabber_buddy_find(js, buddy->name, FALSE);
 
+	/*
+	 * For some reason if we're waiting for our subscription request
+	 * to be approved and we try to add the buddy to another group
+	 * then we remove the buddy from the old group.  I don't understand
+	 * the rationale for this, can someone please explain it?  It seems
+	 * like we should pass NULL as the groups parameter to
+	 * jabber_roster_update().
+	 */
 	if(!jb || !(jb->subscription & JABBER_SUB_TO)) {
 		groups = g_slist_append(groups, group->name);
 	}
 
 	jabber_roster_update(js, who, groups);
+	g_slist_free(groups);
 
 	my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
 	if(!strcmp(who, my_bare_jid)) {
--- a/libpurple/protocols/msn/command.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/command.c	Tue May 06 07:58:54 2008 +0000
@@ -121,7 +121,7 @@
 	/* khc: Huh! */
 	/*add payload Length checking*/
 	msn_set_payload_len(cmd);
-	purple_debug_info("MSNP14","get payload len:%d\n",cmd->payload_len);
+	purple_debug_info("MSNP14","get payload len:%" G_GSIZE_FORMAT "\n", cmd->payload_len);
 
 	msn_command_ref(cmd);
 
--- a/libpurple/protocols/msn/contact.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Tue May 06 07:58:54 2008 +0000
@@ -100,56 +100,46 @@
 void
 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who)
 {
-	gchar *nval;
 	g_return_if_fail(state != NULL);
 
-	nval = g_strdup(who);
 	g_free(state->who);
-	state->who = nval;
+	state->who = g_strdup(who);
 }
 
 void
 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid)
 {
-	gchar *nval;
 	g_return_if_fail(state != NULL);
 
-	nval = g_strdup(uid);
 	g_free(state->uid);
-	state->uid = nval;
+	state->uid = g_strdup(uid);
 }
 
 void
 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name)
 {
-	gchar *nval;
 	g_return_if_fail(state != NULL);
 
-	nval = g_strdup(old_group_name);
 	g_free(state->old_group_name);
-	state->old_group_name = nval;
+	state->old_group_name = g_strdup(old_group_name);
 }
 
 void
 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name)
 {
-	gchar *nval;
 	g_return_if_fail(state != NULL);
 
-	nval = g_strdup(new_group_name);
 	g_free(state->new_group_name);
-	state->new_group_name = nval;
+	state->new_group_name = g_strdup(new_group_name);
 }
 
 void
 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid)
 {
-	gchar *nval;
 	g_return_if_fail(state != NULL);
 
-	nval = g_strdup(guid);
 	g_free(state->guid);
-	state->guid = nval;
+	state->guid = g_strdup(guid);
 }
 
 
@@ -495,12 +485,13 @@
 					xmlnode *messenger_enabled;
 					char *is_messenger_enabled = NULL;
 
+					g_free(mobile_number);
 					mobile_number = xmlnode_get_data(number);
 
 					if (mobile_number &&
-						(messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled")) 
-						&& (is_messenger_enabled = xmlnode_get_data(messenger_enabled)) 
-						&& !strcmp(is_messenger_enabled, "true"))
+							(messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled")) 
+							&& (is_messenger_enabled = xmlnode_get_data(messenger_enabled)) 
+							&& !strcmp(is_messenger_enabled, "true"))
 						mobile = TRUE;
 
 					g_free(is_messenger_enabled);
@@ -538,6 +529,7 @@
 		g_free(Name);
 		g_free(uid);
 		g_free(type);
+		g_free(mobile_number);
 		passport = Name = uid = type = mobile_number = NULL;
 		mobile = FALSE;
 
@@ -659,6 +651,7 @@
 	g_free(Name);
 	g_free(uid);
 	g_free(type);
+	g_free(mobile_number);
 }
 
 static gboolean
@@ -691,6 +684,7 @@
 				g_free(errorcode);
 				return TRUE;
 			}
+			g_free(errorcode);
 		}
 
 		return FALSE;
--- a/libpurple/protocols/msn/dialog.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/dialog.c	Tue May 06 07:58:54 2008 +0000
@@ -112,7 +112,7 @@
 
 	data        = g_new0(MsnAddRemData, 1);
 	data->who   = g_strdup(passport);
-	data->group = group_name != NULL ? g_strdup(group_name) : NULL;
+	data->group = g_strdup(group_name);
 	data->gc    = gc;
 
 	msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
--- a/libpurple/protocols/msn/msn.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Tue May 06 07:58:54 2008 +0000
@@ -246,7 +246,7 @@
 	MsnUser *user;
 	char *payload = NULL;
 	const char *mobile_number = NULL;
-	size_t payload_len;
+	gsize payload_len;
 
 	session = gc->proto_data;
 	cmdproc = session->notification->cmdproc;
@@ -261,13 +261,13 @@
 		mobile_number[0] == '+') {
 		/* if msn_user_get_mobile_phone() has a + in front, it's a number
 		   that from the buddy's contact card */
-		trans = msn_transaction_new(cmdproc, "PGD", "tel:%s 1 %d",
+		trans = msn_transaction_new(cmdproc, "PGD", "tel:%s 1 %" G_GSIZE_FORMAT,
 			mobile_number, payload_len);
 	} else {
 		/* otherwise we send to whatever phone number the buddy registered
 		   with msn */
-		trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who,
-			payload_len);
+		trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %" G_GSIZE_FORMAT,
+			who, payload_len);
 	}
 
 	msn_transaction_set_payload(trans, payload, payload_len);
@@ -2095,7 +2095,7 @@
 
 static void
 msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data,
-		const gchar *url_text, size_t len, const gchar *error_message)
+		const gchar *url_text, gsize len, const gchar *error_message)
 {
 	MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data;
 	int id = -1;
@@ -2137,7 +2137,7 @@
 		else
 		{
 			char buf[1024];
-			purple_debug_info("msn", "%s is %d bytes\n", photo_url_text, len);
+			purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT " bytes\n", photo_url_text, len);
 			id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL);
 			g_snprintf(buf, sizeof(buf), "<img id=\"%d\"><br>", id);
 			purple_notify_user_info_prepend_pair(user_info, NULL, buf);
--- a/libpurple/protocols/msn/nexus.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/nexus.c	Tue May 06 07:58:54 2008 +0000
@@ -52,6 +52,7 @@
 	if (nexus->challenge_data != NULL)
 		g_hash_table_destroy(nexus->challenge_data);
 
+	g_free(nexus->challenge_data_str);
 	g_free(nexus);
 }
 
@@ -101,13 +102,10 @@
 			msn_twn_p = g_hash_table_lookup(nexus->challenge_data, "p");
 
 			/*setup the t and p parameter for session*/
-			if (session->passport_info.t != NULL){
-				g_free(session->passport_info.t);
-			}
+			g_free(session->passport_info.t);
 			session->passport_info.t = g_strdup(msn_twn_t);
 
-			if (session->passport_info.p != NULL)
-				g_free(session->passport_info.p);
+			g_free(session->passport_info.p);
 			session->passport_info.p = g_strdup(msn_twn_p);
 
 			cert_str = g_strdup_printf("t=%s&p=%s",msn_twn_t,msn_twn_p);
@@ -133,7 +131,8 @@
 	MsnSession *session = nexus->session;
 	char *ru,*lc,*id,*tw,*ct,*kpp,*kv,*ver,*rn,*tpf;
 	char *fs0,*fs;
-	char *username, *password;
+	const char *username;
+	char *password;
 	char *tail;
 #ifdef NEXUS_LOGIN_TWN
 	char *challenge_str;
@@ -147,7 +146,7 @@
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE);
 
 	/*prepare the Windows Live ID authentication token*/
-	username = g_strdup(purple_account_get_username(session->account));
+	username = purple_account_get_username(session->account);
 	password = g_strndup(purple_connection_get_password(session->account->gc), 16);
 
 	lc =	(char *)g_hash_table_lookup(nexus->challenge_data, "lc");
@@ -170,7 +169,6 @@
 	if(!(lc && id && tw && ru && ct && kpp && kv && ver && tpf)){
 		purple_debug_error("MSN Nexus","WLM Authenticate Key Error!\n");
 		msn_session_set_error(session, MSN_ERROR_AUTH, _("Windows Live ID authentication Failed"));
-		g_free(username);
 		g_free(password);
 		msn_nexus_destroy(nexus);
 		session->nexus = NULL;
--- a/libpurple/protocols/msn/notification.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/notification.c	Tue May 06 07:58:54 2008 +0000
@@ -414,7 +414,9 @@
 	{
 		g_return_if_fail(cmd->payload_cb != NULL);
 
-		purple_debug_info("MSNP14","MSG payload:{%.*s}\n",cmd->payload_len, cmd->payload);
+#if 0 /* glib on win32 doesn't correctly support precision modifiers for a string */
+		purple_debug_info("MSNP14", "MSG payload:{%.*s}\n", cmd->payload_len, cmd->payload);
+#endif
 		cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len);
 	}
 }
@@ -432,10 +434,12 @@
 	cmdproc = session->notification->cmdproc;
 	g_return_if_fail(msg     != NULL);
 	payload = msn_message_gen_payload(msg, &payload_len);
-	purple_debug_info("MSNP14","send UUM,payload{%s},strlen:%d,len:%d\n",
-		payload,strlen(payload),payload_len);
+	purple_debug_info("MSNP14",
+		"send UUM, payload{%s}, strlen:%" G_GSIZE_FORMAT ", len:%" G_GSIZE_FORMAT "\n",
+		payload, strlen(payload), payload_len);
 	type = msg->type;
-	trans = msn_transaction_new(cmdproc, "UUM","%s 32 %d %d",msg->remote_user,type,payload_len);
+	trans = msn_transaction_new(cmdproc, "UUM", "%s 32 %d %" G_GSIZE_FORMAT,
+		msg->remote_user, type, payload_len);
 	msn_transaction_set_payload(trans, payload, strlen(payload));
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
@@ -449,7 +453,7 @@
 	const char *passport;
 	const char *content_type;
 
-	purple_debug_info("MSNP14","Process UBM payload:%.*s\n", len, payload);
+	purple_debug_info("MSNP14","Process UBM payload:%.*s\n", (guint)len, payload);
 	msg = msn_message_new_from_cmd(cmdproc->session, cmd);
 
 	msn_message_parse_payload(msg, payload, len,MSG_LINE_DEM,MSG_BODY_DEM);
@@ -530,7 +534,7 @@
 	}else{
 		g_return_if_fail(cmd->payload_cb != NULL);
 
-		purple_debug_info("MSNP14","UBM payload:{%.*s}\n", cmd->payload_len, cmd->payload);
+		purple_debug_info("MSNP14", "UBM payload:{%.*s}\n", (guint)(cmd->payload_len), cmd->payload);
 		ubm_cmd_post(cmdproc, cmd, cmd->payload, cmd->payload_len);
 	}
 }
@@ -645,8 +649,8 @@
 {
 	MsnTransaction *trans;
 	purple_debug_info("MSN Notification","Sending ADL with payload: %s\n", payload);
-	trans = msn_transaction_new(cmdproc, "ADL","%d", strlen(payload));
-	msn_transaction_set_payload(trans, payload, strlen(payload));
+	trans = msn_transaction_new(cmdproc, "ADL","%" G_GSIZE_FORMAT, payload_len);
+	msn_transaction_set_payload(trans, payload, payload_len);
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
@@ -729,7 +733,7 @@
 	domain = tokens[1];
 
 	payload = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", domain, email);
-	trans = msn_transaction_new(cmdproc, "FQY","%d", strlen(payload));
+	trans = msn_transaction_new(cmdproc, "FQY","%" G_GSIZE_FORMAT, strlen(payload));
 	msn_transaction_set_payload(trans, payload, strlen(payload));
 	msn_cmdproc_send_trans(cmdproc, trans);
 
@@ -1703,6 +1707,9 @@
 		msn_user_set_currentmedia(user, &media);
 	else
 		msn_user_set_currentmedia(user, NULL);
+	g_free(media.title);
+	g_free(media.album);
+	g_free(media.artist);
 	g_free(str);
 
 	msn_user_update(user);
@@ -2070,7 +2077,7 @@
 	xmlnode_free(rml_node);
 
 	purple_debug_info("MSN Notification","Send RML with payload:\n%s\n", payload);
-	trans = msn_transaction_new(cmdproc, "RML","%d", strlen(payload));
+	trans = msn_transaction_new(cmdproc, "RML","%" G_GSIZE_FORMAT, strlen(payload));
 	msn_transaction_set_payload(trans, payload, strlen(payload));
 	msn_cmdproc_send_trans(cmdproc, trans);
 	g_free(payload);
--- a/libpurple/protocols/msn/oim.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/oim.c	Tue May 06 07:58:54 2008 +0000
@@ -58,7 +58,7 @@
 
 	oim = g_new0(MsnOim, 1);
 	oim->session = session;
-	oim->oim_list	= NULL;
+	oim->oim_list = NULL;
 	oim->run_id = rand_guid();
 	oim->challenge = NULL;
 	oim->send_queue = g_queue_new();
@@ -71,16 +71,18 @@
 msn_oim_destroy(MsnOim *oim)
 {
 	MsnOimSendReq *request;
-	
-	purple_debug_info("OIM","destroy the OIM \n");
+
+	purple_debug_info("OIM", "destroy the OIM %p\n", oim);
 	g_free(oim->run_id);
 	g_free(oim->challenge);
-	
+
 	while((request = g_queue_pop_head(oim->send_queue)) != NULL){
 		msn_oim_free_send_req(request);
 	}
+
 	g_queue_free(oim->send_queue);
-	
+	g_list_free(oim->oim_list);
+
 	g_free(oim);
 }
 
@@ -91,7 +93,7 @@
 	MsnOimSendReq *request;
 	
 	request = g_new0(MsnOimSendReq, 1);
-	request->from_member	=g_strdup(from_member);
+	request->from_member	= g_strdup(from_member);
 	request->friendname		= g_strdup(friendname);
 	request->to_member		= g_strdup(to_member);
 	request->oim_msg		= g_strdup(msg);
@@ -170,7 +172,6 @@
 								msg->oim_msg);
 							g_queue_push_head(oim->send_queue, msg);
 							msn_oim_send_msg(oim);
-							return;
 						} else {
 							purple_debug_info("msnoim",
 								"can't find lock key for OIM: %s\n",
@@ -191,9 +192,10 @@
 						purple_debug_info("MSNP14","resending OIM: %s\n", msg->oim_msg);
 						g_queue_push_head(oim->send_queue, msg);
 						msn_oim_send_msg(oim);
-						return;
 					}
 				}
+
+				g_free(faultcode_str);
 			}
 		}
 	}
@@ -472,7 +474,7 @@
 	xmlnode *iu_node;
 	MsnSession *session = oim->session;
 
-	purple_debug_info("MSNP14:OIM", "%s", xmlmsg);
+	purple_debug_info("MSNP14:OIM", "%s\n", xmlmsg);
 
 	node = xmlnode_from_str(xmlmsg, -1);
 	if (strcmp(node->name, "MD") != 0) {
--- a/libpurple/protocols/msn/page.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/page.c	Tue May 06 07:58:54 2008 +0000
@@ -39,14 +39,9 @@
 {
 	g_return_if_fail(page != NULL);
 
-	if (page->body != NULL)
-		g_free(page->body);
-
-	if (page->from_location != NULL)
-		g_free(page->from_location);
-
-	if (page->from_phone != NULL)
-		g_free(page->from_phone);
+	g_free(page->body);
+	g_free(page->from_location);
+	g_free(page->from_phone);
 
 	g_free(page);
 }
--- a/libpurple/protocols/msn/slp.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/slp.c	Tue May 06 07:58:54 2008 +0000
@@ -359,6 +359,7 @@
 			g_free(bin);
 
 			purple_xfer_set_filename(xfer, file_name);
+			g_free(file_name);
 			purple_xfer_set_size(xfer, file_size);
 			purple_xfer_set_init_fnc(xfer, msn_xfer_init);
 			purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
--- a/libpurple/protocols/msn/slpcall.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Tue May 06 07:58:54 2008 +0000
@@ -71,14 +71,9 @@
 	if (slpcall->timer)
 		purple_timeout_remove(slpcall->timer);
 
-	if (slpcall->id != NULL)
-		g_free(slpcall->id);
-
-	if (slpcall->branch != NULL)
-		g_free(slpcall->branch);
-
-	if (slpcall->data_info != NULL)
-		g_free(slpcall->data_info);
+	g_free(slpcall->id);
+	g_free(slpcall->branch);
+	g_free(slpcall->data_info);
 
 	for (e = slpcall->slplink->slp_msgs; e != NULL; )
 	{
--- a/libpurple/protocols/msn/slplink.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/slplink.c	Tue May 06 07:58:54 2008 +0000
@@ -101,11 +101,8 @@
 
 	session = slplink->session;
 
-	if (slplink->local_user != NULL)
-		g_free(slplink->local_user);
-
-	if (slplink->remote_user != NULL)
-		g_free(slplink->remote_user);
+	g_free(slplink->local_user);
+	g_free(slplink->remote_user);
 
 #if 0
 	if (slplink->directconn != NULL)
@@ -598,7 +595,9 @@
 	{
 		if ((offset + len) > slpmsg->size)
 		{
-			purple_debug_error("msn", "Oversized slpmsg - msgsize=%lld offset=%d len=%d\n", slpmsg->size, offset, len);
+			purple_debug_error("msn",
+				"Oversized slpmsg - msgsize=%lld offset=%" G_GSIZE_FORMAT " len=%" G_GSIZE_FORMAT "\n",
+				slpmsg->size, offset, len);
 			g_return_if_reached();
 		}
 		else
--- a/libpurple/protocols/msn/slpmsg.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Tue May 06 07:58:54 2008 +0000
@@ -95,6 +95,7 @@
 		msg->nak_cb = NULL;
 		msg->ack_data = NULL;
 	}
+	g_list_free(slpmsg->msgs);
 
 	slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
 
--- a/libpurple/protocols/msn/soap.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/soap.c	Tue May 06 07:58:54 2008 +0000
@@ -273,7 +273,7 @@
 			case EAGAIN: return len;
 
 			default : purple_debug_error("MSN SOAP", "Read error!"
-						"read len: %d, error = %s\n",
+						"read len: %" G_GSSIZE_FORMAT ", error = %s\n",
 						len, g_strerror(errno));
 				  purple_input_remove(soapconn->input_handler);
 				  //soapconn->input_handler = 0;
@@ -293,7 +293,9 @@
 			soapconn->read_buf[soapconn->read_len] = '\0';
 		}
 		else {
-			purple_debug_error("MSN SOAP", "Failure re-allocating %d bytes of memory!\n", soapconn->read_len + len + 1);
+			purple_debug_error("MSN SOAP",
+				"Failure re-allocating %" G_GSIZE_FORMAT " bytes of memory!\n",
+				soapconn->read_len + len + 1);
 			exit(EXIT_FAILURE);
 		}
 			
@@ -301,7 +303,9 @@
 
 #if defined(MSN_SOAP_DEBUG)
 	if (len > 0)
-		purple_debug_info("MSN SOAP","Read %d bytes from SOAP server:\n%s\n", len, soapconn->read_buf + soapconn->read_len - len);
+		purple_debug_info("MSN SOAP",
+			"Read %" G_GSIZE_FORMAT " bytes from SOAP server:\n%s\n", len,
+			soapconn->read_buf + soapconn->read_len - len);
 #endif
 
 	return len;
@@ -523,7 +527,9 @@
 		soapconn->body_len	= atoi(body_len);
 		g_free(body_len);
 #ifdef MSN_SOAP_DEBUG
-		purple_debug_misc("MSN SOAP","SOAP bytes read so far: %d, Content-Length: %d\n", soapconn->read_len, soapconn->body_len);
+		purple_debug_misc("MSN SOAP",
+			"SOAP bytes read so far: %" G_GSIZE_FORMAT ", Content-Length: %d\n",
+			soapconn->read_len, soapconn->body_len);
 #endif
 		soapconn->need_to_read = (body_start - soapconn->read_buf + soapconn->body_len) - soapconn->read_len;
 		if ( soapconn->need_to_read > 0 ) {
--- a/libpurple/protocols/msn/soap2.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/soap2.c	Tue May 06 07:58:54 2008 +0000
@@ -261,7 +261,7 @@
 static void
 msn_soap_read_cb(gpointer data, gint fd, PurpleInputCondition cond)
 {
-    MsnSoapConnection *conn = data;
+	MsnSoapConnection *conn = data;
 	int count = 0, cnt;
 	char buf[8192];
 	char *linebreak;
@@ -382,7 +382,7 @@
 	}
 
 	if (!handled && conn->headers_done) {
-		if (conn->buf->len - conn->handled_len >= 
+		if (conn->buf->len - conn->handled_len >=
 			conn->body_len) {
 			xmlnode *node = xmlnode_from_str(cursor, conn->body_len);
 
@@ -394,8 +394,11 @@
 				conn->message = NULL;
 				message->xml = node;
 
-				if (!msn_soap_handle_body(conn, message))
+				if (!msn_soap_handle_body(conn, message)) {
+					msn_soap_message_destroy(message);
 					return;
+				}
+				msn_soap_message_destroy(message);
 			}
 
 			msn_soap_connection_handle_next(conn);
@@ -508,7 +511,7 @@
 
 			g_free(authstr);
 			g_free(body);
-		}		
+		}
 	}
 
 	return FALSE;
@@ -643,12 +646,12 @@
 }
 
 void
-msn_soap_message_add_header(MsnSoapMessage *req,
+msn_soap_message_add_header(MsnSoapMessage *message,
 		const char *name, const char *value)
 {
 	char *header = g_strdup_printf("%s: %s\r\n", name, value);
 
-	req->headers = g_slist_prepend(req->headers, header);
+	message->headers = g_slist_prepend(message->headers, header);
 }
 
 static void
--- a/libpurple/protocols/msn/state.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/state.c	Tue May 06 07:58:54 2008 +0000
@@ -87,7 +87,8 @@
 msn_parse_currentmedia(const char *cmedia, CurrentMedia *media)
 {
 	char **cmedia_array;
-	int strings;
+	int strings = 0;
+	gboolean parsed = FALSE;
 
 	if ((cmedia == NULL) || (*cmedia == '\0')) {
 		purple_debug_info("msn", "No currentmedia string\n");
@@ -108,31 +109,39 @@
 	 * 6: Album
 	 * 7: ?
 	 */
-	strings = 0;
+#if GLIB_CHECK_VERSION(2,6,0)
+	strings  = g_strv_length(cmedia_array);
+#else
 	while (cmedia_array[++strings] != NULL);
+#endif
+
+	if (strings >= 4 && !strcmp(cmedia_array[2], "1")) {
+		parsed = TRUE;
 
-	if (strings < 4)
-		return FALSE;
-	if (strcmp(cmedia_array[2], "1"))
-		return FALSE;
+		g_free(media->title);
+		if (strings == 4) {
+			media->title = g_strdup(cmedia_array[3]);
+		} else {
+			media->title = g_strdup(cmedia_array[4]);
+		}
 
-	if (strings == 4) {
-		media->title = g_strdup(cmedia_array[3]);
-	} else {
-		media->title = g_strdup(cmedia_array[4]);
+		g_free(media->artist);
+		if (strings > 5)
+			media->artist = g_strdup(cmedia_array[5]);
+		else
+			media->artist = NULL;
+
+		g_free(media->album);
+		if (strings > 6)
+			media->album = g_strdup(cmedia_array[6]);
+		else
+			media->album = NULL;
+
 	}
 
-	if (strings > 5)
-		media->artist = g_strdup(cmedia_array[5]);
-	else
-		media->artist = NULL;
+	g_strfreev(cmedia_array);
 
-	if (strings > 6)
-		media->album = g_strdup(cmedia_array[6]);
-	else
-		media->album = NULL;
-
-	return TRUE;
+	return parsed;
 }
 
 /* get the CurrentMedia info from the XML string */
@@ -241,7 +250,7 @@
 
 	payload = session->psm;
 	purple_debug_misc("MSNP14","Sending UUX command with payload: %s\n",payload);
-	trans = msn_transaction_new(cmdproc, "UUX", "%d", strlen(payload));
+	trans = msn_transaction_new(cmdproc, "UUX", "%" G_GSIZE_FORMAT, strlen(payload));
 	msn_transaction_set_payload(trans, payload, strlen(payload));
 	msn_cmdproc_send_trans(cmdproc, trans);
 
--- a/libpurple/protocols/msn/switchboard.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Tue May 06 07:58:54 2008 +0000
@@ -544,7 +544,7 @@
 	msn_message_show_readable(msg, "SB SEND", FALSE);
 #endif
 
-	trans = msn_transaction_new(cmdproc, "MSG", "%c %d",
+	trans = msn_transaction_new(cmdproc, "MSG", "%c %" G_GSIZE_FORMAT,
 								msn_message_get_flag(msg), payload_len);
 
 	/* Data for callbacks */
--- a/libpurple/protocols/msn/sync.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/sync.c	Tue May 06 07:58:54 2008 +0000
@@ -156,16 +156,13 @@
 
 		for (c = tokens; *c != NULL; c++)
 		{
-			char *id;
-
-			id = *c;
-			group_ids = g_slist_append(group_ids, g_strdup(id));
+			group_ids = g_slist_append(group_ids, *c);
 		}
 
-		g_strfreev(tokens);
 
 		msn_got_lst_user(session, user, list_op, group_ids);
 
+		g_strfreev(tokens);
 		g_slist_free(group_ids);
 	}
 	else
--- a/libpurple/protocols/msn/userlist.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/msn/userlist.c	Tue May 06 07:58:54 2008 +0000
@@ -349,8 +349,7 @@
 		GSList *c;
 		for (c = group_ids; c != NULL; c = g_slist_next(c))
 		{
-			char *group_id;
-			group_id = c->data;
+			char *group_id = c->data;
 			msn_user_add_group_id(user, group_id);
 		}
 
--- a/libpurple/protocols/sametime/sametime.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Tue May 06 07:58:54 2008 +0000
@@ -1233,6 +1233,7 @@
   }
 
   mwSametimeList_free(stlist);
+  mwGetBuffer_free(b);
 }
 
 
--- a/libpurple/protocols/silc/buddy.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/buddy.c	Tue May 06 07:58:54 2008 +0000
@@ -52,13 +52,13 @@
 			   _("User %s is not present in the network"), r->nick);
 		purple_notify_error(gc, _("Key Agreement"),
 				  _("Cannot perform the key agreement"), tmp);
-		silc_free(r->nick);
+		g_free(r->nick);
 		silc_free(r);
 		return;
 	}
 
 	silcpurple_buddy_keyagr_do(gc, r->nick, FALSE);
-	silc_free(r->nick);
+	g_free(r->nick);
 	silc_free(r);
 }
 
@@ -276,7 +276,7 @@
 	}
 
  out:
-	silc_free(a->hostname);
+	g_free(a->hostname);
 	silc_free(a);
 }
 
@@ -309,7 +309,7 @@
 	a->conn = conn;
 	a->client_id = client_entry->id;
 	if (hostname)
-		a->hostname = strdup(hostname);
+		a->hostname = g_strdup(hostname);
 	a->port = port;
 
 	purple_request_action(client->application, _("Key Agreement Request"), tmp,
@@ -416,7 +416,7 @@
 	}
 
 	silcpurple_buddy_privkey(client->application, context);
-	silc_free(context);
+	g_free(context);
 }
 
 static void
@@ -544,7 +544,7 @@
 	}
 
 	silcpurple_buddy_getkey(client->application, context);
-	silc_free(context);
+	g_free(context);
 }
 
 static void
--- a/libpurple/protocols/silc/chat.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/chat.c	Tue May 06 07:58:54 2008 +0000
@@ -92,7 +92,7 @@
 {
 	SilcPurple sg = gc->proto_data;
 	const char *chname;
-	char *buf, tmp[256], *tmp2;
+	char tmp[256], *tmp2;
 	GString *s;
 	SilcChannelEntry channel;
 	SilcHashTableList htl;
@@ -173,9 +173,8 @@
 		}
 	}
 
-	buf = g_string_free(s, FALSE);
-	purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, buf, NULL, NULL);
-	g_free(buf);
+	purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, s->str, NULL, NULL);
+	g_string_free(s, TRUE);
 }
 
 
@@ -689,17 +688,20 @@
 
 	if (!limit || !(*limit) || *limit == '0') {
 		if (limit && ulimit == channel->user_limit) {
+			g_free(s->channel);
 			silc_free(s);
 			return;
 		}
 		silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE",
 					 s->channel, "-l", NULL);
 
+		g_free(s->channel);
 		silc_free(s);
 		return;
 	}
 
 	if (ulimit == channel->user_limit) {
+		g_free(s->channel);
 		silc_free(s);
 		return;
 	}
@@ -708,6 +710,7 @@
 	silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE",
 				 s->channel, "+l", limit, NULL);
 
+	g_free(s->channel);
 	silc_free(s);
 }
 
--- a/libpurple/protocols/silc/ft.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/ft.c	Tue May 06 07:58:54 2008 +0000
@@ -424,12 +424,12 @@
 			   (const char *)context);
 		purple_notify_error(gc, _("Secure File Transfer"),
 				  _("Cannot send file"), tmp);
-		silc_free(context);
+		g_free(context);
 		return;
 	}
 
 	silcpurple_ftp_send_file(client->application, (const char *)context, NULL);
-	silc_free(context);
+	g_free(context);
 }
 
 PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name)
@@ -447,7 +447,7 @@
 	if (!clients) {
 		silc_client_get_clients(client, conn, name, NULL,
 					silcpurple_ftp_send_file_resolved,
-					strdup(name));
+					g_strdup(name));
 		return NULL;
 	}
 	silc_dlist_start(clients);
--- a/libpurple/protocols/silc/ops.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/ops.c	Tue May 06 07:58:54 2008 +0000
@@ -462,7 +462,7 @@
 			client_entry = va_arg(va, SilcClientEntry);
 
 			components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-			g_hash_table_insert(components, strdup("channel"), strdup(name));
+			g_hash_table_insert(components, g_strdup("channel"), g_strdup(name));
 			serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components);
 		}
 		break;
@@ -484,7 +484,7 @@
 		g_snprintf(buf, sizeof(buf), "%s@%s",
 			   client_entry->username, client_entry->hostname);
 		purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo),
-					  g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE);
+					  client_entry->nickname, buf, PURPLE_CBFLAGS_NONE, TRUE);
 
 		break;
 
@@ -974,7 +974,6 @@
 {
 	SilcAttributePayload attr;
 	SilcAttribute attribute;
-	char *buf;
 	GString *s;
 	SilcVCardStruct vcard;
 	int i;
@@ -1064,10 +1063,9 @@
 		}
 	}
 
-	buf = g_string_free(s, FALSE);
 	purple_notify_info(NULL, _("User Information"), _("User Information"),
-			 buf);
-	g_free(buf);
+			 s->str);
+	g_string_free(s, TRUE);
 }
 #endif
 
@@ -1133,7 +1131,7 @@
 			    f |= PURPLE_CBFLAGS_FOUNDER;
 			  if (chu->mode & SILC_CHANNEL_UMODE_CHANOP)
 			    f |= PURPLE_CBFLAGS_OP;
-			  users = g_list_append(users, g_strdup(chu->client->nickname));
+			  users = g_list_append(users, chu->client->nickname);
 			  flags = g_list_append(flags, GINT_TO_POINTER(f));
 
 			  if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) {
--- a/libpurple/protocols/silc/pk.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/pk.c	Tue May 06 07:58:54 2008 +0000
@@ -56,9 +56,9 @@
 					  SILC_PKCS_FILE_BASE64);
 	}
 
-	silc_free(verify->filename);
-	silc_free(verify->entity);
-	silc_free(verify->entity_name);
+	g_free(verify->filename);
+	g_free(verify->entity);
+	g_free(verify->entity_name);
 	silc_free(verify->fingerprint);
 	silc_free(verify->babbleprint);
 	silc_pkcs_public_key_free(verify->public_key);
@@ -211,10 +211,10 @@
 		return;
 	verify->client = client;
 	verify->conn = conn;
-	verify->filename = strdup(ipf);
-	verify->entity = strdup(entity);
+	verify->filename = g_strdup(ipf);
+	verify->entity = g_strdup(entity);
 	verify->entity_name = (conn_type != SILC_CONN_CLIENT ?
-			       (name ? strdup(name) : strdup(hostname))
+			       (name ? g_strdup(name) : g_strdup(hostname))
 			       : NULL);
 	verify->public_key = silc_pkcs_public_key_copy(public_key);
 	verify->completion = completion;
@@ -262,9 +262,9 @@
 		/* Local copy matched */
 		if (completion)
 			completion(TRUE, context);
-		silc_free(verify->filename);
-		silc_free(verify->entity);
-		silc_free(verify->entity_name);
+		g_free(verify->filename);
+		g_free(verify->entity);
+		g_free(verify->entity_name);
 		silc_free(verify->fingerprint);
 		silc_free(verify->babbleprint);
 		silc_pkcs_public_key_free(verify->public_key);
--- a/libpurple/protocols/silc/silc.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/silc.c	Tue May 06 07:58:54 2008 +0000
@@ -575,7 +575,7 @@
 
 	username = (char *)purple_account_get_username(account);
 	up = g_strsplit(username, "@", 2);
-	username = strdup(up[0]);
+	username = g_strdup(up[0]);
 	g_strfreev(up);
 
 	if (!purple_account_get_user_info(account)) {
@@ -619,12 +619,12 @@
 		                             _("Cannot initialize SILC protocol"));
 		gc->proto_data = NULL;
 		silc_free(sg);
-		free(hostname);
-		free(username);
+		silc_free(hostname);
+		g_free(username);
 		return;
 	}
-	free(hostname);
-	free(username);
+	silc_free(hostname);
+	g_free(username);
 
 	/* Check the ~/.silc dir and create it, and new key pair if necessary. */
 	if (!silcpurple_check_silc_dir(gc)) {
@@ -2111,6 +2111,15 @@
 	NULL
 };
 
+#if 0
+static SilcBool silcpurple_debug_cb(char *file, char *function, int line,
+		char *message, void *context)
+{
+	purple_debug_info("SILC", "%s:%d:%s - %s\n", file ? file : "(null)", line, function ? function : "(null)", message ? message : "(null)");
+	return TRUE;
+}
+#endif
+
 static void
 init_plugin(PurplePlugin *plugin)
 {
@@ -2189,6 +2198,8 @@
 #if 0
 silc_log_debug(TRUE);
 silc_log_set_debug_string("*client*");
+silc_log_quick(TRUE);
+silc_log_set_debug_callbacks(silcpurple_debug_cb, NULL, NULL, NULL);
 #endif
 
 }
--- a/libpurple/protocols/silc/util.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/silc/util.c	Tue May 06 07:58:54 2008 +0000
@@ -338,7 +338,6 @@
 	unsigned char *pk;
 	SilcUInt32 pk_len, key_len = 0;
 	GString *s;
-	char *buf;
 
 	/* We support showing only SILC public keys for now */
 	if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC)
@@ -380,14 +379,12 @@
 	g_string_append_printf(s, _("Public Key Fingerprint:\n%s\n\n"), fingerprint);
 	g_string_append_printf(s, _("Public Key Babbleprint:\n%s"), babbleprint);
 
-	buf = g_string_free(s, FALSE);
-
 	purple_request_action(sg->gc, _("Public Key Information"),
 			      _("Public Key Information"),
-			      buf, 0, purple_connection_get_account(sg->gc),
+			      s->str, 0, purple_connection_get_account(sg->gc),
 			      NULL, NULL, context, 1, _("Close"), callback);
 
-	g_free(buf);
+	g_string_free(s, TRUE);
 	silc_free(fingerprint);
 	silc_free(babbleprint);
 	silc_free(pk);
@@ -545,8 +542,7 @@
 			g_string_append_printf(s, "[%s] ", _("Anxious"));
 	}
 	if (strlen(s->str)) {
-		*moodstr = s->str;
-		g_string_free(s, FALSE);
+		*moodstr = g_string_free(s, FALSE);
 		g_strchomp(*moodstr);
 	} else
 		g_string_free(s, TRUE);
@@ -575,8 +571,7 @@
 			g_string_append_printf(s, "[%s] ", _("Video Conferencing"));
 	}
 	if (strlen(s->str)) {
-		*contactstr = s->str;
-		g_string_free(s, FALSE);
+		*contactstr = g_string_free(s, FALSE);
 		g_strchomp(*contactstr);
 	} else
 		g_string_free(s, TRUE);
@@ -604,10 +599,9 @@
 				device.model ? device.model : "",
 				device.language ? device.language : "");
 	}
-	if (strlen(s->str)) {
-		*devicestr = s->str;
-		g_string_free(s, FALSE);
-	} else
+	if (strlen(s->str))
+		*devicestr = g_string_free(s, FALSE);
+	else
 		g_string_free(s, TRUE);
 
 	attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_TIMEZONE);
@@ -635,15 +629,15 @@
 	if (!ct)
 		return NULL;
 	else if (!g_ascii_strcasecmp(".png", ct))
-		return strdup("image/png");
+		return g_strdup("image/png");
 	else if (!g_ascii_strcasecmp(".jpg", ct))
-		return strdup("image/jpeg");
+		return g_strdup("image/jpeg");
 	else if (!g_ascii_strcasecmp(".jpeg", ct))
-		return strdup("image/jpeg");
+		return g_strdup("image/jpeg");
 	else if (!g_ascii_strcasecmp(".gif", ct))
-		return strdup("image/gif");
+		return g_strdup("image/gif");
 	else if (!g_ascii_strcasecmp(".tiff", ct))
-		return strdup("image/tiff");
+		return g_strdup("image/tiff");
 
 	return NULL;
 }
@@ -705,7 +699,7 @@
 				continue;
 			}
 			silc_mime_add_field(p, "Content-Type", type);
-			silc_free(type);
+			g_free(type);
 
 			/* Add content transfer encoding */
 			silc_mime_add_field(p, "Content-Transfer-Encoding", "binary");
--- a/libpurple/protocols/yahoo/yahoo.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Tue May 06 07:58:54 2008 +0000
@@ -3492,9 +3492,12 @@
 {
 	PurpleConnection *gc = user_data;
 	gboolean set_cookie = FALSE;
-	char *url;
+	gchar *url;
+	struct yahoo_data *yd = gc->proto_data;
 
 	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
+	
+	yd->url_datas = g_slist_remove(yd->url_datas, url_data);
 
 	if (error_message != NULL)
 		purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message);
@@ -3509,7 +3512,6 @@
 	}
 
 	if (!set_cookie) {
-		struct yahoo_data *yd = gc->proto_data;
 		purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n");
 		url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
 	}
@@ -3553,7 +3555,9 @@
 
 	g_free(request);
 
-	if (url_data == NULL) {
+	if (url_data != NULL)
+		yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
+	else {
 		const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
 		purple_debug_error("yahoo",
 				   "Unable to request mail login token; forwarding to login screen.");
--- a/libpurple/protocols/yahoo/yahoo_aliases.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_aliases.c	Tue May 06 07:58:54 2008 +0000
@@ -32,6 +32,7 @@
 #include "version.h"
 #include "yahoo.h"
 #include "yahoo_aliases.h"
+#include "yahoo_friend.h"
 #include "yahoo_packet.h"
 
 /* I hate hardcoding this stuff, but Yahoo never sends us anything to use.  Someone in the know may be able to tweak this URL */
@@ -68,8 +69,10 @@
 		purple_debug_info("yahoo", "No Aliases to process.%s%s\n",
 						  error_message ? " Error:" : "", error_message ? error_message : "");
 	} else {
-		const char *yid, *full_name, *nick_name, *alias, *id, *fn, *ln, *nn;
-		PurpleBuddy *b = NULL;
+		gchar *full_name, *nick_name, *alias;
+		const char *yid, *id, *fn, *ln, *nn;
+		YahooFriend *f;
+		PurpleBuddy *b;
 		xmlnode *item, *contacts;
 
 		/* Put our web response into a xmlnode for easy management */
@@ -92,7 +95,9 @@
 				nn = xmlnode_get_attrib(item,"nn");
 				id = xmlnode_get_attrib(item,"id");
 
-		                /* Yahoo stores first and last names separately, lets put them together into a full name */
+				full_name = nick_name = alias = NULL;
+
+				/* Yahoo stores first and last names separately, lets put them together into a full name */
 				if (yd->jp)
 					full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : "")));
 				else
@@ -103,22 +108,14 @@
 					alias = nick_name;   /* If we have a nickname from Yahoo, let's use it */
 				else if (strlen(full_name) != 0)
 					alias = full_name;  /* If no Yahoo nickname, we can use the full_name created above */
-				else
-					alias = NULL;  /* No nickname, first name or last name, then you get no alias !!  */
 
 				/*  Find the local buddy that matches */
+				f = yahoo_friend_find(cb->gc, yid);
 				b = purple_find_buddy(cb->gc->account, yid);
 
 				/*  If we don't find a matching buddy, ignore the alias !!  */
-				if (b != NULL) {
-					/* Create an object that we can attach to the buddies proto_data pointer */
-					struct YahooUser *yu;
-					yu = g_new0(struct YahooUser, 1);
-					yu->id = g_strdup(id);
-					yu->firstname = g_strdup(fn);
-					yu->lastname = g_strdup(ln);
-					yu->nickname = g_strdup(nn);
-					b->proto_data=yu;
+				if (f != NULL && b != NULL) {
+					yahoo_friend_set_alias_id(f, id);
 
 					/* Finally, if we received an alias, we better update the buddy list */
 					if (alias != NULL) {
@@ -132,6 +129,9 @@
 				} else {
 					purple_debug_info("yahoo", "Bizarre, received alias for %s, but they are not on your list...\n", yid);
 				}
+
+				g_free(full_name);
+				g_free(nick_name);
 			}
 		}
 		xmlnode_free(contacts);
@@ -232,14 +232,13 @@
 yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias)
 {
 	struct yahoo_data *yd;
-	struct YahooUser *yu;
 	char *content, *url, *request, *webpage, *webaddress, *strtmp;
 	char *escaped_alias, *alias_jp, *converted_alias_jp;
 	int inttmp;
 	struct callback_data *cb;
-	PurpleBuddy *buddy;
 	PurpleUtilFetchUrlData *url_data;
 	gboolean use_whole_url = FALSE;
+	YahooFriend *f;
 
 	/* use whole URL if using HTTP Proxy */
 	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
@@ -249,20 +248,19 @@
 	g_return_if_fail(who != NULL);
 	g_return_if_fail(gc != NULL);
 
-	purple_debug_info("yahoo", "Sending '%s' as new alias for user '%s'.\n",alias, who);
+	purple_debug_info("yahoo", "Sending '%s' as new alias for user '%s'.\n", alias, who);
 
-	buddy = purple_find_buddy(gc->account, who);
-	if (buddy == NULL || buddy->proto_data == NULL) {
+	f = yahoo_friend_find(gc, who);
+	if (f == NULL) {
 		purple_debug_info("yahoo", "Missing proto_data (get_yahoo_aliases must have failed), bailing out\n");
 		return;
 	}
 
 	yd = gc->proto_data;
-	yu = buddy->proto_data;
 
 	/* Using callback_data so I have access to gc in the callback function */
 	cb = g_new0(struct callback_data, 1);
-	cb->id = g_strdup(yu->id);
+	cb->id = g_strdup(yahoo_friend_get_alias_id(f));
 	cb->gc = gc;
 
 	/*  Build all the info to make the web request */
@@ -274,7 +272,7 @@
 		converted_alias_jp = yahoo_convert_to_numeric(alias_jp);
 		content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n"
 		                          "<ct e=\"1\"  yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
-		                          gc->account->username, who, yu->id, converted_alias_jp);
+		                          gc->account->username, who, yahoo_friend_get_alias_id(f), converted_alias_jp);
 		free(converted_alias_jp);
 		g_free(alias_jp);
 	}
@@ -282,7 +280,7 @@
 		escaped_alias = g_markup_escape_text(alias, strlen(alias));
 		content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"1\">\n"
 		                          "<ct e=\"1\"  yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
-		                          gc->account->username, who, yu->id, escaped_alias);
+		                          gc->account->username, who, yahoo_friend_get_alias_id(f), escaped_alias);
 		g_free(escaped_alias);
 	}
 
--- a/libpurple/protocols/yahoo/yahoo_aliases.h	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_aliases.h	Tue May 06 07:58:54 2008 +0000
@@ -33,18 +33,6 @@
 #include "yahoo.h"
 #include "yahoo_packet.h"
 
-
-/**
- * The additional protocol specific info attached to each buddy.  We need
- * to store the unique numeric id number to allow us to push alias changes.
- */
-struct YahooUser
-{
-    const char *id;             /* The yahoo accountid for this buddy (not YahooID but numeric value) */
-    char *firstname;            /* Storing this information for no real reason, just because */
-    char *lastname;             /* Storing this information for no real reason, just because */
-    char *nickname;             /* Storing this information for no real reason, just because */
-};
-
 void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias);
 void yahoo_fetch_aliases(PurpleConnection *gc);
+
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Tue May 06 07:58:54 2008 +0000
@@ -1003,6 +1003,7 @@
 	url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a);
 	if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) {
 		purple_xfer_cancel_remote(xfer);
+		g_free(url);
 		return;
 	}
 	g_free(url);
--- a/libpurple/protocols/yahoo/yahoo_friend.c	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_friend.c	Tue May 06 07:58:54 2008 +0000
@@ -76,8 +76,7 @@
 
 void yahoo_friend_set_ip(YahooFriend *f, const char *ip)
 {
-	if (f->ip)
-		g_free(f->ip);
+	g_free(f->ip);
 	f->ip = g_strdup(ip);
 }
 
@@ -88,8 +87,7 @@
 
 void yahoo_friend_set_game(YahooFriend *f, const char *game)
 {
-	if (f->game)
-		g_free(f->game);
+	g_free(f->game);
 
 	if (game)
 		f->game = g_strdup(game);
@@ -104,8 +102,7 @@
 
 void yahoo_friend_set_status_message(YahooFriend *f, char *msg)
 {
-	if (f->msg)
-		g_free(f->msg);
+	g_free(f->msg);
 
 	f->msg = msg;
 }
@@ -125,15 +122,24 @@
 	return !f->bicon_sent_request;
 }
 
+void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id)
+{
+	g_free(f->alias_id);
+	f->alias_id = g_strdup(alias_id);
+}
+
+const char *yahoo_friend_get_alias_id(YahooFriend *f)
+{
+	return f->alias_id;
+}
+
 void yahoo_friend_free(gpointer p)
 {
 	YahooFriend *f = p;
-	if (f->msg)
-		g_free(f->msg);
-	if (f->game)
-		g_free(f->game);
-	if (f->ip)
-		g_free(f->ip);
+	g_free(f->msg);
+	g_free(f->game);
+	g_free(f->ip);
+	g_free(f->alias_id);
 	g_free(f);
 }
 
--- a/libpurple/protocols/yahoo/yahoo_friend.h	Tue May 06 07:51:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_friend.h	Tue May 06 07:58:54 2008 +0000
@@ -39,16 +39,17 @@
  */
 typedef struct _YahooFriend {
 	enum yahoo_status status;
-	char *msg;
-	char *game;
+	gchar *msg;
+	gchar *game;
 	int idle;
 	int away;
 	gboolean sms;
-	char *ip;
+	gchar *ip;
 	gboolean bicon_sent_request;
 	YahooPresenceVisibility presence;
 	int protocol; /* 1=LCS, 2=MSN*/
 	long int version_id;
+	gchar *alias_id;
 } YahooFriend;
 
 YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name);
@@ -63,6 +64,9 @@
 void yahoo_friend_set_status_message(YahooFriend *f, char *msg);
 const char *yahoo_friend_get_status_message(YahooFriend *f);
 
+void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id);
+const char *yahoo_friend_get_alias_id(YahooFriend *f);
+
 void yahoo_friend_set_buddy_icon_need_request(YahooFriend *f, gboolean needs);
 gboolean yahoo_friend_get_buddy_icon_need_request(YahooFriend *f);
 
--- a/pidgin/gtkaccount.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtkaccount.c	Tue May 06 07:58:54 2008 +0000
@@ -511,10 +511,6 @@
 			gtk_entry_set_text(GTK_ENTRY(dialog->password_entry),
 							   purple_account_get_password(dialog->account));
 
-		if (purple_account_get_alias(dialog->account))
-			gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry),
-							   purple_account_get_alias(dialog->account));
-
 		gtk_toggle_button_set_active(
 				GTK_TOGGLE_BUTTON(dialog->remember_pass_check),
 				purple_account_get_remember_password(dialog->account));
@@ -635,6 +631,10 @@
 		gpointer data = NULL;
 		size_t len = 0;
 
+		if (purple_account_get_alias(dialog->account))
+			gtk_entry_set_text(GTK_ENTRY(dialog->alias_entry),
+							   purple_account_get_alias(dialog->account));
+
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->new_mail_check),
 					     purple_account_get_check_mail(dialog->account));
 
--- a/pidgin/gtkblist.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtkblist.c	Tue May 06 07:58:54 2008 +0000
@@ -685,8 +685,8 @@
 
 	g_list_free(parts);
 
-	purple_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."),
-			fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL,
+	purple_request_fields(NULL, _("Edit Chat"), NULL, _("Please update the necessary fields."),
+			fields, _("Save"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL,
 			NULL, NULL, NULL,
 			chat);
 }
--- a/pidgin/gtkconv.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtkconv.c	Tue May 06 07:58:54 2008 +0000
@@ -3121,7 +3121,7 @@
 	{ N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "<CheckItem>", NULL },
 	{ "/Options/sep0", NULL, NULL, 0, "<Separator>", NULL },
 	{ N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL },
-	{ N_("/Options/Show Ti_mestamps"), "F2", menu_timestamps_cb, 0, "<CheckItem>", NULL },
+	{ N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "<CheckItem>", NULL },
 };
 
 static const int menu_item_count =
@@ -4053,11 +4053,10 @@
 }
 
 static void
-tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial,
+tab_complete_process_item(int *most_matched, char *entered, gsize entered_bytes, char **partial, char *nick_partial,
 				  GList **matches, gboolean command, char *name)
 {
-	strncpy(nick_partial, name, strlen(entered));
-	nick_partial[strlen(entered)] = '\0';
+	memcpy(nick_partial, name, entered_bytes);
 	if (purple_utf8_strcasecmp(nick_partial, entered))
 		return;
 
@@ -4102,6 +4101,7 @@
 	const char *prefix;
 	GList *matches = NULL;
 	gboolean command = FALSE;
+	gsize entered_bytes = 0;
 
 	gtkconv = PIDGIN_CONVERSATION(conv);
 
@@ -4121,19 +4121,24 @@
 	/* if we're at the end of ": " we need to move back 2 spaces */
 	start = strlen(text) - 1;
 
-	if (strlen(text) >= 2 && !strncmp(&text[start-1], ": ", 2)) {
+	if (start >= 1 && !strncmp(&text[start-1], ": ", 2)) {
 		gtk_text_iter_backward_chars(&word_start, 2);
-		start-=2;
-	}
-
-	/* find the start of the word that we're tabbing */
-	while (start >= 0 && text[start] != ' ') {
-		gtk_text_iter_backward_char(&word_start);
-		start--;
+	}
+
+	/* find the start of the word that we're tabbing.
+	 * Using gtk_text_iter_backward_word_start won't work, because a nick can contain
+	 * characters (e.g. '.', '/' etc.) that Pango may think are word separators. */
+	while (gtk_text_iter_backward_char(&word_start)) {
+		if (gtk_text_iter_get_char(&word_start) == ' ') {
+			/* Reached the whitespace before the start of the word. Move forward once */
+			gtk_text_iter_forward_char(&word_start);
+			break;
+		}
 	}
 
 	prefix = pidgin_get_cmd_prefix();
-	if (start == -1 && (strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
+	if (gtk_text_iter_get_offset(&word_start) == 0 &&
+			(strlen(text) >= strlen(prefix)) && !strncmp(text, prefix, strlen(prefix))) {
 		command = TRUE;
 		gtk_text_iter_forward_chars(&word_start, strlen(prefix));
 	}
@@ -4142,13 +4147,14 @@
 
 	entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start,
 									   &cursor, FALSE);
+	entered_bytes = strlen(entered);
 
 	if (!g_utf8_strlen(entered, -1)) {
 		g_free(entered);
 		return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE;
 	}
 
-	nick_partial = g_malloc(strlen(entered)+1);
+	nick_partial = g_malloc0(entered_bytes + 1);
 
 	if (command) {
 		GList *list = purple_cmd_list(conv);
@@ -4156,7 +4162,7 @@
 
 		/* Commands */
 		for (l = list; l != NULL; l = l->next) {
-			tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
+			tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
 									  &matches, TRUE, l->data);
 		}
 		g_list_free(list);
@@ -4169,7 +4175,7 @@
 
 		/* Users */
 		for (; l != NULL; l = l->next) {
-			tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
+			tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
 									  &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name);
 		}
 
@@ -4187,7 +4193,7 @@
 						   -1);
 
 				if (name && alias && strcmp(name, alias))
-					tab_complete_process_item(&most_matched, entered, &partial, nick_partial,
+					tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
 										  &matches, FALSE, alias);
 				g_free(name);
 				g_free(alias);
@@ -4526,7 +4532,10 @@
 	GdkRectangle oneline;
 	int height, diff;
 	int pad_top, pad_inside, pad_bottom;
-	int max_height = gtkconv->tab_cont->allocation.height / 2;
+	int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height);
+	int max_height = total_height / 2;
+	int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines");
+	int min_height;
 
 	pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
 	pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry));
@@ -4547,15 +4556,14 @@
 	} while (gtk_text_iter_forward_line(&iter));
 	height += lines * (oneline.height + pad_top + pad_bottom);
 
-	/* Make sure there's enough room for at least two lines. Allocate enough space to
+	/* Make sure there's enough room for at least min_lines. Allocate enough space to
 	 * prevent scrolling when the second line is a continuation of the first line, or
 	 * is the beginning of a new paragraph. */
-	height = MAX(height, 2 * (oneline.height + MAX(pad_inside, pad_top + pad_bottom)));
-
-	height = MIN(height, max_height);
+	min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom));
+	height = CLAMP(height, MIN(min_height, max_height), max_height);
 
 	diff = height - gtkconv->entry->allocation.height;
-	if (diff <= 0)
+	if (diff == 0 || (diff < 0 && -diff < oneline.height / 2))
 		return FALSE;
 	gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
 				    diff + gtkconv->lower_hbox->allocation.height);
@@ -4563,6 +4571,25 @@
 }
 
 static void
+minimum_entry_lines_pref_cb(const char *name,
+                            PurplePrefType type,
+                            gconstpointer value,
+                            gpointer data)
+{
+	GList *l = purple_get_conversations();
+	PurpleConversation *conv;
+	while (l != NULL)
+	{
+		conv = (PurpleConversation *)l->data;
+
+		if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
+			resize_imhtml_cb(PIDGIN_CONVERSATION(conv));
+
+		l = l->next;
+	}
+}
+
+static void
 setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox)
 {
 	PurpleConversation *conv = gtkconv->active_conv;
@@ -4834,6 +4861,7 @@
 
 	/* Setup the gtkimhtml widget */
 	frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
+	gtk_widget_set_size_request(gtkconv->imhtml, -1, 0);
 	if (chat) {
 		GtkWidget *hpaned;
 
@@ -7868,6 +7896,7 @@
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
+	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 2);
 
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", TRUE);
 	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", TRUE);
@@ -7934,6 +7963,9 @@
 								conv_placement_pref_cb, NULL);
 	purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
 
+	purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
+		minimum_entry_lines_pref_cb, NULL);
+
 	/* IM callbacks */
 	purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons",
 								animate_buddy_icons_pref_cb, NULL);
--- a/pidgin/gtkimhtml.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtkimhtml.c	Tue May 06 07:58:54 2008 +0000
@@ -822,9 +822,30 @@
 	gtk_imhtml_clear_formatting(imhtml);
 }
 
+static void disable_smiley_selected(GtkMenuItem *item, GtkIMHtml *imhtml)
+{
+	GtkTextIter start, end;
+	GtkTextMark *mark;
+	char *text;
+
+	if (!gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end))
+		return;
+
+	text = gtk_imhtml_get_markup_range(imhtml, &start, &end);
+
+	mark = gtk_text_buffer_get_selection_bound(imhtml->text_buffer);
+	gtk_text_buffer_delete_selection(imhtml->text_buffer, FALSE, FALSE);
+
+	gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &start, mark);
+	gtk_imhtml_insert_html_at_iter(imhtml, text, GTK_IMHTML_NO_NEWLINE | GTK_IMHTML_NO_SMILEY, &start);
+
+	g_free(text);
+}
+
 static void hijack_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data)
 {
 	GtkWidget *menuitem;
+	GtkTextIter start, end;
 
 	menuitem = gtk_menu_item_new_with_mnemonic(_("Paste as Plain _Text"));
 	gtk_widget_show(menuitem);
@@ -850,6 +871,15 @@
 	gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 5);
 
 	g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(clear_formatting_cb), imhtml);
+
+	menuitem = gtk_menu_item_new_with_mnemonic(_("Disable _smileys in selected text"));
+	gtk_widget_show(menuitem);
+	if (gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) {
+		g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(disable_smiley_selected), imhtml);
+	} else {
+		gtk_widget_set_sensitive(menuitem, FALSE);
+	}
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 6);
 }
 
 static char *
@@ -1483,10 +1513,8 @@
 
 static void gtk_imhtml_init (GtkIMHtml *imhtml)
 {
-	GtkTextIter iter;
 	imhtml->text_buffer = gtk_text_buffer_new(NULL);
 	imhtml->undo_manager = gtk_source_undo_manager_new(imhtml->text_buffer);
-	gtk_text_buffer_get_end_iter (imhtml->text_buffer, &iter);
 	gtk_text_view_set_buffer(GTK_TEXT_VIEW(imhtml), imhtml->text_buffer);
 	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD_CHAR);
 	gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(imhtml), 2);
--- a/pidgin/gtknotify.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtknotify.c	Tue May 06 07:58:54 2008 +0000
@@ -52,6 +52,7 @@
 	GtkWidget *label;
 	GtkTreeIter iter;
 	int count;
+	gboolean purple_has_handle;
 } PidginNotifyMailData;
 
 typedef struct
@@ -100,6 +101,8 @@
 									const char **froms, const char **tos,
 									const char **urls);
 
+static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle);
+
 static void
 message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget)
 {
@@ -144,7 +147,10 @@
 				purple_notify_uri(NULL, data->url);
 
 			gtk_tree_store_remove(dialog->treemodel, &iter);
-			purple_notify_close(PURPLE_NOTIFY_EMAILS, data);
+			if (data->purple_has_handle)
+				purple_notify_close(PURPLE_NOTIFY_EMAILS, data);
+			else
+				pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data);
 		}
 	}
 	gtk_widget_destroy(dialog->dialog);
@@ -465,6 +471,7 @@
 
 	if (new_n) {
 		data = g_new0(PidginNotifyMailData, 1);
+		data->purple_has_handle = TRUE;
 		gtk_tree_store_append(treemodel, &iter, NULL);
 	}
 
@@ -479,6 +486,8 @@
 	data->iter = iter;              /* XXX: Do we use this for something? */
 	data->account = account;
 	data->count = count;
+
+	/* Why is this necessary?*/
 	gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter,
 						PIDGIN_MAIL_DATA, &data, -1);
 	if (icon)
@@ -540,6 +549,9 @@
 			g_free(from_text);
 			g_free(subject_text);
 
+			/* If we don't keep track of this, will leak "data" for each of the notifications except the last */
+			if (data)
+				data->purple_has_handle = FALSE;
 			data = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE);
 			g_free(notification);
 
@@ -588,7 +600,7 @@
 	} else if (!GTK_WIDGET_HAS_FOCUS(dialog))
 		pidgin_set_urgent(GTK_WINDOW(dialog), TRUE);
 
-	return NULL;
+	return data;
 }
 
 static gboolean
@@ -807,6 +819,7 @@
 		col_types[i] = G_TYPE_STRING;
 	}
 	model = gtk_list_store_newv(col_num, col_types);
+	g_free(col_types);
 
 	/* Setup the scrolled window containing the treeview */
 	sw = gtk_scrolled_window_new(NULL, NULL);
--- a/pidgin/gtkprefs.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtkprefs.c	Tue May 06 07:58:54 2008 +0000
@@ -878,8 +878,7 @@
 	 * should never arise.
 	 */
 	if(!changed)
-		purple_notify_warning (NULL, NULL,
-			_("IT'S A LION! GET IN THE CAR!"), NULL);
+		purple_debug_warning("gtkprefs", "Escape accel failed to change\n");
 
 	/* TODO: create pidgin_accels_schedule_save */
 	pidgin_save_accels_cb(NULL, 0, 0, NULL, NULL);
@@ -1078,6 +1077,12 @@
 	pidgin_prefs_checkbox(_("Minimi_ze new conversation windows"), PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", vbox);
 #endif
 
+	pidgin_prefs_labeled_spin_button(vbox,
+		_("Minimum input area height in lines:"),
+		PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
+		1, 8, NULL);
+
+
 #if GTK_CHECK_VERSION(2,4,0)
 	vbox = pidgin_make_frame(ret, _("Font"));
 	if (purple_running_gnome())
--- a/pidgin/gtkrequest.c	Tue May 06 07:51:03 2008 +0000
+++ b/pidgin/gtkrequest.c	Tue May 06 07:58:54 2008 +0000
@@ -1282,6 +1282,7 @@
 				size_t col_offset = col_num * 2;
 				PurpleRequestFieldType type;
 				GtkWidget *widget = NULL;
+				const char *field_label;
 
 				label = NULL;
 				field = fl->data;
@@ -1292,17 +1293,17 @@
 				}
 
 				type = purple_request_field_get_type(field);
+				field_label = purple_request_field_get_label(field);
 
-				if (type != PURPLE_REQUEST_FIELD_BOOLEAN &&
-				    purple_request_field_get_label(field))
+				if (type != PURPLE_REQUEST_FIELD_BOOLEAN && field_label)
 				{
-					char *text;
+					char *text = NULL;
 
-					text = g_strdup_printf("%s:",
-						purple_request_field_get_label(field));
+					if (field_label[strlen(field_label) - 1] != ':')
+						text = g_strdup_printf("%s:", field_label);
 
 					label = gtk_label_new(NULL);
-					gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text);
+					gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text ? text : field_label);
 					g_free(text);
 
 					gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);