--- a/src/protocols/oscar/flap_connection.c Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/flap_connection.c Sun Apr 09 23:37:37 2006 -0400
@@ -229,13 +229,16 @@
flap_connection_destroy_cb(gpointer data)
gaim_debug_info("oscar", "Destroying oscar connection of "
"type 0x%04hx\n", conn->type);
- flap_connection_close(conn->od, conn);
+ flap_connection_close(od, conn); if (conn->watcher_incoming != 0)
gaim_input_remove(conn->watcher_incoming);
@@ -248,7 +251,7 @@
* Free conn->internal, if necessary
if (conn->type == SNAC_FAMILY_CHAT)
- flap_connection_destroy_chat(conn->od, conn);
+ flap_connection_destroy_chat(od, conn); if (conn->inside != NULL)
@@ -260,18 +263,38 @@
- conn->od->oscar_connections = g_list_remove(conn->od->oscar_connections, conn);
+ od->oscar_connections = g_list_remove(od->oscar_connections, conn);
+ account = gaim_connection_get_account(od->gc); + if ((od->oscar_connections == NULL) && (!account->disconnecting)) + /* No more FLAP connections! Sign off this GaimConnection! */ + if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) + tmp = _("Server closed the connection."); + else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) + tmp = _("Lost connection with server for an unknown reason."); + else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) + tmp = _("Received invalid data on connection with server."); + else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) + tmp = _("Could not establish a connection with the server."); + gaim_connection_error(od->gc, tmp); -flap_connection_destroy(FlapConnection *conn)
+flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason) if (conn->destroy_timeout != 0)
gaim_timeout_remove(conn->destroy_timeout);
+ conn->disconnect_reason = reason; flap_connection_destroy_cb(conn);
@@ -282,7 +305,7 @@
-flap_connection_schedule_destroy(FlapConnection *conn)
+flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason) if (conn->destroy_timeout != 0)
/* Already taken care of */
@@ -290,6 +313,7 @@
gaim_debug_info("oscar", "Scheduling destruction of FLAP "
"connection of type 0x%04hx\n", conn->type);
+ conn->disconnect_reason = reason; conn->destroy_timeout = gaim_timeout_add(0, flap_connection_destroy_cb, conn);
@@ -594,7 +618,8 @@
gaim_debug_warning("oscar", "Expecting FLAP version "
"0x00000001 but received FLAP version %08lx. Closing connection.\n",
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_INVALID_DATA); @@ -638,8 +663,8 @@
/* Check if the FLAP server closed the connection */
- /* TODO: Print an error? Server closed connection. */
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_REMOTE_CLOSED); @@ -651,8 +676,8 @@
- /* TODO: Print an error? Lost connection with server. */
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_LOST_CONNECTION); @@ -666,7 +691,8 @@
/* All FLAP frames must start with the byte 0x2a */
if (aimutil_get8(&header[0]) != 0x2a)
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_INVALID_DATA); @@ -689,7 +715,8 @@
/* Check if the FLAP server closed the connection */
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_REMOTE_CLOSED); @@ -700,8 +727,8 @@
- /* TODO: Print an error? Lost connection with server. */
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_LOST_CONNECTION); @@ -745,7 +772,7 @@
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_LOST_CONNECTION); --- a/src/protocols/oscar/odc.c Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/odc.c Sun Apr 09 23:37:37 2006 -0400
@@ -36,30 +36,30 @@
- if (conn->disconnect_reason == PEER_DISCONNECT_REMOTE_CLOSED)
+ if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - tmp = _("Remote user closed the connection.");
+ tmp = _("The remote user has closed the connection."); - else if (conn->disconnect_reason == PEER_DISCONNECT_REMOTE_REFUSED)
+ else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - tmp = _("Remote user declined your request.");
+ tmp = _("The remote user has declined your request."); - else if (conn->disconnect_reason == PEER_DISCONNECT_LOST_CONNECTION)
+ else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - tmp = _("Lost connection with remote user for an unknown reason.");
+ tmp = _("Lost connection with the remote user for an unknown reason."); - else if (conn->disconnect_reason == PEER_DISCONNECT_INVALID_DATA)
+ else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - tmp = _("Received invalid data on connection.");
+ tmp = _("Received invalid data on connection with remote user."); - else if (conn->disconnect_reason == PEER_DISCONNECT_COULD_NOT_CONNECT)
+ else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - tmp = _("Could not establish connection with remote user.");
+ tmp = _("Could not establish a connection with the remote user."); * We shouldn't print a message for some disconnect_reasons.
- * Like PEER_DISCONNECT_LOCAL_CLOSED.
+ * Like OSCAR_DISCONNECT_LOCAL_CLOSED. @@ -452,7 +452,7 @@
/* Check if the remote user closed the connection */
- peer_connection_destroy(conn, PEER_DISCONNECT_REMOTE_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED); @@ -462,7 +462,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_LOST_CONNECTION);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_LOST_CONNECTION); @@ -536,7 +536,7 @@
gaim_debug_info("oscar", "Received an incorrect cookie. "
"Closing connection.\n");
- peer_connection_destroy(conn, PEER_DISCONNECT_INVALID_DATA);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA); --- a/src/protocols/oscar/oft.c Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/oft.c Sun Apr 09 23:37:37 2006 -0400
@@ -307,7 +307,7 @@
gaim_debug_info("oscar", "Received an incorrect cookie. "
"Closing connection.\n");
- peer_connection_destroy(conn, PEER_DISCONNECT_INVALID_DATA);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA); @@ -415,7 +415,7 @@
peer_oft_send_done(conn);
- conn->disconnect_reason = PEER_DISCONNECT_DONE;
+ conn->disconnect_reason = OSCAR_DISCONNECT_DONE; conn->sending_data_timer = gaim_timeout_add(100,
destroy_connection_when_done_sending_data, conn);
@@ -524,7 +524,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_LOCAL_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED); /*******************************************************************/
--- a/src/protocols/oscar/oscar.c Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/oscar.c Sun Apr 09 23:37:37 2006 -0400
@@ -912,7 +912,7 @@
/* Destroy the chat_connection */
od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
- flap_connection_schedule_destroy(cc->conn);
+ flap_connection_schedule_destroy(cc->conn, OSCAR_DISCONNECT_DONE); @@ -967,7 +967,8 @@
if (conn->type == SNAC_FAMILY_LOCATE)
gaim_connection_error(gc, _("Could not connect to BOS server"));
else /* Maybe we should call this for BOS connections, too? */
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, + OSCAR_DISCONNECT_COULD_NOT_CONNECT); destroy_new_conn_data(new_conn_data);
@@ -1336,13 +1337,12 @@
gaim_debug_misc("oscar", "Reg status: %hu\n", info->regstatus);
gaim_debug_misc("oscar", "E-mail: %s\n",
(info->email != NULL) ? info->email : "null");
gaim_debug_misc("oscar", "BOSIP: %s\n", info->bosip);
gaim_debug_info("oscar", "Closing auth connection...\n");
- flap_connection_schedule_destroy(conn);
+ flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_DONE); for (i = 0; i < strlen(info->bosip); i++) {
if (info->bosip[i] == ':') {
@@ -1644,7 +1644,8 @@
if (gaim_proxy_connect(account, host, port, connection_established_cb, new_conn_data) != 0)
- flap_connection_schedule_destroy(new_conn_data->conn);
+ flap_connection_schedule_destroy(new_conn_data->conn, + OSCAR_DISCONNECT_COULD_NOT_CONNECT); gaim_debug_error("oscar", "Unable to connect to FLAP server "
"of type 0x%04hx\n", redir->group);
destroy_new_conn_data(new_conn_data);
@@ -2054,7 +2055,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_REMOTE_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED); else if (args->status == AIM_RENDEZVOUS_CONNECTED)
@@ -2595,7 +2596,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_REMOTE_REFUSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_REFUSED); @@ -6263,7 +6264,7 @@
aim_im_sendch2_cancel(conn);
- peer_connection_destroy(conn, PEER_DISCONNECT_LOCAL_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED); --- a/src/protocols/oscar/oscar.h Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/oscar.h Sun Apr 09 23:37:37 2006 -0400
@@ -287,6 +287,18 @@
+ OSCAR_DISCONNECT_LOCAL_CLOSED, + OSCAR_DISCONNECT_REMOTE_CLOSED, + OSCAR_DISCONNECT_REMOTE_REFUSED, + OSCAR_DISCONNECT_LOST_CONNECTION, + OSCAR_DISCONNECT_INVALID_DATA, + OSCAR_DISCONNECT_COULD_NOT_CONNECT, + OSCAR_DISCONNECT_RETRYING +} OscarDisconnectReason; OSCAR_CAPABILITY_BUDDYICON = 0x00000001,
OSCAR_CAPABILITY_TALK = 0x00000002,
OSCAR_CAPABILITY_DIRECTIM = 0x00000004,
@@ -349,11 +361,12 @@
OscarData *od; /**< Pointer to parent session. */
time_t lastactivity; /**< Time of last transmit. */
+ OscarDisconnectReason disconnect_reason; FlapFrame buffer_incoming;
GaimCircBuffer *buffer_outgoing;
@@ -550,8 +563,8 @@
FlapConnection *flap_connection_new(OscarData *, int type);
void flap_connection_addgroup(FlapConnection *conn, guint16 group);
void flap_connection_close(OscarData *od, FlapConnection *conn);
-void flap_connection_destroy(FlapConnection *conn);
-void flap_connection_schedule_destroy(FlapConnection *conn);
+void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason); +void flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason); FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group);
FlapConnection *flap_connection_getbytype(OscarData *, int type);
FlapConnection *flap_connection_getbytype_all(OscarData *, int type);
@@ -612,7 +625,7 @@
#define AIM_OFT_SUBTYPE_SEND_FILE 0x0001
#define AIM_OFT_SUBTYPE_SEND_DIR 0x0002
#define AIM_OFT_SUBTYPE_GET_FILE 0x0011
-#define AIM_OPT_SUBTYPE_GET_LIST 0x0012
+#define AIM_OFT_SUBTYPE_GET_LIST 0x0012 #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
#define AIM_TRANSFER_DENY_DECLINE 0x0001
--- a/src/protocols/oscar/oscar_data.c Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/oscar_data.c Sun Apr 09 23:37:37 2006 -0400
@@ -108,11 +108,12 @@
if (od->getinfotimer > 0)
gaim_timeout_remove(od->getinfotimer);
while (od->oscar_connections != NULL)
- flap_connection_destroy(od->oscar_connections->data);
+ flap_connection_destroy(od->oscar_connections->data, + OSCAR_DISCONNECT_DONE); while (od->peer_connections != NULL)
peer_connection_destroy(od->peer_connections->data,
- PEER_DISCONNECT_LOCAL_CLOSED);
+ OSCAR_DISCONNECT_LOCAL_CLOSED); if (od->handlerlist != NULL)
--- a/src/protocols/oscar/peer.c Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/peer.c Sun Apr 09 23:37:37 2006 -0400
@@ -191,8 +191,8 @@
(status != GAIM_XFER_STATUS_CANCEL_LOCAL) &&
(status != GAIM_XFER_STATUS_CANCEL_REMOTE))
- if ((conn->disconnect_reason == PEER_DISCONNECT_REMOTE_CLOSED) ||
- (conn->disconnect_reason == PEER_DISCONNECT_REMOTE_REFUSED))
+ if ((conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) || + (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED)) gaim_xfer_cancel_remote(conn->xfer);
gaim_xfer_cancel_local(conn->xfer);
@@ -214,7 +214,7 @@
-peer_connection_destroy(PeerConnection *conn, PeerDisconnectReason reason)
+peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason) conn->disconnect_reason = reason;
if (conn->destroy_timeout != 0)
@@ -223,7 +223,7 @@
-peer_connection_schedule_destroy(PeerConnection *conn, PeerDisconnectReason reason)
+peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason) if (conn->destroy_timeout != 0)
/* Already taken care of */
@@ -271,7 +271,7 @@
/* Check if the remote user closed the connection */
- peer_connection_destroy(conn, PEER_DISCONNECT_REMOTE_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED); @@ -282,7 +282,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_LOST_CONNECTION);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_LOST_CONNECTION); @@ -303,7 +303,7 @@
conn->magic[0], conn->magic[1], conn->magic[2],
conn->magic[3], header[0], header[1], header[2], header[3]);
- peer_connection_destroy(conn, PEER_DISCONNECT_INVALID_DATA);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA); @@ -322,7 +322,7 @@
/* Check if the remote user closed the connection */
- peer_connection_destroy(conn, PEER_DISCONNECT_REMOTE_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED); @@ -332,7 +332,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_LOST_CONNECTION);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_LOST_CONNECTION); @@ -389,7 +389,7 @@
- peer_connection_schedule_destroy(conn, PEER_DISCONNECT_LOST_CONNECTION);
+ peer_connection_schedule_destroy(conn, OSCAR_DISCONNECT_LOST_CONNECTION); @@ -764,7 +764,7 @@
- peer_connection_destroy(conn, PEER_DISCONNECT_COULD_NOT_CONNECT);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_COULD_NOT_CONNECT); @@ -798,7 +798,7 @@
/* Cancel the old connection and try again */
- peer_connection_destroy(conn, PEER_DISCONNECT_RETRYING);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_RETRYING); @@ -841,7 +841,7 @@
aim_im_denytransfer(conn->od, conn->sn, conn->cookie,
AIM_TRANSFER_DENY_DECLINE);
- peer_connection_destroy(conn, PEER_DISCONNECT_LOCAL_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED); @@ -894,7 +894,7 @@
/* Close the old direct IM and start a new one */
gaim_debug_info("oscar", "Received new direct IM request "
"from %s. Destroying old connection.\n", sn);
- peer_connection_destroy(conn, PEER_DISCONNECT_REMOTE_CLOSED);
+ peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED); --- a/src/protocols/oscar/peer.h Sun Apr 09 22:47:43 2006 -0400
+++ b/src/protocols/oscar/peer.h Sun Apr 09 23:37:37 2006 -0400
@@ -33,18 +33,6 @@
typedef struct _NewPeerConnectionData NewPeerConnectionData;
typedef struct _PeerConnection PeerConnection;
- PEER_DISCONNECT_LOCAL_CLOSED,
- PEER_DISCONNECT_REMOTE_CLOSED,
- PEER_DISCONNECT_REMOTE_REFUSED,
- PEER_DISCONNECT_LOST_CONNECTION,
- PEER_DISCONNECT_INVALID_DATA,
- PEER_DISCONNECT_COULD_NOT_CONNECT,
- PEER_DISCONNECT_RETRYING
#define PEER_CONNECTION_FLAG_INITIATED_BY_ME 0x0001
#define PEER_CONNECTION_FLAG_APPROVED 0x0002
#define PEER_CONNECTION_FLAG_TRIED_VERIFIEDIP 0x0004
@@ -163,7 +151,7 @@
int flags; /**< Bitmask of PEER_CONNECTION_FLAG_ */
time_t lastactivity; /**< Time of last transmit. */
- PeerDisconnectReason disconnect_reason;
+ OscarDisconnectReason disconnect_reason; * A pointer to either an OdcFrame or an OftFrame.
@@ -221,8 +209,8 @@
PeerConnection *peer_connection_new(OscarData *od, OscarCapability type, const char *sn);
-void peer_connection_destroy(PeerConnection *conn, PeerDisconnectReason reason);
-void peer_connection_schedule_destroy(PeerConnection *conn, PeerDisconnectReason reason);
+void peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason); +void peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason); PeerConnection *peer_connection_find_by_type(OscarData *od, const char *sn, OscarCapability type);
PeerConnection *peer_connection_find_by_cookie(OscarData *od, const char *sn, const guchar *cookie);