diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/AcaciaZPushPlugin.csproj b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/AcaciaZPushPlugin.csproj
index dd0ffbe..831ef3d 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/AcaciaZPushPlugin.csproj
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/AcaciaZPushPlugin.csproj
@@ -276,6 +276,7 @@
+
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Native/IOleWindow.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Native/IOleWindow.cs
new file mode 100644
index 0000000..473593c
--- /dev/null
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Native/IOleWindow.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Acacia.Native
+{
+ [ComImport]
+ [Guid("00000114-0000-0000-C000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IOleWindow
+ {
+ void GetWindow(out IntPtr phwnd);
+ void ContextSensitiveHelp([In, MarshalAs(UnmanagedType.Bool)] bool fEnterMode);
+ }
+}
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs
index f2f609e..204b24a 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.Designer.cs
@@ -60,6 +60,24 @@ namespace Acacia.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to The password for account '{0}' is not available. Advanced Z-Push features will not work..
+ ///
+ internal static string AccountNoPassword_Body {
+ get {
+ return ResourceManager.GetString("AccountNoPassword_Body", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Password unavailable.
+ ///
+ internal static string AccountNoPassword_Title {
+ get {
+ return ResourceManager.GetString("AccountNoPassword_Title", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Support.
///
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx
index 93b5c6b..a8eb0c0 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Properties/Resources.resx
@@ -439,4 +439,10 @@
Contacts folder
Shown when a secondary contact folder is detected, to inform the user that a restart is required
+
+ The password for account '{0}' is not available. Advanced Z-Push features will not work.
+
+
+ Password unavailable
+
\ No newline at end of file
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs
index 269c820..640a8f0 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ThisAddIn.cs
@@ -32,6 +32,7 @@ using Acacia.UI.Outlook;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Reflection;
+using Acacia.Native;
namespace Acacia
{
@@ -244,6 +245,41 @@ namespace Acacia
}
}
+ #region Window handle
+
+ private class WindowHandle : IWin32Window
+ {
+ private IntPtr hWnd;
+
+ public WindowHandle(IntPtr hWnd)
+ {
+ this.hWnd = hWnd;
+ }
+
+ public IntPtr Handle
+ {
+ get
+ {
+ return hWnd;
+ }
+ }
+ }
+
+ public IWin32Window Window
+ {
+ get
+ {
+ var win = Application.ActiveWindow() as IOleWindow;
+ if (win == null)
+ return null;
+ IntPtr hWnd;
+ win.GetWindow(out hWnd);
+ return new WindowHandle(hWnd);
+ }
+ }
+
+ #endregion
+
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return OutlookUI;
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushAccount.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushAccount.cs
index 09fc992..d3c89c9 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushAccount.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushAccount.cs
@@ -136,6 +136,12 @@ namespace Acacia.ZPush
}
}
+ [Browsable(false)]
+ public bool HasPassword
+ {
+ get { return Registry.GetValue(_regPath, OutlookConstants.REG_VAL_EAS_PASSWORD, null) != null; }
+ }
+
public string StoreID
{
get { return GetStoreId(_regPath); }
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushWatcher.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushWatcher.cs
index 571cfb8..dc536c5 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushWatcher.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/ZPushWatcher.cs
@@ -141,24 +141,39 @@ namespace Acacia.ZPush
// Register any events
HandleFolderWatchers(account);
- // Send an OOF request to get the OOF state and capabilities
- Tasks.Task(null, "ZPushCheck: " + account.DisplayName, () =>
+ if (account.HasPassword)
{
- // TODO: if this fails, retry?
- ActiveSync.SettingsOOF oof;
- using (ZPushConnection connection = new ZPushConnection(account, new System.Threading.CancellationToken(false)))
+ // Send an OOF request to get the OOF state and capabilities
+ Tasks.Task(null, "ZPushCheck: " + account.DisplayName, () =>
{
- oof = connection.Execute(new ActiveSync.SettingsOOFGet());
- }
- account.OnConfirmationResponse(oof.RawResponse);
+ // TODO: if this fails, retry?
+ ActiveSync.SettingsOOF oof;
+ using (ZPushConnection connection = new ZPushConnection(account, new System.Threading.CancellationToken(false)))
+ {
+ oof = connection.Execute(new ActiveSync.SettingsOOFGet());
+ }
+ account.OnConfirmationResponse(oof.RawResponse);
- // [ZO-109] Always update the current selection, it might have changed.
- Explorer_SelectionChange();
+ // [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()?.OnOOFSettings(account, oof);
- });
+ // Notify the OOF feature.
+ // TODO: this coupling is pretty hideous
+ ThisAddIn.Instance.GetFeature()?.OnOOFSettings(account, oof);
+ });
+ }
+ else
+ {
+ ThisAddIn.Instance.InvokeUI(() =>
+ {
+ Logger.Instance.Warning(this, "Password not available for account: {0}", account);
+ System.Windows.Forms.MessageBox.Show(ThisAddIn.Instance.Window,
+ string.Format(Properties.Resources.AccountNoPassword_Body, account.DisplayName),
+ Properties.Resources.AccountNoPassword_Title,
+ System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information
+ );
+ });
+ }
}
internal void OnAccountsScanned()