about summary refs log tree commit diff stats
path: root/src/ui/chatwin.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-04-08 10:20:42 +0200
committerGitHub <noreply@github.com>2021-04-08 10:20:42 +0200
commit558d672733c3bee3395b0236b8454a6af853301e (patch)
tree306c928deffe94c655ec80d2295d9f4cb5cf4244 /src/ui/chatwin.c
parent1ec606540eb0f474f3d968d3566a7c56d778a367 (diff)
parent025c2fb1e0ed0915c90d4371c2f96ce9f9c8f957 (diff)
downloadprofani-tty-558d672733c3bee3395b0236b8454a6af853301e.tar.gz
Merge pull request #1515 from mwuttke97/fix_omemo_empty_devlist
 [OMEMO] Fix sending messages
Diffstat (limited to 'src/ui/chatwin.c')
-rw-r--r--src/ui/chatwin.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index a52af306..e1ec1968 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -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);