| 145 } |
145 } |
| 146 |
146 |
| 147 void |
147 void |
| 148 gaim_account_destroy(GaimAccount *account) |
148 gaim_account_destroy(GaimAccount *account) |
| 149 { |
149 { |
| 150 GaimBlistNode *gnode, *bnode; |
|
| 151 |
|
| 152 g_return_if_fail(account != NULL); |
150 g_return_if_fail(account != NULL); |
| 153 |
151 |
| 154 gaim_debug(GAIM_DEBUG_INFO, "account", |
152 gaim_debug(GAIM_DEBUG_INFO, "account", |
| 155 "Destroying account %p\n", account); |
153 "Destroying account %p\n", account); |
| 156 |
154 |
| 157 if (account->gc != NULL) |
155 if (account->gc != NULL) |
| 158 gaim_connection_destroy(account->gc); |
156 gaim_connection_destroy(account->gc); |
| 159 |
157 |
| 160 gaim_debug(GAIM_DEBUG_INFO, "account", |
158 gaim_debug(GAIM_DEBUG_INFO, "account", |
| 161 "Continuing to destroy account %p\n", account); |
159 "Continuing to destroy account %p\n", account); |
| 162 |
|
| 163 /* Let's remove the buddies for this account, before they cause trouble */ |
|
| 164 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
|
| 165 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
|
| 166 continue; |
|
| 167 for(bnode = gnode->child; bnode; bnode=bnode->next) { |
|
| 168 if(GAIM_BLIST_NODE_IS_BUDDY(bnode)) { |
|
| 169 struct buddy *b = (struct buddy *)bnode; |
|
| 170 if(b->account == account) |
|
| 171 gaim_blist_remove_buddy(b); |
|
| 172 } else if(GAIM_BLIST_NODE_IS_CHAT(bnode)) { |
|
| 173 struct chat *c = (struct chat *)bnode; |
|
| 174 if(c->account == account) |
|
| 175 gaim_blist_remove_chat(c); |
|
| 176 } |
|
| 177 } |
|
| 178 } |
|
| 179 |
|
| 180 gaim_blist_save(); |
|
| 181 |
160 |
| 182 if (account->username != NULL) g_free(account->username); |
161 if (account->username != NULL) g_free(account->username); |
| 183 if (account->alias != NULL) g_free(account->alias); |
162 if (account->alias != NULL) g_free(account->alias); |
| 184 if (account->password != NULL) g_free(account->password); |
163 if (account->password != NULL) g_free(account->password); |
| 185 if (account->user_info != NULL) g_free(account->user_info); |
164 if (account->user_info != NULL) g_free(account->user_info); |