diff options
| author | Gnus developers | 2011-02-16 23:12:47 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-02-16 23:12:47 +0000 |
| commit | 584c9d3fd0784fac55fe46d98ccefa5eb461fed8 (patch) | |
| tree | 9b5bff8a80af3fe9a1234f37e2ab6526d226e8f6 | |
| parent | aac7a93503c664ba0d117a904597ecf21b0f0c2f (diff) | |
| download | emacs-584c9d3fd0784fac55fe46d98ccefa5eb461fed8.tar.gz emacs-584c9d3fd0784fac55fe46d98ccefa5eb461fed8.zip | |
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'.
| -rw-r--r-- | lisp/gnus/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 67 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 8 |
4 files changed, 71 insertions, 26 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 91ba9e5a359..5891d4b6193 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2011-02-16 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * gnus-sum.el (gnus-propagate-marks): Change default to t again, since | ||
| 4 | nil means that nnimap doesn't get updated. | ||
| 5 | |||
| 6 | 2011-02-16 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 7 | |||
| 8 | * auth-source.el (auth-source-netrc-create): Return a synthetic search | ||
| 9 | result when the user doesn't want to write to the file. | ||
| 10 | (auth-source-netrc-search): Expect a synthetic result and proceed | ||
| 11 | accordingly. | ||
| 12 | (auth-source-cache-expiry): New variable to override | ||
| 13 | `password-cache-expiry'. | ||
| 14 | (auth-source-remember): Use it. | ||
| 15 | |||
| 16 | * nnimap.el (nnimap-credentials): Remove the `inhibit-create' | ||
| 17 | parameter. Create entry if necessary by using :create t. | ||
| 18 | (nnimap-open-connection-1): Don't pass `inhibit-create'. | ||
| 19 | |||
| 1 | 2011-02-15 Teodor Zlatanov <tzz@lifelogs.com> | 20 | 2011-02-15 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 21 | ||
| 3 | * auth-source.el (auth-source-debug): Enable by default and don't | 22 | * auth-source.el (auth-source-debug): Enable by default and don't |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index a259c5c2f0b..2b284e3729d 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -61,6 +61,18 @@ | |||
| 61 | :version "23.1" ;; No Gnus | 61 | :version "23.1" ;; No Gnus |
| 62 | :group 'gnus) | 62 | :group 'gnus) |
| 63 | 63 | ||
| 64 | ;;;###autoload | ||
| 65 | (defcustom auth-source-cache-expiry 7200 | ||
| 66 | "How many seconds passwords are cached, or nil to disable | ||
| 67 | expiring. Overrides `password-cache-expiry' through a | ||
| 68 | let-binding." | ||
| 69 | :group 'auth-source | ||
| 70 | :type '(choice (const :tag "Never" nil) | ||
| 71 | (const :tag "All Day" 86400) | ||
| 72 | (const :tag "2 Hours" 7200) | ||
| 73 | (const :tag "30 Minutes" 1800) | ||
| 74 | (integer :tag "Seconds"))) | ||
| 75 | |||
| 64 | (defclass auth-source-backend () | 76 | (defclass auth-source-backend () |
| 65 | ((type :initarg :type | 77 | ((type :initarg :type |
| 66 | :initform 'netrc | 78 | :initform 'netrc |
| @@ -588,8 +600,9 @@ Returns the deleted entries." | |||
| 588 | 600 | ||
| 589 | (defun auth-source-remember (spec found) | 601 | (defun auth-source-remember (spec found) |
| 590 | "Remember FOUND search results for SPEC." | 602 | "Remember FOUND search results for SPEC." |
| 591 | (password-cache-add | 603 | (let ((password-cache-expiry auth-source-cache-expiry)) |
| 592 | (concat auth-source-magic (format "%S" spec)) found)) | 604 | (password-cache-add |
| 605 | (concat auth-source-magic (format "%S" spec)) found))) | ||
| 593 | 606 | ||
| 594 | (defun auth-source-recall (spec) | 607 | (defun auth-source-recall (spec) |
| 595 | "Recall FOUND search results for SPEC." | 608 | "Recall FOUND search results for SPEC." |
| @@ -808,14 +821,17 @@ See `auth-source-search' for details on SPEC." | |||
| 808 | (when (and create | 821 | (when (and create |
| 809 | (= 0 (length results))) | 822 | (= 0 (length results))) |
| 810 | 823 | ||
| 811 | ;; create based on the spec | 824 | ;; create based on the spec and record the value |
| 812 | (apply (slot-value backend 'create-function) spec) | 825 | (setq results (or |
| 813 | ;; turn off the :create key | 826 | ;; if the user did not want to create the entry |
| 814 | (setq spec (plist-put spec :create nil)) | 827 | ;; in the file, it will be returned |
| 815 | ;; run the search again to get the updated data | 828 | (apply (slot-value backend 'create-function) spec) |
| 816 | ;; the result will be returned, even if the search fails | 829 | ;; if not, we do the search again without :create |
| 817 | (setq results (apply 'auth-source-netrc-search spec))) | 830 | ;; to get the updated data. |
| 818 | 831 | ||
| 832 | ;; the result will be returned, even if the search fails | ||
| 833 | (apply 'auth-source-netrc-search | ||
| 834 | (plist-put spec :create nil))))) | ||
| 819 | results)) | 835 | results)) |
| 820 | 836 | ||
| 821 | ;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t) | 837 | ;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t) |
| @@ -833,7 +849,9 @@ See `auth-source-search' for details on SPEC." | |||
| 833 | (file (oref backend source)) | 849 | (file (oref backend source)) |
| 834 | (add "") | 850 | (add "") |
| 835 | ;; `valist' is an alist | 851 | ;; `valist' is an alist |
| 836 | valist) | 852 | valist |
| 853 | ;; `artificial' will be returned if no creation is needed | ||
| 854 | artificial) | ||
| 837 | 855 | ||
| 838 | ;; only for base required elements (defined as function parameters): | 856 | ;; only for base required elements (defined as function parameters): |
| 839 | ;; fill in the valist with whatever data we may have from the search | 857 | ;; 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." | |||
| 902 | nil nil default)) | 920 | nil nil default)) |
| 903 | (t data)))) | 921 | (t data)))) |
| 904 | 922 | ||
| 923 | (when data | ||
| 924 | (setq artificial (plist-put artificial | ||
| 925 | (intern (concat ":" (symbol-name r))) | ||
| 926 | (if (eq r 'secret) | ||
| 927 | (lexical-let ((data data)) | ||
| 928 | (lambda () data)) | ||
| 929 | data)))) | ||
| 930 | |||
| 905 | ;; when r is not an empty string... | 931 | ;; when r is not an empty string... |
| 906 | (when (and (stringp data) | 932 | (when (and (stringp data) |
| 907 | (< 0 (length data))) | 933 | (< 0 (length data))) |
| @@ -935,14 +961,17 @@ See `auth-source-search' for details on SPEC." | |||
| 935 | (goto-char (point-max)) | 961 | (goto-char (point-max)) |
| 936 | 962 | ||
| 937 | ;; ask AFTER we've successfully opened the file | 963 | ;; ask AFTER we've successfully opened the file |
| 938 | (when (y-or-n-p (format "Add to file %s: line [%s]" file add)) | 964 | (if (y-or-n-p (format "Add to file %s: line [%s]" file add)) |
| 939 | (unless (bolp) | 965 | (progn |
| 940 | (insert "\n")) | 966 | (unless (bolp) |
| 941 | (insert add "\n") | 967 | (insert "\n")) |
| 942 | (write-region (point-min) (point-max) file nil 'silent) | 968 | (insert add "\n") |
| 943 | (auth-source-do-debug | 969 | (write-region (point-min) (point-max) file nil 'silent) |
| 944 | "auth-source-netrc-create: wrote 1 new line to %s" | 970 | (auth-source-do-debug |
| 945 | file))))) | 971 | "auth-source-netrc-create: wrote 1 new line to %s" |
| 972 | file) | ||
| 973 | nil) | ||
| 974 | (list artificial))))) | ||
| 946 | 975 | ||
| 947 | ;;; Backend specific parsing: Secrets API backend | 976 | ;;; Backend specific parsing: Secrets API backend |
| 948 | 977 | ||
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 4dfc79a8883..619c8bd75fd 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -1234,11 +1234,10 @@ For example: ((1 . cn-gb-2312) (2 . big5))." | |||
| 1234 | :type 'boolean | 1234 | :type 'boolean |
| 1235 | :group 'gnus-summary-marks) | 1235 | :group 'gnus-summary-marks) |
| 1236 | 1236 | ||
| 1237 | (defcustom gnus-propagate-marks nil | 1237 | (defcustom gnus-propagate-marks t |
| 1238 | "If non-nil, Gnus will store and retrieve marks from the backends. | 1238 | "If non-nil, Gnus will store and retrieve marks from the backends. |
| 1239 | This means that marks will be stored both in .newsrc.eld and in | 1239 | This means that marks will be stored both in .newsrc.eld and in |
| 1240 | the backend, and will slow operation down somewhat." | 1240 | the backend, and will slow operation down somewhat." |
| 1241 | :version "24.1" | ||
| 1242 | :type 'boolean | 1241 | :type 'boolean |
| 1243 | :group 'gnus-summary-marks) | 1242 | :group 'gnus-summary-marks) |
| 1244 | 1243 | ||
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index a5a001f7e11..4e220bc7553 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -276,13 +276,11 @@ textual parts.") | |||
| 276 | (push (current-buffer) nnimap-process-buffers) | 276 | (push (current-buffer) nnimap-process-buffers) |
| 277 | (current-buffer))) | 277 | (current-buffer))) |
| 278 | 278 | ||
| 279 | (defun nnimap-credentials (address ports &optional inhibit-create) | 279 | (defun nnimap-credentials (address ports) |
| 280 | (let* ((found (nth 0 (auth-source-search :max 1 | 280 | (let* ((found (nth 0 (auth-source-search :max 1 |
| 281 | :host address | 281 | :host address |
| 282 | :port ports | 282 | :port ports |
| 283 | :create (if inhibit-create | 283 | :create t))) |
| 284 | nil | ||
| 285 | (null ports))))) | ||
| 286 | (user (plist-get found :user)) | 284 | (user (plist-get found :user)) |
| 287 | (secret (plist-get found :secret)) | 285 | (secret (plist-get found :secret)) |
| 288 | (secret (if (functionp secret) (funcall secret) secret))) | 286 | (secret (if (functionp secret) (funcall secret) secret))) |
| @@ -389,7 +387,7 @@ textual parts.") | |||
| 389 | (list | 387 | (list |
| 390 | (nnoo-current-server 'nnimap) | 388 | (nnoo-current-server 'nnimap) |
| 391 | nnimap-address) | 389 | nnimap-address) |
| 392 | ports t)))) | 390 | ports)))) |
| 393 | (setq nnimap-object nil) | 391 | (setq nnimap-object nil) |
| 394 | (let ((nnimap-inhibit-logging t)) | 392 | (let ((nnimap-inhibit-logging t)) |
| 395 | (setq login-result | 393 | (setq login-result |