diff src/savedstatuses.c @ 12283:4396691844e2

[gaim-migrate @ 14587] Make the Gaim 2.0.0 status.xml file not cause Gaim 1.5.0 to crash committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 01 Dec 2005 05:58:43 +0000
parents 0ab1c9916dc2
children b3385115815c
line wrap: on
line diff
--- a/src/savedstatuses.c	Thu Dec 01 05:52:21 2005 +0000
+++ b/src/savedstatuses.c	Thu Dec 01 05:58:43 2005 +0000
@@ -170,7 +170,22 @@
 
 	node = xmlnode_new("status");
 	if (status->title != NULL)
+	{
 		xmlnode_set_attrib(node, "name", status->title);
+	}
+	else
+	{
+		/*
+		 * Gaim 1.5.0 and earlier require a name to be set, so we
+		 * do this little hack to maintain backward compatability
+		 * in the status.xml file.  Eventually this should be used
+		 * and we should determine if a status is transient by
+		 * whether the "name" attribute is set to something or if
+		 * it does not exist at all.
+		 */
+		xmlnode_set_attrib(node, "name", "Auto-Cached");
+		xmlnode_set_attrib(node, "transient", "true");
+	}
 
 	snprintf(buf, sizeof(buf), "%lu", status->creation_time);
 	xmlnode_set_attrib(node, "created", buf);
@@ -336,9 +351,13 @@
 
 	ret = g_new0(GaimSavedStatus, 1);
 
-	/* Read the title */
-	attrib = xmlnode_get_attrib(status, "name");
-	ret->title = g_strdup(attrib);
+	attrib = xmlnode_get_attrib(status, "transient");
+	if ((attrib == NULL) || (strcmp(attrib, "true")))
+	{
+		/* Read the title */
+		attrib = xmlnode_get_attrib(status, "name");
+		ret->title = g_strdup(attrib);
+	}
 
 	if (ret->title != NULL)
 	{