changeset 26227:abf830f6cd43

When sending a file, if there isn't a p2p connection, try establishing it. one.
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Fri, 22 Aug 2008 15:00:16 +0000
parents 0dd4629e75ee
children 9c633c83caa6
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo.h libpurple/protocols/yahoo/yahoo_filexfer.c
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Wed Aug 20 21:37:09 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Aug 22 15:00:16 2008 +0000
@@ -2622,7 +2622,7 @@
 }
 
 /* send p2p pkt containing our encoded ip, asking peer to connect to us */
-static void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13)
+void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13)
 {
 	const char *public_ip;
 	guint32 temp[4];	
--- a/libpurple/protocols/yahoo/yahoo.h	Wed Aug 20 21:37:09 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.h	Fri Aug 22 15:00:16 2008 +0000
@@ -274,4 +274,7 @@
 gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type);
 GList *yahoo_attention_types(PurpleAccount *account);
 
+/* send p2p pkt containing our encoded ip, asking peer to connect to us */
+void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13);
+
 #endif /* _YAHOO_H_ */
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Wed Aug 20 21:37:09 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Fri Aug 22 15:00:16 2008 +0000
@@ -1047,6 +1047,10 @@
 
 	g_return_if_fail(xfer != NULL);
 
+	/* if we don't have a p2p connection, try establishing it now */
+	if( !g_hash_table_lookup(yd->peers, who) )
+		yahoo_send_p2p_pkt(gc, who, 0);
+
 	xfer_data = xfer->data;
 	xfer_data->status_15 = STARTED;
 	purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15);