Gnus development mailing list
 help / color / mirror / Atom feed
From: dsg@mitre.org (David S. Goldberg)
Subject: Re: Message access from gnus-posting-styles?
Date: 16 Nov 1999 12:53:39 -0500	[thread overview]
Message-ID: <m1b4sem1fx8.fsf@blackbird.mitre.org> (raw)
In-Reply-To: Norman Walsh's message of "Tue, 16 Nov 1999 10:37:48 -0500"

> In particular, can I get access to the headers? If the message is
> being created as a reply, can I get the address(es) of the
> recipients of the message?

> They don't appear to be in the current buffer when mail-signature is
> called, but I might have missed something.

They're not, but that doesn't mean you can't get them...

Here's a snippet from my gnus-posting-styles that should give you an
idea of how to do what you want:

    (gnus-article-reply
     (signature-file
      (let* ((net
              (save-excursion
                (set-buffer gnus-article-buffer)
                (car
                 (cdr
                  (mail-extract-address-components
                   (message-fetch-field
                    "From"))))))
             (rec (car (bbdb-search
                        (bbdb-records) nil nil
                        net nil nil)))
             (sig (if rec
                      (bbdb-record-getprop
                       rec 'signature))))
        (cond (sig sig)
              ((string-match "@.*\\.?mitre\\.org" net)
               "~/.signature-mitre-i")
              ((string-match "nnml:personal.*"
                              gnus-newsgroup-name)
               "~/.signature-personal")
              (t "~/.signature-mitre"))))

What does it do?  If the message is a reply (that's the
gnus-article-reply part), set signature file in a particular way.  It
goes to the article buffer and gets the From line (who I'm replying
to; I ignore Reply-To for this purpose; haven't been burned yet, but I
know it will happen :-)  Then I look for that person in my bbdb.  If I
find her, I look for a signature-file record in bbdb.  If there is one
I use it, otherwise I set signature file based on whether the person
is someone I work with or if the gnusgroup is one I use for non-work
mail and finally, if all else fails, I put my work address in the
sig.  I do have to change that last one by hand occasionally, but
haven't come up with a perfect formula for determining it otherwise.

Hope this helps,
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: dsg@mitre.org


      reply	other threads:[~1999-11-16 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-16 15:37 Norman Walsh
1999-11-16 17:53 ` David S. Goldberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1b4sem1fx8.fsf@blackbird.mitre.org \
    --to=dsg@mitre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).