mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-14] Patching secondary contact folders now works
This commit is contained in:
parent
5806ee9b80
commit
495386dea9
@ -43,14 +43,16 @@ namespace Acacia.Features.SecondaryContacts
|
|||||||
|
|
||||||
public override bool IsApplicable(IFolder folder)
|
public override bool IsApplicable(IFolder folder)
|
||||||
{
|
{
|
||||||
// Check the sync type
|
// Check the sync type.
|
||||||
if (FolderUtils.GetFolderSyncType(folder) != OutlookConstants.SyncType.Unknown)
|
// Also allow again if the sync type is user contact, it may not have been fully patched.
|
||||||
|
if (FolderUtils.GetFolderSyncType(folder) != OutlookConstants.SyncType.Unknown &&
|
||||||
|
FolderUtils.GetFolderSyncType(folder) != OutlookConstants.SyncType.UserContact)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check the hidden suffix
|
// Check the hidden suffix
|
||||||
if (!folder.Name.EndsWith(SUFFIX_CONTACTS))
|
if (!folder.Name.EndsWith(SUFFIX_CONTACTS))
|
||||||
return false;
|
return false;
|
||||||
Logger.Instance.Debug(this.Feature, "CONTACTS: {0} - {1}", folder.Name, StringUtil.BytesToHex(Encoding.UTF8.GetBytes(folder.Name)));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,24 +72,23 @@ namespace Acacia.Features.SecondaryContacts
|
|||||||
private void OnUnpatchedFolderDiscovered(IFolder folder)
|
private void OnUnpatchedFolderDiscovered(IFolder folder)
|
||||||
{
|
{
|
||||||
string strippedName = folder.Name.StripSuffix(SUFFIX_CONTACTS);
|
string strippedName = folder.Name.StripSuffix(SUFFIX_CONTACTS);
|
||||||
// Update the properties
|
Logger.Instance.Debug(this, "Patching secondary contacts folder: {0}", strippedName);
|
||||||
folder.SetProperties(new string[]
|
|
||||||
{
|
// Note that somehow it fails if these are updated in one go, so do the steps individually
|
||||||
OutlookConstants.PR_EAS_SYNCTYPE,
|
|
||||||
OutlookConstants.PR_CONTAINER_CLASS,
|
// Sync type
|
||||||
OutlookConstants.PR_EAS_NAME,
|
Logger.Instance.Trace(this, "Setting sync type");
|
||||||
OutlookConstants.PR_DISPLAY_NAME,
|
folder.SetProperty(OutlookConstants.PR_EAS_SYNCTYPE, (int)OutlookConstants.SyncType.UserContact);
|
||||||
OutlookConstants.PR_EAS_SYNC1,
|
|
||||||
OutlookConstants.PR_EAS_SYNC2
|
// Container type
|
||||||
}, new object[]
|
Logger.Instance.Trace(this, "Setting container class");
|
||||||
{
|
folder.SetProperty(OutlookConstants.PR_CONTAINER_CLASS, "IPF.Contact");
|
||||||
(int)OutlookConstants.SyncType.UserContact,
|
|
||||||
"IPF.Contact",
|
// And the name
|
||||||
strippedName,
|
Logger.Instance.Trace(this, "Patching name");
|
||||||
strippedName,
|
folder.Name = strippedName;
|
||||||
true, true
|
|
||||||
});
|
Logger.Instance.Debug(this, "Patched secondary contacts folder: {0}", strippedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user