summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--init.el42
1 files changed, 23 insertions, 19 deletions
diff --git a/init.el b/init.el
index 74e0690..34a4971 100644
--- a/init.el
+++ b/init.el
@@ -282,6 +282,14 @@
(pwd (plist-get item :secret)))
(list user (when pwd (funcall pwd)))))))
+(defun jao-call-with-auth (host fun)
+ (let ((up (jao--get-user/password host)))
+ (funcall fun (car up) (cadr up))))
+
+(defmacro jao-with-auth (host usr pwd &rest body)
+ (declare (indent defun))
+ `(jao-call-with-auth ,host (lambda (,usr ,pwd) ,@body)))
+
;;;; pass
(use-package password-store :ensure t
:bind (("C-c p" . jao-transient-password)))
@@ -2561,9 +2569,7 @@
(defun circe-command-RECOVER (&rest _ignore)
"Recover nick"
- (let* ((fn (jao--get-user/password "freenode"))
- (u (car fn))
- (p (cadr fn)))
+ (jao-with-auth "freenode" u p
(circe-command-MSG "nickserv" (format "IDENTIFY %s %s" u p))
(circe-command-MSG "nickserv" (format "GHOST %s" u))
(circe-command-MSG "nickserv" (format "RELEASE %s" u))
@@ -2577,26 +2583,23 @@
(advice-add 'circe-command-NAMES :after #'circe-command-NNICKS)
(setq circe-network-options
- (let ((up (jao--get-user/password "libera"))
- (oup (jao--get-user/password "oftc"))
- (bup (jao--get-user/password "bitlbee")))
- `(("Libera Chat"
- :nick ,(car up) :channels ,jao-libera-channels
- :tls t :sasl-username ,(car up) :sasl-password ,(cadr up))
- ("OFTC" :nick ,(car oup) :channels ,jao-oftc-channels
- :nickserv-password ,(cadr oup)
- :tls t :sasl-username ,(car oup) :sasl-password ,(cadr oup))
- ("Bitlbee"
- :host "127.0.0.1" :nick ,(car bup)
- :channels ,jao-bitlbee-channels
- :lagmon-disabled t
- :nickserv-password ,(cadr bup) :user ,(car bup)))))
+ (list (jao-with-auth "libera" u p
+ (list "Libera Chat" :nick u :channels jao-libera-channels
+ :tls t :sasl-username u :sasl-password p))
+ (jao-with-auth "oftc" u p
+ (list "OFTC"
+ :nick u :channels jao-oftc-channels :nickserv-password p
+ :tls t :sasl-username u :sasl-password p))
+ (jao-with-auth "bitlbee" u p
+ (list "Bitlbee" :host "127.0.0.1" :nick u
+ :channels jao-bitlbee-channels :lagmon-disabled t
+ :nickserv-password u :user p))))
(jao-shorten-modes 'circe-channel-mode
'circe-server-mode
'circe-query-mode)
- ;; (enable-circe-display-images)
+ (enable-circe-display-images)
(enable-lui-track)
(circe-lagmon-mode))
@@ -2675,6 +2678,7 @@
(use-package ement
:ensure t
:init (setq ement-save-sessions t
+ ement-sessions-file (locate-user-emacs-file "cache/ement.el")
ement-room-avatars nil
ement-notify-dbus-p nil
ement-room-left-margin-width 0
@@ -2704,7 +2708,7 @@
(telega))
(when (or p (y-or-n-p "Connect to matrix? "))
(unless (get-buffer "*Ement Rooms*")
- (ement-connect)))
+ (jao-with-auth "matrix.org" u p (ement-connect :user-id u :password p))))
(when (or p (y-or-n-p "Connect to libera? "))
(unless (get-buffer "irc.libera.chat:6697")
(circe "Libera Chat"))))