soc.2008.yahoo: 4ecf2899: changed PKT_YAHOOSERVER and PKT_P2P, int...

sulabh at soc.pidgin.im sulabh at soc.pidgin.im
Sat Jul 12 15:50:54 EDT 2008


-----------------------------------------------------------------
Revision: 4ecf28996582dd8b6fd463ea62b1ad7f859c0ea7
Ancestor: 52973f914c2894837803289d33288506e90460e7
Author: sulabh at soc.pidgin.im
Date: 2008-07-12T19:13:31
Branch: im.pidgin.soc.2008.yahoo
URL: http://d.pidgin.im/viewmtn/revision/info/4ecf28996582dd8b6fd463ea62b1ad7f859c0ea7

Modified files:
        libpurple/protocols/yahoo/yahoo.c
        libpurple/protocols/yahoo/yahoo.h

ChangeLog: 

changed PKT_YAHOOSERVER and PKT_P2P, into enum yahoo_pkt_type 

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	53fd035ccd30edcdde88dc958f58dbeeebf94b1a
+++ libpurple/protocols/yahoo/yahoo.c	00b946bcae83f8c408211fb8b487ea01cd1f275a
@@ -696,8 +696,8 @@ static void yahoo_process_list(PurpleCon
 	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 @@ static void yahoo_process_notify(PurpleC
 		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 @@ struct _yahoo_im {
 	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 @@ static void yahoo_process_message(Purple
 	}
 
 	/*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 @@ static void yahoo_p2p_read_pkt_cb(gpoint
 			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 @@ static void yahoo_packet_process(PurpleC
 		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);
============================================================
--- libpurple/protocols/yahoo/yahoo.h	fde40ded4d6bcb58141874e5d47e1b051dd968e3
+++ libpurple/protocols/yahoo/yahoo.h	beaf7b702cb5ace5a92be8ade42fa9a513da5e8e
@@ -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,


More information about the Commits mailing list