MCPcopy Create free account
hub / github.com/amule-project/amule / SendSharedDirectories

Method SendSharedDirectories

src/BaseClient.cpp:2819–2858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2817#endif
2818
2819void CUpDownClient::SendSharedDirectories()
2820{
2821 // This list will contain all (unique) folders.
2822 PathList foldersToSend;
2823
2824 // The shared folders
2825 const unsigned folderCount = theApp->glob_prefs->shareddir_list.size();
2826 for (unsigned i = 0; i < folderCount; ++i) {
2827 foldersToSend.push_back(theApp->glob_prefs->shareddir_list[i]);
2828 }
2829
2830 // ... the categories folders ... (category 0 -> incoming)
2831 for (unsigned i = 0; i < theApp->glob_prefs->GetCatCount(); ++i) {
2832 foldersToSend.push_back(theApp->glob_prefs->GetCategory(i)->path);
2833 }
2834
2835 // Strip duplicates
2836 foldersToSend.sort();
2837 foldersToSend.unique();
2838
2839 // Build packet
2840 CMemFile tempfile(80);
2841 tempfile.WriteUInt32(foldersToSend.size() + 1); // + 1 for the incomplete files
2842
2843 PathList::iterator it = foldersToSend.begin();
2844 for (; it != foldersToSend.end(); ++it) {
2845 // Note: the public shared name contains the 'raw' path, so we can recognize it again.
2846 // the 'raw' path is determined using CPath::GetRaw()
2847 tempfile.WriteString( theApp->sharedfiles->GetPublicSharedDirName(*it), GetUnicodeSupport() );
2848 }
2849
2850 // ... and the Magic thing from the eDonkey Hybrids...
2851 tempfile.WriteString(OP_INCOMPLETE_SHARED_FILES, GetUnicodeSupport());
2852
2853 // Send the packet.
2854 CPacket* replypacket = new CPacket(tempfile, OP_EDONKEYPROT, OP_ASKSHAREDDIRSANS);
2855 theStats::AddUpOverheadOther(replypacket->GetPacketSize());
2856 AddDebugLogLineN( logLocalClient, "Local Client: OP_ASKSHAREDDIRSANS to " + GetFullIP() );
2857 SendPacket(replypacket, true, true);
2858}
2859
2860void CUpDownClient::SendSharedFilesOfDirectory(const wxString& strReqDir)
2861{

Callers 1

ProcessPacketMethod · 0.80

Calls 9

GetCatCountMethod · 0.80
WriteUInt32Method · 0.80
WriteStringMethod · 0.80
GetPacketSizeMethod · 0.80
sizeMethod · 0.45
GetCategoryMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected