Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 2920:4ed6fb39870b
[gaim-migrate @ 2933]
who the hell cares.
committer: Tailor Script <tailor@pidgin.im>
author | Adam Fritzler <mid@auk.cx> |
---|---|
date | Tue, 01 Jan 2002 09:49:04 +0000 |
parents | 4df759d607f3 |
children | 10a2d4d5bcf2 |
comparison
equal
deleted
inserted
replaced
2919:22aefb8de0cb | 2920:4ed6fb39870b |
---|---|
1568 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", | 1568 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
1569 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : ""); | 1569 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : ""); |
1570 return buf; | 1570 return buf; |
1571 } | 1571 } |
1572 | 1572 |
1573 /* XXX This is horribly copied from ../../buddy.c. */ | |
1574 static char *caps_string(guint caps) | |
1575 { | |
1576 static char buf[512], *tmp; | |
1577 int count = 0, i = 0; | |
1578 guint bit = 1; | |
1579 while (bit <= 0x10000) { | |
1580 if (bit & caps) { | |
1581 switch (bit) { | |
1582 case 0x1: | |
1583 tmp = _("Buddy Icon"); | |
1584 break; | |
1585 case 0x2: | |
1586 tmp = _("Voice"); | |
1587 break; | |
1588 case 0x4: | |
1589 tmp = _("IM Image"); | |
1590 break; | |
1591 case 0x8: | |
1592 tmp = _("Chat"); | |
1593 break; | |
1594 case 0x10: | |
1595 tmp = _("Get File"); | |
1596 break; | |
1597 case 0x20: | |
1598 tmp = _("Send File"); | |
1599 break; | |
1600 case 0x40: | |
1601 case 0x200: | |
1602 tmp = _("Games"); | |
1603 break; | |
1604 case 0x80: | |
1605 tmp = _("Stocks"); | |
1606 break; | |
1607 case 0x100: | |
1608 tmp = _("Send Buddy List"); | |
1609 break; | |
1610 case 0x400: | |
1611 tmp = _("EveryBuddy Bug"); | |
1612 break; | |
1613 case 0x800: | |
1614 tmp = _("AP User"); | |
1615 break; | |
1616 case 0x1000: | |
1617 tmp = _("ICQ RTF"); | |
1618 break; | |
1619 case 0x2000: | |
1620 tmp = _("Nihilist"); | |
1621 break; | |
1622 case 0x4000: | |
1623 tmp = _("ICQ Server Relay"); | |
1624 break; | |
1625 case 0x8000: | |
1626 tmp = _("ICQ Unknown"); | |
1627 break; | |
1628 case 0x10000: | |
1629 tmp = _("Trillian Encryption"); | |
1630 break; | |
1631 default: | |
1632 tmp = NULL; | |
1633 break; | |
1634 } | |
1635 if (tmp) | |
1636 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
1637 tmp); | |
1638 count++; | |
1639 } | |
1640 bit <<= 1; | |
1641 } | |
1642 return buf; | |
1643 } | |
1644 | |
1573 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { | 1645 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
1574 aim_userinfo_t *info; | 1646 aim_userinfo_t *info; |
1575 char *prof_enc = NULL, *prof = NULL; | 1647 char *prof_enc = NULL, *prof = NULL; |
1576 fu16_t infotype; | 1648 fu16_t infotype; |
1577 char header[BUF_LONG]; | 1649 char header[BUF_LONG]; |
1578 char legend[BUF_LONG]; | 1650 char legend[BUF_LONG]; |
1579 struct gaim_connection *gc = sess->aux_data; | 1651 struct gaim_connection *gc = sess->aux_data; |
1580 struct oscar_data *od = gc->proto_data; | 1652 struct oscar_data *od = gc->proto_data; |
1581 GSList *l = od->evilhack; | 1653 GSList *l = od->evilhack; |
1582 gboolean evilhack = FALSE; | 1654 gboolean evilhack = FALSE; |
1583 gboolean away; | |
1584 va_list ap; | 1655 va_list ap; |
1585 char *asc; | 1656 char *asc; |
1586 | 1657 |
1587 va_start(ap, fr); | 1658 va_start(ap, fr); |
1588 info = va_arg(ap, aim_userinfo_t *); | 1659 info = va_arg(ap, aim_userinfo_t *); |
1660 infotype = (fu16_t)va_arg(ap, unsigned int); | |
1589 prof_enc = va_arg(ap, char *); | 1661 prof_enc = va_arg(ap, char *); |
1590 prof = va_arg(ap, char *); | 1662 prof = va_arg(ap, char *); |
1591 infotype = (fu16_t)va_arg(ap, unsigned int); | |
1592 va_end(ap); | 1663 va_end(ap); |
1593 | 1664 |
1594 g_snprintf(legend, sizeof legend, | 1665 g_snprintf(legend, sizeof legend, |
1595 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>" | 1666 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>" |
1596 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>" | 1667 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>" |
1597 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" | 1668 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" |
1598 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" | 1669 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" |
1599 "<IMG SRC=\"admin_icon.gif\"> : Administrator")); | 1670 "<IMG SRC=\"admin_icon.gif\"> : Administrator")); |
1600 | |
1601 away = infotype != AIM_GETINFO_GENERALINFO; | |
1602 | 1671 |
1603 if (info->membersince) | 1672 if (info->membersince) |
1604 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n", | 1673 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n", |
1605 asctime(localtime(&info->membersince))); | 1674 asctime(localtime(&info->membersince))); |
1606 else | 1675 else |
1627 break; | 1696 break; |
1628 } | 1697 } |
1629 l = l->next; | 1698 l = l->next; |
1630 } | 1699 } |
1631 | 1700 |
1632 if (away) { | 1701 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
1633 if (evilhack) { | 1702 if (evilhack) { |
1634 g_show_info_text(gc, info->sn, 2, | 1703 g_show_info_text(gc, info->sn, 2, |
1635 header, | 1704 header, |
1636 (prof && *prof) ? away_subs(prof, gc->username) : | 1705 (prof && *prof) ? away_subs(prof, gc->username) : |
1637 _("<i>User has no away message</i>"), | 1706 _("<i>User has no away message</i>"), |
1641 header, | 1710 header, |
1642 (prof && *prof) ? away_subs(prof, gc->username) : NULL, | 1711 (prof && *prof) ? away_subs(prof, gc->username) : NULL, |
1643 (prof && *prof) ? "<BR><HR><BR>" : NULL, | 1712 (prof && *prof) ? "<BR><HR><BR>" : NULL, |
1644 NULL); | 1713 NULL); |
1645 } | 1714 } |
1715 } else if (infotype == AIM_GETINFO_CAPABILITIES) { | |
1716 g_show_info_text(gc, info->sn, 2, | |
1717 header, | |
1718 "<i>", _("Client Capabilities: "), | |
1719 caps_string(info->capabilities), | |
1720 "</i>", | |
1721 legend, | |
1722 NULL); | |
1646 } else { | 1723 } else { |
1647 g_show_info_text(gc, info->sn, 1, | 1724 g_show_info_text(gc, info->sn, 1, |
1648 (prof && *prof) ? away_subs(prof, gc->username) : | 1725 (prof && *prof) ? away_subs(prof, gc->username) : |
1649 _("<i>No Information Provided</i>"), | 1726 _("<i>No Information Provided</i>"), |
1650 legend, | 1727 legend, |
2320 | 2397 |
2321 static void oscar_get_away(struct gaim_connection *g, char *name) { | 2398 static void oscar_get_away(struct gaim_connection *g, char *name) { |
2322 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | 2399 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2323 if (!odata->icq) | 2400 if (!odata->icq) |
2324 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); | 2401 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); |
2402 } | |
2403 | |
2404 static void oscar_get_caps(struct gaim_connection *g, char *name) { | |
2405 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2406 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES); | |
2325 } | 2407 } |
2326 | 2408 |
2327 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, | 2409 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, |
2328 char *maiden, char *city, char *state, char *country, int web) { | 2410 char *maiden, char *city, char *state, char *country, int web) { |
2329 /* FIXME : some of these things are wrong, but i'm lazy */ | 2411 /* FIXME : some of these things are wrong, but i'm lazy */ |
2772 pbm->callback = oscar_ask_direct_im; | 2854 pbm->callback = oscar_ask_direct_im; |
2773 pbm->gc = gc; | 2855 pbm->gc = gc; |
2774 m = g_list_append(m, pbm); | 2856 m = g_list_append(m, pbm); |
2775 } | 2857 } |
2776 } | 2858 } |
2859 | |
2860 pbm = g_new0(struct proto_buddy_menu, 1); | |
2861 pbm->label = _("Get Capabilities"); | |
2862 pbm->callback = oscar_get_caps; | |
2863 pbm->gc = gc; | |
2864 m = g_list_append(m, pbm); | |
2865 | |
2777 g_free(n); | 2866 g_free(n); |
2778 | 2867 |
2779 return m; | 2868 return m; |
2780 } | 2869 } |
2781 | 2870 |