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) => 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 && if (zpush.Confirmed == ZPushAccount.ConfirmationType.IsZPush &&
!string.IsNullOrEmpty(zpush.GABFolder)) !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 // Set up the Z-Push channel listener
ZPushChannel channel = ZPushChannels.Get(this, zpush, zpush.GABFolder); ZPushChannel channel = ZPushChannels.Get(this, zpush, zpush.GABFolder);
channel.Available += ZPushChannelAvailable; channel.Available += ZPushChannelAvailable;
@ -735,6 +737,7 @@ namespace Acacia.Features.GAB
private void ZPushChannelAvailable(IFolder folder) private void ZPushChannelAvailable(IFolder folder)
{ {
Logger.Instance.Debug(this, "Z-Push channel available 0: {0}", folder);
using (IStore store = folder.GetStore()) using (IStore store = folder.GetStore())
{ {
Logger.Instance.Debug(this, "Z-Push channel available: {0} on {1}", folder, store.DisplayName); 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); ZPushAccount account = Watcher.Accounts.GetAccount(folder);
if (account != null) if (account != null)
{ {
Logger.Instance.Debug(this, "Z-Push channel available 0: {0} -> {1}", folder, account);
account.LinkedGABFolder(folder); account.LinkedGABFolder(folder);
RegisterGABAccount(account, folder); RegisterGABAccount(account, folder);
} }

View File

@ -92,7 +92,7 @@ namespace Acacia.Features.SharedFolders
_queryRoot = FolderQuery; _queryRoot = FolderQuery;
if (!(_queryRoot is SearchQuery.And)) if (!(_queryRoot is SearchQuery.And))
return false; 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; SearchQuery.And root = (SearchQuery.And)_queryRoot;
// TODO: more strict checking of query // 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. // 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) if (_queryCustomShared == null)
_queryCustomShared = AddCustomQuery(root, "S"); _queryCustomShared = AddCustomQuery(root, "S");
_queryCustomConfigured = AddCustomQuery(root, "C"); _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 // Store it
FolderQuery = root; 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) catch (Exception e)
{ {
@ -281,7 +281,7 @@ namespace Acacia.Features.SharedFolders
_queryRoot = FolderQuery; _queryRoot = FolderQuery;
if (!(_queryRoot is SearchQuery.And)) if (!(_queryRoot is SearchQuery.And))
return false; 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; SearchQuery.And root = (SearchQuery.And)_queryRoot;
// TODO: more strict checking of query // TODO: more strict checking of query
@ -304,10 +304,10 @@ namespace Acacia.Features.SharedFolders
root.Operands.Add(_queryCustomShared); 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 // Store it
FolderQuery = root; 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) catch (Exception e)
{ {

View File

@ -446,7 +446,7 @@ namespace Acacia.Stubs.OutlookWrappers
{ {
SearchCriteriaState state; SearchCriteriaState state;
imapi.GetSearchCriteria(0, &restrict, &sb1, out 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()); restrict == null ? "<NODE>" : restrict->ToString());
return restrict->ToSearchQuery(); return restrict->ToSearchQuery();
} }
@ -466,7 +466,7 @@ namespace Acacia.Stubs.OutlookWrappers
using (RestrictionEncoder res = value.ToRestriction()) using (RestrictionEncoder res = value.ToRestriction())
{ {
SRestriction* resEncoded = res.Encoded; 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); imapi.SetSearchCriteria(resEncoded, null, SearchCriteriaFlags.NONE);
} }
} }

View File

@ -149,6 +149,8 @@ namespace Acacia.ZPush
Confirmed = Capabilities == null ? ConfirmationType.IsNotZPush : ConfirmationType.IsZPush; Confirmed = Capabilities == null ? ConfirmationType.IsNotZPush : ConfirmationType.IsZPush;
Logger.Instance.Info(this, "ZPush confirmation: {0} -> {1}, {2}", Confirmed, Capabilities, GABFolder); 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); _confirmedChanged?.Invoke(this);
} }

View File

@ -85,7 +85,19 @@ namespace Acacia.ZPush
// Notify any listeners // Notify any listeners
if (Available != null) 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()); 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. // [ZO-109] Always update the current selection, it might have changed.
Explorer_SelectionChange(); Explorer_SelectionChange();
// Notify the OOF feature. // Notify the OOF feature.
// TODO: this coupling is pretty hideous // TODO: this coupling is pretty hideous
ThisAddIn.Instance.GetFeature<FeatureOutOfOffice>()?.OnOOFSettings(account, oof); ThisAddIn.Instance.GetFeature<FeatureOutOfOffice>()?.OnOOFSettings(account, oof);*/
}); });
} }
else else