int CFileZillaEnginePrivate::List(const CListCommand &command) { if (!IsConnected()) return FZ_REPLY_NOTCONNECTED; if (command.GetPath().empty() && !command.GetSubDir().empty()) return FZ_REPLY_SYNTAXERROR; if (command.GetFlags() & LIST_FLAG_LINK && command.GetSubDir().empty()) return FZ_REPLY_SYNTAXERROR; int flags = command.GetFlags(); bool const refresh = (command.GetFlags() & LIST_FLAG_REFRESH) != 0; bool const avoid = (command.GetFlags() & LIST_FLAG_AVOID) != 0; if (refresh && avoid) return FZ_REPLY_SYNTAXERROR; if (!refresh && !command.GetPath().empty()) { const CServer* pServer = m_pControlSocket->GetCurrentServer(); if (pServer) { CServerPath path(CPathCache::Lookup(*pServer, command.GetPath(), command.GetSubDir())); if (path.empty() && command.GetSubDir().empty()) path = command.GetPath(); if (!path.empty()) { CDirectoryListing *pListing = new CDirectoryListing; CDirectoryCache cache; bool is_outdated = false; bool found = cache.Lookup(*pListing, *pServer, path, true, is_outdated); if (found && !is_outdated) { if (pListing->get_unsure_flags()) flags |= LIST_FLAG_REFRESH; else { if (!avoid) { m_lastListDir = pListing->path; m_lastListTime = CDateTime::Now(); CDirectoryListingNotification *pNotification = new CDirectoryListingNotification(pListing->path); AddNotification(pNotification); } delete pListing; return FZ_REPLY_OK; } } if (is_outdated) flags |= LIST_FLAG_REFRESH; delete pListing; } } } if (IsBusy()) return FZ_REPLY_BUSY; m_pCurrentCommand = command.Clone(); return m_pControlSocket->List(command.GetPath(), command.GetSubDir(), flags); }