home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libmime / mimeunty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  84 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* mimeunty.h --- definition of the MimeUntypedText class (see mimei.h)
  20.    Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
  21.  */
  22.  
  23. #ifndef _MIMEUNTY_H_
  24. #define _MIMEUNTY_H_
  25.  
  26. #include "mimecont.h"
  27.  
  28. /* The MimeUntypedText class is used for untyped message contents, that is, 
  29.    it is the class used for the body of a message/rfc822 object which had
  30.    *no* Content-Type header, as opposed to an unrecognized content-type.
  31.    Such a message, technically, does not contain MIME data (it follows only
  32.    RFC 822, not RFC 1521.)
  33.  
  34.    This is a container class, and the reason for that is that it loosely
  35.    parses the body of the message looking for ``sub-parts'' and then
  36.    creates appropriate containers for them.
  37.  
  38.    More specifically, it looks for uuencoded data.  It may do more than that
  39.    some day.
  40.  
  41.    Basically, the algorithm followed is:
  42.  
  43.      if line is "begin 644 foo.gif"
  44.        if there is an open sub-part, close it
  45.        add a sub-part with type: image/gif; encoding: x-uue
  46.        hand this line to it
  47.        and hand subsequent lines to that subpart
  48.      else if there is an open uuencoded sub-part, and line is "end"
  49.        hand this line to it
  50.        close off the uuencoded sub-part
  51.      else if there is an open sub-part
  52.        hand this line to it
  53.      else
  54.        open a text/plain subpart
  55.        hand this line to it
  56.  
  57.    Adding other types than uuencode to this (for example, PGP) would be 
  58.    pretty straightforward.
  59.  */
  60.  
  61. typedef struct MimeUntypedTextClass MimeUntypedTextClass;
  62. typedef struct MimeUntypedText      MimeUntypedText;
  63.  
  64. struct MimeUntypedTextClass {
  65.   MimeContainerClass container;
  66. };
  67.  
  68. extern MimeUntypedTextClass mimeUntypedTextClass;
  69.  
  70. typedef enum {
  71.   MimeUntypedTextSubpartTypeText,    /* text/plain */
  72.   MimeUntypedTextSubpartTypeUUE,    /* uuencoded data */
  73.   MimeUntypedTextSubpartTypeBinhex    /* Mac BinHex data */
  74. } MimeUntypedTextSubpartType;
  75.  
  76. struct MimeUntypedText {
  77.   MimeContainer container;            /* superclass variables */
  78.   MimeObject *open_subpart;            /* The part still-being-parsed */
  79.   MimeUntypedTextSubpartType type;    /* What kind of type it is */
  80.   MimeHeaders *open_hdrs;            /* The faked-up headers describing it */
  81. };
  82.  
  83. #endif /* _MIMEUNTY_H_ */
  84.