]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/auth-source.el
Another minor fix for next-single-char-property-change.
[gnu-emacs] / lisp / gnus / auth-source.el
index acbc541512f3961b0e6d25d8bdfa2b7ecc80927e..5e946372d04c45b2b256d2fe0a3e5e6ec08e827a 100644 (file)
@@ -1781,6 +1781,26 @@ MODE can be \"login\" or \"password\"."
 
     found))
 
+(defun auth-source-user-and-password (host &optional user)
+  (let* ((auth-info (car
+                     (if user
+                         (auth-source-search
+                          :host host
+                          :user "yourusername"
+                          :max 1
+                          :require '(:user :secret)
+                          :create nil)
+                       (auth-source-search
+                        :host host
+                        :max 1
+                        :require '(:user :secret)
+                        :create nil))))
+         (user (plist-get auth-info :user))
+         (password (plist-get auth-info :secret)))
+    (when (functionp password)
+      (setq password (funcall password)))
+    (list user password auth-info)))
+
 (provide 'auth-source)
 
 ;;; auth-source.el ends here