From be7a3272b3b2936fd5540d8f0467ef7b0648ab12 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 16 Nov 2004 18:51:51 +0000 Subject: [PATCH] added reply-to parameter support for text mime types git-svn-id: http://svn.opengroupware.org/SOPE/trunk@376 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/WOSession.m | 1 - sope-mime/ChangeLog | 5 +++ sope-mime/NGMime/ChangeLog | 5 +++ sope-mime/NGMime/NGConcreteMimeType.h | 26 ++++++------- sope-mime/NGMime/NGConcreteMimeType.m | 54 +++++++++++++++++++-------- sope-mime/Version | 2 +- 6 files changed, 61 insertions(+), 32 deletions(-) diff --git a/sope-appserver/NGObjWeb/WOSession.m b/sope-appserver/NGObjWeb/WOSession.m index 61231902..fea2451f 100644 --- a/sope-appserver/NGObjWeb/WOSession.m +++ b/sope-appserver/NGObjWeb/WOSession.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include #include "WOContext+private.h" diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index 7eab2d81..986c1d2b 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,8 @@ +2004-11-13 Helge Hess + + * NGMime: added support for 'reply-type' parameter in text MIME types + (v4.5.198) + 2004-11-08 Helge Hess * NGImap4: fixed a bug with parsing envelopes that are reported with diff --git a/sope-mime/NGMime/ChangeLog b/sope-mime/NGMime/ChangeLog index 6a2f55fd..fb4b383c 100644 --- a/sope-mime/NGMime/ChangeLog +++ b/sope-mime/NGMime/ChangeLog @@ -1,3 +1,8 @@ +2004-11-13 Helge Hess + + * NGConcreteMimeType.m: added support for 'reply-type' parameter in + text MIME types + 2004-10-27 Marcus Mueller * NGMime.xcode: added NGSendMail files to Xcode build diff --git a/sope-mime/NGMime/NGConcreteMimeType.h b/sope-mime/NGMime/NGConcreteMimeType.h index cc283474..4ac1e5e3 100644 --- a/sope-mime/NGMime/NGConcreteMimeType.h +++ b/sope-mime/NGMime/NGConcreteMimeType.h @@ -1,7 +1,7 @@ /* - 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 @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __NGMime_NGConcreteMimeType_H__ #define __NGMime_NGConcreteMimeType_H__ @@ -53,19 +52,17 @@ 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 @@ -76,6 +73,7 @@ NSString *name; // used in vcards NSString *format; NSString *method; // used in iCalendars (method=REQUEST) + NSString *replyType; // eg value 'response' BOOL delsp; float quality; } diff --git a/sope-mime/NGMime/NGConcreteMimeType.m b/sope-mime/NGMime/NGConcreteMimeType.m index 6f1b0b2d..a0fd0068 100644 --- a/sope-mime/NGMime/NGConcreteMimeType.m +++ b/sope-mime/NGMime/NGConcreteMimeType.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include "NGConcreteMimeType.h" #include "common.h" @@ -103,7 +102,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; { NSAssert([_type isEqualToString:NGMimeTypeText], @"invalid use of concrete subclass .."); - + if (textPlainNoCharset) { if (_parameters == nil) { if ([_subType isEqualToString:@"plain"]) { @@ -116,10 +115,11 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; 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"); @@ -147,6 +147,10 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; [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]; } @@ -176,6 +180,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; } - (void)dealloc { + [self->replyType release]; [self->method release]; [self->format release]; [self->name release]; @@ -307,6 +312,9 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; - (NSString *)method { return self->method; } +- (NSString *)replyType { + return self->replyType; +} - (float)quality { return self->quality; } @@ -315,7 +323,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; } - (NSEnumerator *)parameterNames { - id args[5]; + id args[6]; int argCount = 0; if (self->charset) { @@ -334,6 +342,10 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; args[argCount] = @"method"; argCount++; } + if (self->replyType) { + args[argCount] = @"reply-type"; + argCount++; + } if (argCount == 0) return nil; @@ -343,14 +355,16 @@ static NGConcreteTextMimeType *textPlainNoCharset = 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 */ @@ -367,12 +381,16 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; [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]; @@ -394,6 +412,10 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; [str appendString:@"; method="]; [str appendString:self->method]; } + if (self->replyType) { + [str appendString:@"; reply-type="]; + [str appendString:self->replyType]; + } return str; } @@ -662,7 +684,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; return YES; } -// parameters +/* parameters */ - (NSEnumerator *)parameterNames { return [self->parameters keyEnumerator]; @@ -676,7 +698,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; return self->parameters; } -// description +/* description */ - (NSString *)stringValue { NSMutableString *str = [NSMutableString stringWithCapacity:128]; @@ -792,7 +814,7 @@ static NGConcreteTextMimeType *textPlainNoCharset = nil; return YES; } -// description +/* description */ - (NSString *)stringValue { NSMutableString *str = [NSMutableString stringWithCapacity:128]; diff --git a/sope-mime/Version b/sope-mime/Version index aa6b591c..34666946 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,6 +2,6 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=197 +SUBMINOR_VERSION:=198 # v4.2.149 requires libNGStreams v4.2.34 -- 2.39.5