Improved mime parsing API and fixed NSUserDefaults bug.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-11-16 12:10:37 +00:00
parent 2e4af295f9
commit 79c8d059a9
10 changed files with 827 additions and 763 deletions

View file

@ -1,3 +1,13 @@
2000-11-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: ([-userLanguages]) updated to ensure we
don't get empty strings in the language list.
* Headers/Foundation/GSMime.h: Revised API
* Source/GSMime.m: Revised API to make more sense
* Documentation/gsdoc/GSMime.gsdoc: ditto
* Documentation/gsdoc/GSMimeDocument.gsdoc: ditto
* Documentation/gsdoc/GSMimeParser.gsdoc: ditto
2000-11-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURL.m: ([-explode]) bugfix for parsing username/password

View file

@ -7,8 +7,8 @@
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>0.1</version>
<date>26 Ovctober, 2000</date>
<version>0.2</version>
<date>16 November, 2000</date>
</head>
<body>
<chapter>
@ -21,8 +21,8 @@
<section>
<heading>The classes</heading>
<list>
<item><uref url="GSXMLDocument.html">GSXMLDocument</uref></item>
<item><uref url="GSXMLParser.html">GSXMParser</uref></item>
<item><uref url="GSMimeDocument.html">GSMimeDocument</uref></item>
<item><uref url="GSMimeParser.html">GSMimearser</uref></item>
</list>
</section>
</chapter>

View file

@ -9,8 +9,8 @@
<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>
<p>Version: 0.2</p>
<p>Date: 16 November, 2000</p>
<h2><a name ="cont-0">Mime Parser</a></h2>
<p>
@ -20,8 +20,8 @@
</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>
<li><a href ="GSMimeDocument.html">GSMimeDocument</a>
<li><a href ="GSMimeParser.html">GSMimearser</a>
</ul>
</body>

View file

@ -7,8 +7,8 @@
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>0.1</version>
<date>25 October, 2000</date>
<version>0.2</version>
<date>16 November, 2000</date>
</head>
<body>
<chapter>
@ -62,23 +62,29 @@
<method type="BOOL">
<sel>addHeader:</sel>
<arg type="NSString*">aHeader</arg>
<arg type="NSDictionary*">headerInfo</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.
<p>
This method may be called to add a header to the document.
The header must be a mutable dictionary object that contains
at least the fields that are standard for all headers.
</p>
</desc>
</method>
<method type="NSData*">
<sel>boundary</sel>
<method type="NSArray">
<sel>allHeaders</sel>
<desc>
For a multipart document, return the raw data used to
delimit the parts of the document.
Otherwise, return nil.
</desc>
</method>
<p>
This method returns an array containing NSDictionary objects
representing the headers associated with the document.
</p>
<p>
The order of the headers in the array is the order of the
headers in the document.
</p>
</desc>
</method>
<method type="id">
<sel>content</sel>
@ -98,7 +104,7 @@
<method type="void">
<sel>deleteHeader:</sel>
<arg type="NSString*">aHeader</arg>
<arg type="NSString*">rawHeader</arg>
<desc>
This method removes all occurrances of headers whose raw data
exactly matches the supplied string.
@ -114,16 +120,8 @@
</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>
<sel>headerNamed:</sel>
<arg type="NSString*">aName</arg>
<desc>
This method returns the info dictionary for the first header
@ -132,7 +130,7 @@
</method>
<method type="NSArray*">
<sel>infoForHeadersNamed:</sel>
<sel>headersNamed:</sel>
<arg type="NSString*">aName</arg>
<desc>
This method returns an array of info dictionaries for all headers
@ -140,59 +138,6 @@
</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="NSString*">
<sel>scanSpecial:</sel>
<arg type="NSScanner*">aScanner</arg>
<desc>
A convenience method to use a scanner (that is set up to scan a
header line) to scan in a special character that terminated a
token previously scanned. If the token was terminated by
whitespace and no other special character, the string returned
will contain a single space character.
</desc>
</method>
<method type="NSString*">
<sel>scanToken:</sel>
<arg type="NSScanner*">aScanner</arg>
<desc>
A convenience method to use a scanner (that is set up to scan a
header line) to scan a header token - either a quoted string or
a simple word.
<list>
<item>Leading whitespace is ignored.</item>
<item>Backslash escapes in quoted text are converted</item>
</list>
</desc>
</method>
<method type="BOOL">
<sel>setContent:</sel>
<arg type="id">newContent</arg>
@ -203,12 +148,9 @@
<method type="BOOL">
<sel>setHeader:</sel>
<arg type="NSString*">aHeader</arg>
<arg type="NSDictionary*">headerInfo</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>

View file

@ -10,8 +10,8 @@
<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>
<p>Version: 0.2</p>
<p>Date: 16 November, 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>
@ -72,18 +72,14 @@
<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-2">-allHeaders</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">-scanSpecial:</a>
<li><a href ="GSMimeDocument.html#method-11">-scanToken:</a>
<li><a href ="GSMimeDocument.html#method-12">-setContent:</a>
<li><a href ="GSMimeDocument.html#method-13">-setHeader:</a>
<li><a href ="GSMimeDocument.html#method-6">-headerNamed:</a>
<li><a href ="GSMimeDocument.html#method-7">-headersNamed:</a>
<li><a href ="GSMimeDocument.html#method-8">-setContent:</a>
<li><a href ="GSMimeDocument.html#method-9">-setHeader:</a>
</ul>
<hr><h2>Class Methods </h2>
<h3><a name ="method-0">mimeDocument</a></h3>
@ -94,21 +90,33 @@
<hr>
<hr><h2>Instances Methods </h2>
<h3><a name ="method-1">addHeader:</a></h3>
- (BOOL) <b>addHeader:</b> (NSString*)aHeader;<br>
- (BOOL) <b>addHeader:</b> (NSDictionary*)headerInfo;<br>
<p>
This method may be called to add a header to the document.
The header must be a mutable dictionary object that contains
at least the fields that are standard for all headers.
</p>
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>
<h3><a name ="method-2">allHeaders</a></h3>
- (NSArray) <b>allHeaders</b>;<br>
For a multipart document, return the raw data used to
delimit the parts of the document.
Otherwise, return nil.
<p>
This method returns an array containing NSDictionary objects
representing the headers associated with the document.
</p>
<p>
The order of the headers in the array is the order of the
headers in the document.
</p>
<hr>
<h3><a name ="method-3">content</a></h3>
- (id) <b>content</b>;<br>
@ -127,7 +135,7 @@
<hr>
<h3><a name ="method-4">deleteHeader:</a></h3>
- (void) <b>deleteHeader:</b> (NSString*)aHeader;<br>
- (void) <b>deleteHeader:</b> (NSString*)rawHeader;<br>
This method removes all occurrances of headers whose raw data
exactly matches the supplied string.
@ -140,90 +148,30 @@
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>
<h3><a name ="method-6">headerNamed:</a></h3>
- (NSDictionary*) <b>headerNamed:</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>
<h3><a name ="method-7">headersNamed:</a></h3>
- (NSArray*) <b>headersNamed:</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">scanSpecial:</a></h3>
- (NSString*) <b>scanSpecial:</b> (NSScanner*)aScanner;<br>
A convenience method to use a scanner (that is set up to scan a
header line) to scan in a special character that terminated a
token previously scanned. If the token was terminated by
whitespace and no other special character, the string returned
will contain a single space character.
<hr>
<h3><a name ="method-11">scanToken:</a></h3>
- (NSString*) <b>scanToken:</b> (NSScanner*)aScanner;<br>
A convenience method to use a scanner (that is set up to scan a
header line) to scan a header token - either a quoted string or
a simple word.
<ul>
<li>Leading whitespace is ignored.
<li>Backslash escapes in quoted text are converted
</ul>
<hr>
<h3><a name ="method-12">setContent:</a></h3>
<h3><a name ="method-8">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-13">setHeader:</a></h3>
- (BOOL) <b>setHeader:</b> (NSString*)aHeader;<br>
<h3><a name ="method-9">setHeader:</a></h3>
- (BOOL) <b>setHeader:</b> (NSDictionary*)headerInfo;<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.

View file

@ -7,8 +7,8 @@
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>0.1</version>
<date>26 October, 2000</date>
<version>0.2</version>
<date>16 November, 2000</date>
</head>
<body>
<chapter>
@ -24,12 +24,21 @@
aspects of the parsing operation.
</p>
</desc>
<method type="GSMimeParser*" factory="yes">
<sel>mimeParser</sel>
<desc>
Create a parser.
</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>parse:</sel>
<arg type="NSData*">rawData</arg>
@ -40,12 +49,30 @@
all the available information.
</desc>
</method>
<method type="GSMimeDocument*">
<sel>document</sel>
<method type="BOOL">
<sel>parseHeader:</sel>
<arg type="NSString*">aRawHeader</arg>
<desc>
Returns the object into which raw mime data is being parsed.
</desc>
</method>
<p>
This method is called to parse a header line <em>for the
current document</em>, split its contents into an info
dictionary, and add that information to the document.
</p>
<p>
The standard implementation of this method scans basic
information and then calls <code>scanHeaders:named:into:</code>
to complete the parsing of the header.
</p>
<p>
This method also performs consistency checks on headers scanned
so it is recommended that it is not overridden, but that
subclasses override <code>scanHeaders:named:into:</code> to
implement custom scanning.
</p>
</desc>
</method>
<method type="BOOL">
<sel>parsingHeaders</sel>
<desc>
@ -55,6 +82,62 @@
trhe mime message (or has been passed all data).
</desc>
</method>
<method type="BOOL">
<sel>scanHeader:</sel>
<arg type="NSScanner*">aScanner</arg>
<sel>named:</sel>
<arg type="NSString*">aName</arg>
<sel>inTo:</sel>
<arg type="NSMutableDictionary*">info</arg>
<desc>
<p>
This method is called to parse a header line and split its
contents into an info dictionary.
</p>
<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="NSString*">
<sel>scanSpecial:</sel>
<arg type="NSScanner*">aScanner</arg>
<desc>
A convenience method to use a scanner (that is set up to scan a
header line) to scan in a special character that terminated a
token previously scanned. If the token was terminated by
whitespace and no other special character, the string returned
will contain a single space character.
</desc>
</method>
<method type="NSString*">
<sel>scanToken:</sel>
<arg type="NSScanner*">aScanner</arg>
<desc>
A convenience method to use a scanner (that is set up to scan a
header line) to scan a header token - either a quoted string or
a simple word.
<list>
<item>Leading whitespace is ignored.</item>
<item>Backslash escapes in quoted text are converted</item>
</list>
</desc>
</method>
</class>
</chapter>
</body>

View file

@ -10,8 +10,8 @@
<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>
<p>Version: 0.2</p>
<p>Date: 16 November, 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>
@ -35,9 +35,13 @@
<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>
<li><a href ="GSMimeParser.html#method-1">-document</a>
<li><a href ="GSMimeParser.html#method-2">-parse:</a>
<li><a href ="GSMimeParser.html#method-3">-parseHeader:</a>
<li><a href ="GSMimeParser.html#method-4">-parsingHeaders</a>
<li><a href ="GSMimeParser.html#method-5">-scanHeader:named:inTo:</a>
<li><a href ="GSMimeParser.html#method-6">-scanSpecial:</a>
<li><a href ="GSMimeParser.html#method-7">-scanToken:</a>
</ul>
<hr><h2>Class Methods </h2>
<h3><a name ="method-0">mimeParser</a></h3>
@ -47,7 +51,13 @@
<hr>
<hr><h2>Instances Methods </h2>
<h3><a name ="method-1">parse:</a></h3>
<h3><a name ="method-1">document</a></h3>
- (GSMimeDocument*) <b>document</b>;<br>
Returns the object into which raw mime data is being parsed.
<hr>
<h3><a name ="method-2">parse:</a></h3>
- (BOOL) <b>parse:</b> (NSData*)rawData;<br>
This method is called repeatedly to pass raw mime data into
@ -56,13 +66,34 @@
all the available information.
<hr>
<h3><a name ="method-2">document</a></h3>
- (GSMimeDocument*) <b>document</b>;<br>
<h3><a name ="method-3">parseHeader:</a></h3>
- (BOOL) <b>parseHeader:</b> (NSString*)aRawHeader;<br>
Returns the object into which raw mime data is being parsed.
<p>
This method is called to parse a header line <em>for the
current document</em>, split its contents into an info
dictionary, and add that information to the document.
</p>
<p>
The standard implementation of this method scans basic
information and then calls <code>scanHeaders:named:into:</code>
to complete the parsing of the header.
</p>
<p>
This method also performs consistency checks on headers scanned
so it is recommended that it is not overridden, but that
subclasses override <code>scanHeaders:named:into:</code> to
implement custom scanning.
</p>
<hr>
<h3><a name ="method-3">parsingHeaders</a></h3>
<h3><a name ="method-4">parsingHeaders</a></h3>
- (BOOL) <b>parsingHeaders</b>;<br>
Returns YES if the parser is expecting to read mime headers,
@ -70,6 +101,60 @@
data containing headers, and is now waiting for the body of
trhe mime message (or has been passed all data).
<hr>
<h3><a name ="method-5">scanHeader:named:inTo:</a></h3>
- (BOOL) <b>scanHeader:</b> (NSScanner*)aScanner <b>named:</b> (NSString*)aName <b>inTo:</b> (NSMutableDictionary*)info;<br>
<p>
This method is called to parse a header line and split its
contents into an info dictionary.
</p>
<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-6">scanSpecial:</a></h3>
- (NSString*) <b>scanSpecial:</b> (NSScanner*)aScanner;<br>
A convenience method to use a scanner (that is set up to scan a
header line) to scan in a special character that terminated a
token previously scanned. If the token was terminated by
whitespace and no other special character, the string returned
will contain a single space character.
<hr>
<h3><a name ="method-7">scanToken:</a></h3>
- (NSString*) <b>scanToken:</b> (NSScanner*)aScanner;<br>
A convenience method to use a scanner (that is set up to scan a
header line) to scan a header token - either a quoted string or
a simple word.
<ul>
<li>Leading whitespace is ignored.
<li>Backslash escapes in quoted text are converted
</ul>
<hr>
</body>

View file

@ -43,26 +43,19 @@
{
NSMutableArray *headers;
id content;
NSData *boundary;
}
+ (GSMimeDocument*) mimeDocument;
- (BOOL) addHeader: (NSString*)aHeader;
- (NSData*) boundary;
- (BOOL) addHeader: (NSDictionary*)headerInfo;
- (NSArray*) allHeaders;
- (id) content;
- (void) deleteHeader: (NSString*)aHeader;
- (void) deleteHeader: (NSString*)rawHeader;
- (void) deleteHeaderNamed: (NSString*)aName;
- (NSArray*) infoForAllHeaders;
- (NSDictionary*) infoForHeaderNamed: (NSString*)name;
- (NSArray*) infoForHeadersNamed: (NSString*)name;
- (BOOL) parseHeader: (NSScanner*)aScanner
named: (NSString*)name
inTo: (NSMutableDictionary*)info;
- (NSString*) scanSpecial: (NSScanner*)aScanner;
- (NSString*) scanToken: (NSScanner*)aScanner;
- (NSDictionary*) headerNamed: (NSString*)name;
- (NSArray*) headersNamed: (NSString*)name;
- (BOOL) setContent: (id)newContent;
- (BOOL) setHeader: (NSString*)aHeader;
- (BOOL) setHeader: (NSDictionary*)headerInfo;
@end
@ -76,6 +69,7 @@
unsigned lineEnd;
unsigned input;
BOOL inBody;
NSData *boundary;
GSMimeDocument *document;
GSMimeParser *child;
}
@ -84,7 +78,13 @@
- (GSMimeDocument*) document;
- (BOOL) parse: (NSData*)input;
- (BOOL) parseHeader: (NSString*)aRawHeader;
- (BOOL) parsedHeaders;
- (BOOL) scanHeader: (NSScanner*)aScanner
named: (NSString*)headerName
inTo: (NSMutableDictionary*)info;
- (NSString*) scanSpecial: (NSScanner*)aScanner;
- (NSString*) scanToken: (NSScanner*)aScanner;
@end

File diff suppressed because it is too large Load diff

View file

@ -290,53 +290,70 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
+ (NSArray*) userLanguages
{
NSArray *currLang = nil;
NSString *locale;
if (userLanguages)
return userLanguages;
NSArray *currLang = nil;
NSString *locale;
if (userLanguages != nil)
{
return userLanguages;
}
userLanguages = RETAIN([NSMutableArray arrayWithCapacity: 5]);
locale = GSSetLocale(@"");
if (sharedDefaults == nil)
{
/* Create our own defaults to get "Languages" since sharedDefaults
depends on us */
NSUserDefaults *tempDefaults;
NSUserDefaults *tempDefaults;
tempDefaults = [[self alloc] init];
if (tempDefaults)
if (tempDefaults != nil)
{
[tempDefaults __createStandardSearchList];
currLang = [tempDefaults stringArrayForKey: @"Languages"];
currLang = [tempDefaults stringArrayForKey: @"Languages"];
RELEASE(tempDefaults);
}
}
else
currLang = [[self standardUserDefaults] stringArrayForKey: @"Languages"];
if (currLang == nil && locale && GSLanguageFromLocale(locale))
currLang = [NSArray arrayWithObject: GSLanguageFromLocale(locale)];
{
currLang = [[self standardUserDefaults] stringArrayForKey: @"Languages"];
}
if (currLang == nil && locale != 0 && GSLanguageFromLocale(locale))
{
currLang = [NSArray arrayWithObject: GSLanguageFromLocale(locale)];
}
if (currLang == nil)
{
const char *env_list;
NSString *env;
env_list = getenv("LANGUAGES");
if (env_list)
if (env_list != 0)
{
env = [NSStringClass stringWithCString: env_list];
currLang = RETAIN([env componentsSeparatedByString: @";"]);
currLang = [env componentsSeparatedByString: @";"];
}
}
if (currLang != nil)
[userLanguages addObjectsFromArray: currLang];
{
if ([currLang containsObject: @""] == YES)
{
NSMutableArray *a = [currLang mutableCopy];
[a removeObject: @""];
currLang = (NSArray*)AUTORELEASE(a);
}
[userLanguages addObjectsFromArray: currLang];
}
/* Check if "English" is included. We do this to make sure all the
required language constants are set somewhere if they aren't set
in the default language */
if ([userLanguages containsObject: @"English"] == NO)
[userLanguages addObject: @"English"];
{
[userLanguages addObject: @"English"];
}
return userLanguages;
}
@ -683,14 +700,18 @@ static NSString *pathForUser(NSString *user)
{
id arr = [self arrayForKey: defaultName];
if (arr)
if (arr != nil)
{
NSEnumerator *enumerator = [arr objectEnumerator];
id obj;
while ((obj = [enumerator nextObject]))
if ( ! [obj isKindOfClass: NSStringClass])
return nil;
{
if ([obj isKindOfClass: NSStringClass] == NO)
{
return nil;
}
}
return arr;
}
return nil;