mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-27 00:36:44 +03:00
Changes for BIMI-Selector #1394
This commit is contained in:
parent
b7bab3cf21
commit
e133cf5ffb
4 changed files with 29 additions and 17 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue