Mercurial > pidgin.yaz
comparison src/protocols/yahoo/yahoo.c @ 7865:1d2e9482e195
[gaim-migrate @ 8519]
" Here's a patch that impliments system messages, and
tries to improve the login errors a little, including
handling one more of them.
Notice that for system messages, we pass NULL instead
of gc to gaim_notify_info, because often we get
disconnected right after receiving a system message. To
see it in action, change the protocol version from
0x000b to 0x0900" --Tim Ringenbach (marv_sf)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 14 Dec 2003 17:07:16 +0000 |
parents | 4bc847ab3bb4 |
children | cbfbed263d00 |
comparison
equal
deleted
inserted
replaced
7864:dc80d4e5c3b0 | 7865:1d2e9482e195 |
---|---|
742 serv_got_im(gc, im->from, m2, 0, im->time); | 742 serv_got_im(gc, im->from, m2, 0, im->time); |
743 g_free(m2); | 743 g_free(m2); |
744 g_free(im); | 744 g_free(im); |
745 } | 745 } |
746 g_slist_free(list); | 746 g_slist_free(list); |
747 } | |
748 | |
749 static void yahoo_process_sysmessage(GaimConnection *gc, struct yahoo_packet *pkt) | |
750 { | |
751 GSList *l = pkt->hash; | |
752 char *prim, *me = NULL, *msg = NULL; | |
753 | |
754 while (l) { | |
755 struct yahoo_pair *pair = l->data; | |
756 | |
757 if (pair->key == 5) | |
758 me = pair->value; | |
759 if (pair->key == 14) | |
760 msg = pair->value; | |
761 | |
762 l = l->next; | |
763 } | |
764 | |
765 if (!msg) | |
766 return; | |
767 | |
768 prim = g_strdup_printf(_("Yahoo! system message for %s:"), | |
769 me?me:gaim_connection_get_display_name(gc)); | |
770 gaim_notify_info(NULL, NULL, prim, msg); | |
771 g_free(prim); | |
747 } | 772 } |
748 | 773 |
749 static void yahoo_buddy_added_us(GaimConnection *gc, struct yahoo_packet *pkt) { | 774 static void yahoo_buddy_added_us(GaimConnection *gc, struct yahoo_packet *pkt) { |
750 char *id = NULL; | 775 char *id = NULL; |
751 char *who = NULL; | 776 char *who = NULL; |
1556 static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt) | 1581 static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt) |
1557 { | 1582 { |
1558 GSList *l = pkt->hash; | 1583 GSList *l = pkt->hash; |
1559 int err = 0; | 1584 int err = 0; |
1560 char *msg; | 1585 char *msg; |
1586 char *url = NULL; | |
1587 char *fullmsg; | |
1561 | 1588 |
1562 while (l) { | 1589 while (l) { |
1563 struct yahoo_pair *pair = l->data; | 1590 struct yahoo_pair *pair = l->data; |
1564 | 1591 |
1565 if (pair->key == 66) | 1592 if (pair->key == 66) |
1566 err = strtol(pair->value, NULL, 10); | 1593 err = strtol(pair->value, NULL, 10); |
1594 if (pair->key == 20) | |
1595 url = pair->value; | |
1567 | 1596 |
1568 l = l->next; | 1597 l = l->next; |
1569 } | 1598 } |
1570 | 1599 |
1571 switch (err) { | 1600 switch (err) { |
1572 case 3: | 1601 case 3: |
1573 msg = _("Invalid username."); | 1602 msg = g_strdup(_("Invalid username.")); |
1574 break; | 1603 break; |
1575 case 13: | 1604 case 13: |
1576 msg = _("Incorrect password."); | 1605 msg = g_strdup(_("Incorrect password.")); |
1606 break; | |
1607 case 14: | |
1608 msg = g_strdup(_("Your account is locked, please log in to the yahoo website.")); | |
1577 break; | 1609 break; |
1578 default: | 1610 default: |
1579 msg = _("Unknown error."); | 1611 msg = g_strdup_printf(_("Unknown error number %d."), err); |
1580 } | 1612 } |
1581 gaim_connection_error(gc, msg); | 1613 |
1614 if (url) | |
1615 fullmsg = g_strdup_printf("%s\n%s", msg, url); | |
1616 else | |
1617 fullmsg = g_strdup(msg); | |
1618 | |
1619 gaim_connection_error(gc, fullmsg); | |
1620 g_free(msg); | |
1621 g_free(fullmsg); | |
1582 } | 1622 } |
1583 | 1623 |
1584 static void yahoo_process_addbuddy(GaimConnection *gc, struct yahoo_packet *pkt) | 1624 static void yahoo_process_addbuddy(GaimConnection *gc, struct yahoo_packet *pkt) |
1585 { | 1625 { |
1586 int err = 0; | 1626 int err = 0; |
1651 case YAHOO_SERVICE_MESSAGE: | 1691 case YAHOO_SERVICE_MESSAGE: |
1652 case YAHOO_SERVICE_GAMEMSG: | 1692 case YAHOO_SERVICE_GAMEMSG: |
1653 case YAHOO_SERVICE_CHATMSG: | 1693 case YAHOO_SERVICE_CHATMSG: |
1654 yahoo_process_message(gc, pkt); | 1694 yahoo_process_message(gc, pkt); |
1655 break; | 1695 break; |
1696 case YAHOO_SERVICE_SYSMESSAGE: | |
1697 yahoo_process_sysmessage(gc, pkt); | |
1698 break; | |
1656 case YAHOO_SERVICE_NEWMAIL: | 1699 case YAHOO_SERVICE_NEWMAIL: |
1657 yahoo_process_mail(gc, pkt); | 1700 yahoo_process_mail(gc, pkt); |
1658 break; | 1701 break; |
1659 case YAHOO_SERVICE_NEWCONTACT: | 1702 case YAHOO_SERVICE_NEWCONTACT: |
1660 yahoo_process_contact(gc, pkt); | 1703 yahoo_process_contact(gc, pkt); |