From 4f35b114718880b5ca0449a8e4cc7c81dcae22da Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 3 Jan 2016 01:32:37 +0000 Subject: [PATCH] End OTR session when recipient goes offline --- src/event/server_events.c | 6 ++++++ src/ui/core.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/event/server_events.c b/src/event/server_events.c index d1300f91..8fc32d4e 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -545,6 +545,12 @@ sv_ev_contact_offline(char *barejid, char *resource, char *status) ui_contact_offline(barejid, resource, status); } + ProfChatWin *chatwin = wins_get_chat(barejid); + if (chatwin && otr_is_secure(barejid)) { + chatwin_otr_unsecured(chatwin); + otr_end_session(chatwin->barejid); + } + rosterwin_roster(); chat_session_remove(barejid); } diff --git a/src/ui/core.c b/src/ui/core.c index 362a1ac8..a4e5814a 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -992,7 +992,7 @@ ui_contact_offline(char *barejid, char *resource, char *status) chatwin_contact_offline(chatwin, resource, status); } - // show in char win if "online" and presence online + // show in chat win if "online" and presence online } else if (g_strcmp0(show_chat_win, "online") == 0) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) {