comparison src/account.c @ 10760:f93ed7f6ecc7

[gaim-migrate @ 12363] Changing your away message by just typing new text into the GtkStatusBox works again. I broke that earlier today when I fix a small bit of the which-status-is-the-active-status-in-this-presence thing. I also removed the log in or out in account.c depending on the status that was set. This was already handled by most of the PRPLs, and I feel that's the best way to do it. There was some talk of removing the login and close PRPL callbacks, and I'm not entirely against that, but things are starting to get pretty good. I don't see a need to change that right now. Also, I'm going to add a link to my (Mark Doliner) blog, for google, I guess: http://www.livejournal.com/users/thekingant/ committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 28 Mar 2005 04:26:33 +0000
parents c80a609bd747
children d83f745c997b
comparison
equal deleted inserted replaced
10759:56915e1b3ba3 10760:f93ed7f6ecc7
276 accounts_to_xmlnode(void) 276 accounts_to_xmlnode(void)
277 { 277 {
278 xmlnode *node, *child; 278 xmlnode *node, *child;
279 GList *cur; 279 GList *cur;
280 280
281 node = xmlnode_new("accounts"); 281 node = xmlnode_new("account");
282 xmlnode_set_attrib(node, "version", "1.0"); 282 xmlnode_set_attrib(node, "version", "1.0");
283 283
284 for (cur = gaim_accounts_get_all(); cur != NULL; cur = cur->next) 284 for (cur = gaim_accounts_get_all(); cur != NULL; cur = cur->next)
285 { 285 {
286 child = account_to_xmlnode(cur->data); 286 child = account_to_xmlnode(cur->data);
296 xmlnode *node; 296 xmlnode *node;
297 char *data; 297 char *data;
298 298
299 if (!accounts_loaded) 299 if (!accounts_loaded)
300 { 300 {
301 gaim_debug_error("accounts", "Attempted to save accounts before " 301 gaim_debug_error("account", "Attempted to save accounts before "
302 "they were read!\n"); 302 "they were read!\n");
303 return; 303 return;
304 } 304 }
305 305
306 node = accounts_to_xmlnode(); 306 node = accounts_to_xmlnode();
1138 void 1138 void
1139 gaim_account_set_status_vargs(GaimAccount *account, const char *status_id, 1139 gaim_account_set_status_vargs(GaimAccount *account, const char *status_id,
1140 gboolean active, va_list args) 1140 gboolean active, va_list args)
1141 { 1141 {
1142 GaimStatus *status; 1142 GaimStatus *status;
1143 GaimStatusType *status_type;
1144 1143
1145 g_return_if_fail(account != NULL); 1144 g_return_if_fail(account != NULL);
1146 g_return_if_fail(status_id != NULL); 1145 g_return_if_fail(status_id != NULL);
1147 1146
1147 gaim_debug_info("account", "Changing status for %s, setting %s to %d\n",
1148 gaim_account_get_username(account), status_id, active);
1149
1148 status = gaim_account_get_status(account, status_id); 1150 status = gaim_account_get_status(account, status_id);
1149 if (status == NULL) 1151 if (status == NULL)
1150 { 1152 {
1151 gaim_debug_error("accounts", 1153 gaim_debug_error("account",
1152 "Invalid status ID %s for account %s (%s)\n", 1154 "Invalid status ID %s for account %s (%s)\n",
1153 status_id, gaim_account_get_username(account), 1155 status_id, gaim_account_get_username(account),
1154 gaim_account_get_protocol_id(account)); 1156 gaim_account_get_protocol_id(account));
1155 return; 1157 return;
1156 } 1158 }
1157 status_type = gaim_status_get_type(status);
1158
1159 /*
1160 * If this account should be disconnected, but is online, then disconnect.
1161 */
1162 if (active &&
1163 (gaim_status_type_get_primitive(status_type) == GAIM_STATUS_OFFLINE) &&
1164 gaim_account_is_connected(account))
1165 {
1166 account->gc->wants_to_die = TRUE;
1167 gaim_account_disconnect(account);
1168
1169 /* No need to actually set the status, so we just exit */
1170 return;
1171 }
1172 1159
1173 /* Our current statuses are saved to accounts.xml */ 1160 /* Our current statuses are saved to accounts.xml */
1174 schedule_accounts_save(); 1161 schedule_accounts_save();
1175 1162
1176 if (active || gaim_status_is_independent(status)) 1163 if (active || gaim_status_is_independent(status))
1177 gaim_status_set_active_with_attrs(status, active, args); 1164 gaim_status_set_active_with_attrs(status, active, args);
1178
1179 /*
1180 * If this account should be connected, but is not, then connect.
1181 */
1182 if (active &&
1183 (gaim_status_type_get_primitive(status_type) != GAIM_STATUS_OFFLINE) &&
1184 !gaim_account_is_connected(account))
1185 {
1186 gaim_account_connect(account);
1187 }
1188 } 1165 }
1189 1166
1190 void 1167 void
1191 gaim_account_clear_settings(GaimAccount *account) 1168 gaim_account_clear_settings(GaimAccount *account)
1192 { 1169 {
1757 g_return_if_fail(new_index >= 0 && new_index <= g_list_length(accounts)); 1734 g_return_if_fail(new_index >= 0 && new_index <= g_list_length(accounts));
1758 1735
1759 index = g_list_index(accounts, account); 1736 index = g_list_index(accounts, account);
1760 1737
1761 if (index == -1) { 1738 if (index == -1) {
1762 gaim_debug_error("accounts", 1739 gaim_debug_error("account",
1763 "Unregistered account (%s) discovered during reorder!\n", 1740 "Unregistered account (%s) discovered during reorder!\n",
1764 gaim_account_get_username(account)); 1741 gaim_account_get_username(account));
1765 return; 1742 return;
1766 } 1743 }
1767 1744