Subject: Re: Ballueder patch

From: "Aleksandr M. Shvedov" <[email-masked]>
Date: Tue, 15 Sep 1998 10:06:27 -0400

I went thru http://Ballueder.home.ml.org/ , but didn't find the patch
you're talking about. Is it hidden somewhere in Your M-client code?
Thanks.
Alex.

---

From: Karsten Ballueder <[email-masked]>
Date: Tue, 15 Sep 1998 17:39:50 +0100 (BST)

> you're talking about. Is it hidden somewhere in Your M-client code?

Yes it is in M, but that code includes more patches.
As the patch is only few lines I include it in the mail to the list,
maybe it could even make it into the distribution?

It defines a function rfc822_setextraheaders() which takes two arrays
of pointers to header line names and their values. These will be added 
to the headers.

It's the responsibility of the caller to free these arrays when no
longer used.

Apply the patch to rfc822.c

Hope this helps!

111a112,132
> static char **rfc822_extraheaders_names = NULL;
> static char **rfc822_extraheaders_values = NULL;
> 
> void rfc822_setextraheaders(char **names, char **values)
> {
>    rfc822_extraheaders_names = names;
>    rfc822_extraheaders_values = values;
> }
> 
> void rfc822_extraheader_lines (char **header,ENVELOPE *env)
> {
>    while(rfc822_extraheaders_names && *rfc822_extraheaders_names)
>    {
>       if (rfc822_extraheaders_values) sprintf ((*header += strlen (*header)),"%s%s: %s\015\012",
> 			 env->remail ? "ReSent-" : "",
> 			 *(rfc822_extraheaders_names++),
> 			 *(rfc822_extraheaders_values++)
> 			 );
>    }
> }
> 
137a159,161
> 
>   rfc822_extraheader_lines (&header,env);
>   

-- 
 Karsten Ballüder http://Ballueder.home.ml.org/ mailto:[email-masked]
Physics Department, Heriot-Watt University, Edinburgh, EH14 4AS, Scotland
            "In a world without fences, who needs Gates?"

---

From: William Suetholz <[email-masked]>
Date: Tue, 15 Sep 1998 16:48:53 +0100

Nice, but.. wouldn't it be better to have this be part of the 
envelope?  Still use your functions, but have the extraheaders
be a structure like this..
-------------------------------
#define HEADERFIELD struct HeaderFields
HEADERFIELD {
  char *name;		/* Field Name.. ie X-Priority */
  char *value;		/* Field Value.  Comment if address exists */
  ADDRESS *address;	/* Field Address. NIL if not used */
  HEADERFIELD *next;
} ;

typedef struct mail_envelope {
  unsigned int ngbogus : 1;
...
  char *references;
  HEADERFIELD *headers;	/* Added for custom header lines */
} ENVELOPE;
...

HEADERFIELD *mail_newheader (void) ;
void mail_free_header (HEADERFIELD **headerfield) ;
-------------------------

These functions would be very similar to the other mail_new and
mail_free functions.  rfc822_header would then be changed to append
the additional header entries after all the standard entries.  It 
would be the MUA programmer's responsibility to make sure that the
headers entered are valid.

Well, I'm off to code this :-)

Bill Suetholz