Release 1.8.3

This commit is contained in:
RainLoop Team 2015-04-14 18:46:02 +04:00
parent 59d2b296b8
commit 7a32baa982
2 changed files with 12 additions and 22 deletions

View file

@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.8.3",
"release": "301",
"release": "302",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "gulpfile.js",
@ -36,7 +36,7 @@
"plugins"
],
"readmeFilename": "README.md",
"ownCloudPackageVersion": "3.2",
"ownCloudPackageVersion": "3.3",
"engines": {
"node": ">= 0.10.0"
},

View file

@ -18,11 +18,13 @@ class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestion
*/
public function Process($oAccount, $sQuery, $iLimit = 20)
{
$iInputLimit = $iLimit;
$aResult = array();
$sQuery = \trim($sQuery);
try
{
if (!$oAccount || !\RainLoop\Utils::IsOwnCloud() ||
if ('' === $sQuery || !$oAccount || !\RainLoop\Utils::IsOwnCloud() ||
!\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled() ||
!\class_exists('\\OCP\\User') || !\OCP\User::isLoggedIn()
)
@ -33,7 +35,7 @@ class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestion
$aSearchResult = \OCP\Contacts::search($sQuery, array('FN', 'EMAIL'));
//$this->oLogger->WriteDump($aSearchResult);
$aPreResult = array();
$aHashes = array();
if (\is_array($aSearchResult) && 0 < \count($aSearchResult))
{
foreach ($aSearchResult as $aContact)
@ -54,35 +56,23 @@ class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestion
$mEmails = array($mEmails);
}
if (!isset($aPreResult[$sUid]))
{
$aPreResult[$sUid] = array();
}
foreach ($mEmails as $sEmail)
{
$sEmail = \trim($sEmail);
if (!empty($sEmail))
$sHash = '"'.$sFullName.'" <'.$sEmail.'>';
if (!isset($aHashes[$sHash]))
{
$aHashes[$sHash] = true;
$aResult[] = array($sEmail, $sFullName);
$iLimit--;
$aPreResult[$sUid][] = array($sEmail, $sFullName);
}
}
}
}
$aPreResult = \array_values($aPreResult);
// $this->oLogger->WriteDump($aPreResult);
foreach ($aPreResult as $aData)
{
foreach ($aData as $aSubData)
{
$aResult[] = $aSubData;
}
}
$aResult = \array_slice($aResult, 0, $iInputLimit);
}
unset($aSearchResult, $aPreResult);
unset($aSearchResult, $aHashes);
}
catch (\Exception $oException)
{