matches.add("LIST (" + getFolderAttributes(folder) + ") \"/\" " + encodeFolder(path));
matches.add("LIST (" + getFolderAttributes(folder) + ") \"/\" " + ImapFolder.encodeFolder(path));
    boolean doLIST(String tag, List args) throws IOException {        if (!checkState(tag, ImapSession.STATE_AUTHENTICATED))            return CONTINUE_PROCESSING;        String referenceName = (String) args.remove(0);        String mailboxName   = (String) args.remove(0);        if (mailboxName.equals("")) {            // 6.3.8: "An empty ("" string) mailbox name argument is a special request to return            //         the hierarchy delimiter and the root name of the name given in the reference."            sendUntagged("LIST (\\Noselect) \"/\" \"\"");            sendOK(tag, "LIST completed");            return CONTINUE_PROCESSING;        }        String pattern = mailboxName;        if (!mailboxName.startsWith("/")) {            if (referenceName.endsWith("/"))  pattern = referenceName + mailboxName;            else                              pattern = referenceName + '/' + mailboxName;        }        if (pattern.startsWith("/"))            pattern = pattern.substring(1);        ArrayList matches = new ArrayList();        try {            synchronized (mMailbox) {                Folder root = mMailbox.getFolderById(Mailbox.ID_FOLDER_USER_ROOT);                List folders = root.getSubfolderHierarchy();                for (Iterator it = folders.iterator(); it.hasNext(); ) {                    Folder folder = (Folder) it.next();                    if (!ImapFolder.isFolderVisible(folder))                        continue;                    String path = folder.getPath().substring(1);                    // FIXME: need to determine "name attributes" for mailbox (\Marked, \Unmarked, \Noinferiors, \Noselect)                    if (path.toUpperCase().matches(pattern))                        matches.add("LIST (" + getFolderAttributes(folder) + ") \"/\" " + encodeFolder(path));                }            }        } catch (ServiceException e) {            ZimbraLog.imap.warn("LIST failed", e);            sendNO(tag, "LIST failed");            return canContinue(e);        }        for (int i = 0; i < matches.size(); i++)            sendUntagged((String) matches.get(i));        sendNotifications(true, false);        sendOK(tag, "LIST completed");        return CONTINUE_PROCESSING;    }