emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106837: nntp.el (nntp-send-authinfo)


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106837: nntp.el (nntp-send-authinfo): Query `auth-source-search' with the logical server name in addition to the actual machine address.
Date: Tue, 10 Jan 2012 22:04:51 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106837
author: Teodor Zlatanov <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2012-01-10 22:04:51 +0000
message:
  nntp.el (nntp-send-authinfo): Query `auth-source-search' with the logical 
server name in addition to the actual machine address.
  auth-source.el (auth-source-user-and-password): Add convenience wrapper to 
search by just host and optionally user.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/auth-source.el
  lisp/gnus/nntp.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2012-01-10 17:32:19 +0000
+++ b/lisp/gnus/ChangeLog       2012-01-10 22:04:51 +0000
@@ -1,3 +1,11 @@
+2012-01-10  Teodor Zlatanov  <address@hidden>
+
+       * nntp.el (nntp-send-authinfo): Query `auth-source-search' with the
+       logical server name in addition to the actual machine address.
+
+       * auth-source.el (auth-source-user-and-password): Add convenience
+       wrapper to search by just host and optionally user.
+
 2012-01-07  Lars Magne Ingebrigtsen  <address@hidden>
 
        * shr.el (shr-visit-file): Move point to the beginning of the buffer

=== modified file 'lisp/gnus/auth-source.el'
--- a/lisp/gnus/auth-source.el  2012-01-05 09:46:05 +0000
+++ b/lisp/gnus/auth-source.el  2012-01-10 22:04:51 +0000
@@ -1781,6 +1781,26 @@
 
     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

=== modified file 'lisp/gnus/nntp.el'
--- a/lisp/gnus/nntp.el 2012-01-07 01:13:52 +0000
+++ b/lisp/gnus/nntp.el 2012-01-10 22:04:51 +0000
@@ -1249,8 +1249,8 @@
         (alist (netrc-machine list nntp-address "nntp"))
          (auth-info
           (nth 0 (auth-source-search :max 1
-                                     ;; TODO: allow the virtual server name too
-                                     :host nntp-address
+                                     :host (list nntp-address
+                                                 (nnoo-current-server 'nntp))
                                      :port '("119" "nntp"))))
          (auth-user (plist-get auth-info :user))
          (auth-force (plist-get auth-info :force))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]