changeset 30794:4481d04cda70

Document SlpMessage size limits.
author masca@cpw.pidgin.im
date Tue, 15 Jun 2010 21:05:27 +0000
parents f84fb808e8ed
children 22f26c372797
files libpurple/protocols/msn/directconn.h libpurple/protocols/msn/sbconn.h libpurple/protocols/msn/slplink.c
diffstat 3 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.h	Tue Jun 15 00:42:05 2010 +0000
+++ b/libpurple/protocols/msn/directconn.h	Tue Jun 15 21:05:27 2010 +0000
@@ -36,6 +36,8 @@
 #include "slpmsg.h"
 #include "p2p.h"
 
+#define MSN_DCCONN_MAX_SIZE 1352
+
 typedef enum
 {
 	DC_STATE_CLOSED,            /*< No socket opened yet */
--- a/libpurple/protocols/msn/sbconn.h	Tue Jun 15 00:42:05 2010 +0000
+++ b/libpurple/protocols/msn/sbconn.h	Tue Jun 15 21:05:27 2010 +0000
@@ -3,6 +3,8 @@
 
 #include "msg.h"
 
+#define MSN_SBCONN_MAX_SIZE 1202
+
 void msn_sbconn_msg_ack(MsnMessage *msg, void *data);
 
 void msn_sbconn_msg_nak(MsnMessage *msg, void *data);
--- a/libpurple/protocols/msn/slplink.c	Tue Jun 15 00:42:05 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Tue Jun 15 21:05:27 2010 +0000
@@ -307,15 +307,15 @@
 		if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND &&
 				purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED)
 		{
-			len = MIN(1202, slpmsg->slpcall->u.outgoing.len);
+			len = MIN(MSN_SBCONN_MAX_SIZE, slpmsg->slpcall->u.outgoing.len);
 			msn_message_set_bin_data(msg, slpmsg->slpcall->u.outgoing.data, len);
 		}
 		else
 		{
 			len = slpmsg->size - slpmsg->offset;
 
-			if (len > 1202)
-				len = 1202;
+			if (len > MSN_SBCONN_MAX_SIZE)
+				len = MSN_SBCONN_MAX_SIZE;
 
 			msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len);
 		}