mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
Revert "[KOE-155] Implemented send-as option in shared folder dialog. Not fully working, as I cannot link it back to Outlook folders. Committing for when we can fix this."
This reverts commit 98e283168a
.
This commit is contained in:
parent
98e283168a
commit
9ab8fc5d89
@ -180,7 +180,7 @@ namespace Acacia.Features.ReplyFlags
|
|||||||
string id = (string)mail.GetProperty(OutlookConstants.PR_ZPUSH_MESSAGE_ID);
|
string id = (string)mail.GetProperty(OutlookConstants.PR_ZPUSH_MESSAGE_ID);
|
||||||
using (IFolder folder = mail.Parent)
|
using (IFolder folder = mail.Parent)
|
||||||
{
|
{
|
||||||
string folderId = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
string folderId = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
|
||||||
string value = ReplyFlags.VerbToExchange(verb) + "/" + id + "/" + folderId;
|
string value = ReplyFlags.VerbToExchange(verb) + "/" + id + "/" + folderId;
|
||||||
Logger.Instance.Trace(this, "Reply header: {0}", value);
|
Logger.Instance.Trace(this, "Reply header: {0}", value);
|
||||||
response.SetProperty(Constants.ZPUSH_REPLY_HEADER, value);
|
response.SetProperty(Constants.ZPUSH_REPLY_HEADER, value);
|
||||||
|
@ -48,15 +48,6 @@ namespace Acacia.Features.SendAs
|
|||||||
}
|
}
|
||||||
private static readonly BoolOption OPTION_SEND_AS_OWNER = new BoolOption("SendAsOwner", true);
|
private static readonly BoolOption OPTION_SEND_AS_OWNER = new BoolOption("SendAsOwner", true);
|
||||||
|
|
||||||
[AcaciaOption("Disables GAB look ups for senders. GAB lookups are required if a username exists on different accounts, " +
|
|
||||||
"as in that case Outlook fails to determine the email address of the sender.")]
|
|
||||||
public bool GABLookup
|
|
||||||
{
|
|
||||||
get { return GetOption(OPTION_GAB_LOOKUP); }
|
|
||||||
set { SetOption(OPTION_GAB_LOOKUP, value); }
|
|
||||||
}
|
|
||||||
private static readonly BoolOption OPTION_GAB_LOOKUP = new BoolOption("GABLookup", true);
|
|
||||||
|
|
||||||
public override void Startup()
|
public override void Startup()
|
||||||
{
|
{
|
||||||
if (MailEvents != null)
|
if (MailEvents != null)
|
||||||
@ -85,75 +76,53 @@ namespace Acacia.Features.SendAs
|
|||||||
{
|
{
|
||||||
ZPushAccount zpush = Watcher.Accounts.GetAccount(store);
|
ZPushAccount zpush = Watcher.Accounts.GetAccount(store);
|
||||||
Logger.Instance.Trace(this, "Checking ZPush: {0}", zpush);
|
Logger.Instance.Trace(this, "Checking ZPush: {0}", zpush);
|
||||||
if (zpush == null)
|
if (zpush != null)
|
||||||
return;
|
|
||||||
|
|
||||||
// Check if the containing folder is a shared folder
|
|
||||||
using (IFolder parent = mail.Parent)
|
|
||||||
using (IRecipient recip = FindSendAsSender(zpush, parent))
|
|
||||||
{
|
{
|
||||||
if (recip == null || !recip.IsResolved)
|
// Check if the containing folder is a shared folder
|
||||||
return;
|
using (IFolder parent = mail.Parent)
|
||||||
|
|
||||||
// Set the sender
|
|
||||||
Logger.Instance.Trace(this, "Sending as: {0}", recip.Address);
|
|
||||||
using (IAddressEntry address = recip.GetAddressEntry())
|
|
||||||
{
|
{
|
||||||
response.SetSender(address);
|
Logger.Instance.Trace(this, "Checking, Parent folder: {0}", parent.Name);
|
||||||
|
SharedFolder shared = _sharedFolders.GetSharedFolder(parent);
|
||||||
|
if (shared != null)
|
||||||
|
Logger.Instance.Trace(this, "Checking, Shared folder: {0}, flags={1}", shared, shared?.Flags);
|
||||||
|
else
|
||||||
|
Logger.Instance.Trace(this, "Not a shared folder");
|
||||||
|
if (shared != null && shared.FlagSendAsOwner)
|
||||||
|
{
|
||||||
|
Logger.Instance.Trace(this, "Checking, Shared folder owner: {0}", shared.Store.UserName);
|
||||||
|
// It's a shared folder, use the owner as the sender if possible
|
||||||
|
using (IRecipient recip = FindSendAsSender(zpush, shared.Store))
|
||||||
|
{
|
||||||
|
if (recip != null && recip.IsResolved)
|
||||||
|
{
|
||||||
|
Logger.Instance.Trace(this, "Sending as: {0}", recip.Address);
|
||||||
|
using (IAddressEntry address = recip.GetAddressEntry())
|
||||||
|
{
|
||||||
|
response.SetSender(address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.Instance.Error(this, "Unable to resolve sender: {0}", shared.Store.UserName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[AcaciaOption("Disables GAB look ups for senders. GAB lookups are required if a username exists on different accounts, " +
|
||||||
/// Finds the sender to use for an email sent from the specified folder.
|
"as in that case Outlook fails to determine the email address of the sender.")]
|
||||||
/// </summary>
|
public bool GABLookup
|
||||||
/// <returns>The sender, or null if the default sender should be used</returns>
|
|
||||||
private IRecipient FindSendAsSender(ZPushAccount zpush, IFolder folder)
|
|
||||||
{
|
{
|
||||||
// First check if the folder is shared
|
get { return GetOption(OPTION_GAB_LOOKUP); }
|
||||||
if (folder.SyncId.Kind != SyncKind.Shared)
|
set { SetOption(OPTION_GAB_LOOKUP, value); }
|
||||||
return null;
|
|
||||||
|
|
||||||
return FindSendAsSender(zpush, folder, folder.BackendId, null);
|
|
||||||
}
|
}
|
||||||
|
private static readonly BoolOption OPTION_GAB_LOOKUP = new BoolOption("GABLookup", true);
|
||||||
|
|
||||||
public IRecipient FindSendAsSender(ZPushAccount zpush, IFolder folder, BackendId id, GABUser user)
|
internal IRecipient FindSendAsSender(ZPushAccount zpush, GABUser user)
|
||||||
{
|
{
|
||||||
// Check for a locally stored address
|
|
||||||
if (id != null)
|
|
||||||
{
|
|
||||||
string address = zpush.GetSendAsAddress(id);
|
|
||||||
if (address != null)
|
|
||||||
{
|
|
||||||
IRecipient resolved = ThisAddIn.Instance.ResolveRecipient(address);
|
|
||||||
if (resolved != null)
|
|
||||||
return resolved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// If we don't have a user, see if we can fetch it from the shared folder state
|
|
||||||
if (user == null && folder != null)
|
|
||||||
{
|
|
||||||
Logger.Instance.Trace(this, "Checking, Parent folder: {0}", folder.Name);
|
|
||||||
SharedFolder shared = _sharedFolders.GetSharedFolder(folder);
|
|
||||||
if (shared != null)
|
|
||||||
Logger.Instance.Trace(this, "Checking, Shared folder: {0}, flags={1}", shared, shared?.Flags);
|
|
||||||
else
|
|
||||||
Logger.Instance.Trace(this, "Not a shared folder");
|
|
||||||
|
|
||||||
if (shared != null && shared.FlagSendAsOwner)
|
|
||||||
{
|
|
||||||
user = shared.Store;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we don't have a user, there's nothing to resolve
|
|
||||||
if (user == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// First try a simple resolve, this will work if the username is unique
|
// First try a simple resolve, this will work if the username is unique
|
||||||
IRecipient recip = ThisAddIn.Instance.ResolveRecipient(user.UserName);
|
IRecipient recip = ThisAddIn.Instance.ResolveRecipient(user.UserName);
|
||||||
if (recip != null)
|
if (recip != null)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
using Acacia.Features.SecondaryContacts;
|
using Acacia.Features.SecondaryContacts;
|
||||||
using Acacia.Features.SendAs;
|
|
||||||
/// Copyright 2016 Kopano b.v.
|
/// Copyright 2016 Kopano b.v.
|
||||||
///
|
///
|
||||||
/// This program is free software: you can redistribute it and/or modify
|
/// This program is free software: you can redistribute it and/or modify
|
||||||
@ -192,7 +191,7 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
public static bool IsSharedFolder(IFolder folder)
|
public static bool IsSharedFolder(IFolder folder)
|
||||||
{
|
{
|
||||||
string id = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
string id = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
|
||||||
return id?.StartsWith("S") == true;
|
return id?.StartsWith("S") == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,45 +485,5 @@ namespace Acacia.Features.SharedFolders
|
|||||||
Logger.Instance.Error(this, "Error removing shared store: {0}: {1}", share, e);
|
Logger.Instance.Error(this, "Error removing shared store: {0}: {1}", share, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Send-As helpers
|
|
||||||
|
|
||||||
public string FindSendAsAddress(ZPushAccount account, AvailableFolder folder, string suggestion)
|
|
||||||
{
|
|
||||||
// Only mail folders have send-as
|
|
||||||
if (!folder.Type.IsMail())
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// Check if we have send-as at all
|
|
||||||
FeatureSendAs sendAs = ThisAddIn.Instance.GetFeature<FeatureSendAs>();
|
|
||||||
if (sendAs == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
using (IRecipient sender = sendAs.FindSendAsSender(account, null, folder.BackendId, folder.Store))
|
|
||||||
{
|
|
||||||
if (sender != null && sender.IsResolved)
|
|
||||||
return sender.Address;
|
|
||||||
}
|
|
||||||
|
|
||||||
return suggestion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FindSendAsAddress(ZPushAccount account, GABUser store, string suggestion)
|
|
||||||
{
|
|
||||||
// Check if we have send-as at all
|
|
||||||
FeatureSendAs sendAs = ThisAddIn.Instance.GetFeature<FeatureSendAs>();
|
|
||||||
if (sendAs == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
using (IRecipient sender = sendAs.FindSendAsSender(account, null, null, store))
|
|
||||||
{
|
|
||||||
if (sender != null && sender.IsResolved)
|
|
||||||
return sender.Address;
|
|
||||||
}
|
|
||||||
|
|
||||||
return suggestion;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,11 @@
|
|||||||
this.textName = new System.Windows.Forms.TextBox();
|
this.textName = new System.Windows.Forms.TextBox();
|
||||||
this._labelSendAs = new System.Windows.Forms.Label();
|
this._labelSendAs = new System.Windows.Forms.Label();
|
||||||
this.checkSendAs = new System.Windows.Forms.CheckBox();
|
this.checkSendAs = new System.Windows.Forms.CheckBox();
|
||||||
this._labelSendAsAddress = new System.Windows.Forms.Label();
|
|
||||||
this.textSendAsAddress = new System.Windows.Forms.TextBox();
|
|
||||||
this._labelReminders = new System.Windows.Forms.Label();
|
this._labelReminders = new System.Windows.Forms.Label();
|
||||||
this.checkReminders = new System.Windows.Forms.CheckBox();
|
this.checkReminders = new System.Windows.Forms.CheckBox();
|
||||||
this._labelPermissions = new System.Windows.Forms.Label();
|
this._labelPermissions = new System.Windows.Forms.Label();
|
||||||
this._labelRestartRequired = new System.Windows.Forms.Label();
|
|
||||||
this.dialogButtons = new Acacia.Controls.KDialogButtons();
|
this.dialogButtons = new Acacia.Controls.KDialogButtons();
|
||||||
|
this._labelRestartRequired = new System.Windows.Forms.Label();
|
||||||
this._layout.SuspendLayout();
|
this._layout.SuspendLayout();
|
||||||
this._mainBusyHider.SuspendLayout();
|
this._mainBusyHider.SuspendLayout();
|
||||||
this._layoutMain.SuspendLayout();
|
this._layoutMain.SuspendLayout();
|
||||||
@ -139,16 +137,14 @@
|
|||||||
resources.ApplyResources(this._layoutOptions, "_layoutOptions");
|
resources.ApplyResources(this._layoutOptions, "_layoutOptions");
|
||||||
this._layoutOptions.Controls.Add(this._labelWholeStore, 0, 0);
|
this._layoutOptions.Controls.Add(this._labelWholeStore, 0, 0);
|
||||||
this._layoutOptions.Controls.Add(this.checkWholeStore, 1, 0);
|
this._layoutOptions.Controls.Add(this.checkWholeStore, 1, 0);
|
||||||
this._layoutOptions.Controls.Add(this.labelPermissionsValue, 1, 5);
|
this._layoutOptions.Controls.Add(this.labelPermissionsValue, 1, 4);
|
||||||
this._layoutOptions.Controls.Add(this._labelName, 0, 1);
|
this._layoutOptions.Controls.Add(this._labelName, 0, 1);
|
||||||
this._layoutOptions.Controls.Add(this.textName, 1, 1);
|
this._layoutOptions.Controls.Add(this.textName, 1, 1);
|
||||||
this._layoutOptions.Controls.Add(this._labelSendAs, 0, 2);
|
this._layoutOptions.Controls.Add(this._labelSendAs, 0, 2);
|
||||||
this._layoutOptions.Controls.Add(this.checkSendAs, 1, 2);
|
this._layoutOptions.Controls.Add(this.checkSendAs, 1, 2);
|
||||||
this._layoutOptions.Controls.Add(this._labelSendAsAddress, 0, 3);
|
this._layoutOptions.Controls.Add(this._labelReminders, 0, 3);
|
||||||
this._layoutOptions.Controls.Add(this.textSendAsAddress, 1, 3);
|
this._layoutOptions.Controls.Add(this.checkReminders, 1, 3);
|
||||||
this._layoutOptions.Controls.Add(this._labelReminders, 0, 4);
|
this._layoutOptions.Controls.Add(this._labelPermissions, 0, 4);
|
||||||
this._layoutOptions.Controls.Add(this.checkReminders, 1, 4);
|
|
||||||
this._layoutOptions.Controls.Add(this._labelPermissions, 0, 5);
|
|
||||||
this._layoutOptions.Controls.Add(this._labelRestartRequired, 2, 0);
|
this._layoutOptions.Controls.Add(this._labelRestartRequired, 2, 0);
|
||||||
this._layoutOptions.Name = "_layoutOptions";
|
this._layoutOptions.Name = "_layoutOptions";
|
||||||
//
|
//
|
||||||
@ -196,18 +192,6 @@
|
|||||||
this.checkSendAs.UseVisualStyleBackColor = true;
|
this.checkSendAs.UseVisualStyleBackColor = true;
|
||||||
this.checkSendAs.CheckedChanged += new System.EventHandler(this.checkSendAs_CheckedChanged);
|
this.checkSendAs.CheckedChanged += new System.EventHandler(this.checkSendAs_CheckedChanged);
|
||||||
//
|
//
|
||||||
// _labelSendAsAddress
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this._labelSendAsAddress, "_labelSendAsAddress");
|
|
||||||
this._labelSendAsAddress.Name = "_labelSendAsAddress";
|
|
||||||
//
|
|
||||||
// textSendAsAddress
|
|
||||||
//
|
|
||||||
this._layoutOptions.SetColumnSpan(this.textSendAsAddress, 2);
|
|
||||||
resources.ApplyResources(this.textSendAsAddress, "textSendAsAddress");
|
|
||||||
this.textSendAsAddress.Name = "textSendAsAddress";
|
|
||||||
this.textSendAsAddress.TextChanged += new System.EventHandler(this.textSendAsAddress_TextChanged);
|
|
||||||
//
|
|
||||||
// _labelReminders
|
// _labelReminders
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this._labelReminders, "_labelReminders");
|
resources.ApplyResources(this._labelReminders, "_labelReminders");
|
||||||
@ -225,11 +209,6 @@
|
|||||||
resources.ApplyResources(this._labelPermissions, "_labelPermissions");
|
resources.ApplyResources(this._labelPermissions, "_labelPermissions");
|
||||||
this._labelPermissions.Name = "_labelPermissions";
|
this._labelPermissions.Name = "_labelPermissions";
|
||||||
//
|
//
|
||||||
// _labelRestartRequired
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this._labelRestartRequired, "_labelRestartRequired");
|
|
||||||
this._labelRestartRequired.Name = "_labelRestartRequired";
|
|
||||||
//
|
|
||||||
// dialogButtons
|
// dialogButtons
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.dialogButtons, "dialogButtons");
|
resources.ApplyResources(this.dialogButtons, "dialogButtons");
|
||||||
@ -240,6 +219,11 @@
|
|||||||
this.dialogButtons.Name = "dialogButtons";
|
this.dialogButtons.Name = "dialogButtons";
|
||||||
this.dialogButtons.Apply += new System.EventHandler(this.dialogButtons_Apply);
|
this.dialogButtons.Apply += new System.EventHandler(this.dialogButtons_Apply);
|
||||||
//
|
//
|
||||||
|
// _labelRestartRequired
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this._labelRestartRequired, "_labelRestartRequired");
|
||||||
|
this._labelRestartRequired.Name = "_labelRestartRequired";
|
||||||
|
//
|
||||||
// SharedFoldersDialog
|
// SharedFoldersDialog
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
@ -286,7 +270,5 @@
|
|||||||
private System.Windows.Forms.CheckBox checkWholeStore;
|
private System.Windows.Forms.CheckBox checkWholeStore;
|
||||||
private System.Windows.Forms.Label labelPermissionsValue;
|
private System.Windows.Forms.Label labelPermissionsValue;
|
||||||
private System.Windows.Forms.Label _labelRestartRequired;
|
private System.Windows.Forms.Label _labelRestartRequired;
|
||||||
private System.Windows.Forms.Label _labelSendAsAddress;
|
|
||||||
private System.Windows.Forms.TextBox textSendAsAddress;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
using Acacia.Controls;
|
using Acacia.Controls;
|
||||||
using Acacia.Features.GAB;
|
using Acacia.Features.GAB;
|
||||||
using Acacia.Features.SendAs;
|
|
||||||
using Acacia.Stubs;
|
using Acacia.Stubs;
|
||||||
using Acacia.UI;
|
using Acacia.UI;
|
||||||
using Acacia.UI.Outlook;
|
using Acacia.UI.Outlook;
|
||||||
@ -413,8 +412,7 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
// Add the node
|
// Add the node
|
||||||
node = new StoreTreeNode(_folders, gabLookup.GAB,
|
node = new StoreTreeNode(_folders, gabLookup.GAB,
|
||||||
user, _feature.FindSendAsAddress(_account, user, null),
|
user, user.DisplayName, currentShares ?? new Dictionary<BackendId, SharedFolder>(),
|
||||||
user.DisplayName, currentShares ?? new Dictionary<BackendId, SharedFolder>(),
|
|
||||||
wholeStore);
|
wholeStore);
|
||||||
node.DirtyChanged += UserSharesChanged;
|
node.DirtyChanged += UserSharesChanged;
|
||||||
node.CheckStateChanged += WholeStoreShareChanged;
|
node.CheckStateChanged += WholeStoreShareChanged;
|
||||||
@ -501,7 +499,6 @@ namespace Acacia.Features.SharedFolders
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_labelSendAs.Visible = checkSendAs.Visible = value != null;
|
_labelSendAs.Visible = checkSendAs.Visible = value != null;
|
||||||
_labelSendAsAddress.Visible = textSendAsAddress.Visible = _labelSendAs.Visible;
|
|
||||||
if (value != null)
|
if (value != null)
|
||||||
checkSendAs.CheckState = value.Value;
|
checkSendAs.CheckState = value.Value;
|
||||||
}
|
}
|
||||||
@ -722,9 +719,6 @@ namespace Acacia.Features.SharedFolders
|
|||||||
OptionSendAs = CheckState.Indeterminate;
|
OptionSendAs = CheckState.Indeterminate;
|
||||||
checkSendAs.ThreeState = true;
|
checkSendAs.ThreeState = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TryInitSendAsAddress();
|
|
||||||
EnableSendAsAddress();
|
|
||||||
}
|
}
|
||||||
// Reminders shown if any node supports it
|
// Reminders shown if any node supports it
|
||||||
if (_optionRemindersNodes.Count > 0)
|
if (_optionRemindersNodes.Count > 0)
|
||||||
@ -797,9 +791,6 @@ namespace Acacia.Features.SharedFolders
|
|||||||
|
|
||||||
private void checkSendAs_CheckedChanged(object sender, EventArgs e)
|
private void checkSendAs_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Hide the address unless it makes sense
|
|
||||||
EnableSendAsAddress();
|
|
||||||
|
|
||||||
for (int i = 0; i < _optionSendAsNodes.Count; ++i)
|
for (int i = 0; i < _optionSendAsNodes.Count; ++i)
|
||||||
{
|
{
|
||||||
FolderTreeNode node = _optionSendAsNodes[i];
|
FolderTreeNode node = _optionSendAsNodes[i];
|
||||||
@ -814,70 +805,16 @@ namespace Acacia.Features.SharedFolders
|
|||||||
if (node.SharedFolder.FlagSendAsOwner != sendAs)
|
if (node.SharedFolder.FlagSendAsOwner != sendAs)
|
||||||
{
|
{
|
||||||
node.SharedFolder = node.SharedFolder.WithFlagSendAsOwner(sendAs);
|
node.SharedFolder = node.SharedFolder.WithFlagSendAsOwner(sendAs);
|
||||||
if (sendAs)
|
|
||||||
{
|
|
||||||
TryInitSendAsAddress();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send-as is applied recursively
|
// Send-as is applied recursively
|
||||||
foreach (FolderTreeNode desc in node.Descendants())
|
foreach (FolderTreeNode desc in node.Descendants())
|
||||||
{
|
{
|
||||||
if (desc.SharedFolder != null)
|
desc.SharedFolder = desc.SharedFolder.WithFlagSendAsOwner(sendAs);
|
||||||
{
|
|
||||||
desc.SharedFolder = desc.SharedFolder.WithFlagSendAsOwner(sendAs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryInitSendAsAddress()
|
|
||||||
{
|
|
||||||
string email = _feature.FindSendAsAddress(_account, _optionSendAsNodes[0].AvailableFolder, null);
|
|
||||||
|
|
||||||
if (email != null)
|
|
||||||
{
|
|
||||||
textSendAsAddress.Text = email;
|
|
||||||
if (!string.IsNullOrEmpty(email) && _optionSendAsNodes[0].IsShared)
|
|
||||||
{
|
|
||||||
_optionSendAsNodes[0].SharedFolder.SendAsAddress = email;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (checkSendAs.Checked)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Unable to determine the email address for the folder. " +
|
|
||||||
"Send-as will only work if you specify the email address manually.",
|
|
||||||
"Shared Folders", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EnableSendAsAddress()
|
|
||||||
{
|
|
||||||
// Hide unless there's only one selected, and send as is enabled
|
|
||||||
if (_optionSendAsNodes.Count == 1)
|
|
||||||
{
|
|
||||||
_labelSendAsAddress.Visible = textSendAsAddress.Visible = true;
|
|
||||||
_labelSendAsAddress.Enabled = textSendAsAddress.Enabled = OptionSendAs == CheckState.Checked;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_labelSendAsAddress.Visible = textSendAsAddress.Visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void textSendAsAddress_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _optionSendAsNodes.Count; ++i)
|
|
||||||
{
|
|
||||||
FolderTreeNode node = _optionSendAsNodes[i];
|
|
||||||
|
|
||||||
if (node.SharedFolder.SendAsAddress != textSendAsAddress.Text)
|
|
||||||
{
|
|
||||||
node.SharedFolder = node.SharedFolder.WithSendAsAddress(textSendAsAddress.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkReminders_CheckedChanged(object sender, EventArgs e)
|
private void checkReminders_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _optionRemindersNodes.Count; ++i)
|
for (int i = 0; i < _optionRemindersNodes.Count; ++i)
|
||||||
|
@ -283,7 +283,7 @@
|
|||||||
<value>3, 38</value>
|
<value>3, 38</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="kTreeFolders.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="kTreeFolders.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>442, 224</value>
|
<value>442, 250</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="kTreeFolders.TabIndex" type="System.Int32, mscorlib">
|
<data name="kTreeFolders.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
@ -394,7 +394,7 @@
|
|||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="labelPermissionsValue.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="labelPermissionsValue.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>99, 133</value>
|
<value>99, 107</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="labelPermissionsValue.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="labelPermissionsValue.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>346, 20</value>
|
<value>346, 20</value>
|
||||||
@ -543,69 +543,6 @@
|
|||||||
<data name=">>checkSendAs.ZOrder" xml:space="preserve">
|
<data name=">>checkSendAs.ZOrder" xml:space="preserve">
|
||||||
<value>6</value>
|
<value>6</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelSendAsAddress.AutoSize" type="System.Boolean, mscorlib">
|
|
||||||
<value>True</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
|
||||||
<value>Fill</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
|
||||||
<value>NoControl</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>3, 80</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>90, 26</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>11</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.Text" xml:space="preserve">
|
|
||||||
<value>Send-as address</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelSendAsAddress.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
|
||||||
<value>MiddleLeft</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>_labelSendAsAddress.Name" xml:space="preserve">
|
|
||||||
<value>_labelSendAsAddress</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>_labelSendAsAddress.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>_labelSendAsAddress.Parent" xml:space="preserve">
|
|
||||||
<value>_layoutOptions</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>_labelSendAsAddress.ZOrder" xml:space="preserve">
|
|
||||||
<value>7</value>
|
|
||||||
</data>
|
|
||||||
<data name="textSendAsAddress.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
|
||||||
<value>Fill</value>
|
|
||||||
</data>
|
|
||||||
<data name="textSendAsAddress.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>102, 83</value>
|
|
||||||
</data>
|
|
||||||
<data name="textSendAsAddress.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
|
||||||
<value>6, 3, 3, 3</value>
|
|
||||||
</data>
|
|
||||||
<data name="textSendAsAddress.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>343, 20</value>
|
|
||||||
</data>
|
|
||||||
<data name="textSendAsAddress.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>12</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textSendAsAddress.Name" xml:space="preserve">
|
|
||||||
<value>textSendAsAddress</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textSendAsAddress.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textSendAsAddress.Parent" xml:space="preserve">
|
|
||||||
<value>_layoutOptions</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textSendAsAddress.ZOrder" xml:space="preserve">
|
|
||||||
<value>8</value>
|
|
||||||
</data>
|
|
||||||
<data name="_labelReminders.AutoSize" type="System.Boolean, mscorlib">
|
<data name="_labelReminders.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</data>
|
||||||
@ -613,7 +550,7 @@
|
|||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelReminders.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_labelReminders.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>3, 106</value>
|
<value>3, 80</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelReminders.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_labelReminders.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>90, 27</value>
|
<value>90, 27</value>
|
||||||
@ -637,7 +574,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelReminders.ZOrder" xml:space="preserve">
|
<data name=">>_labelReminders.ZOrder" xml:space="preserve">
|
||||||
<value>9</value>
|
<value>7</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkReminders.AutoSize" type="System.Boolean, mscorlib">
|
<data name="checkReminders.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -646,7 +583,7 @@
|
|||||||
<value>Left</value>
|
<value>Left</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkReminders.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="checkReminders.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>102, 110</value>
|
<value>102, 84</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="checkReminders.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="checkReminders.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>6, 4, 3, 3</value>
|
<value>6, 4, 3, 3</value>
|
||||||
@ -670,7 +607,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>checkReminders.ZOrder" xml:space="preserve">
|
<data name=">>checkReminders.ZOrder" xml:space="preserve">
|
||||||
<value>10</value>
|
<value>8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.AutoSize" type="System.Boolean, mscorlib">
|
<data name="_labelPermissions.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@ -679,7 +616,7 @@
|
|||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_labelPermissions.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>3, 133</value>
|
<value>3, 107</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelPermissions.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="_labelPermissions.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 4, 0, 3</value>
|
<value>0, 4, 0, 3</value>
|
||||||
@ -706,7 +643,7 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelPermissions.ZOrder" xml:space="preserve">
|
<data name=">>_labelPermissions.ZOrder" xml:space="preserve">
|
||||||
<value>11</value>
|
<value>9</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_labelRestartRequired.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="_labelRestartRequired.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
@ -739,22 +676,22 @@
|
|||||||
<value>_layoutOptions</value>
|
<value>_layoutOptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>_labelRestartRequired.ZOrder" xml:space="preserve">
|
<data name=">>_labelRestartRequired.ZOrder" xml:space="preserve">
|
||||||
<value>12</value>
|
<value>10</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="_layoutOptions.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="_layoutOptions.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>0, 265</value>
|
<value>0, 291</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="_layoutOptions.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 0, 0, 0</value>
|
<value>0, 0, 0, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.RowCount" type="System.Int32, mscorlib">
|
<data name="_layoutOptions.RowCount" type="System.Int32, mscorlib">
|
||||||
<value>6</value>
|
<value>5</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="_layoutOptions.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>448, 153</value>
|
<value>448, 127</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.TabIndex" type="System.Int32, mscorlib">
|
<data name="_layoutOptions.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
@ -772,7 +709,7 @@
|
|||||||
<value>2</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutOptions.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
<data name="_layoutOptions.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="_labelWholeStore" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkWholeStore" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelPermissionsValue" Row="5" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="_labelName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="textName" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="_labelSendAs" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkSendAs" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelSendAsAddress" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="textSendAsAddress" Row="3" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="_labelReminders" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkReminders" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelPermissions" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="_labelRestartRequired" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings></value>
|
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="_labelWholeStore" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkWholeStore" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelPermissionsValue" Row="4" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="_labelName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="textName" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="_labelSendAs" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkSendAs" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelReminders" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="checkReminders" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="_labelPermissions" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="_labelRestartRequired" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="_layoutMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="_layoutMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
|
@ -47,7 +47,6 @@ namespace Acacia.Features.SharedFolders
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FeatureSharedFolders Feature { get { return _feature; } }
|
public FeatureSharedFolders Feature { get { return _feature; } }
|
||||||
public ZPushAccount Account { get { return _account; } }
|
|
||||||
|
|
||||||
#region API
|
#region API
|
||||||
|
|
||||||
@ -58,17 +57,6 @@ namespace Acacia.Features.SharedFolders
|
|||||||
{
|
{
|
||||||
// Make sure reminders are updated as soon as possible
|
// Make sure reminders are updated as soon as possible
|
||||||
UpdateReminders(shares);
|
UpdateReminders(shares);
|
||||||
|
|
||||||
// Store the send-as addresses
|
|
||||||
foreach (SharedFolder share in shares)
|
|
||||||
{
|
|
||||||
if (share.CanSendAs)
|
|
||||||
{
|
|
||||||
_account.SetSendAsAddress(share.BackendId, share.FlagSendAsOwner ? share.SendAsAddress : null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the shares
|
|
||||||
_api.SetCurrentShares(store, shares, cancel);
|
_api.SetCurrentShares(store, shares, cancel);
|
||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
|
@ -43,10 +43,8 @@ namespace Acacia.Features.SharedFolders
|
|||||||
private readonly Dictionary<BackendId, SharedFolder> _currentShares;
|
private readonly Dictionary<BackendId, SharedFolder> _currentShares;
|
||||||
|
|
||||||
private readonly FeatureSharedFolders _feature;
|
private readonly FeatureSharedFolders _feature;
|
||||||
private readonly ZPushAccount _account;
|
|
||||||
private readonly GABHandler _gab;
|
private readonly GABHandler _gab;
|
||||||
private readonly GABUser _user;
|
private readonly GABUser _user;
|
||||||
private readonly string _sendAsAddress;
|
|
||||||
|
|
||||||
public readonly bool IsReadOnly;
|
public readonly bool IsReadOnly;
|
||||||
|
|
||||||
@ -63,21 +61,15 @@ namespace Acacia.Features.SharedFolders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StoreTreeNode(SharedFoldersManager folders, GABHandler gab, GABUser user, string sendAsAddress, string text,
|
public StoreTreeNode(SharedFoldersManager folders, GABHandler gab, GABUser user, string text,
|
||||||
Dictionary<BackendId, SharedFolder> currentFolders, bool isShared)
|
Dictionary<BackendId, SharedFolder> currentFolders, bool isShared)
|
||||||
:
|
:
|
||||||
base(text)
|
base(text)
|
||||||
{
|
{
|
||||||
this._initialShares = currentFolders;
|
this._initialShares = currentFolders;
|
||||||
// Patch in send as address
|
|
||||||
foreach (SharedFolder share in _initialShares.Values)
|
|
||||||
if (share.SendAsAddress == null)
|
|
||||||
share.SendAsAddress = sendAsAddress;
|
|
||||||
this._feature = folders.Feature;
|
this._feature = folders.Feature;
|
||||||
this._account = folders.Account;
|
|
||||||
this._gab = gab;
|
this._gab = gab;
|
||||||
this._user = user;
|
this._user = user;
|
||||||
this._sendAsAddress = sendAsAddress;
|
|
||||||
this.IsReadOnly = false;
|
this.IsReadOnly = false;
|
||||||
this._isShared = isShared;
|
this._isShared = isShared;
|
||||||
|
|
||||||
@ -164,16 +156,9 @@ namespace Acacia.Features.SharedFolders
|
|||||||
{
|
{
|
||||||
SharedFolder share = new SharedFolder(folder, DefaultNameForFolder(folder));
|
SharedFolder share = new SharedFolder(folder, DefaultNameForFolder(folder));
|
||||||
|
|
||||||
// Default send as for mail folders if the address can be determined
|
// Default send as for mail folders
|
||||||
string sendAs = _feature.FindSendAsAddress(_account, folder, _sendAsAddress);
|
if (folder.Type.IsMail())
|
||||||
if (sendAs != null)
|
share = share.WithFlagSendAsOwner(true);
|
||||||
{
|
|
||||||
share = share.WithFlagSendAsOwner(true).WithSendAsAddress(sendAs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
share = share.WithFlagSendAsOwner(false).WithSendAsAddress(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return share;
|
return share;
|
||||||
}
|
}
|
||||||
@ -233,8 +218,6 @@ namespace Acacia.Features.SharedFolders
|
|||||||
if (state.FlagUpdateShareName)
|
if (state.FlagUpdateShareName)
|
||||||
state = state.WithName(DefaultNameForFolder(folder));
|
state = state.WithName(DefaultNameForFolder(folder));
|
||||||
}
|
}
|
||||||
|
|
||||||
state = state.WithSendAsAddress(_sendAsAddress);
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -501,7 +501,7 @@ namespace Acacia.Features.SyncState
|
|||||||
// Check the inbox folder
|
// Check the inbox folder
|
||||||
using (IFolder inbox = account.Account.Store.GetDefaultFolder(DefaultFolder.Inbox))
|
using (IFolder inbox = account.Account.Store.GetDefaultFolder(DefaultFolder.Inbox))
|
||||||
{
|
{
|
||||||
string syncId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_BACKEND_ID);
|
string syncId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
||||||
|
|
||||||
// If it's syncing, it's not stalled
|
// If it's syncing, it's not stalled
|
||||||
if (syncId != null && syncId != "0")
|
if (syncId != null && syncId != "0")
|
||||||
@ -515,7 +515,7 @@ namespace Acacia.Features.SyncState
|
|||||||
_syncStallLastSyncTime = sync.LastSyncTime;
|
_syncStallLastSyncTime = sync.LastSyncTime;
|
||||||
|
|
||||||
// Get the sync state
|
// Get the sync state
|
||||||
string folderId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
string folderId = (string)inbox.GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
|
||||||
if (folderId != null)
|
if (folderId != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ namespace Acacia
|
|||||||
|
|
||||||
#region EAS / ZPush
|
#region EAS / ZPush
|
||||||
|
|
||||||
public const string PR_ZPUSH_BACKEND_ID = PROP + "6A18" + PT_STRING8;
|
public const string PR_ZPUSH_SYNC_ID = PROP + "6A18" + PT_STRING8;
|
||||||
public const string PR_ZPUSH_SYNC_ID = PROP + "6A19" + PT_STRING8;
|
public const string PR_ZPUSH_FOLDER_ID = PROP + "6A19" + PT_STRING8;
|
||||||
public const string PR_ZPUSH_MESSAGE_ID = PROP + "6B20" + PT_STRING8;
|
public const string PR_ZPUSH_MESSAGE_ID = PROP + "6B20" + PT_STRING8;
|
||||||
public const string PR_ZPUSH_NAME = PROP + "6915" + PT_UNICODE;
|
public const string PR_ZPUSH_NAME = PROP + "6915" + PT_UNICODE;
|
||||||
|
|
||||||
|
@ -74,11 +74,5 @@ namespace Acacia.Stubs
|
|||||||
}
|
}
|
||||||
|
|
||||||
string ShareFor {get;}
|
string ShareFor {get;}
|
||||||
|
|
||||||
string this[string index]
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,6 @@ namespace Acacia.Stubs
|
|||||||
|
|
||||||
ItemType ItemType { get; }
|
ItemType ItemType { get; }
|
||||||
|
|
||||||
BackendId BackendId { get; }
|
|
||||||
SyncId SyncId { get; }
|
SyncId SyncId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -158,10 +158,7 @@ namespace Acacia.Stubs.OutlookWrappers
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string devId = RegistryUtil.GetValueString(_regPath, OutlookConstants.REG_VAL_EAS_DEVICEID, null);
|
return RegistryUtil.GetValueString(_regPath, OutlookConstants.REG_VAL_EAS_DEVICEID, null);
|
||||||
if (devId == null)
|
|
||||||
devId = RegistryUtil.GetValueString(_regPath, OutlookConstants.REG_VAL_EAS_DEVICEID, null);
|
|
||||||
return devId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,22 +292,6 @@ namespace Acacia.Stubs.OutlookWrappers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string this[string index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return RegistryUtil.GetValueString(_regPath, index, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
RegistryUtil.RemoveValue(_regPath, index);
|
|
||||||
else
|
|
||||||
RegistryUtil.SetValueString(_regPath, index, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,17 +119,8 @@ namespace Acacia.Stubs.OutlookWrappers
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string syncId = (string)GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
|
string folderId = (string)GetProperty(OutlookConstants.PR_ZPUSH_FOLDER_ID);
|
||||||
return syncId == null ? null : new SyncId(syncId);
|
return folderId == null ? null : new SyncId(folderId);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BackendId BackendId
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string backendId = (string)GetProperty(OutlookConstants.PR_ZPUSH_BACKEND_ID);
|
|
||||||
return backendId == null ? null : new BackendId(backendId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,29 +45,6 @@ namespace Acacia.Utils
|
|||||||
Registry.SetValue(keyPath, valueName, value);
|
Registry.SetValue(keyPath, valueName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveValue(string keyPath, string valueName)
|
|
||||||
{
|
|
||||||
using (RegistryKey key = KeyFromPath(keyPath, true))
|
|
||||||
{
|
|
||||||
if (key != null)
|
|
||||||
{
|
|
||||||
key.DeleteValue(valueName, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static RegistryKey KeyFromPath(string keyPath, bool writeable)
|
|
||||||
{
|
|
||||||
foreach (RegistryKey baseKey in new RegistryKey[] {Registry.CurrentUser, Registry.LocalMachine })
|
|
||||||
{
|
|
||||||
if (keyPath.StartsWith(baseKey.Name))
|
|
||||||
{
|
|
||||||
return baseKey.OpenSubKey(keyPath.Substring(baseKey.Name.Length + 1), writeable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string RegToString(object o)
|
public static string RegToString(object o)
|
||||||
{
|
{
|
||||||
if (o is byte[])
|
if (o is byte[])
|
||||||
|
@ -163,14 +163,7 @@ namespace Acacia.ZPush.API.SharedFolders
|
|||||||
{
|
{
|
||||||
SoapData newData = _data;
|
SoapData newData = _data;
|
||||||
newData.flags = flags;
|
newData.flags = flags;
|
||||||
SharedFolder clone = new SharedFolder(newData);
|
return new SharedFolder(newData);
|
||||||
clone.SendAsAddress = SendAsAddress;
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanSendAs
|
|
||||||
{
|
|
||||||
get { return SyncType.IsMail(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FlagSendAsOwner { get { return Flags.HasFlag(ShareFlags.SendAsOwner); } }
|
public bool FlagSendAsOwner { get { return Flags.HasFlag(ShareFlags.SendAsOwner); } }
|
||||||
@ -203,23 +196,6 @@ namespace Acacia.ZPush.API.SharedFolders
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Send as
|
|
||||||
|
|
||||||
public string SendAsAddress
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SharedFolder WithSendAsAddress(string sendAs)
|
|
||||||
{
|
|
||||||
SharedFolder clone = new SharedFolder(_data);
|
|
||||||
clone.SendAsAddress = sendAs;
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Standard overrides
|
#region Standard overrides
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
@ -229,17 +205,7 @@ namespace Acacia.ZPush.API.SharedFolders
|
|||||||
|
|
||||||
override public bool Equals(object o)
|
override public bool Equals(object o)
|
||||||
{
|
{
|
||||||
SharedFolder rhs = o as SharedFolder;
|
return o is SharedFolder && _data.Equals(((SharedFolder)o)._data);
|
||||||
if (rhs == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!_data.Equals(rhs._data))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!FlagSendAsOwner)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return Object.Equals(SendAsAddress, rhs.SendAsAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -284,21 +284,5 @@ namespace Acacia.ZPush
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Send as
|
|
||||||
|
|
||||||
private const string PREFIX_SEND_AS = "KOE SendAs ";
|
|
||||||
|
|
||||||
public void SetSendAsAddress(BackendId id, string sendAsAddress)
|
|
||||||
{
|
|
||||||
_account[PREFIX_SEND_AS + id.ToString()] = sendAsAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetSendAsAddress(BackendId id)
|
|
||||||
{
|
|
||||||
return _account[PREFIX_SEND_AS + id.ToString()];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,23 +118,7 @@ namespace Acacia.ZPush
|
|||||||
{
|
{
|
||||||
public static readonly BackendId NONE = new BackendId("0");
|
public static readonly BackendId NONE = new BackendId("0");
|
||||||
|
|
||||||
public BackendId(string id)
|
public BackendId(string id) : base(id) { }
|
||||||
:
|
|
||||||
base(StripSuffix(id))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string StripSuffix(string id)
|
|
||||||
{
|
|
||||||
// The backend id is of the format {id}num?. Strip off num if present
|
|
||||||
int index = id.IndexOf('}');
|
|
||||||
if (index >= 0 && index < id.Length)
|
|
||||||
{
|
|
||||||
id = id.Substring(0, index + 1);
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BackendId(int id) : base(id) { }
|
public BackendId(int id) : base(id) { }
|
||||||
public BackendId(long id) : base(id.ToString()) { }
|
public BackendId(long id) : base(id.ToString()) { }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user