diff options
author | Maximilian Wuttke <mwuttke97@posteo.de> | 2021-03-29 02:47:35 +0200 |
---|---|---|
committer | Maximilian Wuttke <mwuttke97@posteo.de> | 2021-04-08 00:23:07 +0200 |
commit | 9e0d0ed46664bcfe9bc3197be2d794fc1c7a5142 (patch) | |
tree | a01f1adb50d56e481f32a801428331be306c581c /src/command | |
parent | 1ec606540eb0f474f3d968d3566a7c56d778a367 (diff) | |
download | profani-tty-9e0d0ed46664bcfe9bc3197be2d794fc1c7a5142.tar.gz |
OMEMO: Remove duplicate session initalisation
The function `omemo_start_session` was effectively called twice in the `/msg` command: Once in `chatwin_new` and afterwards in `cmd_msg`. I've removed the second call.
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_funcs.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 8f463a6c..b140de53 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -2151,30 +2151,22 @@ cmd_msg(ProfWin* window, const char* const command, gchar** args) ProfChatWin* chatwin = wins_get_chat(barejid); if (!chatwin) { + // NOTE: This will also start the new OMEMO session + // and send a MAM request. chatwin = chatwin_new(barejid); } ui_focus_win((ProfWin*)chatwin); -#ifdef HAVE_OMEMO - gboolean is_otr_secure = FALSE; - -#ifdef HAVE_LIBOTR - is_otr_secure = otr_is_secure(barejid); -#endif // HAVE_LIBOTR - - if (omemo_automatic_start(barejid) && is_otr_secure) { - win_println(window, THEME_DEFAULT, "!", "Chat could be either OMEMO or OTR encrypted. Use '/omemo start %s' or '/otr start %s' to start a session.", usr, usr); - return TRUE; - } else if (omemo_automatic_start(barejid)) { - omemo_start_session(barejid); - chatwin->is_omemo = TRUE; - } -#endif // HAVE_OMEMO - if (msg) { + // FIXME [OMEMO] We can't be sure whether the + // bundles have already been receieved. Thus, it is + // possible (and probable) that the recipent can't + // encrypt the message. cl_ev_send_msg(chatwin, msg, NULL); } else { #ifdef HAVE_LIBOTR + // Start the OTR session after this (i.e. the + // first) message was sent if (otr_is_secure(barejid)) { chatwin_otr_secured(chatwin, otr_is_trusted(barejid)); } |