From: Stefan Becker Date: Mon, 25 Nov 2013 13:13:37 +0000 (+0200) Subject: Fix #222: SIPE crashes when groupchat session expires (II) X-Git-Tag: 1.17.2~4 X-Git-Url: https://repo.or.cz/w/siplcs.git/commitdiff_plain/7b838ffa7ac91cc56053431f1ac59fb1871b04c5 Fix #222: SIPE crashes when groupchat session expires (II) Make sure user is notified if his groupchat message couldn't be delivered due to session expiration. (cherry picked from commit 94fbd26ae9e37e2b42169dd24fcd7cf3b790dc7d) --- diff --git a/src/core/sipe-groupchat.c b/src/core/sipe-groupchat.c index 72eb56b6..f26ad47d 100644 --- a/src/core/sipe-groupchat.c +++ b/src/core/sipe-groupchat.c @@ -464,6 +464,22 @@ void sipe_groupchat_invite_response(struct sipe_core_private *sipe_private, } } +static void chatserver_command_error_notify(struct sipe_core_private *sipe_private, + struct sipe_chat_session *chat_session, + const gchar *content) +{ + gchar *label = g_strdup_printf(_("This message was not delivered to chat room '%s'"), + chat_session->title); + gchar *errmsg = g_strdup_printf("%s:\n%s", + label, content); + g_free(label); + sipe_backend_notify_message_error(SIPE_CORE_PUBLIC, + chat_session->backend, + NULL, + errmsg); + g_free(errmsg); +} + /* TransCallback */ static gboolean chatserver_command_response(struct sipe_core_private *sipe_private, struct sipmsg *msg, @@ -475,18 +491,10 @@ static gboolean chatserver_command_response(struct sipe_core_private *sipe_priva SIPE_DEBUG_INFO("chatserver_command_response: failure %d", msg->response); - if (chat_session) { - gchar *label = g_strdup_printf(_("This message was not delivered to chat room '%s'"), - chat_session->title); - gchar *errmsg = g_strdup_printf("%s:\n%s", - label, gmsg->content); - g_free(label); - sipe_backend_notify_message_error(SIPE_CORE_PUBLIC, - chat_session->backend, - NULL, - errmsg); - g_free(errmsg); - } + if (chat_session) + chatserver_command_error_notify(sipe_private, + chat_session, + gmsg->content); } return TRUE; } @@ -1102,6 +1110,10 @@ void sipe_groupchat_send(struct sipe_core_private *sipe_private, if (msg) { msg->session = chat_session; msg->content = g_strdup(what); + } else { + chatserver_command_error_notify(sipe_private, + chat_session, + what); } }