soc.2010.msn-tlc: 42d97406: Move MsnMessage stuff out of slplink to ...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Wed Jun 16 19:15:58 EDT 2010


-----------------------------------------------------------------
Revision: 42d97406a4966cdb5d0a74cce32b25d6c5c6482a
Ancestor: 3d5d87c16b3ebcaf8c44aa828aa50ba9bb73fe05
Author: masca at cpw.pidgin.im
Date: 2010-06-15T00:42:05
Branch: im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/42d97406a4966cdb5d0a74cce32b25d6c5c6482a

Added files:
        libpurple/protocols/msn/sbconn.c
        libpurple/protocols/msn/sbconn.h
Modified files:
        libpurple/protocols/msn/Makefile.am
        libpurple/protocols/msn/Makefile.mingw
        libpurple/protocols/msn/slplink.c

ChangeLog: 

Move MsnMessage stuff out of slplink to SBConn.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/sbconn.c	1dfe9a263dec74d50117d63a08dcc10450f8ec05
+++ libpurple/protocols/msn/sbconn.c	1dfe9a263dec74d50117d63a08dcc10450f8ec05
@@ -0,0 +1,61 @@
+#include "sbconn.h"
+
+/* We have received the message ack */
+void
+msn_sbconn_msg_ack(MsnMessage *msg, void *data)
+{
+	MsnSlpMessage *slpmsg;
+	long long real_size;
+
+	slpmsg = data;
+
+	real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size;
+
+	slpmsg->offset += msg->slpmsg->header->length;
+
+	slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
+
+	if (slpmsg->offset < real_size)
+	{
+		if (slpmsg->slpcall->xfer && purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED)
+		{
+			slpmsg->slpcall->xfer_msg = slpmsg;
+			msn_message_ref(msg);
+			purple_xfer_prpl_ready(slpmsg->slpcall->xfer);
+		}
+		else
+			msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
+	}
+	else
+	{
+		/* The whole message has been sent */
+		if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
+	        slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
+	        slpmsg->flags == P2P_FILE_DATA) 
+		{
+			if (slpmsg->slpcall != NULL)
+			{
+				if (slpmsg->slpcall->cb)
+					slpmsg->slpcall->cb(slpmsg->slpcall,
+						NULL, 0);
+			}
+		}
+	}
+
+	msn_message_unref(msg);
+}
+
+/* We have received the message nak. */
+void
+msn_sbconn_msg_nak(MsnMessage *msg, void *data)
+{
+	MsnSlpMessage *slpmsg;
+
+	slpmsg = data;
+
+	msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
+
+	slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
+	msn_message_unref(msg);
+}
+
============================================================
--- libpurple/protocols/msn/sbconn.h	a4decb4c77b646fe7f124d8fbbbdff4a47585240
+++ libpurple/protocols/msn/sbconn.h	a4decb4c77b646fe7f124d8fbbbdff4a47585240
@@ -0,0 +1,9 @@
+#ifndef MSN_SBCONN_H
+#define MSN_SBCONN_H
+
+#include "msg.h"
+
+void msn_sbconn_msg_ack(MsnMessage *msg, void *data);
+
+void msn_sbconn_msg_nak(MsnMessage *msg, void *data);
+#endif /* MSN_SBCONN_H */
============================================================
--- libpurple/protocols/msn/Makefile.am	c798a884bd63ad37644cbeafc082f26c95376307
+++ libpurple/protocols/msn/Makefile.am	92e18590a57f724e046601ca95ef41d92bcf7735
@@ -54,6 +54,8 @@ MSNSOURCES = \
 	soap.h \
 	state.c \
 	state.h \
+	sbconn.c \
+	sbconn.h \
 	switchboard.c \
 	switchboard.h \
 	table.c \
============================================================
--- libpurple/protocols/msn/Makefile.mingw	0d858261872c095dd105a45bad5d00921881a16c
+++ libpurple/protocols/msn/Makefile.mingw	e3371113dc93110638043690e78c2f7af03a0d74
@@ -62,6 +62,7 @@ C_SRC =			cmdproc.c \
 			slpmsg.c \
 			soap.c\
 			state.c \
+			sbconn.c \
 			switchboard.c \
 			sync.c \
 			table.c \
============================================================
--- libpurple/protocols/msn/slplink.c	1a8038e7777a9d00932fc382939a436d301dae21
+++ libpurple/protocols/msn/slplink.c	f75fe3889ed7bd059248b13e33a93cc5b65ccdf2
@@ -28,6 +28,7 @@
 #include "msn.h"
 #include "slplink.h"
 
+#include "sbconn.h"
 #include "switchboard.h"
 #include "slp.h"
 #include "p2p.h"
@@ -351,66 +352,7 @@ msn_slplink_send_msgpart(MsnSlpLink *slp
 	/* slpmsg->offset += len; */
 }
 
-/* We have received the message ack */
 static void
-msg_ack(MsnMessage *msg, void *data)
-{
-	MsnSlpMessage *slpmsg;
-	long long real_size;
-
-	slpmsg = data;
-
-	real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size;
-
-	slpmsg->offset += msg->slpmsg->header->length;
-
-	slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
-
-	if (slpmsg->offset < real_size)
-	{
-		if (slpmsg->slpcall->xfer && purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED)
-		{
-			slpmsg->slpcall->xfer_msg = slpmsg;
-			msn_message_ref(msg);
-			purple_xfer_prpl_ready(slpmsg->slpcall->xfer);
-		}
-		else
-			msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
-	}
-	else
-	{
-		/* The whole message has been sent */
-		if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
-	        slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
-	        slpmsg->flags == P2P_FILE_DATA) 
-		{
-			if (slpmsg->slpcall != NULL)
-			{
-				if (slpmsg->slpcall->cb)
-					slpmsg->slpcall->cb(slpmsg->slpcall,
-						NULL, 0);
-			}
-		}
-	}
-
-	msn_message_unref(msg);
-}
-
-/* We have received the message nak. */
-static void
-msg_nak(MsnMessage *msg, void *data)
-{
-	MsnSlpMessage *slpmsg;
-
-	slpmsg = data;
-
-	msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
-
-	slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
-	msn_message_unref(msg);
-}
-
-static void
 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
 {
 	MsnMessage *msg;
@@ -461,8 +403,8 @@ msn_slplink_release_slpmsg(MsnSlpLink *s
 	passport = purple_normalize(slplink->session->account, slplink->remote_user);
 	msn_message_set_header(msg, "P2P-Dest", passport);
 
-	msg->ack_cb = msg_ack;
-	msg->nak_cb = msg_nak;
+	msg->ack_cb = msn_sbconn_msg_ack;
+	msg->nak_cb = msn_sbconn_msg_nak;
 	msg->ack_data = slpmsg;
 
 	msn_slplink_send_msgpart(slplink, slpmsg);


More information about the Commits mailing list