summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSulabh Mahajan <sulabh@pidgin.im>2008-08-22 15:00:16 +0000
committerSulabh Mahajan <sulabh@pidgin.im>2008-08-22 15:00:16 +0000
commitfab1423c552a0cdf96a0eba65bc0310caa950e10 (patch)
tree6bad8d7889b831d7b5e47a1a47892d606ac54519
parented9954bf3ac28a65e05bd62c2ec9ddb3e4250490 (diff)
downloadpidgin-fab1423c552a0cdf96a0eba65bc0310caa950e10.tar.gz
When sending a file, if there isn't a p2p connection, try establishing it.
one.
-rw-r--r--libpurple/protocols/yahoo/yahoo.c2
-rw-r--r--libpurple/protocols/yahoo/yahoo.h3
-rw-r--r--libpurple/protocols/yahoo/yahoo_filexfer.c4
3 files changed, 8 insertions, 1 deletions
diff --git a/libpurple/protocols/yahoo/yahoo.c b/libpurple/protocols/yahoo/yahoo.c
index dc23f50eb2..9f868787a1 100644
--- a/libpurple/protocols/yahoo/yahoo.c
+++ b/libpurple/protocols/yahoo/yahoo.c
@@ -2622,7 +2622,7 @@ static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data)
}
/* 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];
diff --git a/libpurple/protocols/yahoo/yahoo.h b/libpurple/protocols/yahoo/yahoo.h
index 13ba9907c3..58647d8a12 100644
--- a/libpurple/protocols/yahoo/yahoo.h
+++ b/libpurple/protocols/yahoo/yahoo.h
@@ -274,4 +274,7 @@ gchar* yahoo_get_cookies(PurpleConnection *gc);
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_ */
diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c
index b84e71ecc7..410bd67502 100644
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c
@@ -1047,6 +1047,10 @@ void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file)
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);