From c6992ecb76368322fe3a65847feb1c5842fa4c43 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Fri, 11 May 2007 18:03:52 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1063 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 8 +++ SoObjects/Mailer/SOGoDraftObject.m | 57 +++++++++++-------- .../English.lproj/Localizable.strings | 3 +- UI/Scheduler/French.lproj/Localizable.strings | 3 +- 4 files changed, 42 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f005d52..6d86d528 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-05-11 Wolfgang Sourdeau + + * SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject -bodyPartForText]) + ([SOGoDraftObject -mimeMessageForContentWithHeaderMap:]): use the + constant string "contentTypeValue". + contentTypeValue is now set back to iso-8859-1 since NGMime + converts extracts the data in that encoding. + 2007-05-10 Wolfgang Sourdeau * SoObjects/SOGo/LDAPSource.m ([LDAPSource diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 2e913702..c8791ed5 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -35,15 +35,17 @@ #include #include "common.h" +static NSString *contentTypeValue = @"text/plain; charset=iso-8859-1"; + @interface NSString (NGMimeHelpers) -- (NSString *) asQPSubjectString; +- (NSString *) asQPSubjectString: (NSString *) encoding; @end @implementation NSString (NGMimeHelpers) -- (NSString *) asQPSubjectString +- (NSString *) asQPSubjectString: (NSString *) encoding; { NSString *qpString; unsigned char *data, *dest; @@ -57,7 +59,7 @@ dest = calloc(dataLen * 3, sizeof (unsigned char*)); NGEncodeQuotedPrintableMime (data, dataLen, dest, destLen); - qpString = [NSString stringWithFormat: @"=?utf-8?Q?%s?=", dest]; + qpString = [NSString stringWithFormat: @"=?%@?Q?%s?=", encoding, dest]; free (data); free (dest); @@ -107,9 +109,9 @@ static NSString *fromInternetSuffixPattern = nil; } - (void)dealloc { - [self->envelope release]; - [self->info release]; - [self->path release]; + [envelope release]; + [info release]; + [path release]; [super dealloc]; } @@ -128,12 +130,12 @@ static NSString *fromInternetSuffixPattern = nil; /* draft object functionality */ - (NSString *)draftFolderPath { - if (self->path != nil) - return self->path; + if (path != nil) + return path; - self->path = [[[self userSpoolFolderPath] stringByAppendingPathComponent: + path = [[[self userSpoolFolderPath] stringByAppendingPathComponent: [self nameInContainer]] copy]; - return self->path; + return path; } - (BOOL)_ensureDraftFolderPath { NSFileManager *fm; @@ -173,15 +175,15 @@ static NSString *fromInternetSuffixPattern = nil; } /* reset info cache */ - [self->info release]; self->info = nil; + [info release]; info = nil; return nil /* everything is excellent */; } - (NSDictionary *)fetchInfo { NSString *p; - if (self->info != nil) - return self->info; + if (info != nil) + return info; p = [self infoPath]; if (![[self spoolFileManager] fileExistsAtPath:p]) { @@ -189,11 +191,11 @@ static NSString *fromInternetSuffixPattern = nil; return nil; } - self->info = [[NSDictionary alloc] initWithContentsOfFile:p]; - if (self->info == nil) + info = [[NSDictionary alloc] initWithContentsOfFile:p]; + if (info == nil) [self errorWithFormat:@"draft info dictionary broken at path: %@", p]; - return self->info; + return info; } /* accessors */ @@ -328,8 +330,9 @@ static NSString *fromInternetSuffixPattern = nil; // TODO: set charset in header! [map setObject:@"text/plain" forKey:@"content-type"]; if ((body = [lInfo objectForKey:@"text"]) != nil) { - if ([body isKindOfClass:[NSString class]]) { - [map setObject:@"text/plain; charset=utf-8" forKey:@"content-type"]; + if ([body isKindOfClass: [NSString class]]) { + [map setObject: contentTypeValue + forKey: @"content-type"]; // body = [body dataUsingEncoding:NSUTF8StringEncoding]; } } @@ -369,7 +372,8 @@ static NSString *fromInternetSuffixPattern = nil; body = [body stringByAppendingString:fromInternetSuffix]; /* Note: just 'utf8' is displayed wrong in Mail.app */ - [map setObject:@"text/plain; charset=utf-8" forKey:@"content-type"]; + [map setObject: contentTypeValue + forKey: @"content-type"]; // body = [body dataUsingEncoding:NSUTF8StringEncoding]; } else if ([body isKindOfClass:[NSData class]] && addSuffix) { @@ -655,7 +659,9 @@ static NSString *fromInternetSuffixPattern = nil; /* add subject */ if ([(s = [lInfo objectForKey:@"subject"]) length] > 0) - [map setObject: [s asQPSubjectString] forKey:@"subject"]; + [map setObject: [s asQPSubjectString: @"iso-8859-1"] + forKey:@"subject"]; +// [map setObject: [s asQPSubjectString: @"utf-8"] forKey:@"subject"]; /* add standard headers */ @@ -786,7 +792,8 @@ static NSString *fromInternetSuffixPattern = nil; { rawSender = [startEmail substringFromIndex: NSMaxRange (delimiter)]; delimiter = [rawSender rangeOfString: @">"]; - rawSender = [rawSender substringToIndex: delimiter.location]; + if (delimiter.location != NSNotFound) + rawSender = [rawSender substringToIndex: delimiter.location]; } return rawSender; @@ -1004,8 +1011,8 @@ static NSString *fromInternetSuffixPattern = nil; NSDictionary *lInfo; id from, replyTo; - if (self->envelope != nil) - return self->envelope; + if (envelope != nil) + return envelope; if ((lInfo = [self fetchInfo]) == nil) return nil; @@ -1017,14 +1024,14 @@ static NSString *fromInternetSuffixPattern = nil; replyTo = [NSArray arrayWithObjects:&replyTo count:1]; } - self->envelope = + envelope = [[NGImap4Envelope alloc] initWithMessageID:[self nameInContainer] subject:[lInfo objectForKey:@"subject"] from:from replyTo:replyTo to:[lInfo objectForKey:@"to"] cc:[lInfo objectForKey:@"cc"] bcc:[lInfo objectForKey:@"bcc"]]; - return self->envelope; + return envelope; } /* debugging */ diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 62d233bf..1a370a3f 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -138,6 +138,7 @@ "Appointment proposal" = "Appointment Proposal"; "Appointment on" = "Appointment on"; "Start:" = "Start:"; +"End:" = "End:"; "Due Date:" = "Due Date:"; "Title:" = "Title:"; "Calendar:" = "Calendar:"; @@ -158,8 +159,6 @@ "Organizer:" = "Organizer:"; "Description:" = "Description:"; "Document:" = "Document:"; -"Start:" = "Start:"; -"End:" = "End:"; "Category:" = "Category:"; "Repeat:" = "Repeat:"; "Reminder:" = "Reminder:"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 49515c12..266d9dfe 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -136,6 +136,7 @@ "Appointment proposal" = "Proposition de rendez-vous"; "Appointment on" = "Rendez-vous le"; "Start:" = "Début :"; +"End:" = "Fin :"; "Due Date:" = "Échéance :"; "Title:" = "Titre :"; "Calendar:" = "Agenda :"; @@ -156,8 +157,6 @@ "Organizer:" = "Organisateur :"; "Description:" = "Description :"; "Document:" = "Document :"; -"Start:" = "Début :"; -"End:" = "Fin :"; "Category:" = "Catégorie :"; "Repeat:" = "Répéter :"; "Reminder:" = "Rappel :"; -- 2.39.5