changeset 9259:f5f7482678d2

[gaim-migrate @ 10058] Patch by Felipe Contreras. He says, "This patch creates a different callback for the end of a slpcall, so there is no mistake with the current callback for a sucessful slpcall ... when we reach the end of a slpcall the slpcall data has been destroyed, the got_userdisplay cb should be called only as the sucessfull slpcall callback." Essentially, it fixes the corrupt buddy icon checksum issue, though it needs another patch that has to be reworked first, if I understood right. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 10 Jun 2004 20:57:52 +0000
parents 43323228a3da
children 947876140943
files src/protocols/msn/slp.c src/protocols/msn/slp.h src/protocols/msn/slpcall.c src/protocols/msn/slpcall.h src/protocols/msn/slplink.c
diffstat 5 files changed, 17 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/slp.c	Thu Jun 10 07:07:10 2004 +0000
+++ b/src/protocols/msn/slp.c	Thu Jun 10 20:57:52 2004 +0000
@@ -138,18 +138,21 @@
 }
 
 void
-msn_xfer_finish_cb(MsnSlpCall *slpcall,
-				   const char *body, long long size)
+msn_xfer_end_cb(MsnSlpCall *slpcall)
 {
 	if (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_DONE)
 	{
-		if (size < 0)
-			gaim_xfer_cancel_remote(slpcall->xfer);
-		else
-			gaim_xfer_set_completed(slpcall->xfer, TRUE);
+		gaim_xfer_cancel_remote(slpcall->xfer);
 	}
 }
 
+void
+msn_xfer_completed_cb(MsnSlpCall *slpcall, const char *body,
+					  long long size)
+{
+	gaim_xfer_set_completed(slpcall->xfer, TRUE);
+}
+
 /**************************************************************************
  * SLP Control
  **************************************************************************/
@@ -307,7 +310,8 @@
 
 		account = slpcall->slplink->session->account;
 
-		slpcall->cb = msn_xfer_finish_cb;
+		slpcall->cb = msn_xfer_completed_cb;
+		slpcall->end_cb = msn_xfer_end_cb;
 		slpcall->progress_cb = msn_xfer_progress_cb;
 		slpcall->branch = g_strdup(branch);
 
--- a/src/protocols/msn/slp.h	Thu Jun 10 07:07:10 2004 +0000
+++ b/src/protocols/msn/slp.h	Thu Jun 10 20:57:52 2004 +0000
@@ -39,8 +39,8 @@
 
 void send_bye(MsnSlpCall *slpcall, const char *type);
 
-void msn_xfer_finish_cb(MsnSlpCall *slpcall,
-						const char *body, long long size);
+void msn_xfer_completed_cb(MsnSlpCall *slpcall,
+						   const char *body, long long size);
 
 void msn_xfer_cancel(GaimXfer *xfer);
 
--- a/src/protocols/msn/slpcall.c	Thu Jun 10 07:07:10 2004 +0000
+++ b/src/protocols/msn/slpcall.c	Thu Jun 10 20:57:52 2004 +0000
@@ -122,8 +122,8 @@
 		}
 	}
 
-	if (slpcall->cb != NULL)
-		slpcall->cb(slpcall, NULL, -1);
+	if (slpcall->end_cb != NULL)
+		slpcall->end_cb(slpcall);
 
 	g_free(slpcall);
 }
--- a/src/protocols/msn/slpcall.h	Thu Jun 10 07:07:10 2004 +0000
+++ b/src/protocols/msn/slpcall.h	Thu Jun 10 20:57:52 2004 +0000
@@ -63,6 +63,7 @@
 	void *xfer;
 
 	MsnSlpCb cb;
+	void (*end_cb)(MsnSlpCall *slpcall);
 	gboolean wasted;
 	gboolean started;
 };
--- a/src/protocols/msn/slplink.c	Thu Jun 10 07:07:10 2004 +0000
+++ b/src/protocols/msn/slplink.c	Thu Jun 10 20:57:52 2004 +0000
@@ -213,23 +213,6 @@
 
 	slpmsg = cmd->trans->data;
 
-#if 0
-	if (slpmsg->wasted)
-	{
-		gaim_debug_info("msn", "slpmsg cancelled %p\n", slpmsg);
-
-		if (slpmsg->slpcall != NULL)
-		{
-			if (slpmsg->slpcall->cb != NULL)
-				slpmsg->slpcall->cb(slpmsg->slpcall, NULL, -1);
-
-			msn_slpcall_destroy(slpmsg->slpcall);
-		}
-
-		msn_slpmsg_destroy(slpmsg);
-	}
-#endif
-
 	real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size;
 
 	if (slpmsg->offset < real_size)
@@ -648,7 +631,7 @@
 
 	slpcall->session_init_cb = send_file;
 	slpcall->progress_cb = msn_xfer_progress_cb;
-	slpcall->cb = msn_xfer_finish_cb;
+	slpcall->cb = msn_xfer_completed_cb;
 	slpcall->xfer = xfer;
 
 	gaim_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel);