src/blist.c

changeset 7725
9cdfca644b9d
parent 7693
1f736efbd12d
child 7726
4f59399d6a5e
--- a/src/blist.c	Wed Dec 03 13:21:55 2003 +0000
+++ b/src/blist.c	Wed Dec 03 15:04:17 2003 +0000
@@ -396,6 +396,8 @@
 
 	if (conv)
 		gaim_conversation_autoset_title(conv);
+
+	gaim_blist_save();
 }
 
 void gaim_blist_rename_group(GaimGroup *group, const char *name)
@@ -1935,7 +1937,7 @@
 {
 	GaimAccount *account;
 	GaimBuddy *buddy;
-	char *name = NULL, *alias = NULL;
+	char *name = NULL, *alias = NULL, *server_alias = NULL;
 	const char *acct_name, *proto, *protocol;
 	xmlnode *x;
 
@@ -1960,6 +1962,9 @@
 	if((x = xmlnode_get_child(bnode, "alias")))
 		alias = xmlnode_get_data(x);
 
+	if((x = xmlnode_get_child(bnode, "server_alias")))
+		server_alias = xmlnode_get_data(x);
+
 	buddy = gaim_buddy_new(account, name, alias);
 	gaim_blist_add_buddy(buddy, contact, group,
 			gaim_blist_get_last_child((GaimBlistNode*)contact));
@@ -1973,6 +1978,9 @@
 	g_free(name);
 	if(alias)
 		g_free(alias);
+
+	if(server_alias)
+		g_free(server_alias);
 }
 
 static void parse_contact(GaimGroup *group, xmlnode *cnode)
@@ -2302,10 +2310,13 @@
 static void print_buddy(FILE *file, GaimBuddy *buddy) {
 	char *bud_name = g_markup_escape_text(buddy->name, -1);
 	char *bud_alias = NULL;
+	char *bud_server_alias = NULL;
 	char *acct_name = g_markup_escape_text(buddy->account->username, -1);
 	int proto_num = gaim_account_get_protocol(buddy->account);
 	if(buddy->alias)
 		bud_alias= g_markup_escape_text(buddy->alias, -1);
+	if(buddy->server_alias)
+		bud_server_alias= g_markup_escape_text(buddy->server_alias, -1);
 	fprintf(file, "\t\t\t\t<buddy account=\"%s\" proto=\"%s\"", acct_name,
 			gaim_account_get_protocol_id(buddy->account));
 	if(proto_num != -1)
@@ -2316,11 +2327,15 @@
 	if(bud_alias) {
 		fprintf(file, "\t\t\t\t\t<alias>%s</alias>\n", bud_alias);
 	}
-	g_hash_table_foreach(buddy->node.settings, blist_print_buddy_settings, file);
+	if(bud_server_alias) {
+		fprintf(file, "\t\t\t\t\t<server_alias>%s</server_alias>\n", bud_server_alias);
+	}
+	g_hash_table_foreach(((GAIM_BLIST_NODE*)buddy)->settings, blist_print_buddy_settings, file);
 	fprintf(file, "\t\t\t\t</buddy>\n");
 	g_free(bud_name);
 	g_free(bud_alias);
 	g_free(acct_name);
+	g_free(budd_server_alias);
 }
 
 static void gaim_blist_write(FILE *file, GaimAccount *exp_acct) {

mercurial