Skip to content

Commit

Permalink
fix(imap): sometimes the folder name does not have the delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
QHivert committed Dec 20, 2023
1 parent cf99999 commit 1160846
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions sope-mime/NGImap4/NGImap4Client.m
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ - (BOOL)isEqualToClient:(NGImap4Client *)_obj {
}

- (NSString *)delimiter {
if (self->delimiter == nil) {
[self list:@"" pattern:@""];
}

return self->delimiter;
}

Expand Down
9 changes: 8 additions & 1 deletion sope-mime/NGImap4/NGImap4Connection.m
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,17 @@ - (NSString *)imap4FolderNameForURL:(NSURL *)_url removeFileName:(BOOL)_delfn {
if (_delfn) folderName = [folderName stringByDeletingLastPathComponent];

if ([[[self client] delimiter] isEqualToString:@"/"])
if (debugKeys) {
[self logWithFormat: @"imap4FolderNameForURL: %@ became %@", _url, folderName];
}
return folderName;

names = [folderName componentsSeparatedByString: @"/"];
return [names componentsJoinedByString: [[self client] delimiter]];
folderName = [names componentsJoinedByString: [[self client] delimiter]];
if (debugKeys) {
[self logWithFormat: @"imap4FolderNameForURL: %@ became %@", _url, folderName];
}
return folderName;
}
- (NSString *)imap4FolderNameForURL:(NSURL *)_url {
return [self imap4FolderNameForURL:_url removeFileName:NO];
Expand Down
6 changes: 2 additions & 4 deletions sope-mime/NGImap4/NGImap4Context.m
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,8 @@ - (NSString *)draftsFolderName {
}

- (void)initializeSentFolder {
if ((self->sentFolder = [self _getFolderWithName:
[self sentFolderName]]) == nil)
self->sentFolder = [self _getFolderWithName:
[self sentFolderName]];
if ((self->sentFolder = [self _getFolderWithName: [self sentFolderName]]) == nil)
self->sentFolder = [self _getFolderWithName: [self sentFolderName]];
if (self->sentFolder == nil)
NSLog(@"WARNING[%s]: Couldn't find/create sentFolder", __PRETTY_FUNCTION__);
}
Expand Down

0 comments on commit 1160846

Please sign in to comment.