Skip to content

Commit

Permalink
fixup! Add imip processing
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulalala committed Aug 17, 2022
1 parent 005f30d commit bc259c4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
4 changes: 1 addition & 3 deletions lib/Db/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ public function updateBulk(Account $account, bool $permflagsEnabled, Message ...
->set('flag_mdnsent', $query->createParameter('flag_mdnsent'))
->set('flag_important', $query->createParameter('flag_important'))
->set('updated_at', $query->createNamedParameter($this->timeFactory->getTime()))
// ->set('imip_message', $query->createParameter('imip_message'))
->where($query->expr()->andX(
$query->expr()->eq('uid', $query->createParameter('uid')),
$query->expr()->eq('mailbox_id', $query->createParameter('mailbox_id'))
Expand Down Expand Up @@ -407,7 +406,6 @@ public function updateBulk(Account $account, bool $permflagsEnabled, Message ...
$query->setParameter('flag_notjunk', $message->getFlagNotjunk(), IQueryBuilder::PARAM_BOOL);
$query->setParameter('flag_mdnsent', $message->getFlagMdnsent(), IQueryBuilder::PARAM_BOOL);
$query->setParameter('flag_important', $message->getFlagImportant(), IQueryBuilder::PARAM_BOOL);
// $query->setParameter('imip_message', $message->isImipMessage(), IQueryBuilder::PARAM_BOOL);
$query->execute();
$perf->step('Updated message ' . $message->getId());
}
Expand Down Expand Up @@ -1291,7 +1289,7 @@ public function findIMipMessagesAscending(): array {
$qb->expr()->eq('imip_message', $qb->createNamedParameter(true, IQueryBuilder::PARAM_BOOL), IQueryBuilder::PARAM_BOOL),
$qb->expr()->eq('imip_processed', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL), IQueryBuilder::PARAM_BOOL),
$qb->expr()->eq('imip_error', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL), IQueryBuilder::PARAM_BOOL),
$qb->expr()->eq('flag_junked', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL), IQueryBuilder::PARAM_BOOL),
$qb->expr()->eq('flag_junk', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL), IQueryBuilder::PARAM_BOOL),
$qb->expr()->gt('sent_at', $qb->createNamedParameter($time, IQueryBuilder::PARAM_INT)),
)->orderBy('sent_at', 'ASC'); // make sure we don't process newer messages first

Expand Down
2 changes: 2 additions & 0 deletions lib/IMAP/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,13 @@ public function getBodyStructureData(Horde_Imap_Client_Socket $client,
$isImipMessage = false;

$structure = $fetchData->getStructure();
/** @var Horde_Mime_Part $part */
foreach ($structure->getParts() as $part) {
if ($part->isAttachment()) {
$hasAttachments = true;
}
$bodyParts = $part->getParts();
/** @var Horde_Mime_Part $bodyPart */
foreach ($bodyParts as $bodyPart) {
$contentParameters = $bodyPart->getAllContentTypeParameters();
if ($bodyPart->getType() === 'text/calendar' && isset($contentParameters['method'])) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/IMipService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function process(): void {
try {
$imapMessages = $this->mailManager->getImapMessagesForScheduleProcessing($account, $mailbox, array_map(function ($message) {
return $message->getUid();
}, $filteredMessages), true);
}, $filteredMessages));
} catch (ServiceException $e) {
$this->logger->error('Could not get IMAP messages form IMAP server', ['exception' => $e]);
continue;
Expand Down
23 changes: 0 additions & 23 deletions tests/Unit/Service/PreprocessingServiceTest.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
<?php
/*
* *
* * {$app} App
* *
* * @copyright 2022 Anna Larch <anna.larch@gmx.net>
* *
* * @author Anna Larch <anna.larch@gmx.net>
* *
* * This library is free software; you can redistribute it and/or
* * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* * License as published by the Free Software Foundation; either
* * version 3 of the License, or any later version.
* *
* * This library 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 library. If not, see <http://www.gnu.org/licenses/>.
* *
*
*/

declare(strict_types=1);

Expand Down

0 comments on commit bc259c4

Please sign in to comment.