From 6b103de2b45d908e68f43e1e6d839515d4126c1b Mon Sep 17 00:00:00 2001 From: helge Date: Sat, 5 Mar 2005 20:34:10 +0000 Subject: [PATCH] fixed NSURL related issues on MacOSX git-svn-id: http://svn.opengroupware.org/SOPE/trunk@618 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-mime/ChangeLog | 4 ++++ sope-mime/NGImap4/ChangeLog | 8 ++++++++ sope-mime/NGImap4/NGImap4Context.m | 4 ++-- sope-mime/NGImap4/NGImap4Folder.m | 22 +++++++++++++++------- sope-mime/Version | 2 +- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index 3e7e5e5a..e5f06fa4 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,7 @@ +2005-03-05 Helge Hess + + * NGImap4: fixed a MacOSX incompatibility (v4.5.216) + 2005-03-03 Helge Hess * NGImap4: added some debugging facilities (v4.5.215) diff --git a/sope-mime/NGImap4/ChangeLog b/sope-mime/NGImap4/ChangeLog index 60bb5a77..d3b24499 100644 --- a/sope-mime/NGImap4/ChangeLog +++ b/sope-mime/NGImap4/ChangeLog @@ -1,3 +1,11 @@ +2005-03-05 Helge Hess + + * NGImap4Folder.m: properly create NSURL if the absolute name doesn't + start with a slash + + * NGImap4Context.m: initialize NSURL with a path to avoid an issue on + MacOSX + 2005-03-03 Helge Hess * NGImap4FileManager.m: added debug logs which can be enabled using diff --git a/sope-mime/NGImap4/NGImap4Context.m b/sope-mime/NGImap4/NGImap4Context.m index 645f8c3b..81e1deb5 100644 --- a/sope-mime/NGImap4/NGImap4Context.m +++ b/sope-mime/NGImap4/NGImap4Context.m @@ -190,7 +190,7 @@ static int ImapLogEnabled = -1; - (NSURL *)url { NSString *scheme; - if (self->url) + if (self->url != nil) return self->url; scheme = [[self->connectionDictionary objectForKey:@"SSL"] boolValue] @@ -199,7 +199,7 @@ static int ImapLogEnabled = -1; self->url = [[NSURL alloc] initWithScheme:scheme host:[self->connectionDictionary objectForKey:@"host"] - path:nil]; + path:@"/"]; return self->url; } diff --git a/sope-mime/NGImap4/NGImap4Folder.m b/sope-mime/NGImap4/NGImap4Folder.m index 2d90dd9c..161c33ee 100644 --- a/sope-mime/NGImap4/NGImap4Folder.m +++ b/sope-mime/NGImap4/NGImap4Folder.m @@ -236,6 +236,8 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; } - (NSString *)absoluteName { + // TODO: sometimes this contains a name with no / in front (eg Dovecot on + // MacOSX). Find out why this is. return self->name; } @@ -1747,17 +1749,23 @@ static int FetchNewUnseenMessagesInSubFoldersOnDemand = -1; } - (NSURL *)url { + NSString *p; NSURL *base; - if (self->url) + if (self->url != nil) return self->url; - - base = [self->context url]; - + + if ((base = [self->context url]) == nil) { + [self logWithFormat:@"ERROR: got no URL for context: %@", self->context]; + return nil; + } + + if ((p = [self absoluteName]) == nil) + return nil; + + if (![p hasPrefix:@"/"]) p = [@"/" stringByAppendingString:p]; self->url = [[NSURL alloc] - initWithScheme:[base scheme] - host:[base host] - path:[self absoluteName]]; + initWithScheme:[base scheme] host:[base host] path:p]; return self->url; } diff --git a/sope-mime/Version b/sope-mime/Version index c61276a2..126abde2 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=215 +SUBMINOR_VERSION:=216 # v4.5.214 requires libNGExtensions v4.5.146 # v4.2.149 requires libNGStreams v4.2.34 -- 2.39.5