From 150716df3480175ac223f59f9349eba8cedf6524 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 10 Oct 2019 13:36:35 +0200 Subject: Use KItinerary to extract information from emails and attachments Signed-off-by: Christoph Wurst --- lib/Controller/MessagesController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/Controller/MessagesController.php') diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php index d4ca2c4a6..22b5d7b03 100755 --- a/lib/Controller/MessagesController.php +++ b/lib/Controller/MessagesController.php @@ -31,7 +31,6 @@ declare(strict_types=1); namespace OCA\Mail\Controller; use Exception; -use OCA\Mail\Account; use OCA\Mail\Contracts\IMailManager; use OCA\Mail\Contracts\IMailSearch; use OCA\Mail\Exception\ServiceException; @@ -40,6 +39,7 @@ use OCA\Mail\Http\HtmlResponse; use OCA\Mail\Model\IMAPMessage; use OCA\Mail\Service\AccountService; use OCA\Mail\Service\IMailBox; +use OCA\Mail\Service\ItineraryService; use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; @@ -47,7 +47,6 @@ use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\TemplateResponse; -use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\Folder; use OCP\Files\IMimeTypeDetector; use OCP\IL10N; @@ -67,6 +66,9 @@ class MessagesController extends Controller { /** @var IMailSearch */ private $mailSearch; + /** @var ItineraryService */ + private $itineraryService; + /** @var string */ private $currentUserId; @@ -101,6 +103,7 @@ class MessagesController extends Controller { AccountService $accountService, IMailManager $mailManager, IMailSearch $mailSearch, + ItineraryService $itineraryService, string $UserId, $userFolder, ILogger $logger, @@ -112,6 +115,7 @@ class MessagesController extends Controller { $this->accountService = $accountService; $this->mailManager = $mailManager; $this->mailSearch = $mailSearch; + $this->itineraryService = $itineraryService; $this->currentUserId = $UserId; $this->userFolder = $userFolder; $this->logger = $logger; @@ -180,6 +184,11 @@ class MessagesController extends Controller { base64_decode($folderId), $id ); + $json['itineraries'] = $this->itineraryService->extract( + $account, + base64_decode($folderId), + $id + ); $json['attachments'] = array_map(function ($a) use ($accountId, $folderId, $id) { return $this->enrichDownloadUrl($accountId, $folderId, $id, $a); }, $json['attachments']); -- cgit v1.2.3