comparison src/protocols/oscar/oscar.c @ 10444:6bf9b17c03a5

[gaim-migrate @ 11704] I'm thinking of getting rid of the "login" and "logout" prpl functions... It's really just a status change. Seems like the status change prpl function should take care of login and logout. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 28 Dec 2004 20:46:59 +0000
parents 911530134bf8
children ad9258716144
comparison
equal deleted inserted replaced
10443:b6ca0e1b19d0 10444:6bf9b17c03a5
1553 if (!gc) { 1553 if (!gc) {
1554 gaim_debug_info("oscar", 1554 gaim_debug_info("oscar",
1555 "oscar callback for closed connection (1).\n"); 1555 "oscar callback for closed connection (1).\n");
1556 return; 1556 return;
1557 } 1557 }
1558 1558
1559 od = (OscarData *)gc->proto_data; 1559 od = (OscarData *)gc->proto_data;
1560 1560
1561 if (!g_list_find(gaim_connections_get_all(), gc)) { 1561 if (!g_list_find(gaim_connections_get_all(), gc)) {
1562 /* oh boy. this is probably bad. i guess the only thing we 1562 /* oh boy. this is probably bad. i guess the only thing we
1563 * can really do is return? */ 1563 * can really do is return? */
1584 gaim_debug_error("oscar", "Waiting to be destroyed\n"); 1584 gaim_debug_error("oscar", "Waiting to be destroyed\n");
1585 return; 1585 return;
1586 } 1586 }
1587 } else { 1587 } else {
1588 if ((conn->type == AIM_CONN_TYPE_BOS) || 1588 if ((conn->type == AIM_CONN_TYPE_BOS) ||
1589 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { 1589 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS)))
1590 gaim_debug_error("oscar", 1590 {
1591 "major connection error\n"); 1591 gaim_debug_error("oscar", "Major connection error. i.e. "
1592 "invalid data was received on the oscar TCP stream\n");
1592 gaim_connection_error(gc, _("Disconnected.")); 1593 gaim_connection_error(gc, _("Disconnected."));
1593 } else if (conn->type == AIM_CONN_TYPE_CHAT) { 1594 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
1594 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); 1595 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
1595 GaimConversation *conv = gaim_find_chat(gc, c->id); 1596 GaimConversation *conv = gaim_find_chat(gc, c->id);
1596 char *buf; 1597 char *buf;
1601 gaim_input_remove(c->inpa); 1602 gaim_input_remove(c->inpa);
1602 c->inpa = 0; 1603 c->inpa = 0;
1603 c->fd = -1; 1604 c->fd = -1;
1604 aim_conn_kill(od->sess, &conn); 1605 aim_conn_kill(od->sess, &conn);
1605 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); 1606 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name);
1606 if (conv) 1607 if (conv)
1607 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL)); 1608 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL));
1608 else 1609 else
1609 gaim_notify_error(gc, NULL, buf, NULL); 1610 gaim_notify_error(gc, NULL, buf, NULL);
1610 g_free(buf); 1611 g_free(buf);
1611 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 1612 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
1704 "Screen name sent, waiting for response\n"); 1705 "Screen name sent, waiting for response\n");
1705 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); 1706 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS);
1706 ck[1] = 0x65; 1707 ck[1] = 0x65;
1707 } 1708 }
1708 1709
1709 static void oscar_login(GaimAccount *account, GaimStatus *status) { 1710 static void
1711 oscar_login(GaimAccount *account, GaimStatus *status)
1712 {
1710 aim_session_t *sess; 1713 aim_session_t *sess;
1711 aim_conn_t *conn; 1714 aim_conn_t *conn;
1712 GaimConnection *gc = gaim_account_get_connection(account); 1715 GaimConnection *gc = gaim_account_get_connection(account);
1713 OscarData *od = gc->proto_data = g_new0(OscarData, 1); 1716 OscarData *od = gc->proto_data = g_new0(OscarData, 1);
1714 GaimStatusType *status_type; 1717 GaimStatusType *status_type;
1716 1719
1717 status_type = gaim_status_get_type(status); 1720 status_type = gaim_status_get_type(status);
1718 primitive = gaim_status_type_get_primitive(status_type); 1721 primitive = gaim_status_type_get_primitive(status_type);
1719 1722
1720 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); 1723 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc);
1721 1724
1722 if (primitive == GAIM_STATUS_OFFLINE) 1725 if (primitive == GAIM_STATUS_OFFLINE)
1723 return; 1726 return;
1724 1727
1725 if (!aim_snvalid(gaim_account_get_username(account))) { 1728 if (!aim_snvalid(gaim_account_get_username(account))) {
1726 gchar *buf; 1729 gchar *buf;
1751 /* Connect to core Gaim signals */ 1754 /* Connect to core Gaim signals */
1752 gaim_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc); 1755 gaim_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc);
1753 1756
1754 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); 1757 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
1755 if (conn == NULL) { 1758 if (conn == NULL) {
1756 gaim_debug_error("oscar", 1759 gaim_debug_error("oscar", "internal connection error\n");
1757 "internal connection error\n");
1758 gaim_connection_error(gc, _("Unable to login to AIM")); 1760 gaim_connection_error(gc, _("Unable to login to AIM"));
1759 return; 1761 return;
1760 } 1762 }
1761 1763
1762 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1764 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);