comparison src/protocols/yahoo/yahoo.c @ 6573:cc41123c684a

[gaim-migrate @ 7095] Bjoern Voigt writes: "As far as I can see, you commited a patch, which adds support for "Get User Info" on Yahoo and MSN. It's not my small Yahoo Get Info patch, it's the bigger one, which parses Yahoo and MSN profile pages. I prepared a patch for it, which adds i18n macros to this patch. Please commit the attached patch i18n21.patch. The patch works fine for Yahoo contacts with English language preference. Unfortunately the patch doesn't work with contacts with other language preferences. The problem is, that in Yahoo every user can set up a language for his/her profile. So http://profiles.yahoo.com/CONTACT can deliver English, German, French, ... pages, depending on CONTACT's preference. The yahoo_get_info() functions doesn't handle this and it's not easy to handle this. I have some ideas, how to fix this issue. I like to discuss this with the author of the patch or in gaim-devel." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 22 Aug 2003 20:06:18 +0000
parents e34907332e46
children a4622f1fb5a1
comparison
equal deleted inserted replaced
6572:4f097c1069b0 6573:cc41123c684a
1397 char buf[1024]; 1397 char buf[1024];
1398 1398
1399 /* we failed to grab the profile URL */ 1399 /* we failed to grab the profile URL */
1400 if (!url_text) { 1400 if (!url_text) {
1401 g_show_info_text(NULL, NULL, 2, 1401 g_show_info_text(NULL, NULL, 2,
1402 "<html><body><b>Error retrieving profile</b></body></html>", NULL); 1402 _("<html><body><b>Error retrieving profile</b></body></html>"), NULL);
1403 return; 1403 return;
1404 } 1404 }
1405 1405
1406 /* we don't yet support the multiple link level of the warning page for 1406 /* we don't yet support the multiple link level of the warning page for
1407 * 'adult' profiles, not to mention the fact that yahoo wants you to be 1407 * 'adult' profiles, not to mention the fact that yahoo wants you to be
1409 * now, just tell them that we can't help them, and provide a link to the 1409 * now, just tell them that we can't help them, and provide a link to the
1410 * profile if they want to do the web browser thing. 1410 * profile if they want to do the web browser thing.
1411 */ 1411 */
1412 p = strstr(url_text, "Adult Profiles Warning Message"); 1412 p = strstr(url_text, "Adult Profiles Warning Message");
1413 if (p) { 1413 if (p) {
1414 strcpy(buf, "<b>Sorry, profiles marked as containing adult content are "); 1414 strcpy(buf, _("<b>Sorry, profiles marked as containing adult content are not supported at this time.</b><br><br>\n"));
1415 strcat(buf, "not supported at this time.</b><br><br>\n");
1416 info_extract_field(url_text, buf, ".idname=", 0, "%26", 0, NULL, 1415 info_extract_field(url_text, buf, ".idname=", 0, "%26", 0, NULL,
1417 "If you wish to view this profile, you will need to visit this link in your web browser", 1416 _("If you wish to view this profile, you will need to visit this link in your web browser"),
1418 1, YAHOO_PROFILE_URL); 1417 1, YAHOO_PROFILE_URL);
1419 strcat(buf, "</body></html>\n"); 1418 strcat(buf, "</body></html>\n");
1420 g_show_info_text(NULL, NULL, 2, buf, NULL); 1419 g_show_info_text(NULL, NULL, 2, buf, NULL);
1421 return; 1420 return;
1422 } 1421 }
1444 /* gonna re-use the memory we've already got for url_text */ 1443 /* gonna re-use the memory we've already got for url_text */
1445 strcpy(url_text, "<html><body>\n"); 1444 strcpy(url_text, "<html><body>\n");
1446 1445
1447 /* extract their Yahoo! ID and put it in */ 1446 /* extract their Yahoo! ID and put it in */
1448 info_extract_field(stripped, url_text, "Yahoo! ID:", 2, "\n", 0, 1447 info_extract_field(stripped, url_text, "Yahoo! ID:", 2, "\n", 0,
1449 NULL, "Yahoo! ID", 0, NULL); 1448 NULL, _("Yahoo! ID"), 0, NULL);
1450 1449
1451 /* extract their Email address and put it in */ 1450 /* extract their Email address and put it in */
1452 info_extract_field(stripped, url_text, "My Email", 5, "\n", 0, 1451 info_extract_field(stripped, url_text, "My Email", 5, "\n", 0,
1453 "Private", "Email", 0, NULL); 1452 _("Private"), _("Email"), 0, NULL);
1454 1453
1455 /* extract the Nickname if it exists */ 1454 /* extract the Nickname if it exists */
1456 info_extract_field(stripped, url_text, "Nickname:", 1, "\n", '\n', 1455 info_extract_field(stripped, url_text, "Nickname:", 1, "\n", '\n',
1457 NULL, "Nickname", 0, NULL); 1456 NULL, _("Nickname"), 0, NULL);
1458 1457
1459 /* extract their RealName and put it in */ 1458 /* extract their RealName and put it in */
1460 info_extract_field(stripped, url_text, "RealName:", 1, "\n", '\n', 1459 info_extract_field(stripped, url_text, "RealName:", 1, "\n", '\n',
1461 NULL, "Real Name", 0, NULL); 1460 NULL, _("Real Name"), 0, NULL);
1462 1461
1463 /* extract their Location and put it in */ 1462 /* extract their Location and put it in */
1464 info_extract_field(stripped, url_text, "Location:", 2, "\n", '\n', 1463 info_extract_field(stripped, url_text, "Location:", 2, "\n", '\n',
1465 NULL, "Location", 0, NULL); 1464 NULL, _("Location"), 0, NULL);
1466 1465
1467 /* extract their Age and put it in */ 1466 /* extract their Age and put it in */
1468 info_extract_field(stripped, url_text, "Age:", 3, "\n", '\n', 1467 info_extract_field(stripped, url_text, "Age:", 3, "\n", '\n',
1469 NULL, "Age", 0, NULL); 1468 NULL, _("Age"), 0, NULL);
1470 1469
1471 /* extract their MaritalStatus and put it in */ 1470 /* extract their MaritalStatus and put it in */
1472 info_extract_field(stripped, url_text, "MaritalStatus:", 3, "\n", '\n', 1471 info_extract_field(stripped, url_text, "MaritalStatus:", 3, "\n", '\n',
1473 "No Answer", "Marital Status", 0, NULL); 1472 _("No Answer"), _("Marital Status"), 0, NULL);
1474 1473
1475 /* extract their Gender and put it in */ 1474 /* extract their Gender and put it in */
1476 info_extract_field(stripped, url_text, "Gender:", 3, "\n", '\n', 1475 info_extract_field(stripped, url_text, "Gender:", 3, "\n", '\n',
1477 "No Answer", "Gender", 0, NULL); 1476 _("No Answer"), _("Gender"), 0, NULL);
1478 1477
1479 /* extract their Occupation and put it in */ 1478 /* extract their Occupation and put it in */
1480 info_extract_field(stripped, url_text, "Occupation:", 2, "\n", '\n', 1479 info_extract_field(stripped, url_text, "Occupation:", 2, "\n", '\n',
1481 NULL, "Occupation", 0, NULL); 1480 NULL, _("Occupation"), 0, NULL);
1482 1481
1483 /* Hobbies, Latest News, and Favorite Quote are a bit different, since the 1482 /* Hobbies, Latest News, and Favorite Quote are a bit different, since the
1484 * values can contain embedded newlines... but any or all of them can also 1483 * values can contain embedded newlines... but any or all of them can also
1485 * not appear. The way we delimit them is to successively look for the next 1484 * not appear. The way we delimit them is to successively look for the next
1486 * one that _could_ appear, and if all else fails, we end the section by 1485 * one that _could_ appear, and if all else fails, we end the section by
1487 * looking for the 'Links' heading, which is the next thing to follow this 1486 * looking for the 'Links' heading, which is the next thing to follow this
1488 * bunch. 1487 * bunch.
1489 */ 1488 */
1490 if (!info_extract_field(stripped, url_text, "Hobbies:", 1, "Latest News", 1489 if (!info_extract_field(stripped, url_text, "Hobbies:", 1, "Latest News",
1491 '\n', NULL, "Hobbies", 0, NULL)) 1490 '\n', NULL, _("Hobbies"), 0, NULL))
1492 if (!info_extract_field(stripped, url_text, "Hobbies:", 1, "Favorite Quote", 1491 if (!info_extract_field(stripped, url_text, "Hobbies:", 1, "Favorite Quote",
1493 '\n', NULL, "Hobbies", 0, NULL)) 1492 '\n', NULL, _("Hobbies"), 0, NULL))
1494 info_extract_field(stripped, url_text, "Hobbies:", 1, "Links", 1493 info_extract_field(stripped, url_text, "Hobbies:", 1, "Links",
1495 '\n', NULL, "Hobbies", 0, NULL); 1494 '\n', NULL, _("Hobbies"), 0, NULL);
1496 if (!info_extract_field(stripped, url_text, "Latest News:", 1, "Favorite Quote", 1495 if (!info_extract_field(stripped, url_text, "Latest News:", 1, "Favorite Quote",
1497 '\n', NULL, "Latest News", 0, NULL)) 1496 '\n', NULL, _("Latest News"), 0, NULL))
1498 info_extract_field(stripped, url_text, "Latest News:", 1, "Links", 1497 info_extract_field(stripped, url_text, "Latest News:", 1, "Links",
1499 '\n', NULL, "Latest News", 0, NULL); 1498 '\n', NULL, _("Latest News"), 0, NULL);
1500 info_extract_field(stripped, url_text, "Favorite Quote:", 0, "Links", 1499 info_extract_field(stripped, url_text, "Favorite Quote:", 0, "Links",
1501 '\n', NULL, "Favorite Quote", 0, NULL); 1500 '\n', NULL, _("Favorite Quote"), 0, NULL);
1502 1501
1503 /* Home Page will either be "No home page specified", 1502 /* Home Page will either be "No home page specified",
1504 * or "Home Page: " and a link. */ 1503 * or "Home Page: " and a link. */
1505 p = strstr(stripped, "No home page specified"); 1504 p = strstr(stripped, "No home page specified");
1506 if (!p) 1505 if (!p)
1507 info_extract_field(stripped, url_text, "Home Page:", 1, " ", 0, NULL, 1506 info_extract_field(stripped, url_text, "Home Page:", 1, " ", 0, NULL,
1508 "Home Page", 1, NULL); 1507 _("Home Page"), 1, NULL);
1509 1508
1510 /* Cool Link {1,2,3} is also different. If "No cool link specified" exists, 1509 /* Cool Link {1,2,3} is also different. If "No cool link specified" exists,
1511 * then we have none. If we have one however, we'll need to check and see if 1510 * then we have none. If we have one however, we'll need to check and see if
1512 * we have a second one. If we have a second one, we have to check to see if 1511 * we have a second one. If we have a second one, we have to check to see if
1513 * we have a third one. 1512 * we have a third one.
1514 */ 1513 */
1515 p = strstr(stripped,"No cool link specified"); 1514 p = strstr(stripped,"No cool link specified");
1516 if (!p) 1515 if (!p)
1517 if (info_extract_field(stripped, url_text, "Cool Link 1:", 1, " ", 0, NULL, 1516 if (info_extract_field(stripped, url_text, "Cool Link 1:", 1, " ", 0, NULL,
1518 "Cool Link 1", 1, NULL)) 1517 _("Cool Link 1"), 1, NULL))
1519 if (info_extract_field(stripped, url_text, "Cool Link 2:", 1, " ", 0, NULL, 1518 if (info_extract_field(stripped, url_text, "Cool Link 2:", 1, " ", 0, NULL,
1520 "Cool Link 2", 1, NULL)) 1519 _("Cool Link 2"), 1, NULL))
1521 info_extract_field(stripped, url_text, "Cool Link 3:", 1, " ", 0, NULL, 1520 info_extract_field(stripped, url_text, "Cool Link 3:", 1, " ", 0, NULL,
1522 "Cool Link 3", 1, NULL); 1521 _("Cool Link 3"), 1, NULL);
1523 1522
1524 /* see if Member Since is there, and if so, extract it. */ 1523 /* see if Member Since is there, and if so, extract it. */
1525 info_extract_field(stripped, url_text, "Member Since:", 1, "Last Updated:", 1524 info_extract_field(stripped, url_text, "Member Since:", 1, "Last Updated:",
1526 '\n', NULL, "Member Since", 0, NULL); 1525 '\n', NULL, _("Member Since"), 0, NULL);
1527 1526
1528 /* extract the Last Updated date and put it in */ 1527 /* extract the Last Updated date and put it in */
1529 info_extract_field(stripped, url_text, "Last Updated:", 1, "\n", '\n', NULL, 1528 info_extract_field(stripped, url_text, "Last Updated:", 1, "\n", '\n', NULL,
1530 "Last Updated", 0, NULL); 1529 _("Last Updated"), 0, NULL);
1531 1530
1532 /* finish off the html */ 1531 /* finish off the html */
1533 strcat(url_text, "</body></html>\n"); 1532 strcat(url_text, "</body></html>\n");
1534 g_free(stripped); 1533 g_free(stripped);
1535 1534