diff options
author | Paul Fariello <paul@fariello.eu> | 2019-03-19 17:10:20 +0100 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-04-10 17:12:31 +0200 |
commit | bc541cb8ac6be40a2ee1e38a99de7cf144361a2a (patch) | |
tree | 7f5a08a7b73ad94ba5fba367860dcd26b2f9853c /src/command/cmd_funcs.c | |
parent | 9a66e74986876ded37bb027bd0f673cd1f975782 (diff) | |
download | profani-tty-bc541cb8ac6be40a2ee1e38a99de7cf144361a2a.tar.gz |
Add OMEMO end command
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index f21da6e7..49e20744 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7996,6 +7996,47 @@ cmd_omemo_start(ProfWin *window, const char *const command, gchar **args) } gboolean +cmd_omemo_end(ProfWin *window, const char *const command, gchar **args) +{ +#ifdef HAVE_OMEMO + if (connection_get_status() != JABBER_CONNECTED) { + cons_show("You must be connected with an account to load OMEMO information."); + return TRUE; + } + + if (window->type == WIN_CHAT) { + ProfChatWin *chatwin = (ProfChatWin*)window; + assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); + + if (!chatwin->is_omemo) { + win_println(window, THEME_DEFAULT, '!', "You are not currently in an OMEMO session."); + return TRUE; + } + + chatwin->is_omemo = FALSE; + } else if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); + + if (!mucwin->is_omemo) { + win_println(window, THEME_DEFAULT, '!', "You are not currently in an OMEMO session."); + return TRUE; + } + + mucwin->is_omemo = FALSE; + } else { + win_println(window, THEME_DEFAULT, '-', "You must be in a regular chat window to start an OMEMO session."); + return TRUE; + } + + return TRUE; +#else + cons_show("This version of Profanity has not been built with OMEMO support enabled"); + return TRUE; +#endif +} + +gboolean cmd_omemo_fingerprint(ProfWin *window, const char *const command, gchar **args) { #ifdef HAVE_OMEMO |