From bdedf841ea62ed5e277a0101076e518a5a5d53b0 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Wed, 11 Sep 2002 09:09:08 +0000 Subject: [PATCH] Synch with Oort Gnus. --- lisp/ChangeLog | 10 ++++++++ lisp/gnus-art.el | 4 +-- lisp/nnimap.el | 72 +++++++++++++++++++++++++++-------------------------- texi/ChangeLog | 9 +++++++ texi/gnus-ja.texi | 27 ++++++++++++++++++++ texi/gnus.texi | 29 +++++++++++++++++++++ 6 files changed, 114 insertions(+), 37 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2c62737..a65a7d2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,14 @@ 2002-09-11 Katsumi Yamaoka + + * gnus-art.el (gnus-article-address-banner-alist): Doc fix. + +2002-09-11 Simon Josefsson + + * nnimap.el (nnimap-expiry-target): Only expiry-target existing articles. + (nnimap-split-rule): Doc fix. + (nnimap-request-expire-articles): Cleanup code. + +2002-09-11 Katsumi Yamaoka From TSUCHIYA Masatoshi . * gnus-art.el (gnus-article-address-banner-alist): New option. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 3429bc9..b70c4d2 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -316,14 +316,14 @@ A string is used as a regular expression to match the banner directly.") (defcustom gnus-article-address-banner-alist nil - "Banner alist for free mail addresses. + "Alist of mail addresses and banners. Each element has the form (ADDRESS . BANNER), where ADDRESS is a regexp to match a mail address in the From: header, BANNER is one of a symbol `signature', an item in `gnus-article-banner-alist', a regexp and nil. If ADDRESS matches author's mail address, it will remove things like advertisements. For example: -\((\"@yahoo\\.co\\.jp\\\\'\" . \"\\n_+\\nDo You Yahoo!\\\\?\\n.*\\n.*\\n\")) +\((\"@yoo-hoo\\.co\\.jp\\\\'\" . \"\\n_+\\nDo You Yoo-hoo!\\\\?\\n.*\\n.*\\n\")) " :type '(repeat (cons diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 335cdcd..12baf9c 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -129,10 +129,10 @@ this: \(setq nnimap-split-rule '((\"INBOX.gnus-imap\" \"From:.*gnus-imap\") (\"INBOX.junk\" \"Subject:.*buy\"))) -As you can see, `nnimap-split-rule' is a list of lists, where the first -element in each \"rule\" is the name of the IMAP mailbox, and the -second is a regexp that nnimap will try to match on the header to find -a fit. +As you can see, `nnimap-split-rule' is a list of lists, where the +first element in each \"rule\" is the name of the IMAP mailbox (or the +symbol `junk' if you want to remove the mail), and the second is a +regexp that nnimap will try to match on the header to find a fit. The second element can also be a function. In that case, it will be called narrowed to the headers with the first element of the rule as @@ -1220,7 +1220,7 @@ function is generally only called when Gnus is shutting down." (when nnmail-cache-accepted-message-ids (with-current-buffer nntp-server-buffer (let (msgid) - (and (setq msgid + (and (setq msgid (nnmail-fetch-field "message-id")) (nnmail-cache-insert msgid to-group))))) ;; Add the group-art list to the history list. @@ -1301,7 +1301,10 @@ function is generally only called when Gnus is shutting down." (defun nnimap-expiry-target (arts group server) (unless (eq nnmail-expiry-target 'delete) (with-temp-buffer - (dolist (art (gnus-uncompress-sequence arts)) + (dolist (art (imap-search (concat "UID " + (imap-range-to-message-set + (gnus-uncompress-sequence arts))) + nnimap-server-buffer)) (nnimap-request-article art group server (current-buffer)) ;; hints for optimization in `nnimap-request-accept-article' (let ((nnimap-current-move-article art) @@ -1317,35 +1320,34 @@ function is generally only called when Gnus is shutting down." (let ((artseq (gnus-compress-sequence articles))) (when (and artseq (nnimap-possibly-change-group group server)) (with-current-buffer nnimap-server-buffer - (if force - (progn - (nnimap-expiry-target artseq group server) - (when (imap-message-flags-add (imap-range-to-message-set artseq) - "\\Deleted") - (setq articles nil))) - (let ((days (or (and nnmail-expiry-wait-function - (funcall nnmail-expiry-wait-function group)) - nnmail-expiry-wait))) - (cond ((eq days 'immediate) - (nnimap-expiry-target artseq group server) - (when (imap-message-flags-add - (imap-range-to-message-set artseq) "\\Deleted") - (setq articles nil))) - ((numberp days) - (let ((oldarts (imap-search - (format nnimap-expunge-search-string - (imap-range-to-message-set artseq) - (nnimap-date-days-ago days)))) - (imap-fetch-data-hook - '(nnimap-request-expire-articles-progress))) - (nnimap-expiry-target oldarts group server) - (and oldarts - (imap-message-flags-add - (imap-range-to-message-set - (gnus-compress-sequence oldarts)) - "\\Deleted") - (setq articles (gnus-set-difference - articles oldarts))))))))))) + (let ((days (or (and nnmail-expiry-wait-function + (funcall nnmail-expiry-wait-function group)) + nnmail-expiry-wait))) + (cond (force + (nnimap-expiry-target artseq group server) + (when (imap-message-flags-add + (imap-range-to-message-set artseq) "\\Deleted") + (setq articles nil))) + ((eq days 'immediate) + (nnimap-expiry-target artseq group server) + (when (imap-message-flags-add + (imap-range-to-message-set artseq) "\\Deleted") + (setq articles nil))) + ((numberp days) + (let ((oldarts (imap-search + (format nnimap-expunge-search-string + (imap-range-to-message-set artseq) + (nnimap-date-days-ago days)))) + (imap-fetch-data-hook + '(nnimap-request-expire-articles-progress))) + (nnimap-expiry-target oldarts group server) + (and oldarts + (imap-message-flags-add + (imap-range-to-message-set + (gnus-compress-sequence oldarts)) + "\\Deleted") + (setq articles (gnus-set-difference + articles oldarts)))))))))) ;; return articles not deleted articles) diff --git a/texi/ChangeLog b/texi/ChangeLog index fca6d83..d4c2c52 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,12 @@ +2002-09-11 Katsumi Yamaoka + + * gnus.texi (Article Hiding): Add a document for + gnus-article-address-banner-alist. + +2002-09-11 Simon Josefsson + + * gnus.texi (Splitting in IMAP): Fix. + 2002-09-10 Simon Josefsson * gnus.texi (Other Marks): Fix. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index 6df3f26..ffb7312 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -7879,6 +7879,8 @@ Fonts})$B!#F1$8%a%C%;!<%8$NCf$KJ#?t$N5-;v$+$i$N0zMQ$,$"$k$H!"(Bgnus $B$O$=$l$ @item W W B @kindex W W B ($B35N,(B) @findex gnus-article-strip-banner +@vindex gnus-article-banner-alist +@vindex gnus-article-address-banner-alist @cindex banner @cindex OneList @cindex stripping advertisements @@ -7894,6 +7896,28 @@ Fonts})$B!#F1$8%a%C%;!<%8$NCf$KJ#?t$N5-;v$+$i$N0zMQ$,$"$k$H!"(Bgnus $B$O$=$l$ $B$O(B @code{gnus-article-banner-alist} $B$N@55,I=8=$KBP1~$7$?%7%s%\%k$G$"$k$3(B $B$H$,$G$-$^$9!#(B +$B%0%k!<%W$K$+$+$o$i$:!"5-;v$NAw?.$l$NMWAG(B +$B$O(B @code{(ADDRESS . BANNER)} $B$N7A<0$r;}$A!"$3$3$G(B ADDRESS $B$O(B From $B%X%C%@!<(B +$B$K$"$k%a!<%k%"%I%l%9$K%^%C%A$9$k@55,I=8=!"(BBANNER $B$O%7%s%\(B +$B%k(B @code{signature}$B!"(B@code{gnus-article-banner-alist} $B$NMWAG!"@55,I=8=$^(B +$B$?$O(B @code{nil} $B$N$&$A$N0l$D$G$9!#(BADDRESS $B$,CxC$7$^$9!#Nc$($P!"Aw?.l9g!"0J2<(B +$B$NMWAG$G$=$l$i$r>C$9$3$H$,$G$-$^$9!#(B + +@lisp +("@@yoo-hoo\.co\.jp\\'" . "\n_+\nDo You Yoo-hoo!\\?\n.*\n.*\n") +@end lisp +@end table + @item W W c @kindex W W c ($B35N,(B) @findex gnus-article-hide-citation @@ -14804,6 +14828,9 @@ Nnmail $B$KBP1~$9$k$b$N$O$"$j$^$;$s!#(B ("INBOX.lists.\\1" "^Sender: owner-\\([a-z-]+\\)@@") @end lisp +$B:G=i$NMWAG$r%7%s%\%k(B @code{junk} $B$K$7$F!"%^%C%A$9$k%a%C%;!<%8$rC1$K>C$9(B +$B$Y$-$G$"$k$3$H$rI=$9$3$H$b$G$-$^$9!#5$$rIU$1$F;H$C$F2<$5$$!#(B + $BFs$DL\$NMWAG$O4X?t$G$"$k$3$H$b$G$-$^$9!#$=$N>l9g$O!"5-;v$N%X%C%@!<$,$"$k(B $B%P%C%U%!$G!"$=$N5,B'$N:G=i$NMWAG$r0z?t$H$7$F8F$P$l$^$9!#%a!<%k$,$=$N%0%k!<(B $B%W$KB0$9$k$H9M$($k>l9g$O!"(B@code{nil} $B$G$J$$CM$rJV$9I,MW$,$"$j$^$9!#(B diff --git a/texi/gnus.texi b/texi/gnus.texi index 9fd4d17..8e1e2cb 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -8021,6 +8021,8 @@ Hide @sc{pem} (privacy enhanced messages) cruft @item W W B @kindex W W B (Summary) @findex gnus-article-strip-banner +@vindex gnus-article-banner-alist +@vindex gnus-article-address-banner-alist @cindex banner @cindex OneList @cindex stripping advertisements @@ -8037,6 +8039,30 @@ signature should be removed, or other symbol, meaning that the corresponding regular expression in @code{gnus-article-banner-alist} is used. +Regardless of a group, you can hide things like advertisements only when +the sender of an article has a certain mail address specified in +@code{gnus-article-address-banner-alist}. + +@table @code + +@item gnus-article-address-banner-alist +@vindex gnus-article-address-banner-alist +Alist of mail addresses and banners. Each element has the form +@code{(ADDRESS . BANNER)}, where ADDRESS is a regexp matching a mail +address in the From header, BANNER is one of a symbol @code{signature}, +an item in @code{gnus-article-banner-alist}, a regexp and @code{nil}. +If ADDRESS matches author's mail address, it will remove things like +advertisements. For example, if a sender has the mail address +@samp{hail@@yoo-hoo.co.jp} and there is a banner something like +@samp{Do You Yoo-hoo!?} in all articles he sends, you can use the +following element to remove them: + +@lisp +("@@yoo-hoo\.co\.jp\\'" . "\n_+\nDo You Yoo-hoo!\\?\n.*\n.*\n") +@end lisp + +@end table + @item W W c @kindex W W c (Summary) @findex gnus-article-hide-citation @@ -15219,6 +15245,9 @@ instance: ("INBOX.lists.\\1" "^Sender: owner-\\([a-z-]+\\)@@") @end lisp +The first element can also be the symbol @code{junk} to indicate that +matching messages should simply be deleted. Use with care. + The second element can also be a function. In that case, it will be called with the first element of the rule as the argument, in a buffer containing the headers of the article. It should return a non-nil value -- 1.7.10.4