Public method for listing message flags

@param string $folder  Folder name
@param array  $uids    Message UIDs
@param int    $mod_seq Optional MODSEQ value (of last flag update)

@return array Indexed array with message flags
9547
public function list_flags($folder, $uids, $mod_seq = null)
    {
        if (!strlen($folder)) {
            $folder = $this->folder;
        }

        if (!$this->check_connection()) {
            return array();
        }

        // @TODO: when cache was synchronized in this request
        // we might already have asked for flag updates, use it.

        $flags  = $this->conn->fetch($folder, $uids, true, array('FLAGS'), $mod_seq);
        $result = array();

        if (!empty($flags)) {
            foreach ($flags as $message) {
                $result[$message->uid] = $message->flags;
            }
        }

        return $result;
    }
255560
function listAccountsInfoByUIDs(array $uids)
    {
        $response = $this->call( new Command\ListAccountsInfo($uids) );
        if ( $ex = $response->hasException() )
            throw $ex;

        $r = $response->expected();
        $r = ($r instanceof iDataEntity) ? $r->get('result') : $r;
        return $r;
    }
467749
public function rsearch($folder, $pattern)
    {
        $dir      = new RecursiveDirectoryIterator($folder);
        $iterator = new RecursiveIteratorIterator($dir);
        $files    = new RegexIterator($iterator, $pattern, RegexIterator::GET_MATCH);
        $fileList = [];

        foreach ($files as $file) {
            $fileList = array_merge($fileList, $file);
        }

        return $fileList;
    }
347636
private Map<String, Message> getMessages(Query qry, Folder folder, String[] uids, String[] messageNumbers, int startRow, int maxRow, boolean all) throws MessagingException {

	Message[] messages = folder.getMessages();
	Map<String, Message> map = qry == null ? new HashMap<String, Message>() : null;
	int k = 0;
	if (uids != null || messageNumbers != null) {
	    startRow = 0;
	    maxRow = -1;
	}
	Message message;
	for (int l = startRow; l < messages.length; l++) {
	    if (maxRow != -1 && k == maxRow) {
		break;
	    }
	    message = messages[l];
	    int messageNumber = message.getMessageNumber();
	    String id = getId(folder, message);

	    if (uids == null ? messageNumbers == null || contains(messageNumbers, messageNumber) : contains(uids, id)) {
		k++;
		if (qry != null) {
		    toQuery(qry, message, id, all);
		}
		else map.put(id, message);
	    }
	}
	return map;
    }
1300331
private function parseFlags() {
        $this->flags = FlagCollection::make([]);

        $this->client->openFolder($this->folder_path);
        $flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID);
        if (is_array($flags) && isset($flags[0])) {
            foreach($this->available_flags as $flag) {
                $this->parseFlag($flags, $flag);
            }
        }
    }
614796
def get_messages(self, folderid="", stack=1, cursor=""):

        

        if self.standard_grant_type is not "authorization_code":
            raise DeviantartError("Authentication through Authorization Code (Grant Type) is required in order to connect to this endpoint.")

        response = self._req('/messages/feed', {
            'folderid' : folderid,
            'stack' : stack,
            'cursor' : cursor
        })

        messages = []

        for item in response['results']:

            m = Message()
            m.from_dict(item)

            messages.append(m)

        return {
            "results" : messages,
            "has_more" : response['has_more'],
            "cursor" : response['cursor']
        }
973385
public function getStatusInfo( $folder = NULL )
	{
		$address	= $this->connection->getAddress( $folder );
		$info		= imap_status( $this->connection->getStream(), $address, SA_ALL );
		if( !$info )
			throw new Exception( "imap_status() failed: ". imap_lasterror() );
		return array(
			"messages"	=> $info->messages,
			"recent"	=> $info->recent,
			"unseen"	=> $info->unseen,
		);
	}
102224
public function copy_message($uids, $to_mbox, $from_mbox='')
    {
        if (!strlen($from_mbox)) {
            $from_mbox = $this->folder;
        }

        list($uids, $all_mode) = $this->parse_uids($uids);

        // exit if no message uids are specified
        if (empty($uids)) {
            return false;
        }

        if (!$this->check_connection()) {
            return false;
        }

        // copy messages
        $copied = $this->conn->copy($uids, $from_mbox, $to_mbox);

        if ($copied) {
            $this->clear_messagecount($to_mbox);
        }

        return $copied;
    }
733890
private function _addModuleFolders($folders)
    {
        foreach ($this->_config->getNode('modules')->children() as $name => $module) {
            if ($module->active) {
                $folders[] = $this->_config->getModuleDir('etc', $name);
            }
        }

        return $folders;
    }
148102
def post_flag_list(self, creator_id=None, creator_name=None, post_id=None,
                       reason_matches=None, is_resolved=None, category=None):
        
        params = {
            'search[creator_id]': creator_id,
            'search[creator_name]': creator_name,
            'search[post_id]': post_id,
            }
        return self._get('post_flags.json', params, auth=True)
1289964
protected function createBreadcrumbJson(Folder $folder)
    {
        $breadcrumbs = array();
        while ($folder->exists()) {
            $breadcrumbs[] = array(
                'title' => $folder->Title,
                'id' => $folder->ID
            );

            $folder = $folder->Parent();
        }
        $breadcrumbs[] = array(
            'title' => ASSETS_DIR,
            'id' => 0
        );

        return array_reverse($breadcrumbs);
    }
229997
protected function set_messagecount($folder, $mode, $increment)
    {
        if (!is_numeric($increment)) {
            return false;
        }

        $mode = strtoupper($mode);
        $a_folder_cache = $this->get_cache('messagecount');

        if (!is_array($a_folder_cache[$folder]) || !isset($a_folder_cache[$folder][$mode])) {
            return false;
        }

        // add incremental value to messagecount
        $a_folder_cache[$folder][$mode] += $increment;

        // there's something wrong, delete from cache
        if ($a_folder_cache[$folder][$mode] < 0) {
            unset($a_folder_cache[$folder][$mode]);
        }

        // write back to cache
        $this->update_cache('messagecount', $a_folder_cache);

        return true;
    }
149384
def folder_created_message(self, request, folder):
        
        messages.success(request, _("Folder {} was created".format(folder)))
947165
public static function sortHeaders($messages, $field, $flag)
    {
        // Strategy: First, we'll create an "index" array.
        // Then, we'll use sort() on that array, and use that to sort the main array.

        $field  = empty($field) ? 'uid' : strtolower($field);
        $flag   = empty($flag) ? 'ASC' : strtoupper($flag);
        $index  = array();
        $result = array();

        reset($messages);

        foreach ($messages as $key => $headers) {
            $value = null;

            switch ($field) {
            case 'arrival':
                $field = 'internaldate';
            case 'date':
            case 'internaldate':
            case 'timestamp':
                $value = rcube_utils::strtotime($headers->$field);
                if (!$value && $field != 'timestamp') {
                    $value = $headers->timestamp;
                }

                break;

            default:
                // @TODO: decode header value, convert to UTF-8
                $value = $headers->$field;
                if (is_string($value)) {
                    $value = str_replace('"', '', $value);
                    if ($field == 'subject') {
                        $value = preg_replace('/^(Re:\s*|Fwd:\s*|Fw:\s*)+/i', '', $value);
                    }

                    $data = strtoupper($value);
                }
            }

            $index[$key] = $value;
        }

        if (!empty($index)) {
            // sort index
            if ($flag == 'ASC') {
                asort($index);
            }
            else {
                arsort($index);
            }

            // form new array based on index
            foreach ($index as $key => $val) {
                $result[$key] = $messages[$key];
            }
        }

        return $result;
    }
972204
public function findByModNames(array $modNames): array
    {
        $result = [];
        if (count($modNames) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select(['mc', 'm'])
                         ->from(ModCombination::class, 'mc')
                         ->innerJoin('mc.mod', 'm')
                         ->andWhere('m.name IN (:modNames)')
                         ->addOrderBy('mc.order', 'ASC')
                         ->setParameter('modNames', array_values($modNames));

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
89409
public function updateStatusFlags(&$flags)
    {
        // If there is no current FluentState, then we shouldn't update.
        if (!FluentState::singleton()->getLocale()) {
            return;
        }

        // If this page does not exist it should be "invisible"
        if (!$this->isDraftedInLocale() && !$this->isPublishedInLocale()) {
            $flags['fluentinvisible'] = [
                'text' => '',
                'title' => '',
            ];
        }
    }
29734
public void getSubFolders(final String folder, final AsyncCallback<List<CmsVfsEntryBean>> callback) {

        CmsRpcAction<List<CmsVfsEntryBean>> action = new CmsRpcAction<List<CmsVfsEntryBean>>() {

            @Override
            public void execute() {

                start(0, false);
                getGalleryService().getSubFolders(folder, this);
            }

            @Override
            protected void onResponse(List<CmsVfsEntryBean> result) {

                stop(false);
                callback.onSuccess(result);
            }

        };
        action.execute();
    }