Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/IMAP
diff options
context:
space:
mode:
authorCyrille Bollu <cyrpub@bollu.be>2020-10-27 12:03:14 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-12-16 17:05:45 +0300
commit67d75c3173ba2c76b9fd100d769e8cf6d93c3321 (patch)
tree290d80f5dcd62af755a8444737efa8a39e966c4e /lib/IMAP
parent64ca3bd53e1f78e9c6bddf8e7dbe2fcb0b027a20 (diff)
Add original attachments when forwarding a mail
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/IMAP')
-rw-r--r--lib/IMAP/MessageMapper.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/IMAP/MessageMapper.php b/lib/IMAP/MessageMapper.php
index e5b0e46a6..47160e65a 100644
--- a/lib/IMAP/MessageMapper.php
+++ b/lib/IMAP/MessageMapper.php
@@ -39,6 +39,7 @@ use OCP\AppFramework\Db\DoesNotExistException;
use Psr\Log\LoggerInterface;
use function array_filter;
use function array_map;
+use function in_array;
use function iterator_to_array;
use function reset;
@@ -455,8 +456,9 @@ class MessageMapper {
}
public function getRawAttachments(Horde_Imap_Client_Socket $client,
- string $mailbox,
- int $uid): array {
+ string $mailbox,
+ int $uid,
+ ?array $attachmentIds = []): array {
$messageQuery = new Horde_Imap_Client_Fetch_Query();
$messageQuery->structure();
@@ -477,6 +479,10 @@ class MessageMapper {
// Ignore message header
continue;
}
+ if (!empty($attachmentIds) && !in_array($part->getMIMEId(), $attachmentIds, true)) {
+ // We are looking for specific parts only and this is not one of them
+ continue;
+ }
$partsQuery->bodyPart($part->getMimeId(), [
'peek' => true,