about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorMaximilian Wuttke <mwuttke97@posteo.de>2021-03-29 21:53:51 +0200
committerMaximilian Wuttke <mwuttke97@posteo.de>2021-04-08 00:29:58 +0200
commite8664e27303e6028bc335e33172d84025ff3fa30 (patch)
treee1c999de8bac1f82b593a80377f06d987ad1615a /src/command
parent9e0d0ed46664bcfe9bc3197be2d794fc1c7a5142 (diff)
downloadprofani-tty-e8664e27303e6028bc335e33172d84025ff3fa30.tar.gz
OMEMO: Fail if message keys couldn't be encrypted for any recipient device
If the message (key) can't be encrypted for any device, sending the
message is refused and an informative error message is presented to the
user.

Also, don't encrypt for the same device, since the OMEMO XEP disallows
this.
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_funcs.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index b140de53..90c41dfd 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -2151,22 +2151,21 @@ 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.
+            // NOTE: This will also start the new OMEMO session and send a MAM request.
             chatwin = chatwin_new(barejid);
         }
         ui_focus_win((ProfWin*)chatwin);
 
         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.
+            // NOTE: In case the message is OMEMO encrypted, we can't be sure
+            // whether the key bundles of the recipient have already been
+            // received. In the case that *no* bundles have been received yet,
+            // the message won't be sent, and an error is shown to the user.
+            // Other cases are not handled here.
             cl_ev_send_msg(chatwin, msg, NULL);
         } else {
 #ifdef HAVE_LIBOTR
-            // Start the OTR session after this (i.e. the
-            // first) message was sent
+            // 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));
             }