diff options
author | Paul Fariello <paul@fariello.eu> | 2019-03-06 19:22:46 +0140 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-04-10 16:31:45 +0200 |
commit | 2718183d27b20eae88d808b2cf181b22610c5e26 (patch) | |
tree | 505a6138b57e118b75378b99d16b0a2f46ca97a0 /src | |
parent | da0376a6a9b83756efffed6fb24fafd72f0fc36e (diff) | |
download | profani-tty-2718183d27b20eae88d808b2cf181b22610c5e26.tar.gz |
Enable start of OMEMO in existing chat win
Diffstat (limited to 'src')
-rw-r--r-- | src/command/cmd_funcs.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 1ce034d9..5ce9b7f4 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7950,6 +7950,36 @@ cmd_omemo_start(ProfWin *window, const char *const command, gchar **args) omemo_start_session(barejid); chatwin->is_omemo = TRUE; + } else { + if (window->type != WIN_CHAT) { + win_println(window, THEME_DEFAULT, '-', "You must be in a regular chat window to start an OMEMO session."); + return TRUE; + } + + ProfChatWin *chatwin = (ProfChatWin*)window; + assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); + if (chatwin->pgp_send) { + win_println(window, THEME_DEFAULT, '!', "You must disable PGP encryption before starting an OMEMO session."); + return TRUE; + } + + if (chatwin->is_otr) { + win_println(window, THEME_DEFAULT, '!', "You must disable OTR encryption before starting an OMEMO session."); + return TRUE; + } + + if (chatwin->is_omemo) { + win_println(window, THEME_DEFAULT, '!', "You are already in an OMEMO session."); + return TRUE; + } + + if (!omemo_loaded()) { + win_println(window, THEME_DEFAULT, '!', "You have not generated or loaded a cryptographic materials, use '/omemo gen'"); + return TRUE; + } + + omemo_start_session(chatwin->barejid); + chatwin->is_omemo = TRUE; } return TRUE; |