Improve ement password handling

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-09-16 19:33:46 +02:00
parent dd3de246a8
commit 931b5aa764

View file

@ -13,11 +13,15 @@
(with-current-buffer " *ement-pass*" (with-current-buffer " *ement-pass*"
(ement-connect (ement-connect
:uri-prefix "http://localhost:8008" :uri-prefix "http://localhost:8008"
:password (string-trim (substring-no-properties (buffer-string))) :password (let ((password (string-trim (substring-no-properties (buffer-string)))))
(if (not (equal (process-exit-status process) 0))
(read-passwd "Ement password: ")
password))
:user-id "@magic_rb:matrix.redalder.org") :user-id "@magic_rb:matrix.redalder.org")
(kill-buffer)))) (kill-buffer))))
(defun after-init-ement-connect () (defun after-init-ement-connect ()
(interactive)
(set-process-sentinel (start-process "ement-pass" " *ement-pass*" "pass" "Matrix/@magic_rb:matrix.redalder.org") #'ement-connect-sentinel)) (set-process-sentinel (start-process "ement-pass" " *ement-pass*" "pass" "Matrix/@magic_rb:matrix.redalder.org") #'ement-connect-sentinel))
(use-package ement (use-package ement
@ -27,7 +31,7 @@
(ement-save-sessions t) (ement-save-sessions t)
:config :config
(remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync) (remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync)
(add-hook 'after-init-hook #'after-init-ement-connect)) (setf ement-sessions (ement--read-sessions)))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp