Gnus development mailing list
 help / color / mirror / Atom feed
* Re: fancy-like split on body
       [not found]   ` <wkog1xayuu.fsf@blue.sea.net>
@ 2000-09-13 14:50     ` Toby Speight
  0 siblings, 0 replies; only message in thread
From: Toby Speight @ 2000-09-13 14:50 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 93 bytes --]

Here's a response I tried to send Jari by mail; his mail server
accused me of spamming :-(



[-- Attachment #2: Type: message/rfc822, Size: 2819 bytes --]

From: Toby Speight <streapadair@gmx.net>
To: jari.aalto@poboxes.com (Jari Aalto+mail.emacs)
Subject: Re: fancy-like split on body
Date: 13 Sep 2000 15:13:10 +0100
Message-ID: <873dj4nzwp.fsf@delivery.cam.eu.citrix.com>

0> In <URL:news:wkog1xayuu.fsf@blue.sea.net>,
0> Jari Aalto <URL:mailto:jari.aalto@poboxes.com> ("Jari") wrote:

Jari> ..Erm, is is possible to um, convince Gnus to call a user defined
Jari> function that would in turn find out the original one and match
Jari> whatever was necessary.

Yes, it's possible (assuming you have some means of finding the
original).  Arranging for your own function to be called is trivial;
here's what I use for ensuring that mail from people in my BBDB
doesn't end up in the spam box (see the highlighted line):

(setq nnmail-split-fancy
      '(|
        ;; ...
        ("X-Resent-For" "streapadair@gmx\\.net$"
         (| ;; ... (lists)
            ;; ****************************************
            (: . (and (tms-split-bbdb) "mail/streapadair"))
            ;; ****************************************
            (|
             ("References\\|In-Reply-To" ".+" "mail/streapadair")
             ("Subject" "\\<Re[: ].+" (to tms "mail/streapadair")))
            (| (any "speight" "mail/misc") "JUNK")))))


;; Non-nil if this message is from someone in the BBDB
(defun tms-split-bbdb nil
  ;; Probably not the best implementation.  May be specific to BBDB 1.51!
  (goto-char (point-min))
  (and (re-search-forward "^from:\\(\\(.\\|\n[ \t]\\)+\\)" nil t)
       (save-restriction
         (narrow-to-region (match-beginning 1) (match-end 1))
         (goto-char (point-min))
         (let (result)
           (while (and (not result) (looking-at "\\([^,'\"]\\|'[^']*'\\|\"[^\"]*\"\\)+,?"))
             (goto-char (match-end 0))
               (let* ((from (match-string 0))
                      (data (condition-case ()
                                (mail-extract-address-components from)
                              (error nil)))
                      (name (car data))
                      (net (car (cdr data)))
                      (record (and data
                                   (bbdb-search-simple name
                                                       (if (and net bbdb-canonicalize-net-hook)
                                                           (bbdb-canonicalize-address net)
                                                         net)))))
                 (and record (setq result t))))
           result))))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-09-13 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m3d7jii29u.fsf@wesley.springies.com>
     [not found] ` <vaf8zu5ill3.fsf@lucy.cs.uni-dortmund.de>
     [not found]   ` <wkog1xayuu.fsf@blue.sea.net>
2000-09-13 14:50     ` fancy-like split on body Toby Speight

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).