1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

Additional logging for GAB sync

This commit is contained in:
Patrick Simpson 2018-09-14 10:05:21 +03:00
parent eed0be43b3
commit 136a15d19c
6 changed files with 36 additions and 12 deletions

View File

@ -576,9 +576,11 @@ namespace Acacia.Features.GAB
zpush.ConfirmedChanged += (z) =>
{
Logger.Instance.Debug(this, "Account discovered and confirmed: {0} -> {1}: {2}", zpush.DisplayName, zpush.Confirmed, zpush.GABFolder);
if (zpush.Confirmed == ZPushAccount.ConfirmationType.IsZPush &&
!string.IsNullOrEmpty(zpush.GABFolder))
{
Logger.Instance.Debug(this, "Account discovered, listening for folder: {0} -> {1}: {2}", zpush.DisplayName, zpush.Confirmed, zpush.GABFolder);
// Set up the Z-Push channel listener
ZPushChannel channel = ZPushChannels.Get(this, zpush, zpush.GABFolder);
channel.Available += ZPushChannelAvailable;
@ -735,6 +737,7 @@ namespace Acacia.Features.GAB
private void ZPushChannelAvailable(IFolder folder)
{
Logger.Instance.Debug(this, "Z-Push channel available 0: {0}", folder);
using (IStore store = folder.GetStore())
{
Logger.Instance.Debug(this, "Z-Push channel available: {0} on {1}", folder, store.DisplayName);
@ -742,6 +745,7 @@ namespace Acacia.Features.GAB
ZPushAccount account = Watcher.Accounts.GetAccount(folder);
if (account != null)
{
Logger.Instance.Debug(this, "Z-Push channel available 0: {0} -> {1}", folder, account);
account.LinkedGABFolder(folder);
RegisterGABAccount(account, folder);
}

View File

@ -92,7 +92,7 @@ namespace Acacia.Features.SharedFolders
_queryRoot = FolderQuery;
if (!(_queryRoot is SearchQuery.And))
return false;
Logger.Instance.Debug(this, "Current query:\n{0}", _queryRoot.ToString());
Logger.Instance.Trace(this, "Current query:\n{0}", _queryRoot.ToString());
SearchQuery.And root = (SearchQuery.And)_queryRoot;
// TODO: more strict checking of query
@ -113,7 +113,7 @@ namespace Acacia.Features.SharedFolders
}
// We have the root, but not the custom query. Create it.
Logger.Instance.Debug(this, "Creating custom query");
Logger.Instance.Trace(this, "Creating custom query");
if (_queryCustomShared == null)
_queryCustomShared = AddCustomQuery(root, "S");
_queryCustomConfigured = AddCustomQuery(root, "C");
@ -124,10 +124,10 @@ namespace Acacia.Features.SharedFolders
)
));
Logger.Instance.Debug(this, "Modified query:\n{0}", root.ToString());
Logger.Instance.Trace(this, "Modified query:\n{0}", root.ToString());
// Store it
FolderQuery = root;
Logger.Instance.Debug(this, "Modified query readback:\n{0}", FolderQuery);
Logger.Instance.Trace(this, "Modified query readback:\n{0}", FolderQuery);
}
catch (Exception e)
{
@ -281,7 +281,7 @@ namespace Acacia.Features.SharedFolders
_queryRoot = FolderQuery;
if (!(_queryRoot is SearchQuery.And))
return false;
Logger.Instance.Debug(this, "Current query:\n{0}", _queryRoot.ToString());
Logger.Instance.Trace(this, "Current query:\n{0}", _queryRoot.ToString());
SearchQuery.And root = (SearchQuery.And)_queryRoot;
// TODO: more strict checking of query
@ -304,10 +304,10 @@ namespace Acacia.Features.SharedFolders
root.Operands.Add(_queryCustomShared);
}
Logger.Instance.Debug(this, "Modified query:\n{0}", root.ToString());
Logger.Instance.Trace(this, "Modified query:\n{0}", root.ToString());
// Store it
FolderQuery = root;
Logger.Instance.Debug(this, "Modified query readback:\n{0}", FolderQuery);
Logger.Instance.Trace(this, "Modified query readback:\n{0}", FolderQuery);
}
catch (Exception e)
{

View File

@ -446,7 +446,7 @@ namespace Acacia.Stubs.OutlookWrappers
{
SearchCriteriaState state;
imapi.GetSearchCriteria(0, &restrict, &sb1, out state);
Logger.Instance.Debug(this, "GetSearchCriteria: {0}: {1}\n{2}", Name, state,
Logger.Instance.Trace(this, "GetSearchCriteria: {0}: {1}\n{2}", Name, state,
restrict == null ? "<NODE>" : restrict->ToString());
return restrict->ToSearchQuery();
}
@ -466,7 +466,7 @@ namespace Acacia.Stubs.OutlookWrappers
using (RestrictionEncoder res = value.ToRestriction())
{
SRestriction* resEncoded = res.Encoded;
Logger.Instance.Debug(this, "SetSearchCriteria: {0}\n{1}", Name, resEncoded == null ? "<NODE>" : resEncoded->ToString());
Logger.Instance.Trace(this, "SetSearchCriteria: {0}\n{1}", Name, resEncoded == null ? "<NODE>" : resEncoded->ToString());
imapi.SetSearchCriteria(resEncoded, null, SearchCriteriaFlags.NONE);
}
}

View File

@ -149,6 +149,8 @@ namespace Acacia.ZPush
Confirmed = Capabilities == null ? ConfirmationType.IsNotZPush : ConfirmationType.IsZPush;
Logger.Instance.Info(this, "ZPush confirmation: {0} -> {1}, {2}", Confirmed, Capabilities, GABFolder);
//new Thread(() => { System.Threading.Thread.Sleep(30000); _confirmedChanged?.Invoke(this); }).Start();
//
_confirmedChanged?.Invoke(this);
}

View File

@ -85,7 +85,19 @@ namespace Acacia.ZPush
// Notify any listeners
if (Available != null)
{
Tasks.Task(null, null, "Watcher_WatchingFolder", () => Available(folder));
Logger.Instance.Debug(this, "ZPUSHCANNEL FOLDER, NOTIFY Available: {0} on {1}", folder.Name, _account.DisplayName);
Tasks.Task(null, null, "Watcher_WatchingFolder",
() =>
{
Logger.Instance.Debug(this, "ZPUSHCANNEL FOLDER, NOTIFY Available before: {0} on {1}", folder.Name, _account.DisplayName);
Available(folder);
Logger.Instance.Debug(this, "ZPUSHCANNEL FOLDER, NOTIFY Available after: {0} on {1}", folder.Name, _account.DisplayName);
}
);
}
else
{
Logger.Instance.Debug(this, "ZPUSHCANNEL FOLDER, Available not registered: {0} on {1}", folder.Name, _account.DisplayName);
}
}

View File

@ -121,14 +121,20 @@ namespace Acacia.ZPush
{
oof = connection.Execute(new ActiveSync.SettingsOOFGet());
}
account.OnConfirmationResponse(oof.RawResponse);
new Thread(() => { System.Threading.Thread.Sleep(30000);
account.OnConfirmationResponse(oof.RawResponse);
Explorer_SelectionChange();
ThisAddIn.Instance.GetFeature<FeatureOutOfOffice>()?.OnOOFSettings(account, oof);
}).Start();
/*account.OnConfirmationResponse(oof.RawResponse);
// [ZO-109] Always update the current selection, it might have changed.
Explorer_SelectionChange();
// Notify the OOF feature.
// TODO: this coupling is pretty hideous
ThisAddIn.Instance.GetFeature<FeatureOutOfOffice>()?.OnOOFSettings(account, oof);
ThisAddIn.Instance.GetFeature<FeatureOutOfOffice>()?.OnOOFSettings(account, oof);*/
});
}
else