comparison src/protocols/msn/msn.c @ 13544:46559ab11aed

[gaim-migrate @ 15921] Active the new MSN profile stuff. Also, fix a couple bugs in this that I noticed. FWIW, I noticed that one of the fields (Home Address, at least) has extra spaces in it, and it seems gtkimhtml displays them all, when it should collapse multiple spaces. I didn't do anything about that. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 21 Mar 2006 04:29:20 +0000
parents 56898561b8a9
children 3cfdf1653a64
comparison
equal deleted inserted replaced
13543:d05d8bcabbfb 13544:46559ab11aed
1430 msn_got_info(void *data, const char *url_text, size_t len) 1430 msn_got_info(void *data, const char *url_text, size_t len)
1431 { 1431 {
1432 MsnGetInfoData *info_data = (MsnGetInfoData *)data; 1432 MsnGetInfoData *info_data = (MsnGetInfoData *)data;
1433 char *stripped, *p, *q; 1433 char *stripped, *p, *q;
1434 char buf[1024]; 1434 char buf[1024];
1435 char *tooltip_text = NULL; 1435 char *tooltip_text;
1436 char *user_url = NULL; 1436 char *user_url = NULL;
1437 gboolean found; 1437 gboolean found;
1438 gboolean has_info = FALSE; 1438 gboolean has_info = FALSE;
1439 gboolean sect_info = FALSE; 1439 gboolean sect_info = FALSE;
1440 const char* title = NULL; 1440 const char* title = NULL;
1441 char *url_buffer; 1441 char *url_buffer;
1442 #if 0 /* XXX: undo this when strings have thawed */
1443 char *personal = NULL; 1442 char *personal = NULL;
1444 char *business = NULL; 1443 char *business = NULL;
1445 #endif
1446 GString *s, *s2; 1444 GString *s, *s2;
1447 int stripped_len; 1445 int stripped_len;
1448 #if PHOTO_SUPPORT 1446 #if PHOTO_SUPPORT
1449 char *photo_url_text = NULL; 1447 char *photo_url_text = NULL;
1450 MsnGetInfoStepTwoData *info2_data = NULL; 1448 MsnGetInfoStepTwoData *info2_data = NULL;
1532 1530
1533 /* Extract their Name and put it in */ 1531 /* Extract their Name and put it in */
1534 MSN_GOT_INFO_GET_FIELD("Name", _("Name")) 1532 MSN_GOT_INFO_GET_FIELD("Name", _("Name"))
1535 1533
1536 /* General */ 1534 /* General */
1537 #if 0 /* XXX: undo this when strings have thawed */ 1535 MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname"));
1538 MSN_GOT_INFO_GET_FIELD("Nickname", gX_("Nickname"));
1539 #endif
1540 MSN_GOT_INFO_GET_FIELD("Age", _("Age")); 1536 MSN_GOT_INFO_GET_FIELD("Age", _("Age"));
1541 MSN_GOT_INFO_GET_FIELD("Gender", _("Gender")); 1537 MSN_GOT_INFO_GET_FIELD("Gender", _("Gender"));
1542 MSN_GOT_INFO_GET_FIELD("Occupation", _("Occupation")); 1538 MSN_GOT_INFO_GET_FIELD("Occupation", _("Occupation"));
1543 MSN_GOT_INFO_GET_FIELD("Location", _("Location")); 1539 MSN_GOT_INFO_GET_FIELD("Location", _("Location"));
1544 1540
1553 1549
1554 MSN_GOT_INFO_GET_FIELD("More about me", _("A Little About Me")); 1550 MSN_GOT_INFO_GET_FIELD("More about me", _("A Little About Me"));
1555 1551
1556 if (sect_info) 1552 if (sect_info)
1557 { 1553 {
1558 /* trim off the trailing <br> */ 1554 /* trim off the trailing "<br>\n" */
1559 g_string_truncate(s, strlen(s->str) - 4); 1555 g_string_truncate(s, strlen(s->str) - 5);
1560 #if 0 /* XXX: undo this when strings have thawed */ 1556 g_string_append_printf(s2, _("%s<b>General</b><br>%s"),
1561 g_string_append_printf(s2, gX_("%s<b>General</b><br>%s"), (tooltip_text != NULL) ? "<hr>" : "", s->str); 1557 (*tooltip_text) ? "<hr>" : "", s->str);
1562 #else
1563 g_string_append(s2, s->str);
1564 #endif
1565 s = g_string_truncate(s, 0); 1558 s = g_string_truncate(s, 0);
1566 has_info = TRUE; 1559 has_info = TRUE;
1567 sect_info = FALSE; 1560 sect_info = FALSE;
1568 } 1561 }
1569 1562
1570 1563
1571 /* Social */ 1564 /* Social */
1572 MSN_GOT_INFO_GET_FIELD("Marital status", _("Marital Status")); 1565 MSN_GOT_INFO_GET_FIELD("Marital status", _("Marital Status"));
1573 #if 0 /* XXX: undo this when strings have thawed */ 1566 MSN_GOT_INFO_GET_FIELD("Interested in", _("Interests"));
1574 MSN_GOT_INFO_GET_FIELD("Interested in", gX_("Interested in")); 1567 MSN_GOT_INFO_GET_FIELD("Pets", _("Pets"));
1575 MSN_GOT_INFO_GET_FIELD("Pets", gX_("Pets")); 1568 MSN_GOT_INFO_GET_FIELD("Hometown", _("Hometown"));
1576 MSN_GOT_INFO_GET_FIELD("Hometown", gX_("Hometown")); 1569 MSN_GOT_INFO_GET_FIELD("Places lived", _("Places Lived"));
1577 MSN_GOT_INFO_GET_FIELD("Places lived", gX_("Places lived")); 1570 MSN_GOT_INFO_GET_FIELD("Fashion", _("Fashion"));
1578 MSN_GOT_INFO_GET_FIELD("Fashion", gX_("Fashion")); 1571 MSN_GOT_INFO_GET_FIELD("Humor", _("Humor"));
1579 MSN_GOT_INFO_GET_FIELD("Humor", gX_("Humor")); 1572 MSN_GOT_INFO_GET_FIELD("Music", _("Music"));
1580 MSN_GOT_INFO_GET_FIELD("Music", gX_("Music"));
1581 #endif
1582 MSN_GOT_INFO_GET_FIELD("Favorite quote", _("Favorite Quote")); 1573 MSN_GOT_INFO_GET_FIELD("Favorite quote", _("Favorite Quote"));
1583 1574
1584 if (sect_info) 1575 if (sect_info)
1585 { 1576 {
1586 #if 0 /* XXX: undo this when strings have thawed */ 1577 g_string_append_printf(s2, _("%s<b>Social</b><br>%s"), has_info ? "<br><hr>" : "", s->str);
1587 g_string_append_printf(s2, gX_("%s<b>Social</b><br>%s"), has_info ? "<br><hr>" : "", s->str);
1588 #else
1589 g_string_append_printf(s2, "%s%s", has_info ? "<br><hr>" : "", s->str);
1590 #endif
1591 s = g_string_truncate(s, 0); 1578 s = g_string_truncate(s, 0);
1592 has_info = TRUE; 1579 has_info = TRUE;
1593 sect_info = FALSE; 1580 sect_info = FALSE;
1594 } 1581 }
1595 1582
1596 #if 0 /* XXX: undo this when strings have thawed */
1597 /* Contact Info */ 1583 /* Contact Info */
1598 /* Personal */ 1584 /* Personal */
1599 MSN_GOT_INFO_GET_FIELD("Name", gX_("Name")); 1585 MSN_GOT_INFO_GET_FIELD("Name", _("Name"));
1600 MSN_GOT_INFO_GET_FIELD("Significant other", gX_("Significant other")); 1586 MSN_GOT_INFO_GET_FIELD("Significant other", _("Significant Other"));
1601 MSN_GOT_INFO_GET_FIELD("Home phone", gX_("Home phone")); 1587 MSN_GOT_INFO_GET_FIELD("Home phone", _("Home Phone"));
1602 MSN_GOT_INFO_GET_FIELD("Home phone 2", gX_("Home phone 2")); 1588 MSN_GOT_INFO_GET_FIELD("Home phone 2", _("Home Phone 2"));
1603 MSN_GOT_INFO_GET_FIELD("Home address", gX_("Home address")); 1589 MSN_GOT_INFO_GET_FIELD("Home address", _("Home Address"));
1604 MSN_GOT_INFO_GET_FIELD("Personal Mobile", gX_("Personal Mobile")); 1590 MSN_GOT_INFO_GET_FIELD("Personal Mobile", _("Personal Mobile"));
1605 MSN_GOT_INFO_GET_FIELD("Home fax", gX_("Home fax")); 1591 MSN_GOT_INFO_GET_FIELD("Home fax", _("Home Fax"));
1606 MSN_GOT_INFO_GET_FIELD("Personal e-mail", gX_("Personal e-mail")); 1592 MSN_GOT_INFO_GET_FIELD("Personal e-mail", _("Personal E-Mail"));
1607 MSN_GOT_INFO_GET_FIELD("Personal IM", gX_("Personal IM")); 1593 MSN_GOT_INFO_GET_FIELD("Personal IM", _("Personal IM"));
1608 MSN_GOT_INFO_GET_FIELD("Birthday", gX_("Birthday")); 1594 MSN_GOT_INFO_GET_FIELD("Birthday", _("Birthday"));
1609 MSN_GOT_INFO_GET_FIELD("Anniversary", gX_("Anniversary")); 1595 MSN_GOT_INFO_GET_FIELD("Anniversary", _("Anniversary"));
1610 MSN_GOT_INFO_GET_FIELD("Notes", gX_("Notes")); 1596 MSN_GOT_INFO_GET_FIELD("Notes", _("Notes"));
1611 1597
1612 if (sect_info) 1598 if (sect_info)
1613 { 1599 {
1614 personal = g_strdup_printf(gX_("<br><b>Personal</b><br>%s"), s->str); 1600 personal = g_strdup_printf(_("<br><b>Personal</b><br>%s"), s->str);
1615 s = g_string_truncate(s, 0); 1601 s = g_string_truncate(s, 0);
1616 sect_info = FALSE; 1602 sect_info = FALSE;
1617 } 1603 }
1618 1604
1619 /* Business */ 1605 /* Business */
1620 MSN_GOT_INFO_GET_FIELD("Name", gX_("Name")); 1606 MSN_GOT_INFO_GET_FIELD("Name", _("Name"));
1621 MSN_GOT_INFO_GET_FIELD("Job title", gX_("Job title")); 1607 MSN_GOT_INFO_GET_FIELD("Job title", _("Job Title"));
1622 MSN_GOT_INFO_GET_FIELD("Company", gX_("Company")); 1608 MSN_GOT_INFO_GET_FIELD("Company", _("Company"));
1623 MSN_GOT_INFO_GET_FIELD("Department", gX_("Department")); 1609 MSN_GOT_INFO_GET_FIELD("Department", _("Department"));
1624 MSN_GOT_INFO_GET_FIELD("Profession", gX_("Profession")); 1610 MSN_GOT_INFO_GET_FIELD("Profession", _("Profession"));
1625 MSN_GOT_INFO_GET_FIELD("Work phone 1", gX_("Work phone 1")); 1611 MSN_GOT_INFO_GET_FIELD("Work phone 1", _("Work Phone"));
1626 MSN_GOT_INFO_GET_FIELD("Work phone 2", gX_("Work phone 2")); 1612 MSN_GOT_INFO_GET_FIELD("Work phone 2", _("Work Phone 2"));
1627 MSN_GOT_INFO_GET_FIELD("Work address", gX_("Work address")); 1613 MSN_GOT_INFO_GET_FIELD("Work address", _("Work Address"));
1628 MSN_GOT_INFO_GET_FIELD("Work mobile", gX_("Work mobile")); 1614 MSN_GOT_INFO_GET_FIELD("Work mobile", _("Work Mobile"));
1629 MSN_GOT_INFO_GET_FIELD("Work pager", gX_("Work pager")); 1615 MSN_GOT_INFO_GET_FIELD("Work pager", _("Work Pager"));
1630 MSN_GOT_INFO_GET_FIELD("Work fax", gX_("Work fax")); 1616 MSN_GOT_INFO_GET_FIELD("Work fax", _("Work Fax"));
1631 MSN_GOT_INFO_GET_FIELD("Work e-mail", gX_("Work e-mail")); 1617 MSN_GOT_INFO_GET_FIELD("Work e-mail", _("Work E-Mail"));
1632 MSN_GOT_INFO_GET_FIELD("Work IM", gX_("Work IM")); 1618 MSN_GOT_INFO_GET_FIELD("Work IM", _("Work IM"));
1633 MSN_GOT_INFO_GET_FIELD("Start date", gX_("Start date")); 1619 MSN_GOT_INFO_GET_FIELD("Start date", _("Start Date"));
1634 MSN_GOT_INFO_GET_FIELD("Notes", gX_("Notes")); 1620 MSN_GOT_INFO_GET_FIELD("Notes", _("Notes"));
1635 1621
1636 if (sect_info) 1622 if (sect_info)
1637 { 1623 {
1638 business = g_strdup_printf(gX_("<br><b>Business</b><br>%s"), s->str); 1624 business = g_strdup_printf(_("<br><b>Business</b><br>%s"), s->str);
1639 s = g_string_truncate(s, 0); 1625 s = g_string_truncate(s, 0);
1640 sect_info = FALSE; 1626 sect_info = FALSE;
1641 } 1627 }
1642 1628
1643 if ((personal != NULL) || (business != NULL)) 1629 if ((personal != NULL) || (business != NULL))
1644 { 1630 {
1645 /* trim off the trailing <br> */ 1631 /* trim off the trailing "<br>\n" */
1646 g_string_truncate(s2, strlen(s2->str) - 4); 1632 g_string_truncate(s, strlen(s->str) - 5);
1633
1647 has_info = TRUE; 1634 has_info = TRUE;
1648 g_string_append_printf(s2, gX_("%s<b>Contact Info</b>%s%s"), 1635 g_string_append_printf(s2, _("<hr><b>Contact Info</b>%s%s"),
1649 has_info ? "<hr>" : "",
1650 personal ? personal : "", 1636 personal ? personal : "",
1651 business ? business : ""); 1637 business ? business : "");
1652 } 1638 }
1653 1639
1654 g_free(personal); 1640 g_free(personal);
1655 g_free(business); 1641 g_free(business);
1656 #endif
1657 g_string_free(s, TRUE); 1642 g_string_free(s, TRUE);
1658 s = s2; 1643 s = s2;
1659 1644
1660 #if 0 /* these probably don't show up any more */ 1645 #if 0 /* these probably don't show up any more */
1661 /* 1646 /*
1816 _("Gaim could not find " /* This should never happen */ 1801 _("Gaim could not find " /* This should never happen */
1817 "any information in the user's profile. " 1802 "any information in the user's profile. "
1818 "The user most likely does not exist."))); 1803 "The user most likely does not exist.")));
1819 } 1804 }
1820 /* put a link to the actual profile URL */ 1805 /* put a link to the actual profile URL */
1821 #if 0 /* XXX: undo when strings thawed */ 1806 g_string_append_printf(s, _("<hr><b>%s:</b> "), _("Profile URL"));
1822 g_string_append_printf(s, gX_("<hr><b>%s:</b> "), _("Profile URL"));
1823 #else
1824 g_string_append(s, "<hr>");
1825 g_string_append_printf(s, _("<b>%s:</b> "), _("Profile URL"));
1826 #endif
1827 g_string_append_printf(s, "<br><a href=\"%s%s\">%s%s</a><br>", 1807 g_string_append_printf(s, "<br><a href=\"%s%s\">%s%s</a><br>",
1828 PROFILE_URL, info_data->name, PROFILE_URL, info_data->name); 1808 PROFILE_URL, info_data->name, PROFILE_URL, info_data->name);
1829 1809
1830 /* Finish it off, and show it to them */ 1810 /* Finish it off, and show it to them */
1831 g_string_append(s, "</body></html>\n"); 1811 g_string_append(s, "</body></html>\n");