mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
Read Receipt (#41)
This commit is contained in:
parent
1dc5a45564
commit
b100560cd8
37 changed files with 883 additions and 461 deletions
|
|
@ -213,29 +213,35 @@ class MailClient
|
|||
* @param bool $bIndexIsUid
|
||||
* @param string $sMessageFlag
|
||||
* @param bool $bSetAction = true
|
||||
* @param bool $sSkipUnsupportedFlag = false
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
* @throws \MailSo\Mail\Exceptions\Exception
|
||||
*/
|
||||
public function MessageSetFlag($sFolderName, $aIndexRange, $bIndexIsUid, $sMessageFlag, $bSetAction = true)
|
||||
public function MessageSetFlag($sFolderName, $aIndexRange, $bIndexIsUid, $sMessageFlag, $bSetAction = true, $sSkipUnsupportedFlag = false)
|
||||
{
|
||||
$this->oImapClient->FolderSelect($sFolderName);
|
||||
|
||||
$oFolderInfo = $this->oImapClient->FolderCurrentInformation();
|
||||
if (!$oFolderInfo || !$oFolderInfo->IsFlagSupported($sMessageFlag))
|
||||
{
|
||||
throw new \MailSo\Mail\Exceptions\RuntimeException('Message flag is not supported.');
|
||||
if (!$sSkipUnsupportedFlag)
|
||||
{
|
||||
throw new \MailSo\Mail\Exceptions\RuntimeException('Message flag is not supported.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sStoreAction = $bSetAction
|
||||
? \MailSo\Imap\Enumerations\StoreAction::ADD_FLAGS_SILENT
|
||||
: \MailSo\Imap\Enumerations\StoreAction::REMOVE_FLAGS_SILENT
|
||||
;
|
||||
|
||||
$sStoreAction = $bSetAction
|
||||
? \MailSo\Imap\Enumerations\StoreAction::ADD_FLAGS_SILENT
|
||||
: \MailSo\Imap\Enumerations\StoreAction::REMOVE_FLAGS_SILENT
|
||||
;
|
||||
|
||||
$sIndexRange = \implode(',', $aIndexRange);
|
||||
$this->oImapClient->MessageStoreFlag($sIndexRange, $bIndexIsUid, array($sMessageFlag), $sStoreAction);
|
||||
$sIndexRange = \implode(',', $aIndexRange);
|
||||
$this->oImapClient->MessageStoreFlag($sIndexRange, $bIndexIsUid, array($sMessageFlag), $sStoreAction);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -136,7 +136,12 @@ class Message
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sReadingConfirmation;
|
||||
private $sDeliveryReceipt;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sReadReceipt;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
|
@ -196,7 +201,8 @@ class Message
|
|||
|
||||
$this->iSensitivity = \MailSo\Mime\Enumerations\Sensitivity::NOTHING;
|
||||
$this->iPriority = \MailSo\Mime\Enumerations\MessagePriority::NORMAL;
|
||||
$this->sReadingConfirmation = '';
|
||||
$this->sDeliveryReceipt = '';
|
||||
$this->sReadReceipt = '';
|
||||
|
||||
$this->aThreads = array();
|
||||
$this->iThreadsLen = 0;
|
||||
|
|
@ -415,12 +421,28 @@ class Message
|
|||
return $this->sReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function DeliveryReceipt()
|
||||
{
|
||||
return $this->sDeliveryReceipt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ReadReceipt()
|
||||
{
|
||||
return $this->sReadReceipt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ReadingConfirmation()
|
||||
{
|
||||
return $this->sReadingConfirmation;
|
||||
return $this->ReadReceipt();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -615,15 +637,16 @@ class Message
|
|||
}
|
||||
}
|
||||
|
||||
// ReadingConfirmation
|
||||
$this->sReadingConfirmation = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::DISPOSITION_NOTIFICATION_TO);
|
||||
if (0 === \strlen($this->sReadingConfirmation))
|
||||
// Delivery Receipt
|
||||
$this->sDeliveryReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::RETURN_RECEIPT_TO));
|
||||
|
||||
// Read Receipt
|
||||
$this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::DISPOSITION_NOTIFICATION_TO));
|
||||
if (empty($this->sReadReceipt))
|
||||
{
|
||||
$this->sReadingConfirmation = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO);
|
||||
$this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO));
|
||||
}
|
||||
|
||||
$this->sReadingConfirmation = \trim($this->sReadingConfirmation);
|
||||
|
||||
|
||||
$sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
|
||||
if (0 < \strlen($sDraftInfo))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue