mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Remove UNSEEN on IMAP4rev2 deprecated SELECT/EXAMINE
This commit is contained in:
parent
4a5bd9033f
commit
a7f93ef864
3 changed files with 34 additions and 44 deletions
|
|
@ -112,7 +112,7 @@ trait Folders
|
||||||
*
|
*
|
||||||
* https://datatracker.ietf.org/doc/html/rfc9051#section-6.3.11
|
* https://datatracker.ietf.org/doc/html/rfc9051#section-6.3.11
|
||||||
*/
|
*/
|
||||||
public function FolderStatus(string $sFolderName) : FolderInformation
|
public function FolderStatus(string $sFolderName, bool $bSelect = false) : FolderInformation
|
||||||
{
|
{
|
||||||
$aStatusItems = array(
|
$aStatusItems = array(
|
||||||
FolderResponseStatus::MESSAGES,
|
FolderResponseStatus::MESSAGES,
|
||||||
|
|
@ -166,14 +166,31 @@ trait Folders
|
||||||
$oInfo->setStatusFromResponse($oResponse);
|
$oInfo->setStatusFromResponse($oResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bReselect) {
|
if ($bReselect || $bSelect) {
|
||||||
$this->selectOrExamineFolder($sFolderName, $bWritable, false);
|
// Don't use FolderExamine, else PERMANENTFLAGS is empty in Dovecot
|
||||||
// $this->oCurrentFolderInfo->UNSEEN = $oInfo->UNSEEN;
|
$oFolderInformation = $this->selectOrExamineFolder($sFolderName, $bSelect || $bWritable, false);
|
||||||
|
$oFolderInformation->MESSAGES = \max(0, $oFolderInformation->MESSAGES, $oInfo->MESSAGES);
|
||||||
|
// $oFolderInformation has the message sequence number of the first unseen message in the mailbox
|
||||||
|
// so we set it to the amount of unseen messages
|
||||||
|
$oFolderInformation->UNSEEN = \max(0, $oInfo->UNSEEN);
|
||||||
|
$oFolderInformation->UIDNEXT = \max(0, $oFolderInformation->UIDNEXT, $oInfo->UIDNEXT);
|
||||||
|
$oFolderInformation->UIDVALIDITY = \max(0, $oFolderInformation->UIDVALIDITY, $oInfo->UIDVALIDITY);
|
||||||
|
$oFolderInformation->HIGHESTMODSEQ = \max(0, $oInfo->HIGHESTMODSEQ);
|
||||||
|
$oFolderInformation->APPENDLIMIT = \max(0, $oFolderInformation->APPENDLIMIT, $oInfo->APPENDLIMIT);
|
||||||
|
$oFolderInformation->MAILBOXID = $oFolderInformation->MAILBOXID ?: $oInfo->MAILBOXID;
|
||||||
|
// $oFolderInformation->SIZE = \max($oFolderInformation->SIZE, $oInfo->SIZE);
|
||||||
|
// $oFolderInformation->RECENT = \max(0, $oFolderInformation->RECENT, $oInfo->RECENT);
|
||||||
|
return $oFolderInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oInfo;
|
return $oInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function FolderStatusAndSelect(string $sFolderName) : FolderInformation
|
||||||
|
{
|
||||||
|
return $this->FolderStatus($sFolderName, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \MailSo\RuntimeException
|
* @throws \MailSo\RuntimeException
|
||||||
* @throws \MailSo\Net\Exceptions\*
|
* @throws \MailSo\Net\Exceptions\*
|
||||||
|
|
@ -382,6 +399,9 @@ trait Folders
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IMAP4rev2 deprecated
|
||||||
|
$oResult->UNSEEN = null;
|
||||||
|
|
||||||
$this->oCurrentFolderInfo = $oResult;
|
$this->oCurrentFolderInfo = $oResult;
|
||||||
|
|
||||||
return $oResult;
|
return $oResult;
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,6 @@ class FolderInformation implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public $PermanentFlags = array();
|
public $PermanentFlags = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* https://datatracker.ietf.org/doc/html/rfc3501#section-7.3.1
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $Exists = null;
|
|
||||||
|
|
||||||
function __construct(string $sFolderName, bool $bIsWritable)
|
function __construct(string $sFolderName, bool $bIsWritable)
|
||||||
{
|
{
|
||||||
$this->FolderName = $sFolderName;
|
$this->FolderName = $sFolderName;
|
||||||
|
|
|
||||||
|
|
@ -17,53 +17,29 @@ namespace MailSo\Mail;
|
||||||
*/
|
*/
|
||||||
class MessageCollection extends \MailSo\Base\Collection
|
class MessageCollection extends \MailSo\Base\Collection
|
||||||
{
|
{
|
||||||
/**
|
public string $FolderHash = '';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $FolderHash = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* Amount of UIDs in this list (could be less then total messages when using threads)
|
||||||
*/
|
*/
|
||||||
public $MessageResultCount = 0;
|
public int $MessageResultCount = 0;
|
||||||
|
|
||||||
/**
|
public string $FolderName = '';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $FolderName = '';
|
|
||||||
|
|
||||||
/**
|
public int $Offset = 0;
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $Offset = 0;
|
|
||||||
|
|
||||||
/**
|
public int $Limit = 0;
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $Limit = 0;
|
|
||||||
|
|
||||||
/**
|
public string $Search = '';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $Search = '';
|
|
||||||
|
|
||||||
/**
|
public int $ThreadUid = 0;
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $ThreadUid = 0;
|
|
||||||
|
|
||||||
// MailSo\Imap\FolderInformation
|
// MailSo\Imap\FolderInformation
|
||||||
public $FolderInfo = null;
|
public $FolderInfo = null;
|
||||||
|
|
||||||
/**
|
public array $NewMessages = array();
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public $NewMessages = array();
|
|
||||||
|
|
||||||
/**
|
public bool $Filtered = false;
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $Filtered = false;
|
|
||||||
|
|
||||||
public function append($oMessage, bool $bToTop = false) : void
|
public function append($oMessage, bool $bToTop = false) : void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue