[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `a' in a mail-and-news group



> Here's what I would like:

>   - `a' inserts the right Newsgroups header
>   - `f' fills out To and Cc headers with sender and recipients of the
>     original message and also adds a (filled-out) Newsgroups header
>   - `r' fills out the To header and does not add a Newsgroups header

> Of course, this should only happen for the shared groups, for my
> personal groups it does not really make sense to add a Newsgroups
> header.  For them, a Gcc header (as per gcc-self, say) is sufficient.

I use the following to decide when to add a "Mail-Copies-To: never"
header.  I bet you could use something similar to this to decide on a
Newsgroups header from within an nnimap group.  I don't have any
shared groups on my IMAP server so I have nothing to test against.
Or, you might be able to do something with posting-styles, but I seem
to recall having trouble using posting styles for this particular
application.

(defun my-message-header-setup-hook ()
  (let ((group (or gnus-newsgroup-name "")))
    (when (or (message-news-p)
	      (and (message-mail-p)
		   (string-match "wide reply" (buffer-name))
		   (or (message-fetch-field "newsgroups")
		       (gnus-group-find-parameter group 'to-address)))
	      (and (message-mail-p)
		   (string-match "mail to" (buffer-name))
		   (gnus-group-find-parameter group 'to-list)))
      (message-add-header "Mail-Copies-To: never"))))
          
(add-hook 'message-header-setup-hook 'my-message-header-setup-hook)

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