Changes committed gnus/lisp (ChangeLog auth-source.el nnimap.el nntp.el)

"Ted Zlatanov" <[email protected]>
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog auth-source.el nnimap.el nntp.el

* nntp.el: Autoload `auth-source-user-or-password'.
(nntp-send-authinfo): Use it.

* nnimap.el: Autoload `auth-source-user-or-password'.
(nnimap-open-connection): Use it.

* auth-source.el: Import gnus-util
for the gnus-message function.
(auth-source-user-or-password): Use it.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1852 gnus/lisp/ChangeLog:7.1853
--- ChangeLog:7.1852	Fri May  9 21:28:48 2008
+++ ChangeLog	Fri May  9 23:21:25 2008
@@ -1,6 +1,14 @@
 2008-05-09  Teodor Zlatanov  <[email protected]>
 
-	* auth-source.el: Added docs on using with url-auth.
+	* nntp.el: Autoload `auth-source-user-or-password'.
+	(nntp-send-authinfo): Use it.
+
+	* nnimap.el: Autoload `auth-source-user-or-password'.
+	(nnimap-open-connection): Use it.
+
+	* auth-source.el: Added docs on using with url-auth.  Import gnus-util
+	for the gnus-message function.
+	(auth-source-user-or-password): Use it.
 
 2008-05-07  Teodor Zlatanov  <[email protected]>
 
Index: auth-source.el
diff -u gnus/lisp/auth-source.el:7.7 gnus/lisp/auth-source.el:7.8
--- auth-source.el:7.7	Fri May  9 21:28:48 2008
+++ auth-source.el	Fri May  9 23:21:25 2008
@@ -51,6 +51,8 @@
 
 ;;; Code:
 
+(require 'gnus-util)
+
 (eval-when-compile (require 'cl))
 (eval-when-compile (require 'netrc))
 
@@ -145,7 +147,9 @@
 
 (defun auth-source-user-or-password (mode host protocol)
   "Find user or password (from the string MODE) matching HOST and PROTOCOL."
-;;; (debug mode host protocol)
+  (gnus-message 9 
+		"auth-source-user-or-password: get %s for %s (%s)"
+		mode host protocol)
   (let (found)
     (dolist (choice (auth-source-pick host protocol))
       (setq found (netrc-machine-user-or-password 
@@ -155,6 +159,12 @@
 		   (list (format "%s" protocol))
 		   (auth-source-protocol-defaults protocol)))
       (when found
+	(gnus-message 9 
+		      "auth-source-user-or-password: found %s=%s for %s (%s)"
+		      mode 
+		      ;; don't show the password
+		      (if (equal mode "password") "SECRET" found) 
+		      host protocol)
 	(return found)))))
 
 (defun auth-source-protocol-defaults (protocol)
Index: nnimap.el
diff -u gnus/lisp/nnimap.el:7.47 gnus/lisp/nnimap.el:7.48
--- nnimap.el:7.47	Thu Apr 24 06:19:20 2008
+++ nnimap.el	Fri May  9 23:21:25 2008
@@ -73,6 +73,9 @@
 
 (eval-when-compile (require 'cl))
 
+(eval-and-compile
+  (autoload 'auth-source-user-or-password "auth-source"))
+
 (nnoo-declare nnimap)
 
 (defconst nnimap-version "nnimap 1.0")
@@ -798,22 +801,26 @@
  	   (port (if nnimap-server-port
  		     (int-to-string nnimap-server-port)
  		   "imap"))
-	   (user (netrc-machine-user-or-password
-		  "login"
-		  list
-		  (list server
-			(or nnimap-server-address
-			    nnimap-address))
-		  (list port)
-		  (list "imap" "imaps" "143" "993")))
-	   (passwd (netrc-machine-user-or-password
-		    "password"
-		    list
-		    (list server
-			  (or nnimap-server-address
-			      nnimap-address))
-		    (list port)
-		    (list "imap" "imaps" "143" "993"))))
+	   (user (or 
+		  (auth-source-user-or-password "login" server port) ; this is preferred to netrc-*
+		  (netrc-machine-user-or-password
+		   "login"
+		   list
+		   (list server
+			 (or nnimap-server-address
+			     nnimap-address))
+		   (list port)
+		   (list "imap" "imaps" "143" "993"))))
+	   (passwd (or 
+		    (auth-source-user-or-password "login" server port) ; this is preferred to netrc-*
+		    (netrc-machine-user-or-password
+		     "password"
+		     list
+		     (list server
+			   (or nnimap-server-address
+			       nnimap-address))
+		     (list port)
+		     (list "imap" "imaps" "143" "993")))))
       (if (imap-authenticate user passwd nnimap-server-buffer)
 	  (prog2
 	      (setq nnimap-server-buffer-alist
Index: nntp.el
diff -u gnus/lisp/nntp.el:7.47 gnus/lisp/nntp.el:7.48
--- nntp.el:7.47	Thu Apr 24 06:19:21 2008
+++ nntp.el	Fri May  9 23:21:25 2008
@@ -38,6 +38,9 @@
 
 (eval-when-compile (require 'cl))
 
+(eval-and-compile
+  (autoload 'auth-source-user-or-password "auth-source"))
+
 (defgroup nntp nil
   "NNTP access for Gnus."
   :group 'gnus)
@@ -1179,8 +1182,15 @@
   (let* ((list (netrc-parse nntp-authinfo-file))
 	 (alist (netrc-machine list nntp-address "nntp"))
 	 (force (or (netrc-get alist "force") nntp-authinfo-force))
-	 (user (or (netrc-get alist "login") nntp-authinfo-user))
-	 (passwd (netrc-get alist "password")))
+	 (user (or 
+		;; this is preferred to netrc-*
+		(auth-source-user-or-password "login" nntp-address "nntp")
+		(netrc-get alist "login") 
+		nntp-authinfo-user))
+	 (passwd (or
+		  ;; this is preferred to netrc-*
+		  (auth-source-user-or-password "password" nntp-address "nntp")
+		  (netrc-get alist "password"))))
     (when (or (not send-if-force)
 	      force)
       (unless user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.