 ===================================================================
 --- sope-mime/NGImap4/ChangeLog	(revision 1660)
 +++ sope-mime/NGImap4/ChangeLog	(working copy)
-@@ -1,3 +1,57 @@
+@@ -1,3 +1,61 @@
 +2009-10-06  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
++
++	* NGImap4Client.m (-delete:): if the folder we want to delete is
++	the same as self->selectedFolder, we unselect it first to ensure a
++	"SELECT" happens if a new folder with the same name is created.
 +
 +	* EOQualifier+IMAPAdditions.m
 +	(-imap4OperatorForDateKeyword:andComparisonSelector:): modified

   return [self->normer normalizeSearchResponse:[self processCommand:s]];
 }
 
@@ -1142,7 +1171,7 @@
   if ((_folder = [self _folder2ImapFolder:_folder]) == nil)
     return nil;
   

   return [self->normer normalizeResponse:[self processCommand:command]];
 }
 
 - (NSDictionary *)delete:(NSString *)_name {
+  if ([self->selectedFolder isEqualToString:_name]) {
+    [self unselect];
+  }
   return [self _performCommand:@"delete" onFolder:_name];
 }
 - (NSDictionary *)create:(NSString *)_name {
@@ -820,23 +839,23 @@
   return [self->normer normalizeResponse:[self processCommand:cmd]];
 }
 
