mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
MIME parsing additions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7908 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
59b06c4f30
commit
71b19751b0
13 changed files with 2364 additions and 0 deletions
|
@ -5,6 +5,13 @@
|
|||
selector into a program where no objects implements it (we might
|
||||
still want to use it over DO or to store in another archive).
|
||||
Change suggested by N.Pero.
|
||||
* Source/GSMime.m: Mime parser classes partially written.
|
||||
* Headers/Foundation/GSMime.h: mime class headers
|
||||
* Documentation/gsdoc/GSMime.gsdoc: documentation
|
||||
* Documentation/gsdoc/GSMimeDocument.gsdoc: documentation
|
||||
* Documentation/gsdoc/GSMimeParser.gsdoc: documentation
|
||||
Various files partially implemented to add MIME parsing support.
|
||||
Intended to aid implementation of HTTP version of NSURLHandle.
|
||||
|
||||
2000-10-24 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
<section>
|
||||
<heading>The GNUstep extension classes</heading>
|
||||
<list>
|
||||
<item><uref url="GSMime.html">GSMime</uref></item>
|
||||
<item><uref url="GSXML.html">GSXML</uref></item>
|
||||
</list>
|
||||
</section>
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
</ul>
|
||||
<h3><a name ="cont-5">The GNUstep extension classes</a></h3>
|
||||
<ul>
|
||||
<li><a href ="GSMime.html">GSMime</a>
|
||||
<li><a href ="GSXML.html">GSXML</a>
|
||||
</ul>
|
||||
</body>
|
||||
|
|
|
@ -100,6 +100,9 @@ Base_GSDOC_FILES = Base.gsdoc \
|
|||
NSUndoManager.gsdoc \
|
||||
NSUserDefaults.gsdoc \
|
||||
NSValue.gsdoc \
|
||||
GSMime.gsdoc \
|
||||
GSMimeDocument.gsdoc \
|
||||
GSMimeParser.gsdoc \
|
||||
GSXML.gsdoc \
|
||||
GSSAXHandler.gsdoc \
|
||||
GSXMLAttribute.gsdoc \
|
||||
|
|
31
Documentation/gsdoc/GSMime.gsdoc
Normal file
31
Documentation/gsdoc/GSMime.gsdoc
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
|
||||
<gsdoc base="GSMime" up="Base">
|
||||
<head>
|
||||
<title>GNUstep MIME parser</title>
|
||||
<author name="Richard Frith-Macdonald">
|
||||
<email address="rfm@gnu.org"/>
|
||||
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
|
||||
</author>
|
||||
<version>0.1</version>
|
||||
<date>26 Ovctober, 2000</date>
|
||||
</head>
|
||||
<body>
|
||||
<chapter>
|
||||
<heading>Mime Parser</heading>
|
||||
<p>
|
||||
The GNUstep Mime parser. This is collection Objective-C classes
|
||||
for representing MIME (and HTTP) documents and managing conversions
|
||||
to and from convenient internal formats.
|
||||
</p>
|
||||
<section>
|
||||
<heading>The classes</heading>
|
||||
<list>
|
||||
<item><uref url="GSXMLDocument.html">GSXMLDocument</uref></item>
|
||||
<item><uref url="GSXMLParser.html">GSXMParser</uref></item>
|
||||
</list>
|
||||
</section>
|
||||
</chapter>
|
||||
</body>
|
||||
</gsdoc>
|
||||
|
28
Documentation/gsdoc/GSMime.html
Normal file
28
Documentation/gsdoc/GSMime.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<html><head>
|
||||
<title>GNUstep MIME parser</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href ="Base.html">[Up]</a>
|
||||
<h1>GNUstep MIME parser</h1>
|
||||
<h3>Authors </h3>
|
||||
<dl>
|
||||
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Richard Frith-Macdonald</a>
|
||||
<dd>
|
||||
</dl>
|
||||
<p>Version: 0.1</p>
|
||||
<p>Date: 26 Ovctober, 2000</p>
|
||||
<h2><a name ="cont-0">Mime Parser</a></h2>
|
||||
<p>
|
||||
|
||||
The GNUstep Mime parser. This is collection Objective-C classes
|
||||
for representing MIME (and HTTP) documents and managing conversions
|
||||
to and from convenient internal formats.
|
||||
</p>
|
||||
<h3><a name ="cont-1">The classes</a></h3>
|
||||
<ul>
|
||||
<li><a href ="GSXMLDocument.html">GSXMLDocument</a>
|
||||
<li><a href ="GSXMLParser.html">GSXMParser</a>
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
</html>
|
182
Documentation/gsdoc/GSMimeDocument.gsdoc
Normal file
182
Documentation/gsdoc/GSMimeDocument.gsdoc
Normal file
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
|
||||
<gsdoc base="GSMimeDocument" next="GSMimeParser" up="GSMime">
|
||||
<head>
|
||||
<title>GSMimeDocument</title>
|
||||
<author name="Richard Frith-Macdonald">
|
||||
<email address="rfm@gnu.org"/>
|
||||
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
|
||||
</author>
|
||||
<version>0.1</version>
|
||||
<date>25 October, 2000</date>
|
||||
</head>
|
||||
<body>
|
||||
<chapter>
|
||||
<heading>GSMimeDocument</heading>
|
||||
<class name="GSMimeDocument" super="NSObject">
|
||||
<declared>Foundation/GSMime.h</declared>
|
||||
<conform>NSObject</conform>
|
||||
<desc>
|
||||
<p>
|
||||
This class is intended to provide a wrapper for MIME messages
|
||||
permitting easy access to the contents of a message and
|
||||
providing a basis for parsing an unparsing messages that
|
||||
have arrived via email or as a web document.
|
||||
</p>
|
||||
<p>
|
||||
The class keeps track of all the document headers, and provides
|
||||
methods for modifying the headers that apply to a document and
|
||||
for looking at the header structures, by providing an info
|
||||
dictionary containing the various parts of a header.
|
||||
</p>
|
||||
<p>
|
||||
The common dictionary keys used for elements provided for
|
||||
<em>all</em> headers are -
|
||||
</p>
|
||||
<deflist>
|
||||
<term>RawHeader</term>
|
||||
<desc>This is the unmodified text of the header
|
||||
</desc>
|
||||
<term>BaseName</term>
|
||||
<desc>This is the header name.
|
||||
</desc>
|
||||
<term>BaseValue</term>
|
||||
<desc>This is the text after the header name and colon.
|
||||
</desc>
|
||||
<term>Name</term>
|
||||
<desc>This is a lowercase representation of the header name.
|
||||
</desc>
|
||||
<term>Value</term>
|
||||
<desc>This is the value of the header (normally lower case).
|
||||
</desc>
|
||||
</deflist>
|
||||
<p>
|
||||
</p>
|
||||
</desc>
|
||||
<method type="GSMimeDocument*" factory="yes">
|
||||
<sel>mimeDocument</sel>
|
||||
<desc>
|
||||
Create an empty MIME document.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="BOOL">
|
||||
<sel>addHeader:</sel>
|
||||
<arg type="NSString*">aHeader</arg>
|
||||
<desc>
|
||||
This method may be called to add a header to the document.
|
||||
The header must be a single line of text in the standard
|
||||
format (begining with a name and a colon). It will be
|
||||
added after all other headers in the document.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="NSData*">
|
||||
<sel>boundary</sel>
|
||||
<desc>
|
||||
For a multipart document, return the raw data used to
|
||||
delimit the parts of the document.
|
||||
Otherwise, return nil.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="id">
|
||||
<sel>content</sel>
|
||||
<desc>
|
||||
This returns the content data of the document in the
|
||||
appropriate format for the type of data -
|
||||
<deflist>
|
||||
<term>text</term>
|
||||
<desc>an NSString object</desc>
|
||||
<term>binary</term>
|
||||
<desc>an NSData object</desc>
|
||||
<term>multipart</term>
|
||||
<desc>an NSArray object containing GSMimeDocument objects</desc>
|
||||
</deflist>
|
||||
</desc>
|
||||
</method>
|
||||
<method type="void">
|
||||
<sel>deleteHeader:</sel>
|
||||
<arg type="NSString*">aHeader</arg>
|
||||
<desc>
|
||||
This method removes all occurrances of headers whose raw data
|
||||
exactly matches the supplied string.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="void">
|
||||
<sel>deleteHeaderNamed:</sel>
|
||||
<arg type="NSString*">aName</arg>
|
||||
<desc>
|
||||
This method removes all occurrances of headers whose name
|
||||
matches the supplied string.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="NSArray">
|
||||
<sel>infoForAllHeaders</sel>
|
||||
<desc>
|
||||
This method returns an array containing info dictionaries that
|
||||
represent all the headers of the document.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="NSDictionary*">
|
||||
<sel>infoForHeaderNamed:</sel>
|
||||
<arg type="NSString*">aName</arg>
|
||||
<desc>
|
||||
This method returns the info dictionary for the first header
|
||||
whose name equals the supplied argument.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="NSArray*">
|
||||
<sel>infoForHeadersNamed:</sel>
|
||||
<arg type="NSString*">aName</arg>
|
||||
<desc>
|
||||
This method returns an array of info dictionaries for all headers
|
||||
whose names equal the supplied argument.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="BOOL">
|
||||
<sel>parseHeader:</sel>
|
||||
<arg type="NSScanner*">aScanner</arg>
|
||||
<sel>named:</sel>
|
||||
<arg type="NSString*">aName</arg>
|
||||
<sel>inTo:</sel>
|
||||
<arg type="NSMutableDictionary*">info</arg>
|
||||
<desc>
|
||||
This method is called to parse a header line and split its
|
||||
contents into an info dictionary.
|
||||
<p>
|
||||
On entry, the dictionary is already partially filled,
|
||||
the name argument is a lowercase representation of the
|
||||
header name, and the scanner is set to a scan location
|
||||
immediately after the colon in the header string.
|
||||
</p>
|
||||
<p>
|
||||
If the header is parsed successfully, the method should
|
||||
return YES, otherwise NO.
|
||||
</p>
|
||||
<p>
|
||||
You should not call this method directly yourself, but may
|
||||
override it to support parsing of new headers.
|
||||
</p>
|
||||
</desc>
|
||||
</method>
|
||||
<method type="BOOL">
|
||||
<sel>setContent:</sel>
|
||||
<arg type="id">newContent</arg>
|
||||
<desc>
|
||||
Sets a new value for the content of the document.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="BOOL">
|
||||
<sel>setHeader:</sel>
|
||||
<arg type="NSString*">aHeader</arg>
|
||||
<desc>
|
||||
This method may be called to set a header in the document.
|
||||
The header must be a single line of text in the standard
|
||||
format (begining with a name and a colon). It will be
|
||||
added after all other headers in the document.
|
||||
Any other headers with the same name will be removed from
|
||||
the document.
|
||||
</desc>
|
||||
</method>
|
||||
</class>
|
||||
</chapter>
|
||||
</body>
|
||||
</gsdoc>
|
208
Documentation/gsdoc/GSMimeDocument.html
Normal file
208
Documentation/gsdoc/GSMimeDocument.html
Normal file
|
@ -0,0 +1,208 @@
|
|||
<html><head>
|
||||
<title>GSMimeDocument</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href ="GSMime.html">[Up]</a>
|
||||
<a href ="GSMimeParser.html">[Next]</a>
|
||||
<h1>GSMimeDocument</h1>
|
||||
<h3>Authors </h3>
|
||||
<dl>
|
||||
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Richard Frith-Macdonald</a>
|
||||
<dd>
|
||||
</dl>
|
||||
<p>Version: 0.1</p>
|
||||
<p>Date: 25 October, 2000</p>
|
||||
<h2><a name ="cont-0">GSMimeDocument</a></h2>
|
||||
<h2><a name ="GSMimeDocument">GSMimeDocument</a></h2>
|
||||
<p><b>Declared in: </b> Foundation/GSMime.h</p>
|
||||
<p><b>Inherits from: </b> NSObject</p>
|
||||
<p><b>Conforms to: </b> NSObject
|
||||
</p>
|
||||
<hr>
|
||||
|
||||
<p>
|
||||
|
||||
This class is intended to provide a wrapper for MIME messages
|
||||
permitting easy access to the contents of a message and
|
||||
providing a basis for parsing an unparsing messages that
|
||||
have arrived via email or as a web document.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
The class keeps track of all the document headers, and provides
|
||||
methods for modifying the headers that apply to a document and
|
||||
for looking at the header structures, by providing an info
|
||||
dictionary containing the various parts of a header.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
The common dictionary keys used for elements provided for
|
||||
<em>all</em> headers are -
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt>RawHeader
|
||||
<dd>This is the unmodified text of the header
|
||||
|
||||
<dt>BaseName
|
||||
<dd>This is the header name.
|
||||
|
||||
<dt>BaseValue
|
||||
<dd>This is the text after the header name and colon.
|
||||
|
||||
<dt>Name
|
||||
<dd>This is a lowercase representation of the header name.
|
||||
|
||||
<dt>Value
|
||||
<dd>This is the value of the header (normally lower case).
|
||||
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Instance Variables </h2>
|
||||
<ul>
|
||||
</ul>
|
||||
<h2>Methods </h2>
|
||||
<ul>
|
||||
<li><a href ="GSMimeDocument.html#method-0">+mimeDocument</a>
|
||||
<li><a href ="GSMimeDocument.html#method-1">-addHeader:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-2">-boundary</a>
|
||||
<li><a href ="GSMimeDocument.html#method-3">-content</a>
|
||||
<li><a href ="GSMimeDocument.html#method-4">-deleteHeader:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-5">-deleteHeaderNamed:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-6">-infoForAllHeaders</a>
|
||||
<li><a href ="GSMimeDocument.html#method-7">-infoForHeaderNamed:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-8">-infoForHeadersNamed:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-9">-parseHeader:named:inTo:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-10">-setContent:</a>
|
||||
<li><a href ="GSMimeDocument.html#method-11">-setHeader:</a>
|
||||
</ul>
|
||||
<hr><h2>Class Methods </h2>
|
||||
<h3><a name ="method-0">mimeDocument</a></h3>
|
||||
+ (GSMimeDocument*) <b>mimeDocument</b>;<br>
|
||||
|
||||
Create an empty MIME document.
|
||||
|
||||
<hr>
|
||||
<hr><h2>Instances Methods </h2>
|
||||
<h3><a name ="method-1">addHeader:</a></h3>
|
||||
- (BOOL) <b>addHeader:</b> (NSString*)aHeader;<br>
|
||||
|
||||
This method may be called to add a header to the document.
|
||||
The header must be a single line of text in the standard
|
||||
format (begining with a name and a colon). It will be
|
||||
added after all other headers in the document.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-2">boundary</a></h3>
|
||||
- (NSData*) <b>boundary</b>;<br>
|
||||
|
||||
For a multipart document, return the raw data used to
|
||||
delimit the parts of the document.
|
||||
Otherwise, return nil.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-3">content</a></h3>
|
||||
- (id) <b>content</b>;<br>
|
||||
|
||||
This returns the content data of the document in the
|
||||
appropriate format for the type of data -
|
||||
<dl>
|
||||
<dt>text
|
||||
<dd>an NSString object
|
||||
<dt>binary
|
||||
<dd>an NSData object
|
||||
<dt>multipart
|
||||
<dd>an NSArray object containing GSMimeDocument objects
|
||||
</dl>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-4">deleteHeader:</a></h3>
|
||||
- (void) <b>deleteHeader:</b> (NSString*)aHeader;<br>
|
||||
|
||||
This method removes all occurrances of headers whose raw data
|
||||
exactly matches the supplied string.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-5">deleteHeaderNamed:</a></h3>
|
||||
- (void) <b>deleteHeaderNamed:</b> (NSString*)aName;<br>
|
||||
|
||||
This method removes all occurrances of headers whose name
|
||||
matches the supplied string.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-6">infoForAllHeaders</a></h3>
|
||||
- (NSArray) <b>infoForAllHeaders</b>;<br>
|
||||
|
||||
This method returns an array containing info dictionaries that
|
||||
represent all the headers of the document.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-7">infoForHeaderNamed:</a></h3>
|
||||
- (NSDictionary*) <b>infoForHeaderNamed:</b> (NSString*)aName;<br>
|
||||
|
||||
This method returns the info dictionary for the first header
|
||||
whose name equals the supplied argument.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-8">infoForHeadersNamed:</a></h3>
|
||||
- (NSArray*) <b>infoForHeadersNamed:</b> (NSString*)aName;<br>
|
||||
|
||||
This method returns an array of info dictionaries for all headers
|
||||
whose names equal the supplied argument.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-9">parseHeader:named:inTo:</a></h3>
|
||||
- (BOOL) <b>parseHeader:</b> (NSScanner*)aScanner <b>named:</b> (NSString*)aName <b>inTo:</b> (NSMutableDictionary*)info;<br>
|
||||
|
||||
This method is called to parse a header line and split its
|
||||
contents into an info dictionary.
|
||||
<p>
|
||||
|
||||
On entry, the dictionary is already partially filled,
|
||||
the name argument is a lowercase representation of the
|
||||
header name, and the scanner is set to a scan location
|
||||
immediately after the colon in the header string.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
If the header is parsed successfully, the method should
|
||||
return YES, otherwise NO.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
You should not call this method directly yourself, but may
|
||||
override it to support parsing of new headers.
|
||||
</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-10">setContent:</a></h3>
|
||||
- (BOOL) <b>setContent:</b> (id)newContent;<br>
|
||||
|
||||
Sets a new value for the content of the document.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-11">setHeader:</a></h3>
|
||||
- (BOOL) <b>setHeader:</b> (NSString*)aHeader;<br>
|
||||
|
||||
This method may be called to set a header in the document.
|
||||
The header must be a single line of text in the standard
|
||||
format (begining with a name and a colon). It will be
|
||||
added after all other headers in the document.
|
||||
Any other headers with the same name will be removed from
|
||||
the document.
|
||||
|
||||
<hr>
|
||||
</body>
|
||||
|
||||
</html>
|
61
Documentation/gsdoc/GSMimeParser.gsdoc
Normal file
61
Documentation/gsdoc/GSMimeParser.gsdoc
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
|
||||
<gsdoc base="GSMimeParser" prev="GSMimeDocument" up="GSMime">
|
||||
<head>
|
||||
<title>GSMimeParser</title>
|
||||
<author name="Richard Frith-Macdonald">
|
||||
<email address="rfm@gnu.org"/>
|
||||
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
|
||||
</author>
|
||||
<version>0.1</version>
|
||||
<date>26 October, 2000</date>
|
||||
</head>
|
||||
<body>
|
||||
<chapter>
|
||||
<heading>GSMimeParser</heading>
|
||||
<class name="GSMimeParser" super="NSObject">
|
||||
<declared>Foundation/GSMime.h</declared>
|
||||
<conform>NSObject</conform>
|
||||
<desc>
|
||||
<p>
|
||||
This class provides support for parsing MIME messages
|
||||
into GSMimeDocument objects. It is imtimately related
|
||||
to the GSMimeDocument class and relys on that class for
|
||||
aspects of the parsing operation.
|
||||
</p>
|
||||
</desc>
|
||||
<method type="GSMimeParser*" factory="yes">
|
||||
<sel>mimeParser</sel>
|
||||
<desc>
|
||||
Create a parser.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="BOOL">
|
||||
<sel>parse:</sel>
|
||||
<arg type="NSData*">rawData</arg>
|
||||
<desc>
|
||||
This method is called repeatedly to pass raw mime data into
|
||||
the parser. It should be called with a nil argument at the
|
||||
end of the data - to inform the parser that it has been given
|
||||
all the available information.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="GSMimeDocument*">
|
||||
<sel>document</sel>
|
||||
<desc>
|
||||
Returns the object into which raw mime data is being parsed.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="BOOL">
|
||||
<sel>parsingHeaders</sel>
|
||||
<desc>
|
||||
Returns YES if the parser is expecting to read mime headers,
|
||||
Returns NO is the parser has already been passed all the
|
||||
data containing headers, and is now waiting for the body of
|
||||
trhe mime message (or has been passed all data).
|
||||
</desc>
|
||||
</method>
|
||||
</class>
|
||||
</chapter>
|
||||
</body>
|
||||
</gsdoc>
|
76
Documentation/gsdoc/GSMimeParser.html
Normal file
76
Documentation/gsdoc/GSMimeParser.html
Normal file
|
@ -0,0 +1,76 @@
|
|||
<html><head>
|
||||
<title>GSMimeParser</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href ="GSMimeDocument.html">[Previous]</a>
|
||||
<a href ="GSMime.html">[Up]</a>
|
||||
<h1>GSMimeParser</h1>
|
||||
<h3>Authors </h3>
|
||||
<dl>
|
||||
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Richard Frith-Macdonald</a>
|
||||
<dd>
|
||||
</dl>
|
||||
<p>Version: 0.1</p>
|
||||
<p>Date: 26 October, 2000</p>
|
||||
<h2><a name ="cont-0">GSMimeParser</a></h2>
|
||||
<h2><a name ="GSMimeParser">GSMimeParser</a></h2>
|
||||
<p><b>Declared in: </b> Foundation/GSMime.h</p>
|
||||
<p><b>Inherits from: </b> NSObject</p>
|
||||
<p><b>Conforms to: </b> NSObject
|
||||
</p>
|
||||
<hr>
|
||||
|
||||
<p>
|
||||
|
||||
This class provides support for parsing MIME messages
|
||||
into GSMimeDocument objects. It is imtimately related
|
||||
to the GSMimeDocument class and relys on that class for
|
||||
aspects of the parsing operation.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Instance Variables </h2>
|
||||
<ul>
|
||||
</ul>
|
||||
<h2>Methods </h2>
|
||||
<ul>
|
||||
<li><a href ="GSMimeParser.html#method-0">+mimeParser</a>
|
||||
<li><a href ="GSMimeParser.html#method-2">-document</a>
|
||||
<li><a href ="GSMimeParser.html#method-1">-parse:</a>
|
||||
<li><a href ="GSMimeParser.html#method-3">-parsingHeaders</a>
|
||||
</ul>
|
||||
<hr><h2>Class Methods </h2>
|
||||
<h3><a name ="method-0">mimeParser</a></h3>
|
||||
+ (GSMimeParser*) <b>mimeParser</b>;<br>
|
||||
|
||||
Create a parser.
|
||||
|
||||
<hr>
|
||||
<hr><h2>Instances Methods </h2>
|
||||
<h3><a name ="method-1">parse:</a></h3>
|
||||
- (BOOL) <b>parse:</b> (NSData*)rawData;<br>
|
||||
|
||||
This method is called repeatedly to pass raw mime data into
|
||||
the parser. It should be called with a nil argument at the
|
||||
end of the data - to inform the parser that it has been given
|
||||
all the available information.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-2">document</a></h3>
|
||||
- (GSMimeDocument*) <b>document</b>;<br>
|
||||
|
||||
Returns the object into which raw mime data is being parsed.
|
||||
|
||||
<hr>
|
||||
<h3><a name ="method-3">parsingHeaders</a></h3>
|
||||
- (BOOL) <b>parsingHeaders</b>;<br>
|
||||
|
||||
Returns YES if the parser is expecting to read mime headers,
|
||||
Returns NO is the parser has already been passed all the
|
||||
data containing headers, and is now waiting for the body of
|
||||
trhe mime message (or has been passed all data).
|
||||
|
||||
<hr>
|
||||
</body>
|
||||
|
||||
</html>
|
82
Headers/gnustep/base/GSMime.h
Normal file
82
Headers/gnustep/base/GSMime.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
|
||||
/* Interface for MIME parsing classes
|
||||
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
Date: October 2000
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __GSMIME_H__
|
||||
#define __GSMIME_H__
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSScanner.h>
|
||||
|
||||
@interface GSMimeDocument : NSObject
|
||||
{
|
||||
NSMutableArray *headers;
|
||||
id content;
|
||||
NSData *boundary;
|
||||
}
|
||||
|
||||
+ (GSMimeDocument*) mimeDocument;
|
||||
|
||||
- (BOOL) addHeader: (NSString*)aHeader;
|
||||
- (NSData*) boundary;
|
||||
- (id) content;
|
||||
- (void) deleteHeader: (NSString*)aHeader;
|
||||
- (void) deleteHeaderNamed: (NSString*)aName;
|
||||
- (NSArray*) infoForAllHeaders;
|
||||
- (NSDictionary*) infoForHeaderNamed: (NSString*)name;
|
||||
- (NSArray*) infoForHeadersNamed: (NSString*)name;
|
||||
- (BOOL) parseHeader: (NSScanner*)aScanner
|
||||
named: (NSString*)name
|
||||
inTo: (NSMutableDictionary*)info;
|
||||
- (BOOL) setContent: (id)newContent;
|
||||
- (BOOL) setHeader: (NSString*)aHeader;
|
||||
|
||||
@end
|
||||
|
||||
@interface GSMimeParser : NSObject
|
||||
{
|
||||
NSMutableData *data;
|
||||
unsigned char *bytes;
|
||||
unsigned dataEnd;
|
||||
unsigned sectionStart;
|
||||
unsigned lineStart;
|
||||
unsigned lineEnd;
|
||||
unsigned input;
|
||||
BOOL inBody;
|
||||
GSMimeDocument *document;
|
||||
}
|
||||
|
||||
+ (GSMimeParser*) mimeParser;
|
||||
|
||||
- (GSMimeDocument*) document;
|
||||
- (BOOL) parse: (NSData*)input;
|
||||
- (BOOL) parsedHeaders;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
|
@ -229,6 +229,7 @@ objc-load.m
|
|||
ifeq ($(HAVE_LIBXML),1)
|
||||
BASE_MFILES += GSXML.m
|
||||
endif
|
||||
BASE_MFILES += GSMime.m
|
||||
|
||||
NSVALUE_MFILES = \
|
||||
NSValue0.m NSValue1.m NSValue2.m NSValue3.m \
|
||||
|
|
1683
Source/GSMime.m
Normal file
1683
Source/GSMime.m
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue