* Message access from gnus-posting-styles?
@ 1999-11-16 15:37 Norman Walsh
1999-11-16 17:53 ` David S. Goldberg
0 siblings, 1 reply; 2+ messages in thread
From: Norman Walsh @ 1999-11-16 15:37 UTC (permalink / raw)
I'm not very familiar with the guts of pgnus, so I hope I'm just
missing something.
For a while now, I've been using gnus-posting-styles and a
function to generate my mail signature, like this:
(setq gnus-posting-styles
'((".*"
(name "Norman Walsh")
(address "ndw@nwalsh.com")
("X-URL" "http://nwalsh.com/")
(signature (mail-signature "~/.signature.default")))))
(Obviously there's more to it in real life, but that's the idea)
Now, here's my question. I want to make the content of the signature
a little more dynamic (I'll spare you the details), so I'd like to
know what I can get access to when mail-signature is called in the
course of processing gnus-posting styles.
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.
Cheers,
norm
--
Norman Walsh <ndw@nwalsh.com> | What good is a can of worms if you
http://nwalsh.com/ | never open it?--Bob Arning
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Message access from gnus-posting-styles?
1999-11-16 15:37 Message access from gnus-posting-styles? Norman Walsh
@ 1999-11-16 17:53 ` David S. Goldberg
0 siblings, 0 replies; 2+ messages in thread
From: David S. Goldberg @ 1999-11-16 17:53 UTC (permalink / raw)
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-11-16 17:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-16 15:37 Message access from gnus-posting-styles? Norman Walsh
1999-11-16 17:53 ` David S. Goldberg
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).