changeset 30490:0b88a1b54475

If there's stuff stuck in the DC queue, then try to send it over the SB if we're dropping back to it.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 20 May 2010 09:06:47 +0000
parents 5044315e81e1
children 1e9644d6c74a
files libpurple/protocols/msn/directconn.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Thu May 20 08:14:20 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Thu May 20 09:06:47 2010 +0000
@@ -318,6 +318,7 @@
 {
 	MsnSlpLink *slplink;
 	MsnSlpCall *slpcall;
+	GQueue *queue = NULL;
 
 	purple_debug_info("msn", "msn_dc_try_fallback_to_p2p %p\n", dc);
 
@@ -325,11 +326,24 @@
 
 	slpcall = dc->slpcall;
 	slplink = msn_slplink_ref(dc->slplink);
+	if (slpcall && !g_queue_is_empty(dc->out_queue)) {
+		queue = dc->out_queue;
+		dc->out_queue = NULL;
+	}
 
 	msn_dc_destroy(dc);
 
-	if (slpcall)
+	if (slpcall) {
 		msn_slpcall_session_init(slpcall);
+		if (queue) {
+			while (!g_queue_is_empty(queue)) {
+				MsnDirectConnPacket *p = g_queue_pop_head(queue);
+				msn_slplink_send_msg(slplink, p->msg);
+				msn_dc_destroy_packet(p);
+			}
+			g_queue_free(queue);
+		}
+	}
 	msn_slplink_unref(slplink);
 }