Commits

simon  committed 49e9df7

2004-11-29 Simon Josefsson <jas@extundo.com>

* netrc.el: Use encrypt.el from ecrypto, instead of gnus-encrypt.
Sync with Gnus CVS.

  • Participants
  • Parent commits dea9004

Comments (0)

Files changed (2)

+2004-11-29  Simon Josefsson  <jas@extundo.com>
+
+	* netrc.el: Use encrypt.el from ecrypto, instead of gnus-encrypt.
+	Sync with Gnus CVS.
+
 2004-11-08  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.69 released.
 ;;; .netrc and .authinfo rc parsing
 ;;;
 
-;; autoload gnus-encrypt
+;; autoload encrypt
 (eval-and-compile
-  (autoload 'gnus-encrypt-find-model "gnus-encrypt")
-  (autoload 'gnus-encrypt-insert-file-contents "gnus-encrypt"))
+  (autoload 'encrypt-find-model "encrypt")
+  (autoload 'encrypt-insert-file-contents "encrypt"))
 
 (defgroup netrc nil
  "Netrc configuration.")
       (let ((tokens '("machine" "default" "login"
 		      "password" "account" "macdef" "force"
 		      "port"))
-	    (encryption-model (gnus-encrypt-find-model file))
+	    (encryption-model (encrypt-find-model file))
 	    alist elem result pair)
 
 	(if encryption-model
-	    (gnus-encrypt-insert-file-contents file encryption-model)
+	    (encrypt-insert-file-contents file encryption-model)
 	  (insert-file-contents file))
 
 	(goto-char (point-min))
 	(pop result))
       (car result))))
 
+(defun netrc-machine-user-or-password (mode authinfo-file-or-list machines ports defaults)
+  "Get the user name or password according to MODE from AUTHINFO-FILE-OR-LIST.
+Matches a machine from MACHINES and a port from PORTS, giving
+default ports DEFAULTS to `netrc-machine'.
+
+MODE can be \"login\" or \"password\", suitable for passing to
+`netrc-get'."
+  (let ((authinfo-list (if (stringp authinfo-file-or-list)
+			   (netrc-parse authinfo-file-or-list)
+			 authinfo-file-or-list))
+	(ports (or ports '(nil)))
+	(defaults (or defaults '(nil)))
+	info)
+    (dolist (machine machines)
+      (dolist (default defaults)
+	(dolist (port ports)
+	  (let ((alist (netrc-machine authinfo-list machine port default)))
+	  (setq info (or (netrc-get alist mode) info))))))
+    info))
+
 (defun netrc-get (alist type)
   "Return the value of token TYPE from ALIST."
   (cdr (assoc type alist)))