From 07cd237dc4ac24c77c2694920db40a059cd33e9d Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Wed, 26 Jan 2011 11:50:42 +0200 Subject: [PATCH] Fix #3161273: Lost Connection Gives No Error Message (part X) Generate an error for each unprocessed message when INVITE fails. If the response to the INVITE is delayed then the user has a chance to type additional messages that are queued on the outgoing list for sending after the new dialog has been established. But when we receive an error response to the INVITE we only generate an error for the first message. Repeat the error for all unprocessed messages. --- src/core/sipe-im.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/sipe-im.c b/src/core/sipe-im.c index abe1fc96..7e3031a8 100644 --- a/src/core/sipe-im.c +++ b/src/core/sipe-im.c @@ -202,11 +202,19 @@ static gboolean process_invite_response(struct sipe_core_private *sipe_private, } if (message) { - sipe_user_present_message_undelivered(sipe_private, session, msg->response, warning, alias ? alias : with, message->body); + /* generate error for each unprocessed message */ + GSList *entry = session->outgoing_message_queue; + while (entry) { + struct queued_message *queued = entry->data; + sipe_user_present_message_undelivered(sipe_private, session, msg->response, warning, alias ? alias : with, queued->body); + entry = sipe_session_dequeue_message(session); + } } else { - gchar *tmp_msg = g_strdup_printf(_("Failed to invite %s"), alias); + /* generate one error and remove all unprocessed messages */ + gchar *tmp_msg = g_strdup_printf(_("Failed to invite %s"), alias ? alias : with); sipe_user_present_error(sipe_private, session, tmp_msg); g_free(tmp_msg); + while (sipe_session_dequeue_message(session)); } g_free(alias); @@ -214,9 +222,6 @@ static gboolean process_invite_response(struct sipe_core_private *sipe_private, /* message is no longer valid */ g_free(key); - /* Remove all unprocessed messages */ - while (sipe_session_dequeue_message(session)); - sipe_dialog_remove(session, with); g_free(with); -- 2.11.4.GIT