changeset 7725:15c7973b7fe8

[gaim-migrate @ 8370] Phil Hannent (phannent)(Monkey77), after some help, got it so that gaim stores the server alias so that it is used even when the person isn't online if so set in preferences. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 03 Dec 2003 15:04:17 +0000
parents 613b20c69d2c
children dcfdbcd223cd
files src/blist.c
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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) {