comparison src/account.c @ 10309:19974fd2d61d

[gaim-migrate @ 11501] I prefer these functions like nobody's business. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 03 Dec 2004 03:07:47 +0000
parents 56b53036e48c
children b234ad7e0dfe
comparison
equal deleted inserted replaced
10308:52c2303f60dc 10309:19974fd2d61d
560 560
561 status = gaim_account_get_status(account, status_id); 561 status = gaim_account_get_status(account, status_id);
562 562
563 if (status == NULL) 563 if (status == NULL)
564 { 564 {
565 gaim_debug(GAIM_DEBUG_ERROR, "accounts", 565 gaim_debug_error("accounts",
566 "Invalid status ID %s for account %s (%s)\n", 566 "Invalid status ID %s for account %s (%s)\n",
567 status_id, gaim_account_get_username(account), 567 status_id, gaim_account_get_username(account),
568 gaim_account_get_protocol_id(account)); 568 gaim_account_get_protocol_id(account));
569 return; 569 return;
570 } 570 }
1202 else if (!strcmp(buffer, "socks5")) 1202 else if (!strcmp(buffer, "socks5"))
1203 gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_SOCKS5); 1203 gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_SOCKS5);
1204 else if (!strcmp(buffer, "envvar")) 1204 else if (!strcmp(buffer, "envvar"))
1205 gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_USE_ENVVAR); 1205 gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_USE_ENVVAR);
1206 else 1206 else
1207 gaim_debug(GAIM_DEBUG_ERROR, "account", 1207 gaim_debug_error("account",
1208 "Invalid proxy type found when loading account " 1208 "Invalid proxy type found when loading account "
1209 "information for %s\n", 1209 "information for %s\n",
1210 gaim_account_get_username(data->account)); 1210 gaim_account_get_username(data->account));
1211 } 1211 }
1212 } 1212 }
1306 accounts_loaded = TRUE; 1306 accounts_loaded = TRUE;
1307 return FALSE; 1307 return FALSE;
1308 } 1308 }
1309 1309
1310 if (!g_file_get_contents(filename, &contents, &length, &error)) { 1310 if (!g_file_get_contents(filename, &contents, &length, &error)) {
1311 gaim_debug(GAIM_DEBUG_ERROR, "accounts", 1311 gaim_debug_error("accounts",
1312 "Error reading accounts: %s\n", error->message); 1312 "Error reading accounts: %s\n", error->message);
1313 g_error_free(error); 1313 g_error_free(error);
1314 g_free(filename); 1314 g_free(filename);
1315 accounts_loaded = TRUE; 1315 accounts_loaded = TRUE;
1316 1316
1330 1330
1331 return TRUE; 1331 return TRUE;
1332 } 1332 }
1333 1333
1334 if (!g_markup_parse_context_end_parse(context, NULL)) { 1334 if (!g_markup_parse_context_end_parse(context, NULL)) {
1335 gaim_debug(GAIM_DEBUG_ERROR, "accounts", "Error parsing %s\n", 1335 gaim_debug_error("accounts", "Error parsing %s\n",
1336 filename); 1336 filename);
1337 g_markup_parse_context_free(context); 1337 g_markup_parse_context_free(context);
1338 g_free(contents); 1338 g_free(contents);
1339 g_free(filename); 1339 g_free(filename);
1340 accounts_loaded = TRUE; 1340 accounts_loaded = TRUE;
1482 const char *user_dir = gaim_user_dir(); 1482 const char *user_dir = gaim_user_dir();
1483 char *filename; 1483 char *filename;
1484 char *filename_real; 1484 char *filename_real;
1485 1485
1486 if (!accounts_loaded) { 1486 if (!accounts_loaded) {
1487 gaim_debug(GAIM_DEBUG_WARNING, "accounts", 1487 gaim_debug_error("accounts",
1488 "Writing accounts to disk.\n"); 1488 "Writing accounts to disk.\n");
1489 schedule_accounts_save(); 1489 schedule_accounts_save();
1490 return; 1490 return;
1491 } 1491 }
1492 1492
1493 if (user_dir == NULL) 1493 if (user_dir == NULL)
1494 return; 1494 return;
1495 1495
1496 gaim_debug(GAIM_DEBUG_INFO, "accounts", "Writing accounts to disk.\n"); 1496 gaim_debug_info("accounts", "Writing accounts to disk.\n");
1497 1497
1498 fp = fopen(user_dir, "r"); 1498 fp = fopen(user_dir, "r");
1499 1499
1500 if (fp == NULL) 1500 if (fp == NULL)
1501 mkdir(user_dir, S_IRUSR | S_IWUSR | S_IXUSR); 1501 mkdir(user_dir, S_IRUSR | S_IWUSR | S_IXUSR);
1517 1517
1518 fclose(fp); 1518 fclose(fp);
1519 chmod(filename, S_IRUSR | S_IWUSR); 1519 chmod(filename, S_IRUSR | S_IWUSR);
1520 } 1520 }
1521 else { 1521 else {
1522 gaim_debug(GAIM_DEBUG_ERROR, "accounts", "Unable to write %s\n", 1522 gaim_debug_error("accounts", "Unable to write %s\n",
1523 filename); 1523 filename);
1524 g_free(filename); 1524 g_free(filename);
1525 return; 1525 return;
1526 } 1526 }
1527 1527
1528 filename_real = g_build_filename(user_dir, "accounts.xml", NULL); 1528 filename_real = g_build_filename(user_dir, "accounts.xml", NULL);
1529 1529
1530 if (rename(filename, filename_real) < 0) { 1530 if (rename(filename, filename_real) < 0) {
1531 gaim_debug(GAIM_DEBUG_ERROR, "accounts", "Error renaming %s to %s\n", 1531 gaim_debug_error("accounts", "Error renaming %s to %s\n",
1532 filename, filename_real); 1532 filename, filename_real);
1533 } 1533 }
1534 1534
1535 g_free(filename); 1535 g_free(filename);
1536 g_free(filename_real); 1536 g_free(filename_real);
1636 g_return_if_fail(new_index >= 0 && new_index <= g_list_length(accounts)); 1636 g_return_if_fail(new_index >= 0 && new_index <= g_list_length(accounts));
1637 1637
1638 index = g_list_index(accounts, account); 1638 index = g_list_index(accounts, account);
1639 1639
1640 if (index == -1) { 1640 if (index == -1) {
1641 gaim_debug(GAIM_DEBUG_ERROR, "accounts", 1641 gaim_debug_error("accounts",
1642 "Unregistered account (%s) discovered during reorder!\n", 1642 "Unregistered account (%s) discovered during reorder!\n",
1643 gaim_account_get_username(account)); 1643 gaim_account_get_username(account));
1644 return; 1644 return;
1645 } 1645 }
1646 1646