diff src/protocols/msn/slpmsg.c @ 10345:2e01c503aa4f

[gaim-migrate @ 11556] Patch 1078151 from Felipe Contreras to fix some more MSN bugs: "User Dislpay messages, and other less used, did not set an slpcall, so the callback that should not be called, was called (in some very special cases)." ... "Here it goes the real real one, as far as I can tell. Cleaning + organizing + documentation + hard bug fix = big patch." -- Felipe Contreras I also fixed drag-and-drop to conversation window file transfers (which I had broken when I fixed some other dnd thing), made the debug output of the autoreconnect plugin more useful, and stopped the message notification plugin notifying you for messages sent by ignored users. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 11 Dec 2004 20:01:58 +0000
parents 56cc5d49472b
children 0f7452b1f777
line wrap: on
line diff
--- a/src/protocols/msn/slpmsg.c	Sat Dec 11 00:06:06 2004 +0000
+++ b/src/protocols/msn/slpmsg.c	Sat Dec 11 20:01:58 2004 +0000
@@ -33,8 +33,13 @@
 msn_slpmsg_new(MsnSlpLink *slplink)
 {
 	MsnSlpMessage *slpmsg;
+
 	slpmsg = g_new0(MsnSlpMessage, 1);
 
+#ifdef MSN_DEBUG_SLPMSG
+	gaim_debug_info("msn", "slpmsg new (%p)\n", slpmsg);
+#endif
+
 	slpmsg->slplink = slplink;
 
 	slplink->slp_msgs =
@@ -47,6 +52,13 @@
 msn_slpmsg_destroy(MsnSlpMessage *slpmsg)
 {
 	MsnSlpLink *slplink;
+	GList *cur;
+
+	g_return_if_fail(slpmsg != NULL);
+
+#ifdef MSN_DEBUG_SLPMSG
+	gaim_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg);
+#endif
 
 	slplink = slpmsg->slplink;
 
@@ -56,42 +68,31 @@
 	if (slpmsg->buffer != NULL)
 		g_free(slpmsg->buffer);
 
-#ifdef DEBUG_SLP
+#ifdef MSN_DEBUG_SLP
 	/*
 	if (slpmsg->info != NULL)
 		g_free(slpmsg->info);
 	*/
 #endif
 
-	if (slpmsg->msg != NULL)
+	for (cur = slpmsg->msgs; cur != NULL; cur = cur->next)
 	{
 		/* Something is pointing to this slpmsg, so we should remove that
 		 * pointer to prevent a crash. */
 		/* Ex: a user goes offline and after that we receive an ACK */
 
-		gaim_debug_info("msn", "Unlink slpmsg callbacks.\n");
-
-		slpmsg->msg->ack_cb = NULL;
-		slpmsg->msg->ack_data = NULL;
-
-#if 0
-		MsnTransaction *trans;
-
-		trans = slpmsg->msg->trans;
+		MsnMessage *msg = cur->data;
 
-		if (trans != NULL)
-		{
-			if (trans->callbacks != NULL && trans->has_custom_callbacks)
-				g_hash_table_destroy(trans->callbacks);
-			
-			trans->callbacks = NULL;
-			trans->data = NULL;
-		}
+#ifdef MSN_DEBUG_SLPMSG
+		gaim_debug_info("msn", "Unlink slpmsg callbacks.\n");
 #endif
+
+		msg->ack_cb = NULL;
+		msg->nak_cb = NULL;
+		msg->ack_data = NULL;
 	}
 
-	slplink->slp_msgs =
-		g_list_remove(slplink->slp_msgs, slpmsg);
+	slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
 
 	g_free(slpmsg);
 }
@@ -119,7 +120,7 @@
 		slpmsg->size = st.st_size;
 }
 
-#ifdef DEBUG_SLP
+#ifdef MSN_DEBUG_SLP
 const void
 msn_slpmsg_show(MsnMessage *msg)
 {
@@ -203,6 +204,7 @@
 	msn_slpmsg_set_body(slpmsg, body, body_len);
 
 	slpmsg->sip = TRUE;
+	slpmsg->slpcall = slpcall;
 
 	g_free(body);