diff --git a/plugins/README.md b/plugins/README.md index e19e799a1..86d513c48 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -164,6 +164,12 @@ $Plugin->addHook('hook.name', 'functionName'); bool $bSuccess \MailSo\Imap\Settings $oSettings +### imap.message-headers + params: + array &$aHeaders + + Allows you to fetch more MIME headers for messages. + ## Sieve ### sieve.before-connect diff --git a/plugins/avatars/index.php b/plugins/avatars/index.php index 5e9854a16..3b5d5dc8f 100644 --- a/plugins/avatars/index.php +++ b/plugins/avatars/index.php @@ -10,8 +10,8 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin NAME = 'Avatars', AUTHOR = 'SnappyMail', URL = 'https://snappymail.eu/', - VERSION = '1.14', - RELEASE = '2024-01-17', + VERSION = '1.15', + RELEASE = '2024-01-22', REQUIRED = '2.25.0', CATEGORY = 'Contacts', LICENSE = 'MIT', @@ -32,6 +32,16 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin $this->addHook('json.after-message', 'JsonMessage'); $this->addHook('json.after-messagelist', 'JsonMessageList'); } + // https://www.ietf.org/archive/id/draft-brand-indicators-for-message-identification-04.html#bimi-selector + if ($this->Config()->Get('plugin', 'bimi', false)) { + $this->addHook('imap.message-headers', 'ImapMessageHeaders'); + } + } + + public function ImapMessageHeaders(array &$aHeaders) + { + // \MailSo\Mime\Enumerations\Header::BIMI_SELECTOR + $aHeaders[] = 'BIMI-Selector'; } public function JsonMessage(array &$aResponse) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php index ad45b0591..20b30c6ab 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php @@ -61,15 +61,11 @@ abstract class FetchType public static function BuildBodyCustomHeaderRequest(array $aHeaders, bool $bPeek = true) : string { - $sResult = ''; - if (\count($aHeaders)) - { - $aHeaders = \array_map('strtoupper', \array_map('trim', $aHeaders)); - - $sResult = $bPeek ? self::BODY_PEEK : self::BODY; - $sResult .= '[HEADER.FIELDS ('.\implode(' ', $aHeaders).')]'; + if (\count($aHeaders)) { + $aHeaders = \array_map(fn($sHeader) => \strtoupper(\trim($sHeader)), $aHeaders); + return ($bPeek ? self::BODY_PEEK : self::BODY) + . '[HEADER.FIELDS ('.\implode(' ', $aHeaders).')]'; } - - return $sResult; + return ''; } } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index 994ed4feb..78fe31e07 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -46,7 +46,7 @@ class MailClient return FetchType::BODY_HEADER_PEEK; } - return FetchType::BuildBodyCustomHeaderRequest(array( + $aHeaders = array( // MimeHeader::RETURN_PATH, // MimeHeader::RECEIVED, // MimeHeader::MIME_VERSION, @@ -75,8 +75,6 @@ class MailClient MimeHeader::LIST_UNSUBSCRIBE, // https://autocrypt.org/level1.html#the-autocrypt-header MimeHeader::AUTOCRYPT, - // https://www.ietf.org/archive/id/draft-brand-indicators-for-message-identification-04.html#bimi-selector - MimeHeader::BIMI_SELECTOR, // SPAM MimeHeader::X_SPAM_STATUS, MimeHeader::X_SPAM_FLAG, @@ -87,9 +85,11 @@ class MailClient MimeHeader::X_VIRUS, MimeHeader::X_VIRUS_SCANNED, MimeHeader::X_VIRUS_STATUS - ), true); -// -// return FetchType::ENVELOPE; + ); + + \RainLoop\Api::Actions()->Plugins()->RunHook('imap.message-headers', array(&$aHeaders)); + + return FetchType::BuildBodyCustomHeaderRequest($aHeaders, true); } /**