changeset 31586:f5fbcdd07d48

Rename this enums a little better. And I don't think we need these length enums, really.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 10 May 2011 03:18:20 +0000
parents 1e657ff2eacb
children 2b289a184dc2
files libpurple/protocols/msn/p2p.c libpurple/protocols/msn/p2p.h
diffstat 2 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/p2p.c	Tue May 10 03:09:47 2011 +0000
+++ b/libpurple/protocols/msn/p2p.c	Tue May 10 03:18:20 2011 +0000
@@ -392,7 +392,7 @@
 			break;
 
 		case MSN_P2P_VERSION_TWO:
-			final = msn_tlv_gettlv(info->header.v2.data_tlv, 0x01, 1) == NULL;
+			final = msn_tlv_gettlv(info->header.v2.data_tlv, P2P_DATA_TLV_REMAINING, 1) == NULL;
 			break;
 
 		default:
@@ -422,16 +422,16 @@
 			MsnP2Pv2Header *old = &old_info->header.v2;
 			MsnP2Pv2Header *new = &new_info->header.v2;
 
-			msn_tlvlist_add_32(&new->header_tlv, P2P_TLV_TYPE_ACK, old->base_id + old->message_len);
+			msn_tlvlist_add_32(&new->header_tlv, P2P_HEADER_TLV_TYPE_ACK, old->base_id + old->message_len);
 			new->opcode = P2P_OPCODE_NONE;
 
 			if (old->message_len > 0) {
-				if (!msn_tlv_gettlv(old->header_tlv, P2P_TLV_TYPE_ACK, 1)) {
+				if (!msn_tlv_gettlv(old->header_tlv, P2P_HEADER_TLV_TYPE_ACK, 1)) {
 					if (old->opcode & P2P_OPCODE_SYN) {
 						msn_tlv_t *ack_tlv;
 						new->opcode |= P2P_OPCODE_RAK;
 						
-						ack_tlv = msn_tlv_gettlv(old->header_tlv, P2P_TLV_TYPE_PEER_INFO, 1);
+						ack_tlv = msn_tlv_gettlv(old->header_tlv, P2P_HEADER_TLV_TYPE_PEER_INFO, 1);
 						if (ack_tlv) {
 							msn_tlvlist_add_tlv(&new->header_tlv, ack_tlv);
 							new->opcode |= P2P_OPCODE_SYN;
@@ -484,7 +484,7 @@
 		}
 
 		case MSN_P2P_VERSION_TWO:
-			ret = msn_tlv_gettlv(info->header.v2.header_tlv, P2P_TLV_TYPE_ACK, 1) != NULL;
+			ret = msn_tlv_gettlv(info->header.v2.header_tlv, P2P_HEADER_TLV_TYPE_ACK, 1) != NULL;
 			break;
 
 		default:
--- a/libpurple/protocols/msn/p2p.h	Tue May 10 03:09:47 2011 +0000
+++ b/libpurple/protocols/msn/p2p.h	Tue May 10 03:18:20 2011 +0000
@@ -76,17 +76,15 @@
 
 typedef enum
 {
-	P2P_TLV_TYPE_PEER_INFO  = 0x01, /**< Client peer info */
-	P2P_TLV_TYPE_ACK        = 0x02, /**< ACK */
-	P2P_TLV_TYPE_NAK        = 0x03  /**< NAK */
-} P2PTLVType;
+	P2P_HEADER_TLV_TYPE_PEER_INFO  = 0x01, /**< Client peer info */
+	P2P_HEADER_TLV_TYPE_ACK        = 0x02, /**< ACK */
+	P2P_HEADER_TLV_TYPE_NAK        = 0x03  /**< NAK */
+} P2PHeaderTLVType;
 
 typedef enum
 {
-	P2P_TLV_LEN_PEER_INFO   = 12,
-	P2P_TLV_LEN_ACK         = 4,
-	P2P_TLV_LEN_NAK         = 4
-} P2PTLVLength;
+	P2P_DATA_TLV_REMAINING  = 0x01, /**< Indicates the remaining data to transfer.*/
+} P2PDataTLVType;
 
 typedef enum
 {
@@ -97,9 +95,6 @@
 	P2P_PI_CAPS     = 0x0000010f
 } P2PPeerInfoVal;
 
-#define DLP_REMAINING 0x01; 	/**< Indicates the remaining data to transfer.*/
-#define DLP_REMAINING_LEN 8
-
 typedef struct
 {
 	guint32 value;