1
0
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:
Patrick Simpson 2017-02-28 12:44:33 +01:00
parent 43e0d9b02d
commit 0cda2fa0c1
3 changed files with 15 additions and 5 deletions

View File

@ -88,11 +88,12 @@ namespace Acacia.Features.SharedFolders
private void AdditionalFolders_Sync(ZPushConnection connection)
{
Logger.Instance.Debug(this, "Starting sync for account {0}", connection.Account);
using (SharedFoldersAPI api = new SharedFoldersAPI(connection))
using (SharedFoldersManager manager = Manage(connection.Account))
{
Logger.Instance.Debug(this, "Starting sync for account {0}", connection.Account);
// Fetch the current shares
ICollection<SharedFolder> shares = api.GetCurrentShares();
ICollection<SharedFolder> shares = manager.GetCurrentShares(null);
Logger.Instance.Trace(this, "AdditionalFolders_Sync: {0}", shares.Count);
// Convert to dictionary

View File

@ -98,6 +98,8 @@ namespace Acacia.Features.SharedFolders
{
Logger.Instance.Trace(this, "Setting reminders for folder {0}: {1}", wantReminders, folderId);
string prefix = MakeFolderPrefix(folderId);
if (prefix == null)
return;
// Find existing
for (int i = 0; i < _queryCustom.Operands.Count;)
@ -131,7 +133,11 @@ namespace Acacia.Features.SharedFolders
// Collect the valid prefixes
HashSet<string> prefixes = new HashSet<string>();
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
for (int i = 0; i < _queryCustom.Operands.Count;)
@ -155,6 +161,10 @@ namespace Acacia.Features.SharedFolders
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() + ":";
}
}

View File

@ -20,7 +20,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Acacia.ZPush.API.SharedFolders.SharedFoldersAPI;
namespace Acacia.ZPush.API.SharedFolders
{