From d3bcc498bbc2784cf172eaa2d7ab1609dcc80c99 Mon Sep 17 00:00:00 2001 From: Pedro Enrique Palau Date: Wed, 14 Aug 2019 16:23:33 -0500 Subject: [PATCH] Fixes the session close when connection ends This code is WIP and need revision - Checks if the client conversation is encrypted - Converts client conversation to plugin conversation in a better way - Related to #65 and #69 --- gtk-dialog.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gtk-dialog.c b/gtk-dialog.c index cd12e6b..d497910 100644 --- a/gtk-dialog.c +++ b/gtk-dialog.c @@ -3097,13 +3097,21 @@ static void connection_signing_off_cb(PurpleConnection *conn) { for (el = client->conversations; el; el = el->next) { otr_conv = el->data; - otr_plugin_conv = otrng_plugin_conversation_new(otr_conv->conn); if (!otr_conv) { continue; } - otrng_ui_disconnect_connection(otr_plugin_conv); - otrng_plugin_conversation_free(otr_plugin_conv); + if (!otrng_conversation_is_encrypted(otr_conv)) { + continue; + } + + otr_plugin_conv = + client_conversation_to_plugin_conversation(otr_conv->conn); + + if (otr_plugin_conv) { + otrng_ui_disconnect_connection(otr_plugin_conv); + otrng_plugin_conversation_free(otr_plugin_conv); + } } }