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.
This commit is contained in:
Maximilian Wuttke
2021-03-29 02:47:35 +02:00
parent 1ec606540e
commit 9e0d0ed466
2 changed files with 20 additions and 18 deletions

View File

@@ -80,12 +80,22 @@ chatwin_new(const char* const barejid)
}
}
// We start a new OMEMO session if this contact has been configured accordingly.
// However, if OTR is *also* configured, ask the user to choose between OMEMO and OTR.
#ifdef HAVE_OMEMO
if (omemo_automatic_start(barejid)) {
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, "!", "This chat could be either OMEMO or OTR encrypted, but not both. "
"Use '/omemo start' or '/otr start' to select the encryption method.");
} else if (omemo_automatic_start(barejid)) {
// Start the OMEMO session
omemo_start_session(barejid);
chatwin->is_omemo = TRUE;
}
#endif
#endif // HAVE_OMEMO
if (prefs_get_boolean(PREF_MAM)) {
iq_mam_request(chatwin);