comparison src/account.c @ 5665:132a30783c3d

[gaim-migrate @ 6081] We're going to shuffle around the init sequence in main.c again. Importing accounts should no longer screw things up, and there's better protection against invalid protocol IDs causing an account to have to be hand-editted. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 02 Jun 2003 10:21:33 +0000
parents 6b3214ab8632
children 44870684dba3
comparison
equal deleted inserted replaced
5664:7867ae4836ac 5665:132a30783c3d
31 #include <sys/types.h> 31 #include <sys/types.h>
32 #include <glib.h> 32 #include <glib.h>
33 33
34 #include "account.h" 34 #include "account.h"
35 #include "prefs.h" 35 #include "prefs.h"
36 #include "prpl.h"
36 37
37 typedef enum 38 typedef enum
38 { 39 {
39 TAG_NONE = 0, 40 TAG_NONE = 0,
40 TAG_PROTOCOL, 41 TAG_PROTOCOL,
246 } 247 }
247 248
248 void 249 void
249 gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol) 250 gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol)
250 { 251 {
251 g_return_if_fail(account != NULL); 252 GaimPlugin *plugin;
253
254 g_return_if_fail(account != NULL);
255
256 plugin = gaim_find_prpl(protocol);
257
258 g_return_if_fail(plugin != NULL);
252 259
253 account->protocol = protocol; 260 account->protocol = protocol;
261
262 if (account->protocol_id != NULL)
263 g_free(account->protocol_id);
264
265 account->protocol_id = g_strdup(plugin->info->id);
254 266
255 schedule_accounts_save(); 267 schedule_accounts_save();
256 } 268 }
257 269
258 void 270 void