From 06e90bed30d77ebc68aae3294db720a63ad93ec7 Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Tue, 26 Sep 2017 16:34:23 +0200
Subject: [PATCH] [KOE-142] Added exception to checking of shared folder
renaming for secondary contacts, as that renames the folder.
---
.../SecondaryContacts/FeatureSecondaryContacts.cs | 5 +++++
.../Features/SharedFolders/FeatureSharedFolders.cs | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs
index c21316c..d693456 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs
@@ -78,6 +78,11 @@ namespace Acacia.Features.SecondaryContacts
}
}
+ public static bool IsSecondaryFolderRename(string oldName, string newName)
+ {
+ return newName + SUFFIX_CONTACTS == oldName;
+ }
+
// Contains the ids of folders for which we've shown a warning. This is both to prevent
// warning multiple times and to detect the case when the app has been restarted.
private readonly HashSet _warnedFolders = new HashSet();
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
index aa73f69..4eeebf7 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
@@ -1,4 +1,6 @@
-/// Copyright 2016 Kopano b.v.
+
+using Acacia.Features.SecondaryContacts;
+/// Copyright 2016 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
@@ -13,7 +15,6 @@
/// along with this program.If not, see.
///
/// Consult LICENSE file for details
-
using Acacia.Stubs;
using Acacia.UI;
using Acacia.UI.Outlook;
@@ -403,7 +404,9 @@ namespace Acacia.Features.SharedFolders
string originalName = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_NAME);
// The folder.name property is sometimes cached, check against the MAPI property
string currentName = (string)folder.GetProperty(OutlookConstants.PR_DISPLAY_NAME_W);
- if (currentName != originalName)
+ if (currentName != originalName &&
+ // Secondary contacts renames folder, check for that
+ !FeatureSecondaryContacts.IsSecondaryFolderRename(originalName, currentName))
{
Logger.Instance.Warning(this, "Shared folder renamed, renaming back: {0} - {1} - {2}", folder.Name, folder.SyncId, originalName);
// This is a locally renamed folder. Warn and rename back