Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-multdom.el anyone...?
@ 1999-05-19  7:32 Steinar Bang
  1999-05-19 14:05 ` David S. Goldberg
  1999-05-20 14:36 ` BrYan P. Johnson
  0 siblings, 2 replies; 3+ messages in thread
From: Steinar Bang @ 1999-05-19  7:32 UTC (permalink / raw)


When wandering through Noah Friedman's emacs lisp page
        http://www.splode.com/users/friedman/software/emacs-lisp/
looking for vcard.el, I found this little critter:

vm-multdom.el 

       This package lets you reply or forward messages from within VM,
       setting your return address to match whatever address was used
       to reach you in the first place.

       For example, my regular address is
       friedman@splode.com. However, I still sometimes use the address
       friedman@prep.ai.mit.edu when I'm sending email that's related
       to the GNU Project. Using this package, if someone sends email
       to the latter address, my From and Reply-To headers are
       automatically filled in with that address so that it looks like
       I am continuing to correspond from MIT, even though the rest of
       the time my correspondence looks like it comes from my regular
       address.

       In order for this to work, all you have to set a lisp variable
       to contain a list of all your known email addresses and load
       this file as part of your emacs initialization.

This is a feature I would have liked to have in Gnus.  What I do
today, is to redirect different addresses into different mail groups
and then use gnus-posting-styles to set the sender address.

But occasionally things end up in the wrong group and my sender
address changes and this may be confusing.

Is there a way already?  All hints and tips are appreciated as always!


- Steinar


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnus-multdom.el anyone...?
  1999-05-19  7:32 gnus-multdom.el anyone...? Steinar Bang
@ 1999-05-19 14:05 ` David S. Goldberg
  1999-05-20 14:36 ` BrYan P. Johnson
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Goldberg @ 1999-05-19 14:05 UTC (permalink / raw)


I don't do this myself, but you can do this sort of thing with
posting-styles.  Note that the example below is incomplete.  You'll
also need to verify that the "To" that you're grabbing is really an
address belonging to you.  I'm just illustrating the capability of
finding the To address in a message you're replying to.

(setq gnus-posting-styles '((gnus-article-reply
			     ("From"
                               (save-excursion
                                 (set-buffer gnus-article-buffer)
                                 (car (cdr (mail-extract-address-components
                                            (message-fetch-field "To")))))))))
-- 
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] 3+ messages in thread

* Re: gnus-multdom.el anyone...?
  1999-05-19  7:32 gnus-multdom.el anyone...? Steinar Bang
  1999-05-19 14:05 ` David S. Goldberg
@ 1999-05-20 14:36 ` BrYan P. Johnson
  1 sibling, 0 replies; 3+ messages in thread
From: BrYan P. Johnson @ 1999-05-20 14:36 UTC (permalink / raw)


Steinar Bang <sb@metis.no> writes:

> When wandering through Noah Friedman's emacs lisp page
>         http://www.splode.com/users/friedman/software/emacs-lisp/
> looking for vcard.el, I found this little critter:
> 
> vm-multdom.el 
> 
>        This package lets you reply or forward messages from within VM,
>        setting your return address to match whatever address was used
>        to reach you in the first place.
> 


I stole this from Robert Sanders, and modified it to check to see if I'm
posting to a newsgroup, or replying to e-mail and act accordingly. I'm sure
that someone with more kung-fu could clean it up, but it works. I used to use
it to set the signature as well, but have since created a signature menu which 
works better for me.

BrYan



;;*** Electric Headers

 ;; Okay. Here's how to change outgoing headers based on a To header or a Newsgroup.
 ;; Default behavior is if there's a newsgroup header, use ng-postspecs, otherwise
 ;; use to-postspecs. 
 ;; The first argument in to-postspecs is the To Header to look for,
 ;; The headers line is which headers to use based on this.

(setq to-postspecs
      '(("girlie@crackrock.com\\|lismooty" .
	 ((headers . "From: BrYan <bilko@onebabyzebra.com>\n")
          ))
        (".*io.com" .
         ((headers . "From: vandeest@io.com\n")
          ))
        ("chiplist.*" .
         ((headers . "From: BrYan P. Johnson <bryan@bryanland.com>\n")
                  ))
	(".*bryanland\\|.*shorty.*" .
	((headers . "From: BrYan <bryan@bryanland.com>\nX-Gratuitous-Latin: Nihil curo de ista tua stulta superstitione.\n")
	))
	(t .
           ((headers . "From: BrYan P. Johnson <beej@mindspring.net>\n")
          ))))
 ;; The first argument in ng-postspecs is the Newsgroups Header to look for,
 ;; The headers line is the headers to add.
(setq ng-postspecs
      '(("alt.religion.kibology" .
	 ((headers . "From: BrYan <bilko@onebabyzebra.com>\n")
	  ))
	("mindspring.*" .
         ((headers . "From: BrYan P. Johnson <beej@mindspring.net>\n")
	 ))
	(t .
           ((headers . "From: BrYan P. Johnson <bryan@bryanland.com>\n")
	))))
(defun find-postspec (speclist groups)
  (cond ((null speclist) nil)
        ((null groups) (cdr-safe (assq t speclist)))
        (t (let ((spec (car speclist)))
	     (if (or (eq t (car spec)) (string-match (car spec) groups))
                 (cdr spec)
               (find-postspec (cdr speclist) groups))))
        ))
 ;; If we use the To field to associate headers:
(defun electric-to (header-alist)
  (let* ((groups        (cdr-safe (assq 'To header-alist)))
         (postspec      (find-postspec to-postspecs groups))
         (headers       (cdr-safe (assq 'headers postspec))))
    (if headers
        (save-excursion
          (goto-char (point-min))
          (insert headers)))
 ))


 ;;Don't know why, but it barfed without this.
(defvar groups2 "")
 ;;If we use the Newsgroup field to associate headers:
(defun electric-newsgroup (header-alist)
  (setq groups2 gnus-newsgroup-name)
  (let* ((postspec      (find-postspec ng-postspecs groups2))
	 (headers       (cdr-safe (assq 'headers postspec)))
	 )	  
    (if headers
        (save-excursion
          (goto-char (point-min))
          (insert headers)))
  ))
 ;; Choose which way to associate headers
(defun electric-messages (header-alist)
  (cond
   ((cdr-safe (assoc 'Newsgroups header-alist))
   (electric-newsgroup header-alist))
   (t
  (electric-to header-alist)))
 )
 ;;Here's the requisite hook that makes the whole thing go:
(add-hook 'message-signature-setup-hook 
          (lambda () (electric-messages headers))
	  	  )
 ;;End Electric Headers


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-05-20 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-19  7:32 gnus-multdom.el anyone...? Steinar Bang
1999-05-19 14:05 ` David S. Goldberg
1999-05-20 14:36 ` BrYan P. Johnson

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