From 789aafcd5f47dc22596fc6cc808638ad527c3a8f Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 26 Sep 2002 23:27:08 +0000 Subject: [PATCH] Synch with Oort Gnus. --- GNUS-NEWS | 12 +++++++++ lisp/ChangeLog | 38 +++++++++++++++++++++++++++++ lisp/gnus-int.el | 8 ++++-- lisp/gnus-start.el | 5 ++-- lisp/imap.el | 2 +- lisp/mml-sec.el | 4 +-- lisp/mml2015.el | 10 +++++--- lisp/nnimap.el | 69 ++++++++++++++++++++++++++++++++++++++++++---------- texi/ChangeLog | 4 +++ texi/gnus-ja.texi | 10 ++++++++ texi/gnus.texi | 10 ++++++++ 11 files changed, 149 insertions(+), 23 deletions(-) diff --git a/GNUS-NEWS b/GNUS-NEWS index 8c95a6f..c432a29 100644 --- a/GNUS-NEWS +++ b/GNUS-NEWS @@ -8,6 +8,18 @@ For older news, see Gnus info node "New Features". * Changes in Oort Gnus +** Unread count correct in nnimap groups. + +The estimated number of unread articles in the group buffer should now +be correct for nnimap groups. This is achieved by calling +`nnimap-fixup-unread-after-getting-new-news' from the +`gnus-setup-news-hook' (called on startup) and +gnus-after-getting-new-news-hook. (called after getting new mail). If +you have modified those variables from the default, you may want to +add n-f-u-a-g-n-n again. If you were happy with the estimate and want +to save some (minimal) time when getting new mail, remove the +function. + ** Group Carbon Copy (GCC) quoting To support groups that contains SPC and other weird characters, groups diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a704ef7..574266b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,41 @@ +2002-09-27 Simon Josefsson + + * nnimap.el (nnimap-fixup-unread-after-getting-new-news): Autoload + it just in case. + (nnimap-update-unseen): New function; update unseen count in + `n-m-info'. + (nnimap-close-group): Call it. + + * gnus-start.el (gnus-setup-news-hook): Add n-f-u-a-g-n-n. + (gnus-after-getting-new-news-hook): Ditto. + + * nnimap.el (nnimap-retrieve-groups): Move the quick mail check + message into verboselevel 9. Change slow mail check message. + (nnimap-retrieve-groups): Use prefixed names in n-mailbox-info. + (nnimap-fixup-unread-after-getting-new-news): New function, to be + used as a hook after getting new mail. + +2002-09-26 Simon Josefsson + + * imap.el (imap-parse-resp-text-code): The UNSEEN value in + SELECT/EXAMINE is first unseen article, not number of unseen + articles. Make them distinct by renaming the former to + `first-unseen' instead of `unseen'. + + * nnimap.el (nnimap-retrieve-groups): Get uidvalidity and unseen + too. + (nnimap-retrieve-groups): Don't used cached data if uidvalidity + changed. + (nnimap-retrieve-groups): Store uidvalidity and unseen data too. + + * gnus-int.el (gnus-server-unopen-status): Defcustom. + + * mml-sec.el (mml-signencrypt-style): Docstring to font-lock + better. + + * mml2015.el (mml2015-pgg-decrypt): Only add security information + if dissecting resulting buffer actually had any information. + 2002-09-26 Katsumi Yamaoka * gnus-group.el (gnus-group-sort-by-method): Remove `symbol-name' diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el index d8c466c..6c2f436 100644 --- a/lisp/gnus-int.el +++ b/lisp/gnus-int.el @@ -36,12 +36,16 @@ :group 'gnus-start :type 'hook) -(defvar gnus-server-unopen-status nil +(defcustom gnus-server-unopen-status nil "The default status if the server is not able to open. If the server is covered by Gnus agent, the possible values are `denied', set the server denied; `offline', set the server offline; `nil', ask user. If the server is not covered by Gnus agent, set the -server denied.") +server denied." + :group 'gnus-start + :type '(choice (const :tag "Ask" nil) + (const :tag "Deny server" denied) + (const :tag "Unplugg Agent" offline))) ;;; ;;; Server Communication diff --git a/lisp/gnus-start.el b/lisp/gnus-start.el index 40dacd0..502c3c9 100644 --- a/lisp/gnus-start.el +++ b/lisp/gnus-start.el @@ -371,7 +371,7 @@ This hook is called as the first thing when Gnus is started." :group 'gnus-start :type 'hook) -(defcustom gnus-setup-news-hook nil +(defcustom gnus-setup-news-hook '(nnimap-fixup-unread-after-getting-new-news) "A hook after reading the .newsrc file, but before generating the buffer." :group 'gnus-start :type 'hook) @@ -382,7 +382,8 @@ This hook is called as the first thing when Gnus is started." :type 'hook) (defcustom gnus-after-getting-new-news-hook - '(gnus-display-time-event-handler) + '(gnus-display-time-event-handler + nnimap-fixup-unread-after-getting-new-news) "A hook run after Gnus checks for new news when Gnus is already running." :group 'gnus-group-new :type 'hook) diff --git a/lisp/imap.el b/lisp/imap.el index 00204de..9d30166 100644 --- a/lisp/imap.el +++ b/lisp/imap.el @@ -2113,7 +2113,7 @@ Return nil if no complete line has arrived." ((search-forward "UIDNEXT \\([0-9]+\\)" nil t) (imap-mailbox-put 'uidnext (match-string 1))) ((search-forward "UNSEEN " nil t) - (imap-mailbox-put 'unseen (read (current-buffer)))) + (imap-mailbox-put 'first-unseen (read (current-buffer)))) ((looking-at "UIDVALIDITY \\([0-9]+\\)") (imap-mailbox-put 'uidvalidity (match-string 1))) ((search-forward "READ-ONLY" nil t) diff --git a/lisp/mml-sec.el b/lisp/mml-sec.el index f0f6a64..9247624 100644 --- a/lisp/mml-sec.el +++ b/lisp/mml-sec.el @@ -60,13 +60,13 @@ Also note that you should access this with mml-signencrypt-style") (defun mml-signencrypt-style (method &optional style) "Function for setting/getting the signencrypt-style used. Takes two arguments, the method (e.g. \"pgp\") and optionally the mode -(e.g. combined). If the mode is omitted, the current value is returned. +\(e.g. combined). If the mode is omitted, the current value is returned. For example, if you prefer to use combined sign & encrypt with smime, putting the following in your Gnus startup file will enable that behavior: - (mml-set-signencrypt-style \"smime\" combined)" +\(mml-set-signencrypt-style \"smime\" combined)" (let ((style-item (assoc method mml-signencrypt-style-alist))) (if style-item (if (or (eq style 'separate) diff --git a/lisp/mml2015.el b/lisp/mml2015.el index 0b8751f..76eac67 100644 --- a/lisp/mml2015.el +++ b/lisp/mml2015.el @@ -661,8 +661,9 @@ by you.") (if (condition-case err (prog1 (pgg-decrypt-region (point-min) (point-max)) - (setq decrypt-status (with-current-buffer mml2015-result-buffer - (buffer-string)))) + (setq decrypt-status + (with-current-buffer mml2015-result-buffer + (buffer-string)))) (error (mm-set-handle-multipart-parameter mm-security-handle 'gnus-details (mml2015-format-error err)) @@ -678,7 +679,10 @@ by you.") mm-security-handle 'gnus-info "OK") (mm-set-handle-multipart-parameter mm-security-handle 'gnus-details - (concat decrypt-status "\n" (mm-handle-multipart-ctl-parameter handles 'gnus-details))) + (concat decrypt-status + (when (stringp (car handles)) + "\n" (mm-handle-multipart-ctl-parameter + handles 'gnus-details)))) (if (listp (car handles)) handles (list handles))) diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 3126385..bc30a59 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -874,10 +874,22 @@ function is generally only called when Gnus is shutting down." (nnheader-report 'nnimap "Group %s selected" group) t))))) +(defun nnimap-update-unseen (group &optional server) + "Update the unseen count in `nnimap-mailbox-info'." + (gnus-sethash + (gnus-group-prefixed-name group server) + (let ((old (gnus-gethash (gnus-group-prefixed-name group server) + nnimap-mailbox-info))) + (list (nth 0 old) (nth 1 old) + (imap-mailbox-status group 'unseen nnimap-server-buffer) + (nth 3 old))) + nnimap-mailbox-info)) + (defun nnimap-close-group (group &optional server) (with-current-buffer nnimap-server-buffer (when (and (imap-opened) (nnimap-possibly-change-group group server)) + (nnimap-update-unseen group server) (case nnimap-expunge-on-close (always (progn (imap-mailbox-expunge nnimap-close-asynchronous) @@ -972,29 +984,40 @@ function is generally only called when Gnus is shutting down." (if (null nnimap-retrieve-groups-asynchronous) (setq slowgroups groups) (dolist (group groups) - (gnus-message 7 "nnimap: Checking mailbox %s" group) - (add-to-list (if (gnus-gethash-safe (concat server group) - nnimap-mailbox-info) + (gnus-message 9 "nnimap: Quickly checking mailbox %s" group) + (add-to-list (if (gnus-gethash-safe + (gnus-group-prefixed-name group server) + nnimap-mailbox-info) 'asyncgroups 'slowgroups) (list group (imap-mailbox-status-asynch - group 'uidnext nnimap-server-buffer)))) + group '(uidvalidity uidnext unseen) + nnimap-server-buffer)))) (dolist (asyncgroup asyncgroups) (let ((group (nth 0 asyncgroup)) (tag (nth 1 asyncgroup)) new old) (when (imap-ok-p (imap-wait-for-tag tag nnimap-server-buffer)) - (if (nnimap-string-lessp-numerical - (car (gnus-gethash - (concat server group) nnimap-mailbox-info)) - (imap-mailbox-get 'uidnext group nnimap-server-buffer)) + (if (or (not (string= + (nth 0 (gnus-gethash (gnus-group-prefixed-name + group server) + nnimap-mailbox-info)) + (imap-mailbox-get 'uidvalidity group + nnimap-server-buffer))) + (not (string= + (nth 1 (gnus-gethash (gnus-group-prefixed-name + group server) + nnimap-mailbox-info)) + (imap-mailbox-get 'uidnext group + nnimap-server-buffer)))) (push (list group) slowgroups) - (insert (cdr (gnus-gethash (concat server group) - nnimap-mailbox-info)))))))) + (insert (nth 3 (gnus-gethash (gnus-group-prefixed-name + group server) + nnimap-mailbox-info)))))))) (dolist (group slowgroups) (if nnimap-retrieve-groups-asynchronous (setq group (car group))) - (gnus-message 7 "nnimap: Rechecking mailbox %s" group) + (gnus-message 7 "nnimap: Mailbox %s modified" group) (imap-mailbox-put 'uidnext nil group nnimap-server-buffer) (or (member "\\NoSelect" (imap-mailbox-get 'list-flags group nnimap-server-buffer)) @@ -1009,11 +1032,19 @@ function is generally only called when Gnus is shutting down." (insert str) (when nnimap-retrieve-groups-asynchronous (gnus-sethash - (concat server group) - (cons (or (imap-mailbox-get + (gnus-group-prefixed-name group server) + (list (or (imap-mailbox-get + 'uidvalidity group nnimap-server-buffer) + (imap-mailbox-status + group 'uidvalidity nnimap-server-buffer)) + (or (imap-mailbox-get 'uidnext group nnimap-server-buffer) (imap-mailbox-status group 'uidnext nnimap-server-buffer)) + (or (imap-mailbox-get + 'unseen group nnimap-server-buffer) + (imap-mailbox-status + group 'unseen nnimap-server-buffer)) str) nnimap-mailbox-info))))))) (gnus-message 5 "nnimap: Checking mailboxes...done") @@ -1520,6 +1551,18 @@ be used in a STORE FLAGS command." "Return t iff MARK can be permanently (between IMAP sessions) saved on articles, in GROUP." (imap-message-flag-permanent-p (nnimap-mark-to-flag mark))) +;;;###autoload +(defun nnimap-fixup-unread-after-getting-new-news () + (let (server group info) + (mapatoms + (lambda (sym) + (when (and (setq group (symbol-name sym)) + (gnus-group-entry group) + (setq info (symbol-value sym))) + (gnus-sethash group (cons (nth 2 info) (cdr (gnus-group-entry group))) + gnus-newsrc-hashtb))) + nnimap-mailbox-info))) + (when nnimap-debug (require 'trace) (buffer-disable-undo (get-buffer-create nnimap-debug)) diff --git a/texi/ChangeLog b/texi/ChangeLog index f445b17..3ab8902 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,7 @@ +2002-09-26 Simon Josefsson + + * gnus.texi (Agent Variables): Add. + 2002-09-25 Simon Josefsson * gnus.texi (Troubleshooting): Add. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index 89e97ba..1e4b902 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -16715,6 +16715,16 @@ plugged $B$N$H$-$K!"%m!<%+%k$K;}$C$F$$$k(B @sc{nov} $B$H5-;v$r;H$&$+$I$&$+$r@ $B$,%G%#%U%)%k%H$G$9$,!"%(!<%8%'%s%H$O:F@\B3$9$k$H$-$K%*%U%i%$%s>uBV$N%5!<(B $B%P!<$r%*%s%i%$%s>uBV$K$9$k$+$I$&$+$r?R$M$^$9!#$=$l0J30$NCM$@$C$?$i!"%*%U(B $B%i%$%s>uBV$N%5!<%P!<$O<+F0E*$K%*%s%i%$%s>uBV$K$J$j$^$9!#(B + +@item gnus-server-unopen-status +@vindex gnus-server-unopen-status +$B$?$V$s%(!<%8%'%s%HJQ?t$G$O$J$$$,%(!<%8%'%s%H$KL)@\$K4XO"$9$k$3$NJQ?t$O!"(B +gnus $B$,%5!<%P!<$K@\B3$G$-$J$H$-$K2?$,5/$-$?$+$rJ*8l$j$^$9!#%(!<%8%'%s%H(B +$B$,3h@-2=$5$l$k$H!"%G%U%)%k%H$N(B @code{nil} $B$G$O!"%f!<%6!<$,%5!<%P!<$H$N@\(B +$BB3$r@d$D$+%(!<%8%'%s%H$r(B unplug $B$K$9$k$+$r(B gnus $B$K?R$M$5$;$^$9!#%(!<%8%'(B +$B%s%H$,IT3h@-2=$5$l$k$H!"(Bgnus $B$O$$$D$bC1$K%5!<%P!<$H$N@\B3$r@d$A$^$9!#$3(B +$B$NJQ?t$NB>$NA*Br;h$K$O(B @code{denied} $B$H(B @code{offline} $B$,$"$j!"%(!<%8%'(B +$B%s%H$,;H$o$l$k>l9g$O8e