Skip to content

Commit

Permalink
fixup! feat: fiter messages by mention
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Mahjoubi <[email protected]>
  • Loading branch information
hamza221 committed Oct 11, 2024
1 parent c4cd27e commit 680c72e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/IMAP/MessageMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ public function getBodyStructureData(Horde_Imap_Client_Socket $client,
$textBodyId = $structure->findBody() ?? $structure->findBody('text');
$htmlBodyId = $structure->findBody('html');
if ($textBodyId === null && $htmlBodyId === null) {
return new MessageStructureData($hasAttachments, $text, $isImipMessage, $isEncrypted);
return new MessageStructureData($hasAttachments, $text, $isImipMessage, $isEncrypted, false);
}
$partsQuery = new Horde_Imap_Client_Fetch_Query();
if ($htmlBodyId !== null) {
Expand All @@ -927,7 +927,7 @@ public function getBodyStructureData(Horde_Imap_Client_Socket $client,
$part = $parts[$fetchData->getUid()];
// This is sus - why does this even happen? A delete / move in the middle of this processing?
if ($part === null) {
return new MessageStructureData($hasAttachments, $text, $isImipMessage, $isEncrypted);
return new MessageStructureData($hasAttachments, $text, $isImipMessage, $isEncrypted, false);
}


Expand Down Expand Up @@ -963,12 +963,16 @@ public function getBodyStructureData(Horde_Imap_Client_Socket $client,
$textBody,
$isImipMessage,
$isEncrypted,
false,
);
}
return new MessageStructureData($hasAttachments, $text, $isImipMessage, $isEncrypted);
return new MessageStructureData($hasAttachments, $text, $isImipMessage, $isEncrypted, false);
}, iterator_to_array($structures->getIterator()));
}
private function checkLinks(string $body, string $mailAddress) : bool {
if(strlen($body) === 0) {
return false;
}
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($body);

Check failure on line 978 in lib/IMAP/MessageMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

ArgumentTypeCoercion

lib/IMAP/MessageMapper.php:978:18: ArgumentTypeCoercion: Argument 1 of DOMDocument::loadHTML expects non-empty-string, but parent type string provided (see https://psalm.dev/193)
Expand Down
2 changes: 1 addition & 1 deletion lib/IMAP/MessageStructureData.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(bool $hasAttachments,
string $previewText,
bool $isImipMessage,
bool $isEncrypted,
?bool $mentionsMe = false) {
bool $mentionsMe) {
$this->hasAttachments = $hasAttachments;
$this->previewText = $previewText;
$this->isImipMessage = $isImipMessage;
Expand Down

0 comments on commit 680c72e

Please sign in to comment.