Mercurial > pidgin.yaz
comparison src/account.c @ 6067:6a3b676eb36a
[gaim-migrate @ 6517]
don't lose same-name accounts, and handle the default protocol a little better
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 09 Jul 2003 00:36:48 +0000 |
parents | 80e3641ee9eb |
children | 0922bb7a7bbc |
comparison
equal
deleted
inserted
replaced
6066:c99959f1bb73 | 6067:6a3b676eb36a |
---|---|
114 } | 114 } |
115 | 115 |
116 GaimAccount * | 116 GaimAccount * |
117 gaim_account_new(const char *username, const char *protocol_id) | 117 gaim_account_new(const char *username, const char *protocol_id) |
118 { | 118 { |
119 GaimAccount *account; | 119 GaimAccount *account = NULL; |
120 | 120 |
121 g_return_val_if_fail(username != NULL, NULL); | 121 g_return_val_if_fail(username != NULL, NULL); |
122 g_return_val_if_fail(protocol_id != NULL, NULL); | 122 |
123 | 123 if(protocol_id) |
124 account = gaim_accounts_find_with_prpl_id(username, protocol_id); | 124 account = gaim_accounts_find_with_prpl_id(username, protocol_id); |
125 | 125 |
126 if (account != NULL) | 126 if (account != NULL) |
127 return account; | 127 return account; |
128 | 128 |
129 account = g_new0(GaimAccount, 1); | 129 account = g_new0(GaimAccount, 1); |
130 | 130 |
131 gaim_account_set_username(account, username); | 131 gaim_account_set_username(account, username); |
132 gaim_account_set_protocol_id(account, protocol_id); | 132 |
133 if(protocol_id) | |
134 gaim_account_set_protocol_id(account, protocol_id); | |
135 else | |
136 gaim_account_set_protocol(account, GAIM_PROTO_DEFAULT); | |
133 | 137 |
134 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, | 138 account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
135 g_free, delete_setting); | 139 g_free, delete_setting); |
136 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, | 140 account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, |
137 g_free, (GDestroyNotify)g_hash_table_destroy); | 141 g_free, (GDestroyNotify)g_hash_table_destroy); |