Mercurial > pidgin.yaz
changeset 18612:56886bde4535
merge of '88e83a787741462b25953d4b5a1c467575657ad0'
and 'd660b3efb34dc79a2af00f40d372ad9d07d44e15'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 22 Jul 2007 08:33:49 +0000 |
parents | 43a331f88c68 (diff) c46515956e2e (current diff) |
children | 784f98a1bc7f |
files | |
diffstat | 4 files changed, 28 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/flap_connection.c Sun Jul 22 08:14:22 2007 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Sun Jul 22 08:33:49 2007 +0000 @@ -356,16 +356,21 @@ FlapConnection *conn; OscarData *od; PurpleAccount *account; + aim_rxcallback_t userfunc; conn = data; od = conn->od; account = (PURPLE_CONNECTION_IS_VALID(od->gc) ? purple_connection_get_account(od->gc) : NULL); purple_debug_info("oscar", "Destroying oscar connection of " - "type 0x%04hx\n", conn->type); + "type 0x%04hx. Disconnect reason is %d\n", + conn->type, conn->disconnect_reason); od->oscar_connections = g_slist_remove(od->oscar_connections, conn); + if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) + userfunc(od, conn, NULL, conn->disconnect_code, conn->error_message); + /* * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then * we should try to request one instead of disconnecting. @@ -375,7 +380,10 @@ { /* No more FLAP connections! Sign off this PurpleConnection! */ gchar *tmp; - if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) + if (conn->disconnect_code == 0x0001) { + tmp = g_strdup(_("You have signed on from another location.")); + od->gc->wants_to_die = TRUE; + } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) tmp = g_strdup(_("Server closed the connection.")); else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) tmp = g_strdup_printf(_("Lost connection with server:\n%s"), @@ -695,8 +703,6 @@ { GSList *tlvlist; char *msg = NULL; - guint16 code = 0; - aim_rxcallback_t userfunc; if (byte_stream_empty(&frame->data) == 0) { /* XXX should do something with this */ @@ -713,13 +719,17 @@ tlvlist = aim_tlvlist_read(&frame->data); if (aim_tlv_gettlv(tlvlist, 0x0009, 1)) - code = aim_tlv_get16(tlvlist, 0x0009, 1); + conn->disconnect_code = aim_tlv_get16(tlvlist, 0x0009, 1); if (aim_tlv_gettlv(tlvlist, 0x000b, 1)) msg = aim_tlv_getstr(tlvlist, 0x000b, 1); - if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) - userfunc(od, conn, frame, code, msg); + /* + * The server ended this FLAP connnection, so let's be nice and + * close the physical TCP connection + */ + flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_REMOTE_CLOSED, msg); aim_tlvlist_free(tlvlist);
--- a/libpurple/protocols/oscar/oscar.c Sun Jul 22 08:14:22 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sun Jul 22 08:33:49 2007 +0000 @@ -1383,7 +1383,6 @@ } purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); purple_debug_info("oscar", "Error URL: %s\n", info->errorurl); - od->killme = TRUE; return 1; } @@ -1410,7 +1409,6 @@ if (newconn->connect_data == NULL) { purple_connection_error(gc, _("Could Not Connect")); - od->killme = TRUE; return 0; } @@ -1438,7 +1436,6 @@ /* Disconnect */ gc->wants_to_die = TRUE; purple_connection_error(gc, _("The SecurID key entered is invalid.")); - od->killme = TRUE; } static int @@ -3472,18 +3469,9 @@ purple_debug_info("oscar", "Disconnected. Code is 0x%04x and msg is %s\n", code, (msg != NULL ? msg : "")); - g_return_val_if_fail(fr != NULL, 1); g_return_val_if_fail(conn != NULL, 1); - if (conn->type == SNAC_FAMILY_LOCATE) { - if (code == 0x0001) { - gc->wants_to_die = TRUE; - purple_connection_error(gc, _("You have signed on from another location.")); - } else { - purple_connection_error(gc, _("You have been signed off for an unknown reason.")); - } - od->killme = TRUE; - } else if (conn->type == SNAC_FAMILY_CHAT) { + if (conn->type == SNAC_FAMILY_CHAT) { struct chat_connection *cc; PurpleConversation *conv; @@ -3492,6 +3480,11 @@ if (conv != NULL) { + /* + * TOOD: Have flap_connection_destroy_cb() send us the + * error message stored in 'tmp', which should be + * human-friendly, and print that to the chat room. + */ gchar *buf; buf = g_strdup_printf(_("You have been disconnected from chat " "room %s."), cc->name);
--- a/libpurple/protocols/oscar/oscar.h Sun Jul 22 08:14:22 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.h Sun Jul 22 08:33:49 2007 +0000 @@ -378,6 +378,7 @@ guint destroy_timeout; OscarDisconnectReason disconnect_reason; gchar *error_message; + guint16 disconnect_code; /* A few variables that are only used when connecting */ PurpleProxyConnectData *connect_data; @@ -442,7 +443,6 @@ GHashTable *buddyinfo; GSList *requesticon; - gboolean killme; gboolean icq; guint icontimer; guint getblisttimer;
--- a/libpurple/protocols/oscar/tlv.c Sun Jul 22 08:14:22 2007 +0000 +++ b/libpurple/protocols/oscar/tlv.c Sun Jul 22 08:33:49 2007 +0000 @@ -718,12 +718,10 @@ for (cur = list, i = 0; cur != NULL; cur = cur->next) { tlv = cur->data; - if (tlv != NULL) { /* TODO: This NULL check shouldn't be needed */ - if (tlv->type == type) - i++; - if (i >= nth) - return tlv; - } + if (tlv->type == type) + i++; + if (i >= nth) + return tlv; } return NULL;