changeset 25070:c3c5e79b4ecc

changed PKT_YAHOOSERVER and PKT_P2P, into enum yahoo_pkt_type
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Sat, 12 Jul 2008 19:13:31 +0000
parents 262ae5f56a9a
children 38d188685f2f
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo.h
diffstat 2 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Sat Jul 12 18:55:29 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Sat Jul 12 19:13:31 2008 +0000
@@ -696,8 +696,8 @@
 	yahoo_fetch_aliases(gc);
 }
 
-/*pkt_type is PKT_YAHOOSERVER if pkt arrives from yahoo server, PKT_P2P if pkt arrives through p2p*/ 
-static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, int pkt_type)
+/*pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p*/
+static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
 {
 	PurpleAccount *account;
 	char *msg = NULL;
@@ -730,7 +730,7 @@
 		return;
 
 	/*disconnect the peer if connected through p2p and sends wrong value for session id*/
-	if( (pkt_type == PKT_P2P) && (val_11 != yd->session_id) ) {
+	if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
 		purple_debug_warning("yahoo","p2p: %s sent us notify with wrong session id. Disconnecting p2p connection to peer\n", from);
 		/*remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data*/
 		g_hash_table_remove(yd->peers, from);
@@ -781,8 +781,8 @@
 	char *msg;
 };
 
-/*pkt_type is PKT_YAHOOSERVER if pkt arrives from yahoo server, PKT_P2P if pkt arrives through p2p*/ 
-static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, int pkt_type)
+/*pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p*/
+static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
 {
 	PurpleAccount *account;
 	struct yahoo_data *yd = gc->proto_data;
@@ -836,7 +836,7 @@
 	}
 
 	/*disconnect the peer if connected through p2p and sends wrong value for session id*/
-	if( (pkt_type == PKT_P2P) && (val_11 != yd->session_id) ) {
+	if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
 		purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->from);
 		/*remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data*/
 		g_hash_table_remove(yd->peers, im->from);
@@ -2432,10 +2432,10 @@
 			yahoo_p2p_process_p2pfilexfer(data, source, pkt);
 			break;
 		case YAHOO_SERVICE_MESSAGE:
-			yahoo_process_message(p2p_data->gc, pkt, PKT_P2P);
+			yahoo_process_message(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P);
 			break;
 		case YAHOO_SERVICE_NOTIFY:
-			yahoo_process_notify(p2p_data->gc, pkt, PKT_P2P);
+			yahoo_process_notify(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P);
 			break;
 		default:
 			purple_debug_warning("yahoo","p2p: p2p service %d Unhandled\n",pkt->service);
@@ -2782,12 +2782,12 @@
 		yahoo_process_status(gc, pkt);
 		break;
 	case YAHOO_SERVICE_NOTIFY:
-		yahoo_process_notify(gc, pkt, PKT_YAHOOSERVER);
+		yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER);
 		break;
 	case YAHOO_SERVICE_MESSAGE:
 	case YAHOO_SERVICE_GAMEMSG:
 	case YAHOO_SERVICE_CHATMSG:
-		yahoo_process_message(gc, pkt, PKT_YAHOOSERVER);
+		yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER);
 		break;
 	case YAHOO_SERVICE_SYSMESSAGE:
 		yahoo_process_sysmessage(gc, pkt);
--- a/libpurple/protocols/yahoo/yahoo.h	Sat Jul 12 18:55:29 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.h	Sat Jul 12 19:13:31 2008 +0000
@@ -81,13 +81,14 @@
 #define YAHOOJP_CLIENT_VERSION_ID "524223"
 #define YAHOOJP_CLIENT_VERSION "7,0,1,1"
 
-/*Packet sources: yahoo server and p2p*/
-#define PKT_YAHOOSERVER 0
-#define PKT_P2P 1
-
 /* Index into attention types list. */
 #define YAHOO_BUZZ 0
 
+typedef enum {
+	YAHOO_PKT_TYPE_SERVER = 0,
+	YAHOO_PKT_TYPE_P2P
+} yahoo_pkt_type;
+
 enum yahoo_status {
 	YAHOO_STATUS_AVAILABLE = 0,
 	YAHOO_STATUS_BRB,