comparison 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
comparison
equal deleted inserted replaced
12282:de27f2831309 12283:4396691844e2
168 char buf[21]; 168 char buf[21];
169 GList *cur; 169 GList *cur;
170 170
171 node = xmlnode_new("status"); 171 node = xmlnode_new("status");
172 if (status->title != NULL) 172 if (status->title != NULL)
173 {
173 xmlnode_set_attrib(node, "name", status->title); 174 xmlnode_set_attrib(node, "name", status->title);
175 }
176 else
177 {
178 /*
179 * Gaim 1.5.0 and earlier require a name to be set, so we
180 * do this little hack to maintain backward compatability
181 * in the status.xml file. Eventually this should be used
182 * and we should determine if a status is transient by
183 * whether the "name" attribute is set to something or if
184 * it does not exist at all.
185 */
186 xmlnode_set_attrib(node, "name", "Auto-Cached");
187 xmlnode_set_attrib(node, "transient", "true");
188 }
174 189
175 snprintf(buf, sizeof(buf), "%lu", status->creation_time); 190 snprintf(buf, sizeof(buf), "%lu", status->creation_time);
176 xmlnode_set_attrib(node, "created", buf); 191 xmlnode_set_attrib(node, "created", buf);
177 192
178 snprintf(buf, sizeof(buf), "%lu", status->lastused); 193 snprintf(buf, sizeof(buf), "%lu", status->lastused);
334 char *data; 349 char *data;
335 int i; 350 int i;
336 351
337 ret = g_new0(GaimSavedStatus, 1); 352 ret = g_new0(GaimSavedStatus, 1);
338 353
339 /* Read the title */ 354 attrib = xmlnode_get_attrib(status, "transient");
340 attrib = xmlnode_get_attrib(status, "name"); 355 if ((attrib == NULL) || (strcmp(attrib, "true")))
341 ret->title = g_strdup(attrib); 356 {
357 /* Read the title */
358 attrib = xmlnode_get_attrib(status, "name");
359 ret->title = g_strdup(attrib);
360 }
342 361
343 if (ret->title != NULL) 362 if (ret->title != NULL)
344 { 363 {
345 /* Ensure the title is unique */ 364 /* Ensure the title is unique */
346 i = 2; 365 i = 2;