+2005-07-18 Helge Hess <helge.hess@opengroupware.org>
+
+ * UIxSubjectFormatter.m: fixed a stupid bug in subject handling leading
+ to an infinite loop in the QP processing, hardened against QP loops
+ (v0.9.143)
+
2005-07-18 Marcus Mueller <znek@mulle-kybernetik.com>
* UIxMailEditor.m: removed -emailForUser usage and replaced with
NSString *s, *r;
unsigned len;
- if ((len = [_subject length] == 0))
+ if ((len = [_subject length]) == 0)
return [self missingSubjectLabel];
-
+
/* check for quoted printable */
if (len > 6 && [self shouldDecodeQP]) {
t = [_subject decodeQuotedPrintableValueOfMIMEHeaderField:@"subject"];
if ([t isNotNull])
return [self stringForObjectValue:t];
+ else
+ [self warnWithFormat:@"decoding QP failed: '%@'", t];
}
}
/* continue NSData processing */
- [self warnWithFormat:@"NSData subject! (using UTF-8 to decode!)"];
-
+ [self warnWithFormat:@"NSData subject, using UTF-8 to decode."];
+
// TODO: exception handler?
s = [[NSString alloc] initWithData:_subject encoding:NSUTF8StringEncoding];
if (s == nil) {
return [self labelForKey:@"Error_CouldNotDecodeSubject"];
}
- r = [[self stringForStringValue:s] copy];
+ if ([s hasPrefix:@"=?"]) { // TODO: this should never happen?
+ [self warnWithFormat:@"subject still has QP signature: '%@'", s];
+ r = [s copy];
+ }
+ else
+ r = [[self stringForStringValue:s] copy];
[s release];
return [r autorelease];
}