Gnus development mailing list
 help / color / mirror / Atom feed
From: Steinar Bang <sb@metis.no>
Subject: Re: Need group parameter "from-list"
Date: 30 Jun 1998 16:59:09 +0200	[thread overview]
Message-ID: <wh7m1z7x6q.fsf@viffer.oslo.metis.no> (raw)
In-Reply-To: Anders Melchiorsen's message of "30 Jun 1998 13:31:48 +0200"

>>>>> Anders Melchiorsen <postmaster@and.nospam.kampsax.k-net.dk>:

> Eze Ogwuma <typhoon@dircon.co.uk> writes:
>> Is there any way to set my "From" header depending on which group I'm
>> in? I was hoping for something like the group parameter "to-list".

> I recently started using this, which seems to work. I believe I got it 
> from the FAQ, actually.


> ; Set spam-resistent address ininternational newsgroups
> (defun my-address ()
>   "Selects an e-mail address based on what newsgroup we are in"
>   (setq user-mail-address
>     (cond ((string-match "^nnml:mail\\|k-net" gnus-newsgroup-name)
> 	   "my@real.address")
> 	  (t
> 	   "postmaster@and.nospam.kampsax.k-net.dk"))))

> (add-hook 'gnus-summary-mode-hook 'my-address)

I'm doing something way more complicated.  The reason for this was to
allow me to cancel and supersede in groups where I had another mail
identity.  Unfortunately, with Gnus 5.6.9, this doesn't work anymore,
and I haven't had the energy to look into why.  Add another sigh for
gnus-posting-styles... 

;=======================================================================
; Emulate "posting styles" by ugly hacks
;

; First a convenient regexp to identify all hobby news and mail groups
; thanx to Erik Naggum
(defvar mc-newsgroups
  (mapconcat #'identity
	     (list "nnml:mail\\.dod"
		   "nnml:mail\\.utdrikk"
		   "nnml:hobby\\.trip_report"
		   "nnml:mail\\.vfr"
		   "dod\..*"
		   "no\\.alt\\.motorsykler"
		   "alt\\.fan\\.ivan"
		   "\\(nordunet.\\)?rec\\.motorcycles"
		   )
	     "\\|"))

(defvar private-newsgroups
  (mapconcat #'identity
	     (list "nnm[hl]:\\(\\(other\\)?folk\\|hobby\\).*"
		   "nnml:mail\\.private"
		   "rec\\.aviation\\.military"
		   "alt\\.fan\\..*"
		   "no\\.film"
		   "NRK\\.generelt"
		   )
	     "\\|"))

(defvar hobby-newsgroups
      (mapconcat #'identity
		 (list mc-newsgroups
		       private-newsgroups
		       )
		 "\\|"))


;===========================
; Customize the user-mail-address on the basis of the mail or news group
; posted from
;
(defadvice message-user-mail-address (before generate-user-mail-address activate compile)
  "Change the value of the user mail address based on the group."
  (setq user-mail-address 
	(cond
	 ((stringp gnus-newsgroup-name) 
	  (cond
	   ((string-match mc-newsgroups gnus-newsgroup-name)
	    "sb@dod.no")
	   ((string-match private-newsgroups gnus-newsgroup-name)
	    "steinar@bang.priv.no")
	   (t "sb@metis.no")
	   ))
	 (t "sb@metis.no"))))

;===========================
; Customize the Organization, dependent on the news group posted from
;
(defun set-custom-organization (org-name)
  "Make the message-user-organization buffer local, and
set it to a custom value.

As a side effect, make the message-syntac checks variable
buffer local, and and set it to disable the Sender header
field"
  (progn
    (make-variable-buffer-local 'message-user-organization)
    (make-variable-buffer-local 'message-syntax-checks)

    (setq message-user-organization org-name)
    (setq message-syntax-checks (list '(sender . disabled)))
    ))

(defun custom-organization-and-sender ()
  "Set custom organization, and sender on some news groups"
  (cond
   ((stringp gnus-newsgroup-name)
    (cond
     ((string-match hobby-newsgroups gnus-newsgroup-name)
      (set-custom-organization "DoD, Norway Chapter"))
     ((string-match "no.test" gnus-newsgroup-name)
      (set-custom-organization "Testers Inc."))
     ))
   (t nil)))

(add-hook 'message-header-setup-hook 'custom-organization-and-sender)


      parent reply	other threads:[~1998-06-30 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-30  4:14 Eze Ogwuma
1998-06-30 10:18 ` Robert Bihlmeyer
1998-06-30 11:33   ` Eze Ogwuma
1998-06-30 15:29     ` Robert Bihlmeyer
1998-06-30 20:18       ` Eze Ogwuma
1998-07-01  2:26         ` Karl Kleinpaste
1998-07-01  9:36           ` Kai Grossjohann
1998-07-01 11:54             ` Lars Magne Ingebrigtsen
1998-07-01 12:49               ` Kai Grossjohann
1998-07-01 15:31                 ` Lars Magne Ingebrigtsen
1998-07-11  6:56                   ` SL Baur
1998-07-01 18:04                 ` Edward J. Sabol
1998-07-02  9:12                   ` Lars Magne Ingebrigtsen
1998-06-30 12:11 ` Jari Aalto+list.ding
1998-06-30 14:27 ` Edward J. Sabol
     [not found] ` <m3af6vp1lm.fsf@k0817.kampsax.dtu.dk>
1998-06-30 14:59   ` Steinar Bang [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=wh7m1z7x6q.fsf@viffer.oslo.metis.no \
    --to=sb@metis.no \
    /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).