View Issue Details

IDProjectCategoryView StatusLast Update
0002700SOGoActiveSyncpublic2014-04-09 14:59
Reportertfu Assigned Toludovic  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platform[Client] MicrosoftOSWindowsOS Version7
Product Version2.2.3 
Target Version2.2.4Fixed in Version2.2.4 
Summary0002700: Outlook folder changes (create/delete/rename/move) not synced correclty
Description

There are several issues when working with folders in Outlook:

Deleting a folder in Outlook moves the folder on the client to "Deleted Items" (as expected) but on server nothing is changed.

When renaming another folder the folder previously deleted appears again (it is "moved" out of the Delete Items-Folder).
-> this is a side defect of the FolderSync triggered by the rename folder.

A sub-folder created in Outlook is actually created under root on server and not under the same sub-folder as it was created on client.

Moving a sub folder to another parent folder doesn't change anything on server.

This behavior causes inconsistencies between Outlook and the server. Some of them are "cleared" when renaming a folder in Outlook.

With the attached patch the mentioned folder operation should sync consistently from Outlook to server.

TagsNo tags attached.

Activities

tfu

tfu

2014-04-03 18:27

reporter  

0001-outlook-folder-mgmt.patch (2,533 bytes)   
From e96ad3af3007bb0a92073d0239ee79ca5f0d87cd Mon Sep 17 00:00:00 2001
From: root <root@example.com>
Date: Thu, 3 Apr 2014 20:21:35 +0200
Subject: [PATCH] outlook folder mgmt

---
 ActiveSync/SOGoActiveSyncDispatcher.m |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m
index 7d99ceb..264b1e8 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher.m
@@ -212,11 +212,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
         accountsFolder = [userFolder lookupName: @"Mail"  inContext: context  acquire: NO];
         currentFolder = [accountsFolder lookupName: @"0"  inContext: context  acquire: NO];
-        
+
+        // tfu if the parrent is 0 -> ok ; otherwise need to build the foldername based on parentId + displayName
+        if ([parentId isEqualToString: @"0"])
         newFolder = [currentFolder lookupName: [NSString stringWithFormat: @"folder%@", [displayName stringByEncodingImap4FolderName]]
                                     inContext: context
                                       acquire: NO];
-        
+        else
+        newFolder = [currentFolder lookupName: [NSString stringWithFormat: @"folder%@/%@", [[parentId stringByUnescapingURL] substringFromIndex:5] , [displayName stringByEncodingImap4FolderName]]
+                                    inContext: context
+                                      acquire: NO];
+
         // FIXME
         // handle exists (status == 2)
         // handle right synckey
@@ -380,7 +386,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                                    inContext: context
                                      acquire: NO];
 
-  error = [folderToUpdate renameTo: displayName];
+  // tfu if parrent is 0 or displayname is not changed it is either a rename of a folder in 0 or a move to 0
+  if ([parentId isEqualToString: @"0"] ||([serverId hasSuffix: [NSString stringWithFormat: @"/%@", displayName]] && [parentId isEqualToString: @"0"] ))
+  {
+      error = [folderToUpdate renameTo: [NSString stringWithFormat: @"/%@", [displayName stringByEncodingImap4FolderName] ]];
+  }
+  else
+  {
+      error = [folderToUpdate renameTo: [NSString stringWithFormat: @"%@/%@", [[parentId stringByUnescapingURL] substringFromIndex:5] , [displayName stringByEncodingImap4FolderName] ]];
+  }
 
   // Handle new name exist
   if (!error)
-- 
1.7.9.5

0001-outlook-folder-mgmt.patch (2,533 bytes)   
tfu

tfu

2014-04-07 11:33

reporter  

0002-outlook-folder-mgmt1.patch (1,675 bytes)   
From b988055937e7f77e0cfb1a076b5e198755830c9b Mon Sep 17 00:00:00 2001
From: root <root@example.com>
Date: Mon, 7 Apr 2014 13:26:09 +0200
Subject: [PATCH 2/2] outlook folder mgmt1

---
 SoObjects/Mailer/SOGoMailFolder.m |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m
index 7f45ec8..7170f0a 100644
--- a/SoObjects/Mailer/SOGoMailFolder.m
+++ b/SoObjects/Mailer/SOGoMailFolder.m
@@ -291,10 +291,18 @@ static NSString *defaultUserID =  @"anyone";
           path = [[imap4URL path] stringByDeletingLastPathComponent];
           if (![path hasSuffix: @"/"])
             path = [path stringByAppendingString: @"/"];
+
+	  // tfu if new name contains the path - dont't need to add
+          if ([newName rangeOfString: @"/"].location == NSNotFound)
           destURL = [[NSURL alloc] initWithScheme: [imap4URL scheme]
                                              host: [imap4URL host]
                                              path: [NSString stringWithFormat: @"%@%@",
                                                              path, [newName stringByEncodingImap4FolderName]]];
+          else
+          destURL = [[NSURL alloc] initWithScheme: [imap4URL scheme]
+                                             host: [imap4URL host]
+                                             path: [NSString stringWithFormat: @"%@",
+                                                              [newName stringByEncodingImap4FolderName]]];
           [destURL autorelease];
           error = [imap4 moveMailboxAtURL: imap4URL
                                     toURL: destURL];
-- 
1.7.9.5

ludovic

ludovic

2014-04-07 19:55

administrator   ~0006846

I guess both patches need to be applied?

tfu

tfu

2014-04-08 13:56

reporter   ~0006854

yes - just forgot to upload the 2nd patch.

ludovic

ludovic

2014-04-09 14:59

administrator   ~0006861

Patches applied: https://github.com/inverse-inc/sogo/commit/ab80e87a3fcd86a7b211bbae5e8033d5a6c39d4a

Thanks and keep the patches coming! You're doing an awesome job.

Issue History

Date Modified Username Field Change
2014-04-03 18:27 tfu New Issue
2014-04-03 18:27 tfu File Added: 0001-outlook-folder-mgmt.patch
2014-04-03 19:08 ludovic Target Version => 2.2.4
2014-04-07 11:33 tfu File Added: 0002-outlook-folder-mgmt1.patch
2014-04-07 19:55 ludovic Note Added: 0006846
2014-04-08 13:56 tfu Note Added: 0006854
2014-04-09 14:59 ludovic Note Added: 0006861
2014-04-09 14:59 ludovic Status new => resolved
2014-04-09 14:59 ludovic Fixed in Version => 2.2.4
2014-04-09 14:59 ludovic Resolution open => fixed
2014-04-09 14:59 ludovic Assigned To => ludovic