mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
Merge changes made in Gnus trunk.
gnus-sum.el (gnus-propagate-marks): Change default to t again, since nil means that nnimap doesn't get updated. auth-source.el (auth-source-netrc-create): Return a synthetic search result when the user doesn't want to write to the file. (auth-source-netrc-search): Expect a synthetic result and proceed accordingly. (auth-source-cache-expiry): New variable to override `password-cache-expiry'. (auth-source-remember): Use it. nnimap.el (nnimap-credentials): Remove the `inhibit-create' parameter. Create entry if necessary by using :create t. (nnimap-open-connection-1): Don't pass `inhibit-create'.
This commit is contained in:
parent
aac7a93503
commit
584c9d3fd0
4 changed files with 70 additions and 25 deletions
|
|
@ -1,3 +1,22 @@
|
|||
2011-02-16 Lars Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* gnus-sum.el (gnus-propagate-marks): Change default to t again, since
|
||||
nil means that nnimap doesn't get updated.
|
||||
|
||||
2011-02-16 Teodor Zlatanov <tzz@lifelogs.com>
|
||||
|
||||
* auth-source.el (auth-source-netrc-create): Return a synthetic search
|
||||
result when the user doesn't want to write to the file.
|
||||
(auth-source-netrc-search): Expect a synthetic result and proceed
|
||||
accordingly.
|
||||
(auth-source-cache-expiry): New variable to override
|
||||
`password-cache-expiry'.
|
||||
(auth-source-remember): Use it.
|
||||
|
||||
* nnimap.el (nnimap-credentials): Remove the `inhibit-create'
|
||||
parameter. Create entry if necessary by using :create t.
|
||||
(nnimap-open-connection-1): Don't pass `inhibit-create'.
|
||||
|
||||
2011-02-15 Teodor Zlatanov <tzz@lifelogs.com>
|
||||
|
||||
* auth-source.el (auth-source-debug): Enable by default and don't
|
||||
|
|
|
|||
|
|
@ -61,6 +61,18 @@
|
|||
:version "23.1" ;; No Gnus
|
||||
:group 'gnus)
|
||||
|
||||
;;;###autoload
|
||||
(defcustom auth-source-cache-expiry 7200
|
||||
"How many seconds passwords are cached, or nil to disable
|
||||
expiring. Overrides `password-cache-expiry' through a
|
||||
let-binding."
|
||||
:group 'auth-source
|
||||
:type '(choice (const :tag "Never" nil)
|
||||
(const :tag "All Day" 86400)
|
||||
(const :tag "2 Hours" 7200)
|
||||
(const :tag "30 Minutes" 1800)
|
||||
(integer :tag "Seconds")))
|
||||
|
||||
(defclass auth-source-backend ()
|
||||
((type :initarg :type
|
||||
:initform 'netrc
|
||||
|
|
@ -588,8 +600,9 @@ Returns the deleted entries."
|
|||
|
||||
(defun auth-source-remember (spec found)
|
||||
"Remember FOUND search results for SPEC."
|
||||
(password-cache-add
|
||||
(concat auth-source-magic (format "%S" spec)) found))
|
||||
(let ((password-cache-expiry auth-source-cache-expiry))
|
||||
(password-cache-add
|
||||
(concat auth-source-magic (format "%S" spec)) found)))
|
||||
|
||||
(defun auth-source-recall (spec)
|
||||
"Recall FOUND search results for SPEC."
|
||||
|
|
@ -808,14 +821,17 @@ See `auth-source-search' for details on SPEC."
|
|||
(when (and create
|
||||
(= 0 (length results)))
|
||||
|
||||
;; create based on the spec
|
||||
(apply (slot-value backend 'create-function) spec)
|
||||
;; turn off the :create key
|
||||
(setq spec (plist-put spec :create nil))
|
||||
;; run the search again to get the updated data
|
||||
;; the result will be returned, even if the search fails
|
||||
(setq results (apply 'auth-source-netrc-search spec)))
|
||||
;; create based on the spec and record the value
|
||||
(setq results (or
|
||||
;; if the user did not want to create the entry
|
||||
;; in the file, it will be returned
|
||||
(apply (slot-value backend 'create-function) spec)
|
||||
;; if not, we do the search again without :create
|
||||
;; to get the updated data.
|
||||
|
||||
;; the result will be returned, even if the search fails
|
||||
(apply 'auth-source-netrc-search
|
||||
(plist-put spec :create nil)))))
|
||||
results))
|
||||
|
||||
;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t)
|
||||
|
|
@ -833,7 +849,9 @@ See `auth-source-search' for details on SPEC."
|
|||
(file (oref backend source))
|
||||
(add "")
|
||||
;; `valist' is an alist
|
||||
valist)
|
||||
valist
|
||||
;; `artificial' will be returned if no creation is needed
|
||||
artificial)
|
||||
|
||||
;; only for base required elements (defined as function parameters):
|
||||
;; fill in the valist with whatever data we may have from the search
|
||||
|
|
@ -902,6 +920,14 @@ See `auth-source-search' for details on SPEC."
|
|||
nil nil default))
|
||||
(t data))))
|
||||
|
||||
(when data
|
||||
(setq artificial (plist-put artificial
|
||||
(intern (concat ":" (symbol-name r)))
|
||||
(if (eq r 'secret)
|
||||
(lexical-let ((data data))
|
||||
(lambda () data))
|
||||
data))))
|
||||
|
||||
;; when r is not an empty string...
|
||||
(when (and (stringp data)
|
||||
(< 0 (length data)))
|
||||
|
|
@ -935,14 +961,17 @@ See `auth-source-search' for details on SPEC."
|
|||
(goto-char (point-max))
|
||||
|
||||
;; ask AFTER we've successfully opened the file
|
||||
(when (y-or-n-p (format "Add to file %s: line [%s]" file add))
|
||||
(unless (bolp)
|
||||
(insert "\n"))
|
||||
(insert add "\n")
|
||||
(write-region (point-min) (point-max) file nil 'silent)
|
||||
(auth-source-do-debug
|
||||
"auth-source-netrc-create: wrote 1 new line to %s"
|
||||
file)))))
|
||||
(if (y-or-n-p (format "Add to file %s: line [%s]" file add))
|
||||
(progn
|
||||
(unless (bolp)
|
||||
(insert "\n"))
|
||||
(insert add "\n")
|
||||
(write-region (point-min) (point-max) file nil 'silent)
|
||||
(auth-source-do-debug
|
||||
"auth-source-netrc-create: wrote 1 new line to %s"
|
||||
file)
|
||||
nil)
|
||||
(list artificial)))))
|
||||
|
||||
;;; Backend specific parsing: Secrets API backend
|
||||
|
||||
|
|
|
|||
|
|
@ -1234,11 +1234,10 @@ For example: ((1 . cn-gb-2312) (2 . big5))."
|
|||
:type 'boolean
|
||||
:group 'gnus-summary-marks)
|
||||
|
||||
(defcustom gnus-propagate-marks nil
|
||||
(defcustom gnus-propagate-marks t
|
||||
"If non-nil, Gnus will store and retrieve marks from the backends.
|
||||
This means that marks will be stored both in .newsrc.eld and in
|
||||
the backend, and will slow operation down somewhat."
|
||||
:version "24.1"
|
||||
:type 'boolean
|
||||
:group 'gnus-summary-marks)
|
||||
|
||||
|
|
|
|||
|
|
@ -276,13 +276,11 @@ textual parts.")
|
|||
(push (current-buffer) nnimap-process-buffers)
|
||||
(current-buffer)))
|
||||
|
||||
(defun nnimap-credentials (address ports &optional inhibit-create)
|
||||
(defun nnimap-credentials (address ports)
|
||||
(let* ((found (nth 0 (auth-source-search :max 1
|
||||
:host address
|
||||
:port ports
|
||||
:create (if inhibit-create
|
||||
nil
|
||||
(null ports)))))
|
||||
:create t)))
|
||||
(user (plist-get found :user))
|
||||
(secret (plist-get found :secret))
|
||||
(secret (if (functionp secret) (funcall secret) secret)))
|
||||
|
|
@ -389,7 +387,7 @@ textual parts.")
|
|||
(list
|
||||
(nnoo-current-server 'nnimap)
|
||||
nnimap-address)
|
||||
ports t))))
|
||||
ports))))
|
||||
(setq nnimap-object nil)
|
||||
(let ((nnimap-inhibit-logging t))
|
||||
(setq login-result
|
||||
|
|
|
|||
Loading…
Reference in a new issue