src/account.c

changeset 6067
4d8cd26c855b
parent 6040
ab00305db747
child 6109
44e5eb92b617
equal deleted inserted replaced
6066:444d1ed0a273 6067:4d8cd26c855b
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);

mercurial