mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-10-05 11:24:24 +08:00
remove imap_message_list_hide_deleted_messages setting (it's a bad idea to use it)
fixed uid cacher certificate validatetion on test connection (first look)
This commit is contained in:
parent
1fee4d35f9
commit
60b449b9f8
8 changed files with 168 additions and 170 deletions
|
@ -2,7 +2,7 @@
|
||||||
"name": "RainLoop",
|
"name": "RainLoop",
|
||||||
"title": "RainLoop Webmail",
|
"title": "RainLoop Webmail",
|
||||||
"version": "1.6.9",
|
"version": "1.6.9",
|
||||||
"release": "169",
|
"release": "170",
|
||||||
"description": "Simple, modern & fast web-based email client",
|
"description": "Simple, modern & fast web-based email client",
|
||||||
"homepage": "http://rainloop.net",
|
"homepage": "http://rainloop.net",
|
||||||
"main": "gulpfile.js",
|
"main": "gulpfile.js",
|
||||||
|
|
|
@ -33,11 +33,6 @@ class Config
|
||||||
*/
|
*/
|
||||||
public static $MessageListCountLimitTrigger = 0;
|
public static $MessageListCountLimitTrigger = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public static $MessageListUndeletedFilter = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -126,6 +126,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
* @param string $sServerName
|
* @param string $sServerName
|
||||||
* @param int $iPort = 143
|
* @param int $iPort = 143
|
||||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||||
|
* @param bool $bCapturePeerCertIfSsl = false
|
||||||
*
|
*
|
||||||
* @return \MailSo\Imap\ImapClient
|
* @return \MailSo\Imap\ImapClient
|
||||||
*
|
*
|
||||||
|
@ -134,11 +135,11 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function Connect($sServerName, $iPort = 143,
|
public function Connect($sServerName, $iPort = 143,
|
||||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT)
|
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bCapturePeerCertIfSsl = false)
|
||||||
{
|
{
|
||||||
$this->aTagTimeouts['*'] = \microtime(true);
|
$this->aTagTimeouts['*'] = \microtime(true);
|
||||||
|
|
||||||
parent::Connect($sServerName, $iPort, $iSecurityType);
|
parent::Connect($sServerName, $iPort, $iSecurityType, $bCapturePeerCertIfSsl);
|
||||||
|
|
||||||
$this->parseResponseWithValidation('*', true);
|
$this->parseResponseWithValidation('*', true);
|
||||||
|
|
||||||
|
@ -1488,21 +1489,23 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sUidRangeIfSupported
|
* @param string $sUidRangeIfSupported = ''
|
||||||
|
* @param bool $bForceUidExpunge = false
|
||||||
|
* @param bool $bExpungeAll = false
|
||||||
*
|
*
|
||||||
* @return \MailSo\Imap\ImapClient
|
* @return \MailSo\Imap\ImapClient
|
||||||
*
|
*
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function MessageExpunge($sUidRangeIfSupported = '', $bForceUidExpunge = false)
|
public function MessageExpunge($sUidRangeIfSupported = '', $bForceUidExpunge = false, $bExpungeAll = false)
|
||||||
{
|
{
|
||||||
$sUidRangeIfSupported = \trim($sUidRangeIfSupported);
|
$sUidRangeIfSupported = \trim($sUidRangeIfSupported);
|
||||||
|
|
||||||
$sCmd = 'EXPUNGE';
|
$sCmd = 'EXPUNGE';
|
||||||
$aArguments = array();
|
$aArguments = array();
|
||||||
|
|
||||||
if ($bForceUidExpunge && 0 < \strlen($sUidRangeIfSupported) && $this->IsSupported('UIDPLUS'))
|
if (!$bExpungeAll && $bForceUidExpunge && 0 < \strlen($sUidRangeIfSupported) && $this->IsSupported('UIDPLUS'))
|
||||||
{
|
{
|
||||||
$sCmd = 'UID '.$sCmd;
|
$sCmd = 'UID '.$sCmd;
|
||||||
$aArguments = array($sUidRangeIfSupported);
|
$aArguments = array($sUidRangeIfSupported);
|
||||||
|
|
|
@ -495,6 +495,7 @@ class MailClient
|
||||||
* @param array $aIndexRange
|
* @param array $aIndexRange
|
||||||
* @param bool $bIndexIsUid
|
* @param bool $bIndexIsUid
|
||||||
* @param bool $bUseExpunge = true
|
* @param bool $bUseExpunge = true
|
||||||
|
* @param bool $bExpungeAll = false
|
||||||
*
|
*
|
||||||
* @return \MailSo\Mail\MailClient
|
* @return \MailSo\Mail\MailClient
|
||||||
*
|
*
|
||||||
|
@ -502,7 +503,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function MessageDelete($sFolder, $aIndexRange, $bIndexIsUid, $bUseExpunge = true)
|
public function MessageDelete($sFolder, $aIndexRange, $bIndexIsUid, $bUseExpunge = true, $bExpungeAll = false)
|
||||||
{
|
{
|
||||||
if (0 === \strlen($sFolder) || !\is_array($aIndexRange) || 0 === \count($aIndexRange))
|
if (0 === \strlen($sFolder) || !\is_array($aIndexRange) || 0 === \count($aIndexRange))
|
||||||
{
|
{
|
||||||
|
@ -520,7 +521,7 @@ class MailClient
|
||||||
|
|
||||||
if ($bUseExpunge)
|
if ($bUseExpunge)
|
||||||
{
|
{
|
||||||
$this->oImapClient->MessageExpunge($bIndexIsUid ? $sIndexRange : '', $bIndexIsUid);
|
$this->oImapClient->MessageExpunge($bIndexIsUid ? $sIndexRange : '', $bIndexIsUid, $bExpungeAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -532,6 +533,7 @@ class MailClient
|
||||||
* @param array $aIndexRange
|
* @param array $aIndexRange
|
||||||
* @param bool $bIndexIsUid
|
* @param bool $bIndexIsUid
|
||||||
* @param bool $bUseMoveSupported = false
|
* @param bool $bUseMoveSupported = false
|
||||||
|
* @param bool $bExpungeAll = false
|
||||||
*
|
*
|
||||||
* @return \MailSo\Mail\MailClient
|
* @return \MailSo\Mail\MailClient
|
||||||
*
|
*
|
||||||
|
@ -539,7 +541,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function MessageMove($sFromFolder, $sToFolder, $aIndexRange, $bIndexIsUid, $bUseMoveSupported = false)
|
public function MessageMove($sFromFolder, $sToFolder, $aIndexRange, $bIndexIsUid, $bUseMoveSupported = false, $bExpungeAll = false)
|
||||||
{
|
{
|
||||||
if (0 === \strlen($sFromFolder) || 0 === \strlen($sToFolder) ||
|
if (0 === \strlen($sFromFolder) || 0 === \strlen($sToFolder) ||
|
||||||
!\is_array($aIndexRange) || 0 === \count($aIndexRange))
|
!\is_array($aIndexRange) || 0 === \count($aIndexRange))
|
||||||
|
@ -559,7 +561,7 @@ class MailClient
|
||||||
$this->oImapClient->MessageCopy($sToFolder,
|
$this->oImapClient->MessageCopy($sToFolder,
|
||||||
\MailSo\Base\Utils::PrepearFetchSequence($aIndexRange), $bIndexIsUid);
|
\MailSo\Base\Utils::PrepearFetchSequence($aIndexRange), $bIndexIsUid);
|
||||||
|
|
||||||
$this->MessageDelete($sFromFolder, $aIndexRange, $bIndexIsUid, true);
|
$this->MessageDelete($sFromFolder, $aIndexRange, $bIndexIsUid, true, $bExpungeAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -647,11 +649,10 @@ class MailClient
|
||||||
* @param int $iCount
|
* @param int $iCount
|
||||||
* @param int $iUnseenCount
|
* @param int $iUnseenCount
|
||||||
* @param string $sUidNext
|
* @param string $sUidNext
|
||||||
* @param \MailSo\Cache\CacheClient|null $oCacher = null
|
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function initFolderValues($sFolderName, &$iCount, &$iUnseenCount, &$sUidNext, $oCacher = null)
|
protected function initFolderValues($sFolderName, &$iCount, &$iUnseenCount, &$sUidNext)
|
||||||
{
|
{
|
||||||
$aFolderStatus = $this->oImapClient->FolderStatus($sFolderName, array(
|
$aFolderStatus = $this->oImapClient->FolderStatus($sFolderName, array(
|
||||||
\MailSo\Imap\Enumerations\FolderResponseStatus::MESSAGES,
|
\MailSo\Imap\Enumerations\FolderResponseStatus::MESSAGES,
|
||||||
|
@ -668,36 +669,7 @@ class MailClient
|
||||||
$sUidNext = isset($aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT])
|
$sUidNext = isset($aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT])
|
||||||
? (string) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT] : '0';
|
? (string) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT] : '0';
|
||||||
|
|
||||||
if (\MailSo\Config::$MessageListUndeletedFilter)
|
if ($this->IsGmail())
|
||||||
{
|
|
||||||
$oFolder = $this->oImapClient->FolderCurrentInformation();
|
|
||||||
if (!$oFolder || $oFolder->FolderName !== $sFolderName)
|
|
||||||
{
|
|
||||||
$this->oImapClient->FolderExamine($sFolderName);
|
|
||||||
}
|
|
||||||
|
|
||||||
$aUids = $this->getSearchUidsResult('',
|
|
||||||
$sFolderName, false, false, false, $oCacher);
|
|
||||||
|
|
||||||
$iNewCount = \count($aUids);
|
|
||||||
if (0 < $iNewCount && $iNewCount !== $iCount)
|
|
||||||
{
|
|
||||||
$iCount = $iNewCount;
|
|
||||||
|
|
||||||
$aUids = $this->getSearchUidsResult('is:unread',
|
|
||||||
$sFolderName, false, false, false, $oCacher);
|
|
||||||
|
|
||||||
$iUnseenCount = \count($aUids);
|
|
||||||
}
|
|
||||||
else if (0 === $iNewCount)
|
|
||||||
{
|
|
||||||
$iCount = 0;
|
|
||||||
$iUnseenCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($aUids);
|
|
||||||
}
|
|
||||||
else if ($this->IsGmail())
|
|
||||||
{
|
{
|
||||||
$oFolder = $this->oImapClient->FolderCurrentInformation();
|
$oFolder = $this->oImapClient->FolderCurrentInformation();
|
||||||
if ($oFolder && null !== $oFolder->Exists && $oFolder->FolderName === $sFolderName)
|
if ($oFolder && null !== $oFolder->Exists && $oFolder->FolderName === $sFolderName)
|
||||||
|
@ -800,7 +772,6 @@ class MailClient
|
||||||
* @param string $sFolderName
|
* @param string $sFolderName
|
||||||
* @param string $sPrevUidNext = ''
|
* @param string $sPrevUidNext = ''
|
||||||
* @param array $aUids = ''
|
* @param array $aUids = ''
|
||||||
* @param \MailSo\Cache\CacheClient|null $oCacher = null
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
@ -808,7 +779,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function FolderInformation($sFolderName, $sPrevUidNext = '', $aUids = array(), $oCacher = null)
|
public function FolderInformation($sFolderName, $sPrevUidNext = '', $aUids = array())
|
||||||
{
|
{
|
||||||
$aFlags = array();
|
$aFlags = array();
|
||||||
|
|
||||||
|
@ -847,7 +818,7 @@ class MailClient
|
||||||
$iUnseenCount = 0;
|
$iUnseenCount = 0;
|
||||||
$sUidNext = '0';
|
$sUidNext = '0';
|
||||||
|
|
||||||
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $sUidNext, $oCacher);
|
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $sUidNext);
|
||||||
|
|
||||||
$aResult = array(
|
$aResult = array(
|
||||||
'Folder' => $sFolderName,
|
'Folder' => $sFolderName,
|
||||||
|
@ -865,7 +836,6 @@ class MailClient
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sFolderName
|
* @param string $sFolderName
|
||||||
* @param \MailSo\Cache\CacheClient|null $oCacher = null
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
@ -873,13 +843,13 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function FolderHash($sFolderName, $oCacher = null)
|
public function FolderHash($sFolderName)
|
||||||
{
|
{
|
||||||
$iCount = 0;
|
$iCount = 0;
|
||||||
$iUnseenCount = 0;
|
$iUnseenCount = 0;
|
||||||
$sUidNext = '0';
|
$sUidNext = '0';
|
||||||
|
|
||||||
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $sUidNext, $oCacher);
|
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $sUidNext);
|
||||||
|
|
||||||
return self::GenerateHash($sFolderName, $iCount, $iUnseenCount, $sUidNext);
|
return self::GenerateHash($sFolderName, $iCount, $iUnseenCount, $sUidNext);
|
||||||
}
|
}
|
||||||
|
@ -1327,10 +1297,6 @@ class MailClient
|
||||||
}
|
}
|
||||||
|
|
||||||
$sCriteriasResult = \trim(\implode(' ', $aCriteriasResult));
|
$sCriteriasResult = \trim(\implode(' ', $aCriteriasResult));
|
||||||
if (\MailSo\Config::$MessageListUndeletedFilter)
|
|
||||||
{
|
|
||||||
$sCriteriasResult .= ' UNDELETED';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < $iTimeFilter)
|
if (0 < $iTimeFilter)
|
||||||
{
|
{
|
||||||
|
@ -1420,11 +1386,6 @@ class MailClient
|
||||||
public function MessageListThreadsMap($sFolderName, $sFolderHash, $oCacher)
|
public function MessageListThreadsMap($sFolderName, $sFolderHash, $oCacher)
|
||||||
{
|
{
|
||||||
$sSearchHash = '';
|
$sSearchHash = '';
|
||||||
if (\MailSo\Config::$MessageListUndeletedFilter)
|
|
||||||
{
|
|
||||||
$sSearchHash .= ' UNDELETED';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < \MailSo\Config::$MessageListDateFilter)
|
if (0 < \MailSo\Config::$MessageListDateFilter)
|
||||||
{
|
{
|
||||||
$iD = \time() - 3600 * 24 * 30 * \MailSo\Config::$MessageListDateFilter;
|
$iD = \time() - 3600 * 24 * 30 * \MailSo\Config::$MessageListDateFilter;
|
||||||
|
@ -1608,7 +1569,7 @@ class MailClient
|
||||||
$aSerialized = @\unserialize($sSerialized);
|
$aSerialized = @\unserialize($sSerialized);
|
||||||
if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) &&
|
if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) &&
|
||||||
\is_array($aSerialized['Uids']) &&
|
\is_array($aSerialized['Uids']) &&
|
||||||
($sFolderHash === $aSerialized['FolderHash'] || false === $sFolderHash))
|
($sFolderHash === $aSerialized['FolderHash']))
|
||||||
{
|
{
|
||||||
if ($this->oLogger)
|
if ($this->oLogger)
|
||||||
{
|
{
|
||||||
|
@ -1762,7 +1723,7 @@ class MailClient
|
||||||
$oCacher = null;
|
$oCacher = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->initFolderValues($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext, $oCacher);
|
$this->initFolderValues($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext);
|
||||||
$iMessageCount = $iMessageRealCount;
|
$iMessageCount = $iMessageRealCount;
|
||||||
|
|
||||||
$oMessageCollection->FolderHash = self::GenerateHash($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext);
|
$oMessageCollection->FolderHash = self::GenerateHash($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext);
|
||||||
|
@ -1860,8 +1821,7 @@ class MailClient
|
||||||
|
|
||||||
if (1 < $iMessageCount)
|
if (1 < $iMessageCount)
|
||||||
{
|
{
|
||||||
if ($bMessageListOptimization ||
|
if ($bMessageListOptimization || 0 === \MailSo\Config::$MessageListDateFilter)
|
||||||
(!\MailSo\Config::$MessageListUndeletedFilter && 0 === \MailSo\Config::$MessageListDateFilter))
|
|
||||||
{
|
{
|
||||||
$aIndexOrUids = \array_reverse(\range(1, $iMessageCount));
|
$aIndexOrUids = \array_reverse(\range(1, $iMessageCount));
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,6 +172,7 @@ abstract class NetClient
|
||||||
* @param string $sServerName
|
* @param string $sServerName
|
||||||
* @param int $iPort
|
* @param int $iPort
|
||||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||||
|
* @param bool $bCapturePeerCertIfSsl = false
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
@ -180,7 +181,7 @@ abstract class NetClient
|
||||||
* @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException
|
* @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException
|
||||||
*/
|
*/
|
||||||
public function Connect($sServerName, $iPort,
|
public function Connect($sServerName, $iPort,
|
||||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT)
|
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bCapturePeerCertIfSsl = false)
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
||||||
{
|
{
|
||||||
|
@ -206,6 +207,8 @@ abstract class NetClient
|
||||||
$this->bSecure = \MailSo\Net\Enumerations\ConnectionSecurityType::UseSSL($iPort, $iSecurityType);
|
$this->bSecure = \MailSo\Net\Enumerations\ConnectionSecurityType::UseSSL($iPort, $iSecurityType);
|
||||||
$this->sConnectedHost = $this->bSecure ? 'ssl://'.$sServerName : $sServerName;
|
$this->sConnectedHost = $this->bSecure ? 'ssl://'.$sServerName : $sServerName;
|
||||||
|
|
||||||
|
$bCapturePeerCertIfSsl = !!($bCapturePeerCertIfSsl && $this->bSecure);
|
||||||
|
|
||||||
if (!$this->bSecure && \MailSo\Net\Enumerations\ConnectionSecurityType::SSL === $this->iSecurityType)
|
if (!$this->bSecure && \MailSo\Net\Enumerations\ConnectionSecurityType::SSL === $this->iSecurityType)
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
|
@ -217,8 +220,24 @@ abstract class NetClient
|
||||||
$this->writeLog('Start connection to "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"',
|
$this->writeLog('Start connection to "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"',
|
||||||
\MailSo\Log\Enumerations\Type::NOTE);
|
\MailSo\Log\Enumerations\Type::NOTE);
|
||||||
|
|
||||||
|
if ($bCapturePeerCertIfSsl && \MailSo\Base\Utils::FunctionExistsAndEnabled('stream_context_create') &&
|
||||||
|
\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_socket_client') && defined('STREAM_CLIENT_CONNECT'))
|
||||||
|
{
|
||||||
|
$rStreamContext = \stream_context_create(array('ssl' => array('capture_peer_cert' => true)));
|
||||||
|
$sRemoteSocket = (0 === \strpos($this->sConnectedHost, 'ssl://')
|
||||||
|
? $this->sConnectedHost : 'tcp://'.$this->sConnectedHost).':'.$this->iConnectedPort;
|
||||||
|
|
||||||
|
if ($rStreamContext)
|
||||||
|
{
|
||||||
|
$this->rConnect = @\stream_socket_client($sRemoteSocket, $iErrorNo, $sErrorStr,
|
||||||
|
$this->iConnectTimeOut, STREAM_CLIENT_CONNECT, $rStreamContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->rConnect = @\fsockopen($this->sConnectedHost, $this->iConnectedPort,
|
$this->rConnect = @\fsockopen($this->sConnectedHost, $this->iConnectedPort,
|
||||||
$iErrorNo, $sErrorStr, $this->iConnectTimeOut);
|
$iErrorNo, $sErrorStr, $this->iConnectTimeOut);
|
||||||
|
}
|
||||||
|
|
||||||
if (!\is_resource($this->rConnect))
|
if (!\is_resource($this->rConnect))
|
||||||
{
|
{
|
||||||
|
@ -308,6 +327,15 @@ abstract class NetClient
|
||||||
$this->IsConnected(true);
|
$this->IsConnected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
public function StreamContextParams()
|
||||||
|
{
|
||||||
|
return \is_resource($this->rConnect) && \MailSo\Base\Utils::FunctionExistsAndEnabled('stream_context_get_options')
|
||||||
|
? \stream_context_get_params($this->rConnect) : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sRaw
|
* @param string $sRaw
|
||||||
* @param bool $bWriteToLog = true
|
* @param bool $bWriteToLog = true
|
||||||
|
|
|
@ -2737,13 +2737,27 @@ class Actions
|
||||||
$oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this, 'domain-test-connection.de');
|
$oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this, 'domain-test-connection.de');
|
||||||
if ($oDomain)
|
if ($oDomain)
|
||||||
{
|
{
|
||||||
|
// $oOpenSSL = \MailSo\Base\Utils::FunctionExistsAndEnabled('openssl_x509_parse');
|
||||||
|
$oOpenSSL = false; // TODO in dev
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->SetLogger($this->Logger());
|
$oImapClient = \MailSo\Imap\ImapClient::NewInstance()->SetLogger($this->Logger());
|
||||||
$oImapClient->SetTimeOuts(5);
|
$oImapClient->SetTimeOuts(5);
|
||||||
|
|
||||||
$iTime = \microtime(true);
|
$iTime = \microtime(true);
|
||||||
$oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(), $oDomain->IncSecure());
|
$oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(), $oDomain->IncSecure(), $oOpenSSL);
|
||||||
|
|
||||||
|
if ($oOpenSSL)
|
||||||
|
{
|
||||||
|
$aStreamContextParams = $oImapClient->StreamContextParams();
|
||||||
|
if (isset($aStreamContextParams['options']['ssl']['peer_certificate']))
|
||||||
|
{
|
||||||
|
$aParseData = @\openssl_x509_parse($aStreamContextParams['options']['ssl']['peer_certificate']);
|
||||||
|
$this->Logger()->WriteDump($aParseData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$iImapTime = \microtime(true) - $iTime;
|
$iImapTime = \microtime(true) - $iTime;
|
||||||
$oImapClient->Disconnect();
|
$oImapClient->Disconnect();
|
||||||
$bImapResult = true;
|
$bImapResult = true;
|
||||||
|
@ -4151,8 +4165,9 @@ class Actions
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$aInboxInformation = $this->MailClient()->FolderInformation(
|
$aInboxInformation = $this->MailClient()->FolderInformation(
|
||||||
$sFolder, $sPrevUidNext, $aFlagsFilteredUids, $this->cacherForUids()
|
$sFolder, $sPrevUidNext, $aFlagsFilteredUids
|
||||||
);
|
);
|
||||||
|
|
||||||
if (\is_array($aInboxInformation) && isset($aInboxInformation['Flags']) && \is_array($aInboxInformation['Flags']))
|
if (\is_array($aInboxInformation) && isset($aInboxInformation['Flags']) && \is_array($aInboxInformation['Flags']))
|
||||||
{
|
{
|
||||||
foreach ($aInboxInformation['Flags'] as $iUid => $aFlags)
|
foreach ($aInboxInformation['Flags'] as $iUid => $aFlags)
|
||||||
|
@ -4205,10 +4220,7 @@ class Actions
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$aInboxInformation = $this->MailClient()->FolderInformation(
|
$aInboxInformation = $this->MailClient()->FolderInformation($sFolder, '', array());
|
||||||
$sFolder, '', array(), $this->cacherForUids()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (\is_array($aInboxInformation) && isset($aInboxInformation['Folder']))
|
if (\is_array($aInboxInformation) && isset($aInboxInformation['Folder']))
|
||||||
{
|
{
|
||||||
$aResult['List'][] = $aInboxInformation;
|
$aResult['List'][] = $aInboxInformation;
|
||||||
|
@ -5650,9 +5662,10 @@ class Actions
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->MailClient()->MessageDelete($sFolder, $aFilteredUids, true);
|
$this->MailClient()->MessageDelete($sFolder, $aFilteredUids, true,
|
||||||
|
!!$this->Config()->Get('labs', 'use_imap_expunge_all_on_delete', false));
|
||||||
|
|
||||||
$sHash = $this->MailClient()->FolderHash($sFolder, $this->cacherForUids());
|
$sHash = $this->MailClient()->FolderHash($sFolder);
|
||||||
}
|
}
|
||||||
catch (\Exception $oException)
|
catch (\Exception $oException)
|
||||||
{
|
{
|
||||||
|
@ -5682,10 +5695,12 @@ class Actions
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->MailClient()->MessageMove($sFromFolder, $sToFolder,
|
$this->MailClient()->MessageMove($sFromFolder, $sToFolder, $aFilteredUids, true,
|
||||||
$aFilteredUids, true, $this->Config()->Get('labs', 'use_imap_move', true));
|
!!$this->Config()->Get('labs', 'use_imap_move', true),
|
||||||
|
!!$this->Config()->Get('labs', 'use_imap_expunge_all_on_delete', false)
|
||||||
|
);
|
||||||
|
|
||||||
$sHash = $this->MailClient()->FolderHash($sFromFolder, $this->cacherForUids());
|
$sHash = $this->MailClient()->FolderHash($sFromFolder);
|
||||||
}
|
}
|
||||||
catch (\Exception $oException)
|
catch (\Exception $oException)
|
||||||
{
|
{
|
||||||
|
@ -5719,7 +5734,7 @@ class Actions
|
||||||
$this->MailClient()->MessageCopy($sFromFolder, $sToFolder,
|
$this->MailClient()->MessageCopy($sFromFolder, $sToFolder,
|
||||||
$aFilteredUids, true);
|
$aFilteredUids, true);
|
||||||
|
|
||||||
$sHash = $this->MailClient()->FolderHash($sFromFolder, $this->cacherForUids());
|
$sHash = $this->MailClient()->FolderHash($sFromFolder);
|
||||||
}
|
}
|
||||||
catch (\Exception $oException)
|
catch (\Exception $oException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,9 +85,6 @@ class Api
|
||||||
\MailSo\Config::$MessageListDateFilter =
|
\MailSo\Config::$MessageListDateFilter =
|
||||||
(int) \RainLoop\Api::Config()->Get('labs', 'imap_message_list_date_filter', 0);
|
(int) \RainLoop\Api::Config()->Get('labs', 'imap_message_list_date_filter', 0);
|
||||||
|
|
||||||
\MailSo\Config::$MessageListUndeletedFilter =
|
|
||||||
!!\RainLoop\Api::Config()->Get('labs', 'imap_message_list_hide_deleted_messages', false);
|
|
||||||
|
|
||||||
\MailSo\Config::$SystemLogger = \RainLoop\Api::Logger();
|
\MailSo\Config::$SystemLogger = \RainLoop\Api::Logger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,11 +238,11 @@ Enables caching in the system'),
|
||||||
'use_imap_thread' => array(true),
|
'use_imap_thread' => array(true),
|
||||||
'use_imap_move' => array(true),
|
'use_imap_move' => array(true),
|
||||||
'use_imap_auth_plain' => array(false),
|
'use_imap_auth_plain' => array(false),
|
||||||
|
'use_imap_expunge_all_on_delete' => array(false),
|
||||||
'imap_forwarded_flag' => array('$Forwarded'),
|
'imap_forwarded_flag' => array('$Forwarded'),
|
||||||
'imap_read_receipt_flag' => array('$ReadReceipt'),
|
'imap_read_receipt_flag' => array('$ReadReceipt'),
|
||||||
'imap_body_text_limit' => array(555000),
|
'imap_body_text_limit' => array(555000),
|
||||||
'imap_message_list_fast_simple_search' => array(true),
|
'imap_message_list_fast_simple_search' => array(true),
|
||||||
'imap_message_list_hide_deleted_messages' => array(false),
|
|
||||||
'imap_message_list_count_limit_trigger' => array(0),
|
'imap_message_list_count_limit_trigger' => array(0),
|
||||||
'imap_message_list_date_filter' => array(0),
|
'imap_message_list_date_filter' => array(0),
|
||||||
'smtp_show_server_errors' => array(false),
|
'smtp_show_server_errors' => array(false),
|
||||||
|
|
Loading…
Add table
Reference in a new issue