summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wifi-bluetooth-conf.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/wifi-bluetooth-conf.el b/wifi-bluetooth-conf.el
index a32af96..52bff4d 100644
--- a/wifi-bluetooth-conf.el
+++ b/wifi-bluetooth-conf.el
@@ -148,6 +148,15 @@ If ARG is non-nil, then list the currently connected port."
:sentinel #'durand-wifi-list-sentinel) )))
;;;###autoload
+(defvar durand-wifi-ssid-machine-alist
+ (list
+ (cons "20-1" "wifi-2")
+ (cons "1-20-4F" "wifi-4"))
+ "A list of associations between the SSID of WIFI and the
+ machine name that we can use to search for the password in my
+ secret file.")
+
+;;;###autoload
(defun durand-wifi-join-port (port &optional pwd)
"Join PORT.
If PWD is non-nil, use that as the password."
@@ -156,6 +165,20 @@ If PWD is non-nil, use that as the password."
(cond ((and pwd (not (string= pwd "")))
(list po pwd))
((list po)))))
+ (cond
+ (pwd)
+ ((let ((search-result
+ (alist-get port
+ durand-wifi-ssid-machine-alist
+ nil nil #'string=)))
+ (cond
+ (search-result
+ (setq
+ pwd
+ (funcall
+ (plist-get
+ (car (auth-source-search :host search-result))
+ :secret))))))))
(make-process
:name "durand-wifi-join-port"
:buffer durand-wifi-bluetooth-buffer