Back to index

lightning-sunbird  0.9+nobinonly
mimeunty.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _MIMEUNTY_H_
00039 #define _MIMEUNTY_H_
00040 
00041 #include "mimecont.h"
00042 
00043 /* The MimeUntypedText class is used for untyped message contents, that is, 
00044    it is the class used for the body of a message/rfc822 object which had
00045    *no* Content-Type header, as opposed to an unrecognized content-type.
00046    Such a message, technically, does not contain MIME data (it follows only
00047    RFC 822, not RFC 1521.)
00048 
00049    This is a container class, and the reason for that is that it loosely
00050    parses the body of the message looking for ``sub-parts'' and then
00051    creates appropriate containers for them.
00052 
00053    More specifically, it looks for uuencoded data.  It may do more than that
00054    some day.
00055 
00056    Basically, the algorithm followed is:
00057 
00058      if line is "begin 644 foo.gif"
00059        if there is an open sub-part, close it
00060           add a sub-part with type: image/gif; encoding: x-uue
00061           hand this line to it
00062           and hand subsequent lines to that subpart
00063         else if there is an open uuencoded sub-part, and line is "end"
00064           hand this line to it
00065           close off the uuencoded sub-part
00066      else if there is an open sub-part
00067           hand this line to it
00068      else
00069        open a text/plain subpart
00070           hand this line to it
00071 
00072    Adding other types than uuencode to this (for example, PGP) would be 
00073    pretty straightforward.
00074  */
00075 
00076 typedef struct MimeUntypedTextClass MimeUntypedTextClass;
00077 typedef struct MimeUntypedText      MimeUntypedText;
00078 
00079 struct MimeUntypedTextClass {
00080   MimeContainerClass container;
00081 };
00082 
00083 extern MimeUntypedTextClass mimeUntypedTextClass;
00084 
00085 typedef enum {
00086   MimeUntypedTextSubpartTypeText,  /* text/plain */
00087   MimeUntypedTextSubpartTypeUUE,   /* uuencoded data */
00088   MimeUntypedTextSubpartTypeYEnc,  /* yencoded data */
00089   MimeUntypedTextSubpartTypeBinhex /* Mac BinHex data */
00090 } MimeUntypedTextSubpartType;
00091 
00092 struct MimeUntypedText {
00093   MimeContainer container;                /* superclass variables */
00094   MimeObject *open_subpart;               /* The part still-being-parsed */
00095   MimeUntypedTextSubpartType type; /* What kind of type it is */
00096   MimeHeaders *open_hdrs;                 /* The faked-up headers describing it */
00097 };
00098 
00099 #endif /* _MIMEUNTY_H_ */