mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-23 02:26:20 +00:00
End OTR session when user closes chat window
This commit is contained in:
@@ -439,7 +439,13 @@ _ui_close_connected_win(int index)
|
||||
char *room_jid = ui_recipient(index);
|
||||
presence_leave_chat_room(room_jid);
|
||||
} else if ((win_type == WIN_CHAT) || (win_type == WIN_PRIVATE)) {
|
||||
|
||||
#ifdef HAVE_LIBOTR
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
if (window->is_otr) {
|
||||
cons_debug("Ending OTR session");
|
||||
otr_end_session(window->from);
|
||||
}
|
||||
#endif
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
char *recipient = ui_recipient(index);
|
||||
|
||||
@@ -588,7 +594,7 @@ _ui_next_win(void)
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_gone_secure(char *recipient)
|
||||
_ui_gone_secure(const char * const recipient)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(recipient);
|
||||
if (window != NULL) {
|
||||
@@ -604,6 +610,23 @@ _ui_gone_secure(char *recipient)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_gone_insecure(const char * const recipient)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(recipient);
|
||||
if (window != NULL) {
|
||||
window->is_otr = FALSE;
|
||||
|
||||
if (wins_is_current(window)) {
|
||||
GString *recipient_str = _get_recipient_string(window);
|
||||
title_bar_set_recipient(recipient_str->str);
|
||||
g_string_free(recipient_str, TRUE);
|
||||
title_bar_draw();
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_previous_win(void)
|
||||
{
|
||||
@@ -1663,4 +1686,5 @@ ui_init_module(void)
|
||||
ui_current_win_is_otr = _ui_current_win_is_otr;
|
||||
ui_current_set_otr = _ui_current_set_otr;
|
||||
ui_gone_secure = _ui_gone_secure;
|
||||
ui_gone_insecure = _ui_gone_insecure;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ void (*ui_handle_special_keys)(const wint_t * const ch, const char * const inp,
|
||||
void (*ui_switch_win)(const int i);
|
||||
void (*ui_next_win)(void);
|
||||
void (*ui_previous_win)(void);
|
||||
void (*ui_gone_secure)(char *recipient);
|
||||
void (*ui_gone_secure)(const char * const recipient);
|
||||
void (*ui_gone_insecure)(const char * const recipient);
|
||||
unsigned long (*ui_get_idle_time)(void);
|
||||
void (*ui_reset_idle_time)(void);
|
||||
void (*ui_new_chat_win)(const char * const to);
|
||||
|
||||
Reference in New Issue
Block a user