changeset 25629:38d188685f2f

changed gboolean connection_type to enum yahoo_p2p_connection_type
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Sat, 12 Jul 2008 19:24:34 +0000
parents c3c5e79b4ecc
children 63033139c590
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo.h libpurple/protocols/yahoo/yahoo_filexfer.c
diffstat 3 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Sat Jul 12 19:13:31 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Sat Jul 12 19:24:34 2008 +0000
@@ -2550,7 +2550,7 @@
 	p2p_data->host_username = (char *)g_malloc(strlen(who));
 	strcpy(p2p_data->host_username, who);
 	p2p_data->val_13 = val_13;
-	p2p_data->connection_type = 1;		/*0:we are server*/
+	p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER;
 
 	purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data);
 
@@ -2696,7 +2696,7 @@
 		p2p_data->session_id = val_11;
 		p2p_data->host_ip = host_ip;
 		p2p_data->gc = gc;
-		p2p_data->connection_type = 0;		/*0:peer is server*/
+		p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT;
 
 		/*connect to host*/
 		if((purple_proxy_connect(NULL, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL)	{
--- a/libpurple/protocols/yahoo/yahoo.h	Sat Jul 12 19:13:31 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.h	Sat Jul 12 19:24:34 2008 +0000
@@ -89,6 +89,11 @@
 	YAHOO_PKT_TYPE_P2P
 } yahoo_pkt_type;
 
+typedef enum {
+	YAHOO_P2P_WE_ARE_CLIENT =0,
+	YAHOO_P2P_WE_ARE_SERVER
+} yahoo_p2p_connection_type;
+
 enum yahoo_status {
 	YAHOO_STATUS_AVAILABLE = 0,
 	YAHOO_STATUS_BRB,
@@ -126,7 +131,7 @@
 	guint input_event;
 	gint source;
 	int session_id;
-	gboolean connection_type;	/* 0: peer is server, 1: we are server*/
+	yahoo_p2p_connection_type connection_type;
 };
 
 struct _YchtConn;
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Sat Jul 12 19:13:31 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Sat Jul 12 19:24:34 2008 +0000
@@ -1502,7 +1502,7 @@
 	yd = gc->proto_data;
 
 	p2p_data = g_hash_table_lookup(yd->peers, xfer->who);
-	if( p2p_data->connection_type == 1 )
+	if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER )
 		if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer))
 			return;
 
@@ -1796,7 +1796,7 @@
 	}
 	else if(val_249 == 2)	{
 		p2p_data = g_hash_table_lookup(yd->peers, xfer->who);
-		if( !( p2p_data && (p2p_data->connection_type == 1) ) )	{
+		if( !( p2p_data && (p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) ) )	{
 			purple_xfer_cancel_remote(xfer);
 			return;
 		}