Added counters of unread messages for additional accounts (#377)

This commit is contained in:
RainLoop Team 2015-02-02 00:46:23 +04:00
parent abddb3d828
commit 79233ad83c
19 changed files with 333 additions and 93 deletions

View file

@ -337,11 +337,11 @@ class Http
}
/**
* @param bool $bCheckProxy = true
* @param bool $bCheckProxy = false
*
* @return string
*/
public function GetClientIp($bCheckProxy = true)
public function GetClientIp($bCheckProxy = false)
{
$sIp = '';
if ($bCheckProxy && null !== $this->GetServer('HTTP_CLIENT_IP', null))

View file

@ -44,8 +44,10 @@ class Logger extends \MailSo\Base\Collection
/**
* @access protected
*
* @param bool $bRegPhpErrorHandler = false
*/
protected function __construct()
protected function __construct($bRegPhpErrorHandler = true)
{
parent::__construct();
@ -55,16 +57,22 @@ class Logger extends \MailSo\Base\Collection
$this->bShowSecter = false;
$this->bHideErrorNotices = false;
\set_error_handler(array(&$this, '__phpErrorHandler'));
if ($bRegPhpErrorHandler)
{
\set_error_handler(array(&$this, '__phpErrorHandler'));
}
\register_shutdown_function(array(&$this, '__loggerShutDown'));
}
/**
* @param bool $bRegPhpErrorHandler = false
*
* @return \MailSo\Log\Logger
*/
public static function NewInstance()
public static function NewInstance($bRegPhpErrorHandler = false)
{
return new self();
return new self($bRegPhpErrorHandler);
}
/**

View file

@ -869,6 +869,24 @@ class MailClient
return self::GenerateHash($sFolderName, $iCount, $iUnseenCount, $sUidNext);
}
/**
* @return int
*
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function InboxUnreadCount()
{
$aFolderStatus = $this->oImapClient->FolderStatus('INBOX', array(
\MailSo\Imap\Enumerations\FolderResponseStatus::UNSEEN
));
$iResult = isset($aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UNSEEN]) ?
(int) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UNSEEN] : 0;
return 0 < $iResult ? $iResult : 0;
}
/**
* @param string $sSearch
* @param bool $bDetectGmail = true