From 4a153a59c1ac2383b68a520f87bb05cd0d34c345 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Mon, 9 Dec 2013 14:19:15 +0400 Subject: [PATCH] Add _FORCE_SELECT_ON_EXAMINE__ property to IMAP client class --- .../v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php | 9 ++++++++- .../v/0.0.0/app/libraries/MailSo/Mail/MailClient.php | 12 ++++++++++-- rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php | 2 ++ .../app/libraries/RainLoop/Config/Application.php | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index ffe624e95..f5edc4d30 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -73,6 +73,11 @@ class ImapClient extends \MailSo\Net\NetClient */ private $sLogginedUser; + /** + * @var bool + */ + public $__FORCE_SELECT_ON_EXAMINE__; + /** * @access protected */ @@ -96,6 +101,8 @@ class ImapClient extends \MailSo\Net\NetClient $this->bIsSelected = false; $this->sLogginedUser = ''; + $this->__FORCE_SELECT_ON_EXAMINE__ = false; + @\ini_set('xdebug.max_nesting_level', 500); } @@ -854,7 +861,7 @@ class ImapClient extends \MailSo\Net\NetClient */ public function FolderExamine($sFolderName, $bReSelectSameFolders = false) { - return $this->selectOrExamineFolder($sFolderName, false, $bReSelectSameFolders); + return $this->selectOrExamineFolder($sFolderName, $this->__FORCE_SELECT_ON_EXAMINE__, $bReSelectSameFolders); } /** diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index 0b5736058..d6ae893da 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -37,6 +37,14 @@ class MailClient return new self(); } + /** + * @return \MailSo\Imap\ImapClient + */ + public function ImapClient() + { + return $this->oImapClient; + } + /** * @param string $sServerName * @param int $iPort = 143 @@ -141,10 +149,10 @@ class MailClient */ private function getEnvelopeOrHeadersRequestString() { -// return \MailSo\Imap\Enumerations\FetchType::ENVELOPE; - return \MailSo\Imap\Enumerations\FetchType::BODY_HEADER_PEEK; +// return \MailSo\Imap\Enumerations\FetchType::ENVELOPE; + return \MailSo\Imap\Enumerations\FetchType::BuildBodyCustomHeaderRequest(array( \MailSo\Mime\Enumerations\Header::RETURN_PATH, \MailSo\Mime\Enumerations\Header::RECEIVED, diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index e06900896..549b5b7cb 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -4978,6 +4978,8 @@ class Actions { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError, $oException); } + + $this->MailClient()->ImapClient()->__FORCE_SELECT_ON_EXAMINE__ = !!$this->Config()->Get('labs', 'use_imap_force_selection'); } return $oAccount; diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 2348a2e00..220d01261 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -208,6 +208,7 @@ Enables caching in the system'), 'suggestions_limit' => array(50), 'determine_user_language' => array(true), 'use_imap_sort' => array(false), + 'use_imap_force_selection' => array(false), 'use_imap_list_status' => array(false), 'use_imap_list_subscribe' => array(true), 'use_imap_thread' => array(true),