/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGMime_NGConcreteMimeType_H__
#define __NGMime_NGConcreteMimeType_H__
and Hebrew may also include facilitites that allow the arbitrary mixing of text
segments with opposite writing directions.
- Beyond plain text, there are many formats for representing what might be known
- as "rich text". An interesting characteristic of many such representations is
- that they are to some extent readable even without the software that interprets
- them. It is useful, then, to distinguish them, at the highest level, from such
- unreadable data as images, audio, or text represented in an unreadable form. In
- the absence of appropriate interpretation software, it is reasonable to show
- subtypes of "text" to the user, while it is not reasonable to do so with most
- nontextual data. Such formatted textual data should be represented using
- subtypes of "text".
-
+ Beyond plain text, there are many formats for representing what might be
+ known as "rich text". An interesting characteristic of many such
+ representations is that they are to some extent readable even without the
+ software that interprets them. It is useful, then, to distinguish them, at
+ the highest level, from such unreadable data as images, audio, or text
+ represented in an unreadable form. In the absence of appropriate
+ interpretation software, it is reasonable to show subtypes of "text" to the
+ user, while it is not reasonable to do so with most nontextual data. Such
+ formatted textual data should be represented using subtypes of "text".
The format parameter is described in:
-
http://www.ietf.org/internet-drafts/draft-gellens-format-06.txt
*/
@interface NGConcreteTextMimeType : NGMimeType
NSString *name; // used in vcards
NSString *format;
NSString *method; // used in iCalendars (method=REQUEST)
+ NSString *replyType; // eg value 'response'
BOOL delsp;
float quality;
}
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#include "NGConcreteMimeType.h"
#include "common.h"
{
NSAssert([_type isEqualToString:NGMimeTypeText],
@"invalid use of concrete subclass ..");
-
+
if (textPlainNoCharset) {
if (_parameters == nil) {
if ([_subType isEqualToString:@"plain"]) {
subType = [_subType copy];
NSAssert(subType, @"subtype may not be nil");
{
- NSEnumerator *keys = [_parameters keyEnumerator];
- NSString *key = nil;
+ NSEnumerator *keys;
+ NSString *key;
- while ((key = [keys nextObject])) {
+ keys = [_parameters keyEnumerator];
+ while ((key = [keys nextObject]) != nil) {
NSAssert([key isKindOfClass:[NSString class]],
@"parameter name has to be a NSString");
[self->method release]; self->method = nil;
self->method = [[_parameters objectForKey:key] copy];
}
+ else if ([key isEqualToString:@"reply-type"]) {
+ [self->replyType release]; self->replyType = nil;
+ self->replyType = [[_parameters objectForKey:key] copy];
+ }
else if ([key isEqualToString:@"delsp"]) {
self->delsp = [[_parameters objectForKey:key] boolValue];
}
}
- (void)dealloc {
+ [self->replyType release];
[self->method release];
[self->format release];
[self->name release];
- (NSString *)method {
return self->method;
}
+- (NSString *)replyType {
+ return self->replyType;
+}
- (float)quality {
return self->quality;
}
}
- (NSEnumerator *)parameterNames {
- id args[5];
+ id args[6];
int argCount = 0;
if (self->charset) {
args[argCount] = @"method";
argCount++;
}
+ if (self->replyType) {
+ args[argCount] = @"reply-type";
+ argCount++;
+ }
if (argCount == 0)
return nil;
- (id)valueOfParameter:(NSString *)_parameterName {
if ([_parameterName isEqualToString:NGMimeParameterTextCharset])
return self->charset;
- else if ([_parameterName isEqualToString:@"name"])
+ if ([_parameterName isEqualToString:@"name"])
return self->name;
- else if ([_parameterName isEqualToString:@"format"])
+ if ([_parameterName isEqualToString:@"format"])
return self->format;
- else if ([_parameterName isEqualToString:@"method"])
+ if ([_parameterName isEqualToString:@"method"])
return self->method;
- else
- return nil;
+ if ([_parameterName isEqualToString:@"reply-type"])
+ return self->replyType;
+
+ return nil;
}
/* representations */
[d setObject:self->format forKey:@"format"];
if (self->method)
[d setObject:self->method forKey:@"method"];
-
+ if (self->replyType)
+ [d setObject:self->replyType forKey:@"reply-type"];
+
return d;
}
- (NSString *)stringValue {
- NSMutableString *str = [NSMutableString stringWithCapacity:20];
+ NSMutableString *str;
+
+ str = [NSMutableString stringWithCapacity:20];
[str appendString:NGMimeTypeText];
[str appendString:@"/"];
[str appendString:self->subType];
[str appendString:@"; method="];
[str appendString:self->method];
}
+ if (self->replyType) {
+ [str appendString:@"; reply-type="];
+ [str appendString:self->replyType];
+ }
return str;
}
return YES;
}
-// parameters
+/* parameters */
- (NSEnumerator *)parameterNames {
return [self->parameters keyEnumerator];
return self->parameters;
}
-// description
+/* description */
- (NSString *)stringValue {
NSMutableString *str = [NSMutableString stringWithCapacity:128];
return YES;
}
-// description
+/* description */
- (NSString *)stringValue {
NSMutableString *str = [NSMutableString stringWithCapacity:128];