changeset 27689:1082e1c25b30

Deprecate multiple chats having the same name and complain in the log. I didn't remove it outright for two reasons: 1. Out-of-tree prpls currently use it that way. 2. This is going to affect logs (currently they're either all saved to the same file(s)/folder(s) or it fails miserably, I'm unsure).
author Paul Aurich <paul@darkrain42.org>
date Sun, 26 Jul 2009 00:39:14 +0000
parents 3723ac957c77
children f4e689845508
files ChangeLog.API libpurple/conversation.c
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun Jul 26 00:21:20 2009 +0000
+++ b/ChangeLog.API	Sun Jul 26 00:39:14 2009 +0000
@@ -88,6 +88,8 @@
 		* All DNS routines support internationalized domain names (IDNs) when
 		  libpurple is compiled with GNU libidn.
 		* status is set before emitting signals in purple_xfer_set_status.
+		* Creating multiple distinct chats with the same name (i.e. "MSN Chat")
+		  is deprecated and will be removed in libpurple 3.0.0.
 
 		Deprecated:
 		* buddy-added and buddy-removed blist signals
--- a/libpurple/conversation.c	Sun Jul 26 00:21:20 2009 +0000
+++ b/libpurple/conversation.c	Sun Jul 26 00:39:14 2009 +0000
@@ -295,6 +295,21 @@
 	/* Check if this conversation already exists. */
 	if ((conv = purple_find_conversation_with_account(type, name, account)) != NULL)
 	{
+		if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
+				!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
+			purple_debug_warning("conversation", "Trying to create multiple "
+					"chats (%s) with the same name is deprecated and will be "
+					"removed in libpurple 3.0.0", name);
+		}
+
+		/*
+		 * This hack is necessary because some prpls (MSN) have unnamed chats
+		 * that all use the same name.  A PurpleConversation for one of those
+		 * is only ever re-used if the user has left, so calls to
+		 * purple_conversation_new need to fall-through to creating a new
+		 * chat.
+		 * TODO 3.0.0: Remove this workaround and mandate unique names.
+		 */
 		if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT ||
 				purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
 		{