about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-08 00:22:17 +0000
committerJames Booth <boothj5@gmail.com>2016-01-08 00:22:17 +0000
commit51f033ae42c9fd6f1e715d170509e3f277586e10 (patch)
tree416db6fa848cb8aed62116146919293c42b4f4c9 /src
parenta90e109f7eb188e31bb6c26ee1aed641ff694f93 (diff)
downloadprofani-tty-51f033ae42c9fd6f1e715d170509e3f277586e10.tar.gz
End OTR sessions on lost server connection
Diffstat (limited to 'src')
-rw-r--r--src/event/server_events.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index ae5608e2..147ea6ce 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -152,6 +152,23 @@ sv_ev_lost_connection(void)
 {
     cons_show_error("Lost connection.");
 
+#ifdef HAVE_LIBOTR
+    GSList *recipients = wins_get_chat_recipients();
+    GSList *curr = recipients;
+    while (curr) {
+        char *barejid = curr->data;
+        ProfChatWin *chatwin = wins_get_chat(barejid);
+        if (chatwin && otr_is_secure(barejid)) {
+            chatwin_otr_unsecured(chatwin);
+            otr_end_session(barejid);
+        }
+        curr = g_slist_next(curr);
+    }
+    if (recipients) {
+        g_slist_free(recipients);
+    }
+#endif
+
     muc_invites_clear();
     chat_sessions_clear();
     ui_disconnected();