| 2858 | } |
| 2859 | |
| 2860 | void CUpDownClient::SendSharedFilesOfDirectory(const wxString& strReqDir) |
| 2861 | { |
| 2862 | CKnownFilePtrList list; |
| 2863 | |
| 2864 | if (strReqDir == OP_INCOMPLETE_SHARED_FILES) { |
| 2865 | // get all shared files from download queue |
| 2866 | int iQueuedFiles = theApp->downloadqueue->GetFileCount(); |
| 2867 | for (int i = 0; i < iQueuedFiles; i++) { |
| 2868 | CPartFile* pFile = theApp->downloadqueue->GetFileByIndex(i); |
| 2869 | if (pFile == NULL || pFile->GetStatus(true) != PS_READY) { |
| 2870 | continue; |
| 2871 | } |
| 2872 | list.push_back(pFile); |
| 2873 | } |
| 2874 | } else { |
| 2875 | // get all shared files for the requested directory |
| 2876 | const CPath *sharedDir = theApp->sharedfiles->GetDirForPublicSharedDirName(strReqDir); |
| 2877 | if (sharedDir) { |
| 2878 | theApp->sharedfiles->GetSharedFilesByDirectory(sharedDir->GetRaw(), list); |
| 2879 | } else { |
| 2880 | AddLogLineC(CFormat(_("User %s (%u) requested sharedfiles-list for not existing directory '%s' -> Ignored")) % GetUserName() % GetUserIDHybrid() % strReqDir); |
| 2881 | } |
| 2882 | } |
| 2883 | |
| 2884 | CMemFile tempfile(80); |
| 2885 | tempfile.WriteString(strReqDir, GetUnicodeSupport()); |
| 2886 | tempfile.WriteUInt32(list.size()); |
| 2887 | |
| 2888 | while (!list.empty()) { |
| 2889 | if (!list.front()->IsLargeFile() || SupportsLargeFiles()) { |
| 2890 | list.front()->CreateOfferedFilePacket(&tempfile, NULL, this); |
| 2891 | } |
| 2892 | list.pop_front(); |
| 2893 | } |
| 2894 | |
| 2895 | CPacket* replypacket = new CPacket(tempfile, OP_EDONKEYPROT, OP_ASKSHAREDFILESDIRANS); |
| 2896 | theStats::AddUpOverheadOther(replypacket->GetPacketSize()); |
| 2897 | AddDebugLogLineN( logLocalClient, "Local Client: OP_ASKSHAREDFILESDIRANS to " + GetFullIP() ); |
| 2898 | SendPacket(replypacket, true, true); |
| 2899 | } |
| 2900 | |
| 2901 | void CUpDownClient::SendFirewallCheckUDPRequest() |
| 2902 | { |
no test coverage detected