changeset 10417:823ad21cd95a

[gaim-migrate @ 11668] Save substatuses as well. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 25 Dec 2004 20:24:17 +0000
parents 73d3a64d5574
children bed2c96bc1fb
files src/status.c
diffstat 1 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/status.c	Sat Dec 25 19:58:18 2004 +0000
+++ b/src/status.c	Sat Dec 25 20:24:17 2004 +0000
@@ -2022,9 +2022,38 @@
 }
 
 static xmlnode *
+gaim_substatus_get_as_xmlnode(GaimStatusSavedSub *substatus)
+{
+	xmlnode *node, *child;
+
+	node = xmlnode_new("substatus");
+
+	child = xmlnode_new("account");
+	xmlnode_set_attrib(node, "protocol",
+					   gaim_account_get_protocol_id(substatus->account));
+	xmlnode_insert_data(child,
+						gaim_account_get_username(substatus->account), -1);
+	xmlnode_insert_child(node, child);
+
+	child = xmlnode_new("state");
+	xmlnode_insert_data(child, substatus->type->id, -1);
+	xmlnode_insert_child(node, child);
+
+	if (substatus->message != NULL)
+	{
+		child = xmlnode_new("message");
+		xmlnode_insert_data(child, substatus->message, -1);
+		xmlnode_insert_child(node, child);
+	}
+
+	return node;
+}
+
+static xmlnode *
 gaim_status_get_as_xmlnode(GaimStatusSaved *status)
 {
 	xmlnode *node, *child;
+	GList *cur;
 
 	node = xmlnode_new("status");
 	xmlnode_set_attrib(node, "name", status->title);
@@ -2037,7 +2066,11 @@
 	xmlnode_insert_data(child, status->message, -1);
 	xmlnode_insert_child(node, child);
 
-	/* TODO: Add substatuses to the tree */
+	for (cur = status->substatuses; cur != NULL; cur = cur->next)
+	{
+		child = gaim_substatus_get_as_xmlnode(cur->data);
+		xmlnode_insert_child(node, child);
+	}
 
 	return node;
 }