[comp.soft-sys.andrew] Adding a Header

urban%monty@RAND.ORG (Michael Urban) (04/20/91)

I would like to arrange for all my outgoing mail to include special header
information (the X-Face: lines in this message, for the obvious example).
Is there a preference or file that I can set, analogous to MH's
`components' file, to accomplish this?

	Mike

ghoti+@ANDREW.CMU.EDU (Adam Stoller) (04/22/91)

Excerpts from internet.info-andrew: 19-Apr-91 Adding a Header Michael
Urban@rand.org (259)

> I would like to arrange for all my outgoing mail to include special
> header information (the X-Face: lines in this message, for the obvious
> example).  Is there a preference or file that I can set, analogous to
> MH's `components' file, to accomplish this?

> 	Mike

It's not beautiful, but I believe something like the following will work
if you put it in ~/.messagesinit[An Andrew ToolKit view (a footnote) was
included here, but could not be displayed.] (note the text between the
lines of '='s is ALL ONE LINE)
================
addmenu sendmessage-compound-operation "Send With Face~75" sendmessage
sendmessage inherit "sendmessage-add-header X-Face:
<path-to-face?>;sendmessage-send-message"
================
(the "<path-to-face?>", including the angle brackets ('<', '>') should
be replaced with whatever you expect to put after the colon in the
X-Face: header)

--fish

urban%hercules@RAND.ORG (Michael Urban) (04/22/91)

Excerpts from mail: 22-Apr-91 Re: Adding a Header Adam
Stoller@andrew.cmu. (878+1)


> addmenu sendmessage-compound-operation "Send With Face~75" sendmessage
> sendmessage inherit "sendmessage-add-header X-Face:
> <path-to-face?>;sendmessage-send-message"

Unfortunately, `X-Face' data is full of intersting characters like
semicolons that are significant in .atkinit-ish files.  Even when I
insert the data into a header line `by hand' (i.e. using the insert-file
menu option), Andrew scrambles my face--a blow to my vanity--by turning
a pair of `@' characters with a single `@' character.

Grumph.

	Mike

nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (04/23/91)

Excerpts from internet.info-andrew: 22-Apr-91 Re: Adding a Header
Michael Urban@rand.org (608)

> Unfortunately, `X-Face' data is full of intersting characters like
> semicolons that are significant in .atkinit-ish files.  Even when I
> insert the data into a header line `by hand' (i.e. using the insert-file
> menu option), Andrew scrambles my face--a blow to my vanity--by turning
> a pair of `@' characters with a single `@' character.

Yup, sounds like someone might want to add code to add the X-Face line
automatically at a level lower than the ATK stuff.  The "right" place to
add it, in my opinion, would be ams/libs/ms/submsg.c.  It should be
pretty easy to fix:  In MS_SubmitMessage, after the message is parsed
(with ParseMessageFromRawBody), you can use AddHeader to add whatever
you want.  For example, if you were hardwiring your face in the code
(not a good idea):

AddHeader(Msg, "X-Face: lkjsfdlkjsfdlkjsdlkjsflk");

So all you'd really need is some code that gets the headers out of a
configuration file of some sort and adds them on in this manner.  You
can add multiple headers with a single call (as long as the headers are
separated by a single newline) so you could just use the contents of a
file (~/.addheaders ?) in a single AddHeader call, but it might be smart
to make sure that the .addheaders file doesn't contain two consecutive
newlines, which would mess things up.

IMPORTANT NOTE:  You should make sure to add the headers right after the
ParseMessage... call, BEFORE the authentication-related checks.  This
will mean, among other things, that people can't add forged From lines
using this mechanism.  

If you make this change, it will affect messages sent with CUI & VUI in
addition to Messages.  I would encourage you to pass the changes back to
the ITC in the form of a patch.  Regards.  -- Nathaniel

miles@cogsci.ed.ac.uk (Miles Bader) (04/23/91)

nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) writes:
> Yup, sounds like someone might want to add code to add the X-Face line
> automatically at a level lower than the ATK stuff.  The "right" place to
> add it, in my opinion, would be ams/libs/ms/submsg.c.  It should be
> pretty easy to fix:  In MS_SubmitMessage, after the message is parsed
> (with ParseMessageFromRawBody), you can use AddHeader to add whatever
> you want.  For example, if you were hardwiring your face in the code
> (not a good idea):

> AddHeader(Msg, "X-Face: lkjsfdlkjsfdlkjsdlkjsflk");

> So all you'd really need is some code that gets the headers out of a
> configuration file of some sort and adds them on in this manner.  You
> can add multiple headers with a single call (as long as the headers are
> separated by a single newline) so you could just use the contents of a
> file (~/.addheaders ?) in a single AddHeader call, but it might be smart
> to make sure that the .addheaders file doesn't contain two consecutive
> newlines, which would mess things up.

This is the wrong way to do it: as the huge numbers of multiple signatures
posted to usenet shows, silently adding junk to outgoing messages just
confuses people, even if they specifically want it to be added.  It's
obviously also less flexible, since you don't have the ability to delete it /
modify while composing the message.

Just *fix* the current code not to fuck with headers it doesn't know about.

Having headers automatically inserted from a file-- into the editable
composition buffer-- *is* a good idea in my opinion (batmail does it with the
file "~/.headers").

-Miles

--
--
Miles Bader  --  HCRC, University of Edinburgh  --  Miles.Bader@ed.ac.uk

Craig_Everhart@TRANSARC.COM (04/24/91)

I believe that the objection to using the existing mechanisms was that
the .atkinit parser couldn't quote funky characters such as appear to be
in an X-Face: header, rather than in Messages doing anything with
headers it doesn't understand.  (I believe that AMS won't f*** [fool]
with ``headers it doesn't know about.'')

When you use a menu item to add a header, you see the header in the
composition window, so if you left yourself some way to send a message
without adding the header, you could use that.

		Craig

nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (04/25/91)

Excerpts from internet.info-andrew: 23-Apr-91 Re: Adding a Header Miles
Bader@bloom-beacon (1710)

> Just *fix* the current code not to fuck with headers it doesn't know about.

As Craig points out, what you need to fix is the ATK init file
mechanism, in the example given.

> Having headers automatically inserted from a file-- into the editable
> composition buffer-- *is* a good idea in my opinion (batmail does it with the
> file "~/.headers").

Sure, another solution would be to alter the Messages code to put X-Face
into the composition area.  That's another approach.  Personally, I
don't like it as much.  If I wanted an X-Face header, I'd want it
*whether  or not* I sent my mail with Messages -- I'd want it
automatically even if I sent mail with, say, CUI or VUI.

Anybody who's running a mail-reader that is too dumb to filter out
headers such as "X-Face" is already so totally accustomed to seeing
garbage headers that one more isn't going to make any difference... --
Nathaniel

miles@cogsci.ed.ac.uk (Miles Bader) (04/25/91)

Craig_Everhart@TRANSARC.COM writes:
> I believe that the objection to using the existing mechanisms was that
> the .atkinit parser couldn't quote funky characters such as appear to be
> in an X-Face: header, rather than in Messages doing anything with
> headers it doesn't understand.  (I believe that AMS won't f*** [fool]
> with ``headers it doesn't know about.'')

Looking back at nathaniel's message, you're right, the problem is reported to
be in the atkinit file.  [So then why not just have it suck in a file to add
to the headers when setting up the message?  Actually what's needed is
someway of specifying events (in .*init) that are invoked by the program
instead of a keystroke or menu selection (i.e., hooks in emacs)...]

Anyway, couldn't isn't there an "insert-file," proctable entry so that you
don't have to put the wierd characters in the init file?

-Miles
--
--
Miles Bader  --  HCRC, University of Edinburgh  --  Miles.Bader@ed.ac.uk

jaap@mtxinu.COM (Jaap Akkerhuis) (04/26/91)

In article <oc5iHSa0M2Yt82gcQu@thumper.bellcore.com> nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) writes:
 > 
 > Anybody who's running a mail-reader that is too dumb to filter out
 > headers such as "X-Face" is already so totally accustomed to seeing
 > garbage headers that one more isn't going to make any difference... --
 > Nathaniel

On the other hand, it would remind him that the average message
has more header goo then contents. The main thing header garbage
does is wasting bandwidth and upping the profits of the phone
companies...

	jaap

:-)