diff options
Diffstat (limited to 'lisp/gnus/auth-source.el')
-rw-r--r-- | lisp/gnus/auth-source.el | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 9883eb64acc..a2a4dcf24cc 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -86,11 +86,6 @@ Each entry is the authentication type with optional properties." (list :tag "Source definition" (const :format "" :value :source) (string :tag "Authentication Source") - (const :format "" :value :server) - (choice :tag "Server (logical name) choice" - (const :tag "Any" t) - (regexp :tag "Server regular expression (TODO)") - (const :tag "Fallback" nil)) (const :format "" :value :host) (choice :tag "Host (machine) choice" (const :tag "Any" t) @@ -118,20 +113,16 @@ Each entry is the authentication type with optional properties." ;; (auth-source-user-or-password-imap "password" "imap.myhost.com") ;; (auth-source-protocol-defaults 'imap) -(defun auth-source-pick (server host protocol &optional fallback) - "Parse `auth-sources' for SERVER, HOST, and PROTOCOL matches. +(defun auth-source-pick (host protocol &optional fallback) + "Parse `auth-sources' for HOST, and PROTOCOL matches. -Returns fallback choices (where SERVER. PROTOCOL or HOST are nil) with FALLBACK t." +Returns fallback choices (where PROTOCOL or HOST are nil) with FALLBACK t." (interactive "sHost: \nsProtocol: \n") ;for testing (let (choices) (dolist (choice auth-sources) - (let ((s (plist-get choice :server)) - (h (plist-get choice :host)) + (let ((h (plist-get choice :host)) (p (plist-get choice :protocol))) (when (and - (or (equal t s) - (and (stringp s) (string-match s server)) - (and fallback (equal s nil))) (or (equal t h) (and (stringp h) (string-match h host)) (and fallback (equal h nil))) @@ -142,12 +133,12 @@ Returns fallback choices (where SERVER. PROTOCOL or HOST are nil) with FALLBACK (if choices choices (unless fallback - (auth-source-pick server host protocol t))))) + (auth-source-pick host protocol t))))) -(defun auth-source-user-or-password (mode server host protocol) - "Find user or password (from the string MODE) matching SERVER, HOST, and PROTOCOL." +(defun auth-source-user-or-password (mode host protocol) + "Find user or password (from the string MODE) matching HOST and PROTOCOL." (let (found) - (dolist (choice (auth-source-pick server host protocol)) + (dolist (choice (auth-source-pick host protocol)) (setq found (netrc-machine-user-or-password mode (plist-get choice :source) @@ -161,20 +152,20 @@ Returns fallback choices (where SERVER. PROTOCOL or HOST are nil) with FALLBACK "Return a list of default ports and names for PROTOCOL." (cdr-safe (assoc protocol auth-source-protocols))) -(defun auth-source-user-or-password-imap (mode server host) - (auth-source-user-or-password mode server host 'imap)) +(defun auth-source-user-or-password-imap (mode host) + (auth-source-user-or-password mode host 'imap)) -(defun auth-source-user-or-password-pop3 (mode server host) - (auth-source-user-or-password mode server host 'pop3)) +(defun auth-source-user-or-password-pop3 (mode host) + (auth-source-user-or-password mode host 'pop3)) -(defun auth-source-user-or-password-ssh (mode server host) - (auth-source-user-or-password mode server host 'ssh)) +(defun auth-source-user-or-password-ssh (mode host) + (auth-source-user-or-password mode host 'ssh)) -(defun auth-source-user-or-password-sftp (mode server host) - (auth-source-user-or-password mode server host 'sftp)) +(defun auth-source-user-or-password-sftp (mode host) + (auth-source-user-or-password mode host 'sftp)) -(defun auth-source-user-or-password-smtp (mode server host) - (auth-source-user-or-password mode server host 'smtp)) +(defun auth-source-user-or-password-smtp (mode host) + (auth-source-user-or-password mode host 'smtp)) (provide 'auth-source) |