--- a/ChangeLog Sat Jul 09 15:26:51 2005 -0400
+++ b/ChangeLog Sat Jul 09 17:48:21 2005 -0400
@@ -2,6 +2,8 @@
* Ability to set IRC quit message (Lalo Martins)
+ * OSCAR file transfers now work for 2 users behind the same NAT version 1.4.0 (7/7/2005):
* Fix system log start times for some protocols
--- a/src/ft.c Sat Jul 09 15:26:51 2005 -0400
+++ b/src/ft.c Sat Jul 09 17:48:21 2005 -0400
@@ -113,8 +113,7 @@
-gaim_xfer_conversation_write(GaimXfer *xfer, char *message, gboolean is_error)
+void gaim_xfer_conversation_write(GaimXfer *xfer, char *message, gboolean is_error) GaimConversation *conv = NULL;
GString *gs_message = NULL;
@@ -326,7 +325,7 @@
gaim_xfer_request(GaimXfer *xfer)
g_return_if_fail(xfer != NULL);
g_return_if_fail(xfer->ops.init != NULL);
@@ -334,10 +333,16 @@
if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
if (gaim_xfer_get_filename(xfer) ||
- gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_ACCEPTED)
+ gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_ACCEPTED) { + message = g_strdup_printf(_("%s is offering to send file %s"), + xfer->who, gaim_xfer_get_filename(xfer)); + gaim_xfer_conversation_write(xfer, message, FALSE); gaim_xfer_ask_recv(xfer);
gaim_xfer_ask_accept(xfer);
gaim_xfer_choose_file(xfer);
@@ -1069,7 +1074,6 @@
ui_ops->update_progress(xfer, gaim_xfer_get_progress(xfer));
/**************************************************************************
* File Transfer Subsystem API
**************************************************************************/
--- a/src/protocols/oscar/oscar.c Sat Jul 09 15:26:51 2005 -0400
+++ b/src/protocols/oscar/oscar.c Sat Jul 09 17:48:21 2005 -0400
@@ -59,6 +59,9 @@
#define OSCAR_CONNECT_STEPS 6
#define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1"
+/* Seconds each file transfer ip address will be given to make a connection */ +#define FT_IP_TIMEOUT 15 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT;
static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT;
@@ -291,6 +294,7 @@
static void oscar_callback(gpointer data, gint source, GaimInputCondition condition);
static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const char *cookie);
+static void oscar_xfer_init_recv(GaimXfer *xfer); /* remove these at some point? */
/* Because I don't like forward declarations? I think that was why... */
@@ -1938,10 +1942,70 @@
od->file_transfers = g_slist_remove(od->file_transfers, xfer);
+/* xfer functions used when receiving files */ + * This is a gaim timeout callback for when the clientip looks to be useless (after verifiedip has been tried) + * It gives up on the file transfer completely if it doesn't approve of the file transfer status +static gboolean oscar_clientip_timeout(gpointer data) { + struct aim_oft_info *oft_info; + gaim_debug_info("oscar","AAA - in oscar_clientip_timeout\n"); + xfer = (GaimXfer*) data; + oft_info = (struct aim_oft_info*) xfer->data; + /* Check to see if the clientip has produced any results */ + if(oft_info->conn && oft_info->conn->status != AIM_CONN_STATUS_INPROGRESS) { + msg = g_strdup_printf(_("Transfer of file %s timed out."),gaim_xfer_get_filename(xfer)); + gaim_xfer_conversation_write(xfer, msg, TRUE); + gaim_xfer_cancel_local(xfer); + * This is a gaim timeout callback for when the verifiedip looks to be useless + * It tries the file transfer again using the clientip +static gboolean oscar_verifiedip_timeout(gpointer data) { + struct aim_oft_info *oft_info; + gaim_debug_info("oscar","AAA - in oscar_verifiedip_timeout\n"); + xfer = (GaimXfer*) data; + oft_info = (struct aim_oft_info*) xfer->data; + /* Check to see if the verifiedip has produced any results */ + if(oft_info->conn && oft_info->conn->status != AIM_CONN_STATUS_INPROGRESS) { + /* gaim_xfer_conversation_write(xfer, + "Attempting file transfer via secondary IP address...", FALSE); */ + /* The verifiedip connection has worn out its welcome. Goodbye. */ + aim_conn_kill(oft_info->sess, &oft_info->conn); + /* Try the file transfer again with the clientip */ + g_free(xfer->remote_ip); + xfer->remote_ip = g_strdup(oft_info->clientip); + gaim_debug_info("oscar","attempting connection using clientip\n"); + oscar_xfer_init_recv(xfer); * xfer functions used when receiving files
static void oscar_xfer_init_recv(GaimXfer *xfer)
struct aim_oft_info *oft_info;
@@ -1956,13 +2020,28 @@
gaim_debug_info("oscar", "AAA - in oscar_xfer_recv_init\n");
+ /* Start a timer for this ip address + * If the verifiedip fails, try the clientip + * If clientip fails, declare the whole file transfer dead + * This xfer reference will be released in oscar_clientip_timeout */ + /* If clientip & verifiedip are the same, we must prevent an infinite loop */ + if(g_ascii_strcasecmp(xfer->remote_ip, oft_info->verifiedip) == 0 + && g_ascii_strcasecmp(oft_info->clientip, oft_info->verifiedip) != 0 ) { + gaim_timeout_add(FT_IP_TIMEOUT * 1000, oscar_verifiedip_timeout, xfer); + gaim_timeout_add(FT_IP_TIMEOUT * 1000, oscar_clientip_timeout, xfer); oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL);
oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE;
aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0);
oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc),
- xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer);
+ xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer); gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who,
_("Unable to establish file descriptor."));
@@ -3457,6 +3536,13 @@
xfer->remote_port = args->port;
gaim_xfer_set_filename(xfer, args->info.sendfile.filename);
gaim_xfer_set_size(xfer, args->info.sendfile.totsize);
+ /* Ignore <ICQ_COOL_FT> XML that is sent along with ICQ sendfile requests */ + if(g_ascii_strncasecmp(message,"<ICQ_COOL_FT>",13)) { + gaim_debug_info("oscar","Ignoring ICQ file transfer message: %s\n", message); gaim_xfer_set_message(xfer, message);
/* Create the oscar-specific data */