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", "name": "RainLoop",
"title": "RainLoop Webmail", "title": "RainLoop Webmail",
"version": "1.8.3", "version": "1.8.3",
"release": "301", "release": "302",
"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",
@ -36,7 +36,7 @@
"plugins" "plugins"
], ],
"readmeFilename": "README.md", "readmeFilename": "README.md",
"ownCloudPackageVersion": "3.2", "ownCloudPackageVersion": "3.3",
"engines": { "engines": {
"node": ">= 0.10.0" "node": ">= 0.10.0"
}, },

View file

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