From 08e50f9e42fa6247a63576902dd452e2f47c6cbe Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Wed, 18 Apr 2018 15:27:43 +0300
Subject: [PATCH] [KOE-168] Added recursive setting of send-as address
---
.../SharedFolders/SharedFoldersDialog.cs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs
index e29241e..ff3bd75 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/SharedFoldersDialog.cs
@@ -948,6 +948,25 @@ namespace Acacia.Features.SharedFolders
if (node.SharedFolder.SendAsAddress != textSendAsAddress.Text)
{
node.SharedFolder = node.SharedFolder.WithSendAsAddress(textSendAsAddress.Text);
+
+ // Try any children
+ ApplySendAsAddressChildren(node, textSendAsAddress.Text);
+ }
+ }
+ }
+
+ private void ApplySendAsAddressChildren(FolderTreeNode node, string address)
+ {
+ foreach(FolderTreeNode child in node.Children)
+ {
+ if (child.SharedFolder == null || !child.SharedFolder.FlagSendAsOwner)
+ continue;
+
+ if (string.IsNullOrWhiteSpace(child.SharedFolder.SendAsAddress))
+ {
+ child.SharedFolder = child.SharedFolder.WithSendAsAddress(address);
+
+ ApplySendAsAddressChildren(child, address);
}
}
}