branch: elpa/jabber
commit 93554dbecb275601886698e4ce098e1b89714d79
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>
chatbuffer: Guard OMEMO toggle and restore without native module
Refuse to enable OMEMO interactively when the native module is
absent. Silently downgrade saved omemo preference to plaintext on
buffer restore when the module is unavailable.
---
lisp/jabber-chatbuffer.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lisp/jabber-chatbuffer.el b/lisp/jabber-chatbuffer.el
index 147eb0e4c3..133b88bb52 100644
--- a/lisp/jabber-chatbuffer.el
+++ b/lisp/jabber-chatbuffer.el
@@ -221,6 +221,8 @@ Works for both 1:1 chat (`jabber-chatting-with') and MUC
(`jabber-group')."
"Set encryption to OMEMO for this chat buffer."
(interactive)
(require 'jabber-omemo)
+ (unless (bound-and-true-p jabber-omemo--available)
+ (user-error "OMEMO encryption requires the jabber-omemo-core native
module"))
(setq jabber-chat-encryption 'omemo)
(jabber-chat-encryption--save 'omemo)
(jabber-chat-encryption--update-header)
@@ -434,7 +436,9 @@ EWOC-PP is the pretty-printer function for the message
EWOC."
(unless saved
(setq jabber-chat-encryption 'plaintext))))
(when (eq jabber-chat-encryption 'omemo)
- (require 'jabber-omemo)))
+ (require 'jabber-omemo nil t)
+ (unless (bound-and-true-p jabber-omemo--available)
+ (setq jabber-chat-encryption 'plaintext))))
(jabber-chat-encryption--update-header))
(declare-function jabber-chat-create-buffer "jabber-chat" (jc chat-with))