From f708d15210ba6a8cd6da973bba7a47e7b5b6782e Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Mon, 24 Jan 2011 18:38:51 +0200 Subject: [PATCH] Fix #3161273: Lost Connection Gives No Error Message (part V) Handle re-enqueue correctly for the case that the queue isn't empty If the outgoing queue isn't empty, then we have to re-enqueue the unconfirmed older messages before those. --- src/core/sipe-im.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/sipe-im.c b/src/core/sipe-im.c index 677de10b..10f9da62 100644 --- a/src/core/sipe-im.c +++ b/src/core/sipe-im.c @@ -744,8 +744,21 @@ void sipe_im_reenqueue_unconfirmed(struct sipe_core_private *sipe_private, const gchar *callid, const gchar *with) { + /* Remember original list, start with an empty list */ + GSList *first = session->outgoing_message_queue; + session->outgoing_message_queue = NULL; + + /* Enqueue unconfirmed messages */ foreach_unconfirmed_message(sipe_private, session, callid, with, reenqueue_callback, NULL); + + /* Append or restore original list */ + if (session->outgoing_message_queue) { + GSList *last = g_slist_last(session->outgoing_message_queue); + last->next = first; + } else { + session->outgoing_message_queue = first; + } } void sipe_core_im_send(struct sipe_core_public *sipe_public, -- 2.11.4.GIT