Ding! The light goes on: Let's use USENET news! Scenario:
1. I'm reading http://info.cern.ch/hypertext/WWW/MarkUp.html.
2. I see something I want to change, so I save the HTML to
a file.
3. I edit the file, trimming it down and adding my comments.
4. I enclose the file in a news article using the MIME text/x-html
content type and the quoted-printable content transfer encoding.
5. I post the article to comp.infosystems or alt.infosystems.www.
6. I make a URL out of the message-id of the article, and I
send
LINK /hypertext/WWW/MarkUp.html
<A HREF="news:<message-id>">Comments by [email protected]</a>
.
to the HTTP server at info.cern.ch.
7. We add MIME style message/rfc-822 parsing to the browser. See below.
8. I'm browsing the annotated http://info.cern.ch/hypertext/WWW/MarkUp.html
and I click on "Comments by [email protected]". The browser contacts
its NNTP server and grabs message-id.
9. It extracts the body, and displays the result as HTML.
Ding! Another light goes on. Here's how to handle MIME body parts:
We need a function:
void
HText_AppendBodyPart(HText* target, int (*getch)(void*), void* stream,
int type, int subtype, char* params);
/*
* PRE:
* target -- hypertext object "in append mode"
* getch -- get one character from stream object
* stream -- opaque stream object
* type -- one of the 7 mime primary types: MIME_TEXT, MIME_MESSAGE, etc.
* subtype -- plain, html, postscript, gif, basic, multipart, etc.
* params -- "name=val; name=val;..." parameters
*
* POST:
* body part on stream has been consumed and appended to or linked
* to target.
*/
text/html -- append as SGML text entity
text/* -- append as plain text
to the SGML parser, it's an external entity text/plain NOTATION
multipart/* -- find boundary on stream
create a new stream object out of getch, stream,
and params that returns eof at the boundary
call HText_AppendBodyPart recursively
message/rfc-822 -- parse headers, display headers as
<DL><DT>Subject<DD>foo...</DL>
append body part recursively
message/external-body -- create a URL out of params. Parse
message headers. Display as
<H2><A href="URL" type="type/subtype params">description</a><H2>
*/* -- save to local file foo. display as
<H2><a HREF="file:foo" TYPE="type/subtype params">description</a></H2>
where description is the content-description, if available, or
"a body part of type image/gif" otherwise.
Then we can add a separate command that takes a link, opens it, and
pipes it through metamail.
Hmmm... I gotta go code this up!
Dan