Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Contracts/IMailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OCA\Mail\Db\Tag;
use OCA\Mail\Exception\ClientException;
use OCA\Mail\Exception\ServiceException;
use OCA\Mail\Exception\SmimeDecryptException;
use OCA\Mail\Exception\TrashMailboxNotSetException;
use OCA\Mail\Model\IMAPMessage;
use OCA\Mail\Service\Quota;
Expand Down Expand Up @@ -97,6 +98,7 @@ public function getSource(Horde_Imap_Client_Socket $client,
* @return IMAPMessage
*
* @throws ServiceException
* @throws SmimeDecryptException
*/
public function getImapMessage(Horde_Imap_Client_Socket $client,
Account $account,
Expand Down
31 changes: 16 additions & 15 deletions lib/IMAP/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCA\Mail\Attachment;
use OCA\Mail\Db\Mailbox;
use OCA\Mail\Exception\ServiceException;
use OCA\Mail\Exception\SmimeDecryptException;
use OCA\Mail\Html\Parser;
use OCA\Mail\IMAP\Charset\Converter;
use OCA\Mail\Model\IMAPMessage;
Expand Down Expand Up @@ -66,9 +67,11 @@ public function __construct(
}

/**
* @return IMAPMessage
* @throws DoesNotExistException
* @throws Horde_Imap_Client_Exception
* @throws Horde_Mime_Exception
* @throws ServiceException
* @throws SmimeDecryptException
*/
public function find(Horde_Imap_Client_Base $client,
string $mailbox,
Expand All @@ -85,15 +88,17 @@ public function find(Horde_Imap_Client_Base $client,
}

/**
* @param Horde_Imap_Client_Socket $client
* @param string $mailbox
* @return array{
* messages: list<IMAPMessage>,
* all: bool,
* total: int,
* }
*
* @param int $maxResults
* @param int $highestKnownUid
* @param PerformanceLoggerTask $perf
*
* @return array
* @throws DoesNotExistException
* @throws Horde_Imap_Client_Exception
* @throws Horde_Imap_Client_Exception_NoSupportExtension
* @throws Horde_Mime_Exception
* @throws ServiceException
*/
public function findAll(Horde_Imap_Client_Socket $client,
string $mailbox,
Expand Down Expand Up @@ -256,22 +261,18 @@ public function findAll(Horde_Imap_Client_Socket $client,
}

/**
* @param Horde_Imap_Client_Base $client
* @param string $mailbox
* @param int[]|Horde_Imap_Client_Ids $ids
* @param string $userId
* @param bool $loadBody
* @return IMAPMessage[]
* @return list<IMAPMessage>
*
* @throws DoesNotExistException
* @throws Horde_Imap_Client_Exception
* @throws Horde_Imap_Client_Exception_NoSupportExtension
* @throws Horde_Mime_Exception
* @throws ServiceException
* @throws SmimeDecryptException
*/
public function findByIds(Horde_Imap_Client_Base $client,
string $mailbox,
$ids,
array|Horde_Imap_Client_Ids $ids,
string $userId,
bool $loadBody = false,
bool $runPhishingCheck = false): array {
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Attachment/AttachmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use OCA\Mail\Db\Message;
use OCA\Mail\Exception\AttachmentNotFoundException;
use OCA\Mail\Exception\ServiceException;
use OCA\Mail\Exception\SmimeDecryptException;
use OCA\Mail\Exception\UploadException;
use OCA\Mail\IMAP\MessageMapper;
use OCP\AppFramework\Db\DoesNotExistException;
Expand Down Expand Up @@ -279,6 +280,8 @@ public function getAttachmentNames(Account $account, Mailbox $mailbox, Message $
true
);
$attachments = $imapMessage->getAttachments();
} catch (SmimeDecryptException $e) {
$this->logger->debug('Could not get attachment names for S/MIME encrypted message', ['exception' => $e, 'messageId' => $message->getUid()]);
} catch (ServiceException $e) {
$this->logger->warning('Could not get attachment names', ['exception' => $e, 'messageId' => $message->getUid()]);
}
Expand Down
15 changes: 1 addition & 14 deletions lib/Service/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use OCA\Mail\Exception\ClientException;
use OCA\Mail\Exception\ImapFlagEncodingException;
use OCA\Mail\Exception\ServiceException;
use OCA\Mail\Exception\SmimeDecryptException;
use OCA\Mail\Exception\TrashMailboxNotSetException;
use OCA\Mail\Folder;
use OCA\Mail\IMAP\FolderMapper;
Expand Down Expand Up @@ -164,18 +163,6 @@ public function createMailbox(Account $account, string $name, array $specialUse
return $this->mailboxMapper->find($account, $name);
}

/**
* @param Horde_Imap_Client_Socket $client
* @param Account $account
* @param Mailbox $mailbox
* @param int $uid
* @param bool $loadBody
*
* @return IMAPMessage
*
* @throws ServiceException
* @throws SmimeDecryptException
*/
#[\Override]
public function getImapMessage(Horde_Imap_Client_Socket $client,
Account $account,
Expand All @@ -190,7 +177,7 @@ public function getImapMessage(Horde_Imap_Client_Socket $client,
$account->getUserId(),
$loadBody
);
} catch (Horde_Imap_Client_Exception|DoesNotExistException $e) {
} catch (DoesNotExistException|Horde_Mime_Exception|Horde_Imap_Client_Exception $e) {
throw new ServiceException(
'Could not load message',
$e->getCode(),
Expand Down
3 changes: 2 additions & 1 deletion lib/Service/SmimeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ public function decryptMimePartText(string $mimePartText,
* @param string $userId
* @return SmimeDecryptionResult
*
* @throws ServiceException
* @throws ServiceException If the database query fails
* @throws SmimeDecryptException No certificate for decryption found
*/
public function decryptDataFetch(Horde_Imap_Client_Data_Fetch $message,
string $userId): SmimeDecryptionResult {
Expand Down
Loading