mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-12] Hooked reminder query manipulation into sync of shared folder state; this makes it work for new shares too.
This commit is contained in:
parent
43e0d9b02d
commit
0cda2fa0c1
@ -88,11 +88,12 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
private void AdditionalFolders_Sync(ZPushConnection connection)
|
private void AdditionalFolders_Sync(ZPushConnection connection)
|
||||||
{
|
{
|
||||||
Logger.Instance.Debug(this, "Starting sync for account {0}", connection.Account);
|
using (SharedFoldersManager manager = Manage(connection.Account))
|
||||||
using (SharedFoldersAPI api = new SharedFoldersAPI(connection))
|
|
||||||
{
|
{
|
||||||
|
Logger.Instance.Debug(this, "Starting sync for account {0}", connection.Account);
|
||||||
|
|
||||||
// Fetch the current shares
|
// Fetch the current shares
|
||||||
ICollection<SharedFolder> shares = api.GetCurrentShares();
|
ICollection<SharedFolder> shares = manager.GetCurrentShares(null);
|
||||||
Logger.Instance.Trace(this, "AdditionalFolders_Sync: {0}", shares.Count);
|
Logger.Instance.Trace(this, "AdditionalFolders_Sync: {0}", shares.Count);
|
||||||
|
|
||||||
// Convert to dictionary
|
// Convert to dictionary
|
||||||
|
@ -98,6 +98,8 @@ namespace Acacia.Features.SharedFolders
|
|||||||
{
|
{
|
||||||
Logger.Instance.Trace(this, "Setting reminders for folder {0}: {1}", wantReminders, folderId);
|
Logger.Instance.Trace(this, "Setting reminders for folder {0}: {1}", wantReminders, folderId);
|
||||||
string prefix = MakeFolderPrefix(folderId);
|
string prefix = MakeFolderPrefix(folderId);
|
||||||
|
if (prefix == null)
|
||||||
|
return;
|
||||||
|
|
||||||
// Find existing
|
// Find existing
|
||||||
for (int i = 0; i < _queryCustom.Operands.Count;)
|
for (int i = 0; i < _queryCustom.Operands.Count;)
|
||||||
@ -131,7 +133,11 @@ namespace Acacia.Features.SharedFolders
|
|||||||
// Collect the valid prefixes
|
// Collect the valid prefixes
|
||||||
HashSet<string> prefixes = new HashSet<string>();
|
HashSet<string> prefixes = new HashSet<string>();
|
||||||
foreach (SyncId id in wanted)
|
foreach (SyncId id in wanted)
|
||||||
prefixes.Add(MakeFolderPrefix(id));
|
{
|
||||||
|
string prefix = MakeFolderPrefix(id);
|
||||||
|
if (prefix != null)
|
||||||
|
prefixes.Add(prefix);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove all operands for which we do not want the prefix
|
// Remove all operands for which we do not want the prefix
|
||||||
for (int i = 0; i < _queryCustom.Operands.Count;)
|
for (int i = 0; i < _queryCustom.Operands.Count;)
|
||||||
@ -155,6 +161,10 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
private string MakeFolderPrefix(SyncId folderId)
|
private string MakeFolderPrefix(SyncId folderId)
|
||||||
{
|
{
|
||||||
|
// Sanity check. The check for shared folders also excludes any weird ids; e.g. if permissions are wrong,
|
||||||
|
// this will not be a sync id, but a backend id.
|
||||||
|
if (folderId == null || !folderId.IsShared)
|
||||||
|
return null;
|
||||||
return folderId.ToString() + ":";
|
return folderId.ToString() + ":";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static Acacia.ZPush.API.SharedFolders.SharedFoldersAPI;
|
|
||||||
|
|
||||||
namespace Acacia.ZPush.API.SharedFolders
|
namespace Acacia.ZPush.API.SharedFolders
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user