* split banners of free mail servers
@ 2002-09-11 4:47 tsuchiya
2002-09-11 5:18 ` Katsumi Yamaoka
2002-09-24 9:40 ` TSUCHIYA Masatoshi
0 siblings, 2 replies; 6+ messages in thread
From: tsuchiya @ 2002-09-11 4:47 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
Hello, Gnus developers.
Some mail servers, which provide free mail accounts, insert their
advertisements into their relaying messages. In order to split them,
I propose the following change.
2002-09-11 TSUCHIYA Masatoshi <tsuchiya@namazu.org>
* gnus-art.el (gnus-article-address-banner-alist): New option.
(article-strip-banner): Refer the above option to split
banners of free mail servers, when no group parameter is
specified.
[-- Attachment #2: Type: text/plain, Size: 1505 bytes --]
Index: gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 6.231
diff -u -u -r6.231 gnus-art.el
--- gnus-art.el 2002/09/09 15:24:16 6.231
+++ gnus-art.el 2002/09/11 05:17:51
@@ -279,6 +279,21 @@
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.
+For example,
+ ((\"@yahoo\\.co\\.jp\\\\'\" . \"\\n_+\\nDo You Yahoo!\\\\?\\n.*\\n.*\\n\"))
+"
+ :type '(repeat
+ (cons
+ (regexp :tag "Address")
+ (choice :tag "Banner" :value nil
+ (const :tag "Remove signature" signature)
+ (symbol :tag "Item in `gnus-article-banner-alist'" none)
+ regexp
+ (const :tag "None" nil))))
+ :group 'gnus-article-washing)
+
(defcustom gnus-emphasis-alist
(let ((format
"\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)")
@@ -2252,6 +2267,15 @@
(banner (gnus-parameter-banner gnus-newsgroup-name))
(gnus-signature-limit nil)
buffer-read-only beg end)
+ (unless banner
+ (setq banner
+ (assoc-default (save-restriction
+ (widen)
+ (article-narrow-to-head)
+ (caar (mail-header-parse-addresses
+ (mail-fetch-field "from"))))
+ gnus-article-address-banner-alist
+ 'string-match)))
(when banner
(article-goto-body)
(cond
[-- Attachment #3: Type: text/plain, Size: 23 bytes --]
--
TSUCHIYA Masatoshi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: split banners of free mail servers
2002-09-11 4:47 split banners of free mail servers tsuchiya
@ 2002-09-11 5:18 ` Katsumi Yamaoka
2002-09-11 5:30 ` tsuchiya
2002-09-24 9:40 ` TSUCHIYA Masatoshi
1 sibling, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2002-09-11 5:18 UTC (permalink / raw)
Cc: ding
>>>>> In <almk4k$vka$1@quimby.gnus.org>
>>>>> tsuchiya@namazu.org wrote:
> Some mail servers, which provide free mail accounts, insert their
> advertisements into their relaying messages. In order to split them,
> I propose the following change.
That's a good feature. But...
> + (assoc-default (save-restriction
I noticed just now that the function `assoc-default' is not
available in XEmacs without APEL. Could we use `assoc' instead?
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: split banners of free mail servers
2002-09-11 5:18 ` Katsumi Yamaoka
@ 2002-09-11 5:30 ` tsuchiya
2002-09-11 5:48 ` Katsumi Yamaoka
0 siblings, 1 reply; 6+ messages in thread
From: tsuchiya @ 2002-09-11 5:30 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
>> On Wed, 11 Sep 2002 14:18:05 +0900
>> yamaoka@jpl.org (Katsumi Yamaoka) said as follows:
>> Some mail servers, which provide free mail accounts, insert their
>> advertisements into their relaying messages. In order to split
>> them, I propose the following change.
>That's a good feature. But...
>> + (assoc-default (save-restriction
>I noticed just now that the function `assoc-default' is not available
>in XEmacs without APEL.
I see. Here is the revised patch.
[-- Attachment #2: Type: text/plain, Size: 1604 bytes --]
Index: gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 6.231
diff -u -u -r6.231 gnus-art.el
--- gnus-art.el 2002/09/09 15:24:16 6.231
+++ gnus-art.el 2002/09/11 06:03:52
@@ -279,6 +279,21 @@
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.
+For example,
+ ((\"@yahoo\\.co\\.jp\\\\'\" . \"\\n_+\\nDo You Yahoo!\\\\?\\n.*\\n.*\\n\"))
+"
+ :type '(repeat
+ (cons
+ (regexp :tag "Address")
+ (choice :tag "Banner" :value nil
+ (const :tag "Remove signature" signature)
+ (symbol :tag "Item in `gnus-article-banner-alist'" none)
+ regexp
+ (const :tag "None" nil))))
+ :group 'gnus-article-washing)
+
(defcustom gnus-emphasis-alist
(let ((format
"\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)")
@@ -2252,6 +2267,17 @@
(banner (gnus-parameter-banner gnus-newsgroup-name))
(gnus-signature-limit nil)
buffer-read-only beg end)
+ (unless banner
+ (setq banner
+ (let ((from (save-restriction
+ (widen)
+ (article-narrow-to-head)
+ (caar (mail-header-parse-addresses
+ (mail-fetch-field "from"))))))
+ (catch 'found
+ (dolist (pair gnus-article-address-banner-alist)
+ (when (string-match (car pair) from)
+ (throw 'found (cdr pair))))))))
(when banner
(article-goto-body)
(cond
[-- Attachment #3: Type: text/plain, Size: 23 bytes --]
--
TSUCHIYA Masatoshi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: split banners of free mail servers
2002-09-11 5:30 ` tsuchiya
@ 2002-09-11 5:48 ` Katsumi Yamaoka
0 siblings, 0 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2002-09-11 5:48 UTC (permalink / raw)
Cc: ding
>>>>> In <almmlm$463$1@quimby.gnus.org>
>>>>> tsuchiya@namazu.org wrote:
>> I noticed just now that the function `assoc-default' is
>> not available in XEmacs without APEL.
> I see. Here is the revised patch.
Thanks. I'll commit it after adding description on doc-string. :)
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: split banners of free mail servers
2002-09-11 4:47 split banners of free mail servers tsuchiya
2002-09-11 5:18 ` Katsumi Yamaoka
@ 2002-09-24 9:40 ` TSUCHIYA Masatoshi
2002-09-24 9:59 ` Katsumi Yamaoka
1 sibling, 1 reply; 6+ messages in thread
From: TSUCHIYA Masatoshi @ 2002-09-24 9:40 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
Hello, Gnus developers.
>> On Wed, 11 Sep 2002 13:47:45 +0900
>> tsuchiya@namazu.org said as follows:
>Some mail servers, which provide free mail accounts, insert their
>advertisements into their relaying messages. In order to split them,
>I propose the following change.
I have noticed that this change causes a wrong-type-argument error
when a message including no from header is displayed. In order to
avoid this error, I propose the following change.
2002-09-24 TSUCHIYA Masatoshi <tsuchiya@namazu.org>
* gnus-art.el (article-strip-banner): Check the existence of
from header.
[-- Attachment #2: Type: text/plain, Size: 604 bytes --]
--- gnus-art.el 2002/09/23 20:38:23 6.239
+++ gnus-art.el 2002/09/24 10:22:47
@@ -2281,10 +2281,11 @@
(article-narrow-to-head)
(caar (mail-header-parse-addresses
(mail-fetch-field "from"))))))
- (catch 'found
- (dolist (pair gnus-article-address-banner-alist)
- (when (string-match (car pair) from)
- (throw 'found (cdr pair))))))))
+ (when from
+ (catch 'found
+ (dolist (pair gnus-article-address-banner-alist)
+ (when (string-match (car pair) from)
+ (throw 'found (cdr pair)))))))))
(when banner
(article-goto-body)
(cond
[-- Attachment #3: Type: text/plain, Size: 23 bytes --]
--
TSUCHIYA Masatoshi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: split banners of free mail servers
2002-09-24 9:40 ` TSUCHIYA Masatoshi
@ 2002-09-24 9:59 ` Katsumi Yamaoka
0 siblings, 0 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2002-09-24 9:59 UTC (permalink / raw)
Cc: ding
>>>>> In <877khbzpxn.fsf@pine.kuee.kyoto-u.ac.jp>
>>>>> TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp> wrote:
> I have noticed that this change causes a wrong-type-argument error
> when a message including no from header is displayed. In order to
> avoid this error, I propose the following change.
> 2002-09-24 TSUCHIYA Masatoshi <tsuchiya@namazu.org>
> * gnus-art.el (article-strip-banner): Check the existence of
> from header.
Thanks. I've modified it as follows:
(setq banner
(let ((from (save-restriction
(widen)
(article-narrow-to-head)
(mail-fetch-field "from"))))
(when (and from
(setq from
(caar (mail-header-parse-addresses from))))
(catch 'found
(dolist (pair gnus-article-address-banner-alist)
(when (string-match (car pair) from)
(throw 'found (cdr pair)))))))))
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-09-24 9:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-11 4:47 split banners of free mail servers tsuchiya
2002-09-11 5:18 ` Katsumi Yamaoka
2002-09-11 5:30 ` tsuchiya
2002-09-11 5:48 ` Katsumi Yamaoka
2002-09-24 9:40 ` TSUCHIYA Masatoshi
2002-09-24 9:59 ` Katsumi Yamaoka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).