From 9ebdc776833d7f444bc838f29e7a75251e9cb870 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Mon, 6 May 2024 18:17:02 +0200 Subject: [PATCH] fixup! fix: honour MDN requests --- .../Version3700Date20240506161400.php | 57 +++++++++++++++++++ lib/Service/MailTransmission.php | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 lib/Migration/Version3700Date20240506161400.php diff --git a/lib/Migration/Version3700Date20240506161400.php b/lib/Migration/Version3700Date20240506161400.php new file mode 100644 index 0000000000..9247790f81 --- /dev/null +++ b/lib/Migration/Version3700Date20240506161400.php @@ -0,0 +1,57 @@ + + * + * FIXME @author Your name + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Mail\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version3700Date20240506161400 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure(): ISchemaWrapper $schemaClosure + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $localMessagesTable = $schema->getTable('mail_local_messages'); + if (!$localMessagesTable->hasColumn('request_mdn')) { + $localMessagesTable->addColumn('request_mdn', Types::BOOLEAN, [ + 'notnull' => false, + 'default' => false, + ]); + } + + return $schema; + } +} diff --git a/lib/Service/MailTransmission.php b/lib/Service/MailTransmission.php index e6ebfccd38..56276af6a7 100644 --- a/lib/Service/MailTransmission.php +++ b/lib/Service/MailTransmission.php @@ -121,7 +121,7 @@ public function sendMessage(Account $account, LocalMessage $localMessage): void $headers['In-Reply-To'] = $inReplyTo; } - if ($localMessage->getMdnRequested()) { + if ($localMessage->getRequestMdn()) { $headers[Horde_Mime_Mdn::MDN_HEADER] = $from->first()->toHorde(); }