List all unsubscribed with magic search term '*'

This commit is contained in:
Thomas Bruederli 2014-07-21 09:54:46 +02:00
parent 086da7cac1
commit 3f74eeb4e0
2 changed files with 6 additions and 3 deletions

View file

@ -200,7 +200,7 @@ function kolab_folderlist(node, p)
// send search request(s) to server
if (search.query && search.execute) {
// require a minimum length for the search string
if (rcmail.env.autocomplete_min_length && search.query.length < rcmail.env.autocomplete_min_length) {
if (rcmail.env.autocomplete_min_length && search.query.length < rcmail.env.autocomplete_min_length && search.query != '*') {
search_messagebox = rcmail.display_message(
rcmail.get_label('autocompletechars').replace('$min', rcmail.env.autocomplete_min_length));
return;

View file

@ -874,12 +874,13 @@ class kolab_storage
}
$folders = array();
$query = str_replace('*', '', $query);
// find unsubscribed IMAP folders of the given type
foreach ((array)self::list_folders('', '*', $type, false, $folderdata) as $foldername) {
// FIXME: only consider the last part of the folder path for searching?
$realname = strtolower(rcube_charset::convert($foldername, 'UTF7-IMAP'));
if (strpos($realname, $query) !== false &&
if (($query == '' || strpos($realname, $query) !== false) &&
!self::folder_is_subscribed($foldername, true) &&
!in_array(self::$imap->folder_namespace($foldername), (array)$exclude_ns)
) {
@ -1423,8 +1424,10 @@ class kolab_storage
*/
public static function search_users($query, $mode = 1, $required = array(), $limit = 0, &$count = 0)
{
$query = str_replace('*', '', $query);
// requires a working LDAP setup
if (!self::ldap()) {
if (!self::ldap() || strlen($query) == 0) {
return array();
}