comparison libpurple/protocols/gg/gg.c @ 23243:56d88bfeed76

Restore status on login on GG, rather than setting Available first. The rest of a patch by Adam "OnO" Strzelecki; references #5693. Fixes #5137.
author Will Thompson <will.thompson@collabora.co.uk>
date Thu, 29 May 2008 12:23:51 +0000
parents 8522f594157c
children 56cf59d028f7 3da0957e7821
comparison
equal deleted inserted replaced
23242:8522f594157c 23243:56d88bfeed76
1489 /* Nothing happened. */ 1489 /* Nothing happened. */
1490 purple_debug_info("gg", "GG_EVENT_NONE\n"); 1490 purple_debug_info("gg", "GG_EVENT_NONE\n");
1491 break; 1491 break;
1492 case GG_EVENT_CONN_SUCCESS: 1492 case GG_EVENT_CONN_SUCCESS:
1493 { 1493 {
1494 PurpleAccount *account;
1495 PurplePresence *presence;
1496 PurpleStatus *status;
1497
1498 purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); 1494 purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n");
1499 purple_input_remove(gc->inpa); 1495 purple_input_remove(gc->inpa);
1500 gc->inpa = purple_input_add(info->session->fd, 1496 gc->inpa = purple_input_add(info->session->fd,
1501 PURPLE_INPUT_READ, 1497 PURPLE_INPUT_READ,
1502 ggp_callback_recv, gc); 1498 ggp_callback_recv, gc);
1503 1499
1504 /* gg_change_status(info->session, GG_STATUS_AVAIL); */
1505
1506 account = purple_connection_get_account(gc);
1507 presence = purple_account_get_presence(account);
1508 status = purple_presence_get_active_status(presence);
1509
1510 ggp_set_status(account, status);
1511 purple_connection_set_state(gc, PURPLE_CONNECTED); 1500 purple_connection_set_state(gc, PURPLE_CONNECTED);
1512 ggp_buddylist_send(gc); 1501 ggp_buddylist_send(gc);
1513 } 1502 }
1514 break; 1503 break;
1515 case GG_EVENT_CONN_FAILED: 1504 case GG_EVENT_CONN_FAILED:
1693 1682
1694 /* static void ggp_login(PurpleAccount *account) {{{ */ 1683 /* static void ggp_login(PurpleAccount *account) {{{ */
1695 static void ggp_login(PurpleAccount *account) 1684 static void ggp_login(PurpleAccount *account)
1696 { 1685 {
1697 PurpleConnection *gc; 1686 PurpleConnection *gc;
1687 PurplePresence *presence;
1688 PurpleStatus *status;
1698 struct gg_login_params *glp; 1689 struct gg_login_params *glp;
1699 GGPInfo *info; 1690 GGPInfo *info;
1700 1691
1701 if (ggp_setup_proxy(account) == -1) 1692 if (ggp_setup_proxy(account) == -1)
1702 return; 1693 return;
1715 gc->proto_data = info; 1706 gc->proto_data = info;
1716 1707
1717 glp->uin = ggp_get_uin(account); 1708 glp->uin = ggp_get_uin(account);
1718 glp->password = (char *)purple_account_get_password(account); 1709 glp->password = (char *)purple_account_get_password(account);
1719 1710
1711 presence = purple_account_get_presence(account);
1712 status = purple_presence_get_active_status(presence);
1713
1720 glp->async = 1; 1714 glp->async = 1;
1721 glp->status = GG_STATUS_AVAIL; 1715 glp->status = ggp_to_gg_status(status, &glp->status_descr);
1722 glp->tls = 0; 1716 glp->tls = 0;
1723 1717
1724 info->session = gg_login(glp); 1718 info->session = gg_login(glp);
1725 if (info->session == NULL) { 1719 if (info->session == NULL) {
1726 purple_connection_error_reason (gc, 1720 purple_connection_error_reason (gc,