changeset 5643:eb685809108b

[gaim-migrate @ 6057] When a prpl couldn't load, the account's prpl ID got set to -1 and the account config file had to be manually editted. Now that's fixed, and it stores the ID on load and writes it on save. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 01 Jun 2003 21:36:40 +0000
parents 1693a3027dc8
children 213e999fa5cc
files src/account.c src/account.h
diffstat 2 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Sun Jun 01 21:18:48 2003 +0000
+++ b/src/account.c	Sun Jun 01 21:36:40 2003 +0000
@@ -67,6 +67,7 @@
 
 	GaimAccount *account;
 	GaimProtocol protocol;
+	char *protocol_id;
 
 	GString *buffer;
 
@@ -134,10 +135,11 @@
 	if (account->gc != NULL)
 		gaim_connection_destroy(account->gc);
 
-	if (account->username  != NULL) g_free(account->username);
-	if (account->alias     != NULL) g_free(account->alias);
-	if (account->password  != NULL) g_free(account->password);
-	if (account->user_info != NULL) g_free(account->user_info);
+	if (account->username    != NULL) g_free(account->username);
+	if (account->alias       != NULL) g_free(account->alias);
+	if (account->password    != NULL) g_free(account->password);
+	if (account->user_info   != NULL) g_free(account->user_info);
+	if (account->protocol_id != NULL) g_free(account->protocol_id);
 
 	g_hash_table_destroy(account->settings);
 
@@ -546,6 +548,7 @@
 		GList *l;
 		GaimPlugin *plugin;
 
+		data->protocol_id = g_strdup(buffer);
 		data->protocol = -1;
 
 		for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) {
@@ -561,8 +564,12 @@
 			}
 		}
 	}
-	else if (data->tag == TAG_NAME)
+	else if (data->tag == TAG_NAME) {
 		data->account = gaim_account_new(buffer, data->protocol);
+		data->account->protocol_id = data->protocol_id;
+
+		data->protocol_id = NULL;
+	}
 	else if (data->tag == TAG_PASSWORD) {
 		gaim_account_set_password(data->account, buffer);
 		gaim_account_set_remember_password(data->account, TRUE);
@@ -706,16 +713,11 @@
 static void
 gaim_accounts_write(FILE *fp, GaimAccount *account)
 {
-	GaimPlugin *plugin;
 	const char *password, *alias, *user_info, *buddy_icon;
 	char *esc;
 
-	plugin = gaim_find_prpl(gaim_account_get_protocol(account));
-
 	fprintf(fp, " <account>\n");
-	fprintf(fp, "  <protocol>%s</protocol>\n",
-			(plugin != NULL && plugin->info != NULL && plugin->info->id != NULL
-			 ? plugin->info->id : "unknown"));
+	fprintf(fp, "  <protocol>%s</protocol>\n", account->protocol_id);
 	esc = g_markup_escape_text(gaim_account_get_username(account), -1);
 	fprintf(fp, "  <name>%s</name>\n", esc);
 	g_free(esc);
--- a/src/account.h	Sun Jun 01 21:18:48 2003 +0000
+++ b/src/account.h	Sun Jun 01 21:36:40 2003 +0000
@@ -41,6 +41,7 @@
 	gboolean check_mail;        /**< Check for mail.             */
 
 	GaimProtocol protocol;      /**< The account protocol.       */
+	char *protocol_id;          /**< The ID of the protocol.     */
 
 	GaimConnection *gc;         /**< The connection handle.      */