summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2010-12-16 22:22:28 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-12-16 22:22:28 +0000
commit549c9aed8dc0590249df20560302756bfb48e84b (patch)
tree1a922a61ad23d25af8391a3e7b525c8033994e2d /lisp/gnus
parentaa936e8e0a8ffcb6cf59e5fa57ce04f5524d03f4 (diff)
Merge changes made in Gnus trunk.
nnimap.el (nnimap-wait-for-response): Always look (at least) at the previous line. nnimap.el (nnimap-quirk): New function. (nnimap-retrieve-group-data-early): Use it. (nnimap-quirks): New alist. gnus.texi (Foreign Groups): Added clarification of foreign groups. gnus-sum.el (gnus-summary-push-marks-to-backend): Fix the logic for copying read-ness to the backends. gnus-group.el (gnus-group-kill-group): Notify the backend that the group has been killed. (gnus-group-yank-group): Ditto. gnus-start.el (gnus-subscribe-newsgroup): Notify the backend. nnir.el: Improve customizations. gnus.texi (Archived Messages): Removed outdated comment and text. nnfolder.el (nnfolder-save-all-buffers): Refactor out into its own function. (nnfolder-request-expire-articles): Save all the buffers after doing expiry. nnmail.el (nnmail-expiry-target-group): Revert the "all articles are the last article", since that led to serious performance regressions when expiring nnml groups. gnus-html.el (gnus-html-schedule-image-fetching): Make sure the HTML fetching stops when Gnus exits. gnus-srvr.el: Avoid passing nil regexp argument to delete-matching-lines. auth-source.el (auth-source-gpg-encrypt-to): New variable to set the list of recipient keys, or use symmetric encryption if not a list. (auth-source-create): Use it to make `epa-file-encrypt-to' local for an EPA override, replacing the call to `netrc-store-data'.
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/ChangeLog57
-rw-r--r--lisp/gnus/auth-source.el34
-rw-r--r--lisp/gnus/gnus-group.el5
-rw-r--r--lisp/gnus/gnus-html.el2
-rw-r--r--lisp/gnus/gnus-int.el12
-rw-r--r--lisp/gnus/gnus-srvr.el6
-rw-r--r--lisp/gnus/gnus-start.el1
-rw-r--r--lisp/gnus/gnus-sum.el2
-rw-r--r--lisp/gnus/nnfolder.el31
-rw-r--r--lisp/gnus/nnimap.el31
-rw-r--r--lisp/gnus/nnir.el24
-rw-r--r--lisp/gnus/nnmail.el2
12 files changed, 172 insertions, 35 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 76565b3f19..2653873193 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,8 +1,65 @@
+2010-12-16 Daiki Ueno <ueno@unixuser.org>
+
+ * auth-source.el (auth-source-gpg-encrypt-to): New variable to set the
+ list of recipient keys, or use symmetric encryption if not a list.
+ (auth-source-create): Use it to make `epa-file-encrypt-to' local for an
+ EPA override, replacing the call to `netrc-store-data'.
+
+2010-12-16 Dan Davison <dandavison7@gmail.com> (tiny change)
+
+ * gnus-srvr.el: Avoid passing nil regexp argument to
+ delete-matching-lines.
+
+2010-12-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * gnus-html.el (gnus-html-schedule-image-fetching): Make sure the HTML
+ fetching stops when Gnus exits.
+
+ * nnfolder.el (nnfolder-save-all-buffers): Refactor out into its own
+ function.
+ (nnfolder-request-expire-articles): Save all the buffers after doing
+ expiry.
+
+ * nnmail.el (nnmail-expiry-target-group): Revert the "all articles are
+ the last article", since that led to serious performance regressions
+ when expiring nnml groups.
+
+2010-12-16 Andrew Cohen <cohen@andy.bu.edu>
+
+ * nnir.el: Improve customizations.
+
+2010-12-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * gnus-start.el (gnus-subscribe-newsgroup): Notify the backend.
+
+ * gnus-group.el (gnus-group-kill-group): Notify the backend that the
+ group has been killed.
+ (gnus-group-yank-group): Ditto.
+
+ * gnus-srvr.el (gnus-browse-unsubscribe-group): Ditto.
+
+ * nnimap.el (nnimap-request-update-group-status): New function.
+
+ * gnus-int.el (gnus-request-update-group-status): New interface
+ function.
+
+ * gnus-sum.el (gnus-summary-push-marks-to-backend): Fix the logic for
+ copying read-ness to the backends.
+
+ * nnimap.el (nnimap-quirk): New function.
+ (nnimap-retrieve-group-data-early): Use it.
+ (nnimap-quirks): New alist.
+
2010-12-16 Katsumi Yamaoka <yamaoka@jpl.org>
* shr.el (shr-insert): Set shr-start after deleting trailing space;
don't delete it within indentation.
+2010-12-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * nnimap.el (nnimap-wait-for-response): Always look (at least) at the
+ previous line.
+
2010-12-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* nnimap.el (nnimap-retrieve-group-data-early): Fix the syntax of the
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index 20e4af189d..5d38630290 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -159,6 +159,15 @@ can get pretty complex."
(const :tag "Any" t)
(string :tag "Specific user name"))))))))
+(defcustom auth-source-gpg-encrypt-to t
+ "List of recipient keys that `authinfo.gpg' encrypted to.
+If the value is not a list, symmetric encryption will be used."
+ :group 'auth-source
+ :version "23.2" ;; No Gnus
+ :type '(choice (const :tag "Symmetric encryption" t)
+ (repeat :tag "Recipient public keys"
+ (string :tag "Recipient public key"))))
+
;; temp for debugging
;; (unintern 'auth-source-protocols)
;; (unintern 'auth-sources)
@@ -352,9 +361,28 @@ Return structure as specified by MODE."
;; netrc interface.
(when (y-or-n-p (format "Do you want to save this password in %s? "
source))
- (netrc-store-data source host prot
- (or user (cdr (assoc "login" result)))
- (cdr (assoc "password" result))))))
+ ;; the code below is almost same as `netrc-store-data' except
+ ;; the `epa-file-encrypt-to' hack (see bug#7487).
+ (with-temp-buffer
+ (when (file-exists-p source)
+ (insert-file-contents source))
+ (when auth-source-gpg-encrypt-to
+ ;; making `epa-file-encrypt-to' local to this buffer lets
+ ;; epa-file skip the key selection query (see the
+ ;; `local-variable-p' check in `epa-file-write-region').
+ (unless (local-variable-p 'epa-file-encrypt-to)
+ (make-local-variable 'epa-file-encrypt-to))
+ (if (listp auth-source-gpg-encrypt-to)
+ (setq epa-file-encrypt-to auth-source-gpg-encrypt-to)))
+ (goto-char (point-max))
+ (unless (bolp)
+ (insert "\n"))
+ (insert (format "machine %s login %s password %s port %s\n"
+ host
+ (or user (cdr (assoc "login" result)))
+ (cdr (assoc "password" result))
+ prot))
+ (write-region (point-min) (point-max) source nil 'silent)))))
(if (consp mode)
(mapcar #'cdr result)
(cdar result))))
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 5ece145716..73eeb7104c 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -3781,6 +3781,7 @@ of groups killed."
gnus-list-of-killed-groups))
(gnus-group-change-level
(if entry entry group) gnus-level-killed (if entry nil level))
+ (gnus-request-update-group-status group 'unsubscribe)
(message "Killed group %s" (gnus-group-decoded-name group)))
;; If there are lots and lots of groups to be killed, we use
;; this thing instead.
@@ -3803,7 +3804,8 @@ of groups killed."
(setq gnus-zombie-list (delete group gnus-zombie-list))))
;; There may be more than one instance displayed.
(while (gnus-group-goto-group group)
- (gnus-delete-line)))
+ (gnus-delete-line))
+ (gnus-request-update-group-status group 'unsubscribe))
(gnus-make-hashtable-from-newsrc-alist))
(gnus-group-position-point)
@@ -3831,6 +3833,7 @@ yanked) a list of yanked groups is returned."
(and prev (gnus-group-entry prev))
t)
(gnus-group-insert-group-line-info group)
+ (gnus-request-update-group-status group 'subscribe)
(gnus-undo-register
`(when (gnus-group-goto-group ,group)
(gnus-group-kill-group 1))))
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index 63a14b204f..deeb3565bc 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -395,7 +395,7 @@ Use ALT-TEXT for the image string."
4)
(setq args (nconc args (list t))))
(ignore-errors
- (apply #'url-retrieve args))))
+ (push (apply #'url-retrieve args) gnus-buffers))))
(defun gnus-html-image-fetched (status buffer image)
"Callback function called when image has been fetched."
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 4328454012..71a9aa9e61 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -473,6 +473,18 @@ If FETCH-OLD, retrieve all headers (or some subset thereof) in the group."
(funcall (gnus-get-function gnus-command-method 'request-type)
(gnus-group-real-name group) article))))
+(defun gnus-request-update-group-status (group status)
+ "Change the status of a group.
+Valid statuses include `subscribe' and `unsubscribe'."
+ (let ((gnus-command-method (gnus-find-method-for-group group)))
+ (if (not (gnus-check-backend-function
+ 'request-update-group-status (car gnus-command-method)))
+ nil
+ (funcall
+ (gnus-get-function gnus-command-method 'request-update-group-status)
+ (gnus-group-real-name group) status
+ (nth 1 gnus-command-method)))))
+
(defun gnus-request-set-mark (group action)
"Set marks on articles in the back end."
(let ((gnus-command-method (gnus-find-method-for-group group)))
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index 19fd5fe663..acca5651e5 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -766,7 +766,8 @@ claim them."
(with-current-buffer nntp-server-buffer
(let ((cur (current-buffer)))
(goto-char (point-min))
- (unless (string= gnus-ignored-newsgroups "")
+ (unless (or (null gnus-ignored-newsgroups)
+ (string= gnus-ignored-newsgroups ""))
(delete-matching-lines gnus-ignored-newsgroups))
;; We treat NNTP as a special case to avoid problems with
;; garbage group names like `"foo' that appear in some badly
@@ -992,7 +993,8 @@ how new groups will be entered into the group buffer."
;; mechanism for new group subscription.
(gnus-call-subscribe-functions
gnus-browse-subscribe-newsgroup-method
- group)))
+ group)
+ (gnus-request-update-group-status group 'subscribe)))
(delete-char 1)
(insert (let ((lvl (gnus-group-level group)))
(cond
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index d9e432736e..322c7d191e 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -645,6 +645,7 @@ the first newsgroup."
(gnus-group-change-level
newsgroup gnus-level-default-subscribed
gnus-level-killed (gnus-group-entry (or next "dummy.group")))
+ (gnus-request-update-group-status newsgroup 'subscribe)
(gnus-message 5 "Subscribe newsgroup: %s" newsgroup)
(run-hook-with-args 'gnus-subscribe-newsgroup-hooks newsgroup)
t))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index a021728375..ceaa014363 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9958,7 +9958,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
(defun gnus-summary-push-marks-to-backend (article)
(let ((set nil)
(marks gnus-article-mark-lists))
- (when (memq article gnus-newsgroup-unreads)
+ (unless (memq article gnus-newsgroup-unreads)
(push 'read set))
(while marks
(when (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
diff --git a/lisp/gnus/nnfolder.el b/lisp/gnus/nnfolder.el
index 5de8653948..f0a21c5a3e 100644
--- a/lisp/gnus/nnfolder.el
+++ b/lisp/gnus/nnfolder.el
@@ -322,20 +322,20 @@ the group. Then the marks file will be regenerated properly by Gnus.")
(when nnfolder-get-new-mail
(nnfolder-possibly-change-group group server)
(nnmail-get-new-mail
- 'nnfolder
- (lambda ()
- (let ((bufs nnfolder-buffer-alist))
- (save-excursion
- (while bufs
- (if (not (gnus-buffer-live-p (nth 1 (car bufs))))
- (setq nnfolder-buffer-alist
- (delq (car bufs) nnfolder-buffer-alist))
- (set-buffer (nth 1 (car bufs)))
- (nnfolder-save-buffer)
- (kill-buffer (current-buffer)))
- (setq bufs (cdr bufs))))))
- nnfolder-directory
- group)))
+ 'nnfolder 'nnfolder-save-all-buffers
+ nnfolder-directory group)))
+
+(defun nnfolder-save-all-buffers ()
+ (let ((bufs nnfolder-buffer-alist))
+ (save-excursion
+ (while bufs
+ (if (not (gnus-buffer-live-p (nth 1 (car bufs))))
+ (setq nnfolder-buffer-alist
+ (delq (car bufs) nnfolder-buffer-alist))
+ (set-buffer (nth 1 (car bufs)))
+ (nnfolder-save-buffer)
+ (kill-buffer (current-buffer)))
+ (setq bufs (cdr bufs))))))
;; Don't close the buffer if we're not shutting down the server. This way,
;; we can keep the buffer in the group buffer cache, and not have to grovel
@@ -488,7 +488,8 @@ the group. Then the marks file will be regenerated properly by Gnus.")
(nnfolder-save-buffer)
(nnfolder-adjust-min-active newsgroup)
(nnfolder-save-active nnfolder-group-alist nnfolder-active-file)
- (gnus-sorted-difference articles (nreverse deleted-articles)))))
+ (gnus-sorted-difference articles (nreverse deleted-articles)))
+ (nnfolder-save-all-buffers)))
(deffoo nnfolder-request-move-article (article group server accept-form
&optional last move-is-internal)
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index ae1929d1bd..d1d6d05842 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -139,6 +139,9 @@ textual parts.")
(download "gnus-download")
(forward "gnus-forward")))
+(defvar nnimap-quirks
+ '(("QRESYNC" "Zimbra" "QRESYNC ")))
+
(defun nnimap-buffer ()
(nnimap-find-process-buffer nntp-server-buffer))
@@ -897,6 +900,16 @@ textual parts.")
(push flag flags)))
flags))
+(deffoo nnimap-request-update-group-status (group status &optional server)
+ (when (nnimap-possibly-change-group nil server)
+ (let ((command (assoc
+ status
+ '((subscribe "SUBSCRIBE")
+ (unsubscribe "UNSUBSCRIBE")))))
+ (when command
+ (with-current-buffer (nnimap-buffer)
+ (nnimap-command "%s %S" (cadr command) (utf7-encode group t)))))))
+
(deffoo nnimap-request-set-mark (group actions &optional server)
(when (nnimap-possibly-change-group group server)
(let (sequence)
@@ -1080,8 +1093,9 @@ textual parts.")
uidvalidity
modseq)
(push
- (list (nnimap-send-command "EXAMINE %S (QRESYNC (%s %s))"
+ (list (nnimap-send-command "EXAMINE %S (%s (%s %s))"
(utf7-encode group t)
+ (nnimap-quirk "QRESYNC")
uidvalidity modseq)
'qresync
nil group 'qresync)
@@ -1107,6 +1121,15 @@ textual parts.")
sequences))))
sequences))))
+(defun nnimap-quirk (command)
+ (let ((quirk (assoc command nnimap-quirks)))
+ ;; If this server is of a type that matches a quirk, then return
+ ;; the "quirked" command instead of the proper one.
+ (if (or (null quirk)
+ (not (string-match (nth 1 quirk) (nnimap-greeting nnimap-object))))
+ command
+ (nth 2 quirk))))
+
(deffoo nnimap-finish-retrieve-group-infos (server infos sequences)
(when (and sequences
(nnimap-possibly-change-group nil server))
@@ -1541,7 +1564,11 @@ textual parts.")
(not (re-search-backward
(format "^%d .*\n" sequence)
(if nnimap-streaming
- (max (point-min) (- (point) 500))
+ (max (point-min)
+ (- (point) 500)
+ (save-excursion
+ (forward-line -1)
+ (point)))
(point-min))
t)))
(when messagep
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 0f07bb1406..f2348bf40a 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -305,13 +305,6 @@ is `(valuefunc member)'."
"Search groups in Gnus with assorted seach engines."
:group 'gnus)
-(defcustom nnir-method-default-engines
- '((nnimap . imap)
- (nntp . gmane))
- "*Alist of default search engines keyed by server method."
- :type '(alist)
- :group 'nnir)
-
(defcustom nnir-ignored-newsgroups ""
"*A regexp to match newsgroups in the active file that should
be skipped when searching."
@@ -329,7 +322,7 @@ with three items unique to nnir summary buffers:
%g Article original short group name (string)
If nil this will use `gnus-summary-line-format'."
- :type '(regexp)
+ :type '(string)
:group 'nnir)
(defcustom nnir-retrieve-headers-override-function nil
@@ -347,7 +340,8 @@ result, `gnus-retrieve-headers' will be called instead."
"*The default IMAP search key for an nnir search. Must be one of
the keys in `nnir-imap-search-arguments'. To use raw imap queries
by default set this to \"Imap\"."
- :type '(string)
+ :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
+ nnir-imap-search-arguments))
:group 'nnir)
(defcustom nnir-swish++-configuration-file
@@ -546,6 +540,18 @@ needs the variables `nnir-namazu-program',
Add an entry here when adding a new search engine.")
+(defcustom nnir-method-default-engines
+ '((nnimap . imap)
+ (nntp . gmane))
+ "*Alist of default search engines keyed by server method."
+ :type `(repeat (cons (choice (const nnimap) (const nttp) (const nnspool)
+ (const nneething) (const nndir) (const nnmbox)
+ (const nnml) (const nnmh) (const nndraft)
+ (const nnfolder) (const nnmaildir))
+ (choice
+ ,@(mapcar (lambda (elem) (list 'const (car elem)))
+ nnir-engines))))
+ :group 'nnir)
;; Gnus glue.
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 06b464c0b2..c86e96bd18 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1915,7 +1915,7 @@ If TIME is nil, then return the cutoff time for oldness instead."
(unless (eq target 'delete)
(when (or (gnus-request-group target)
(gnus-request-create-group target))
- (let ((group-art (gnus-request-accept-article target nil t t)))
+ (let ((group-art (gnus-request-accept-article target nil nil t)))
(when (and (consp group-art)
(cdr group-art))
(gnus-group-mark-article-read target (cdr group-art))))))))