This site is for P2P development and test software ONLY!

Dont's Share incoming (on-off)

emule.rc

search :


CONTROL "Use UPnP to setup portforwardings",IDC_PREF_UPNPONSTART,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,116,208,10

add under:


CONTROL "Don´t Share incoming",IDC_NEVERINC,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,141,85,78,10



Preferences.cpp-----------------------------------------------------------------


search :

bool CPreferences::m_bStoreSearches;


add under :

//b4
bool CPreferences::m_neverinc;
//b4


search :


ini.WriteInt(L"PCPort", m_nPeerCachePort);


add under :


ini.WriteBool(_T("neverinc"), m_neverinc);


search:


m_bPeerCacheShow = ini.GetBool(L"Show", false);


add under:


m_neverinc=ini.GetBool(_T("neverinc"),true);



Preferences.h------------------------------------------------------------

search:

static bool m_bStoreSearches;


add under:


//b4
static bool m_neverinc;
//b4


PPgConnection.cpp-------------------------------------------------------


search :


ON_BN_CLICKED(IDC_PREF_UPNPONSTART, OnSettingsChange)

add under:


//b4
ON_BN_CLICKED(IDC_NEVERINC, OnBnClickedneverinc)
//b4



search:


CPropertyPage::OnInitDialog();


add under:


//b4
if (thePrefs.m_neverinc)
CheckDlgButton(IDC_NEVERINC,1);
//b4


search:


if (bRestartApp)
AfxMessageBox(GetResString(IDS_NOPORTCHANGEPOSSIBLE));

OnEnChangePorts(2);



add under:


//b4
if(IsDlgButtonChecked(IDC_NEVERINC))
thePrefs.m_neverinc = true;
else
thePrefs.m_neverinc = false;
//b4



search:


// TODO: actually we could offer the user to remove existing rules
AfxMessageBox(GetResString(IDS_FO_PREF_EXISTED), MB_ICONINFORMATION | MB_OK);
}
else
AfxMessageBox(GetResString(IDS_FO_PREF_FAILED), MB_ICONSTOP | MB_OK);
}


add under:


//b4
void CPPgConnection::OnBnClickedneverinc()
{
SetModified();
}
//b4



PPgConnection.h---------------------------------------------------------


search:


void Localize(void);
void LoadSettings(void);



add under:

//b4
afx_msg void OnBnClickedneverinc();
//b4



resource.h--------------------------------------------------------------


search:


#define IDC_EDITCOMMENTFILTER 2995
#define IDC_WIZZARDOBFUSCATION 2996

add under:

#define IDC_NEVERINC 2997



SharedFileList.cpp-----------------------------------------------------



search:


// khaos::kmod+ Fix: Shared files loaded multiple times.
CStringList l_sAdded;
CString tempDir;
CString ltempDir;
tempDir = thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR);
if (tempDir.Right(1)!=_T("\\"))
tempDir+=_T("\\");

add under:

//B4n$h33 no share incoming
if (thePrefs.m_neverinc == 0)
{


search:

if( l_sAdded.Find( ltempDir ) ==NULL ) {
l_sAdded.AddHead( ltempDir );
AddFilesFromDirectory(tempDir);
}

add under:

} //b4 end


search:


if( l_sAdded.Find( ltempDir ) ==NULL ) {
l_sAdded.AddHead( ltempDir );
AddFilesFromDirectory(tempDir);
}
}
// khaos::kmod-


add under:


//B4n$h33 no share incoming
if (thePrefs.m_neverinc == 0)
{



search:


AddLogLine(false,GetResString(IDS_SHAREDFOUNDHASHING), m_Files_map.GetCount(), waitingforhash_list.GetCount());

HashNextFile();
}


add under:


}
// B4n$h33 end



emule.h--------------------------------------------------------------


searc:


class CemuleApp : public CWinApp
{
public:
CemuleApp(LPCTSTR lpszAppName = NULL);

// ZZ:UploadSpeedSense -->
UploadBandwidthThrottler* uploadBandwidthThrottler;
LastCommonRouteFinder* lastCommonRouteFinder;
// ZZ:UploadSpeedSense <-- add under: //b4 static bool m_neverinc; //b4 PartFile.cpp--------------------------------------------------------- search: SetStatus(PS_COMPLETE); // (set status and) update status-modification related GUI elements theApp.knownfiles->SafeAddKFile(this);

add under:


//b4 dazzle - remove downloaded file from share if file is not in a shared directory
if (thePrefs.m_neverinc !=0)
{

bool keepshared = false;
for (POSITION pos = thePrefs.shareddir_list.GetHeadPosition();pos != 0 ; )
{
CString tempDir = thePrefs.shareddir_list.GetNext(pos);
CString fileDir = GetFilePath();
fileDir = fileDir.Left(fileDir.ReverseFind('\\'));
if (tempDir.Right(1)!=_T("\\"))
tempDir+=_T("\\");
if (fileDir.Right(1)!=_T("\\"))
fileDir+=_T("\\");
if (!fileDir.CompareNoCase(tempDir)) keepshared = true;
}
//remove file from share if..
if (!keepshared) theApp.sharedfiles->RemoveFile(this);
}
//end



search:



// Criterion 3. Request state (downloading in process from other source(s))
//const bool critRequested = IsAlreadyRequested(uStart, uEnd);
bool critRequested = false; // <--- This is set as a part of the second critCompletion loop below add under: //b4 - dazzle - if part files are shared (share level <=1) then, if the part file is not in the shared //file list yet, try to complete a chunk as soon as possible. once the file is shared, normal chunk selection is good enough bool critRequested; if (thePrefs.m_neverinc <=1 && !theApp.m_neverinc->IsFilePtrInList(this))
critRequested = false; // <--- This is set as a part of the second critCompletion loop below else critRequested = cur_chunk.frequency > veryRareBound && // => CPU load
IsAlreadyRequested(uStart, uEnd);
//end

For auto reload shared files just add this in partfile.cpp

theApp.sharedfiles->Reload(); // g_m : auto reload share files


after

// 05-Jän-2004 [bc]: ed2k and Kad are already full of totally wrong and/or not properly attached meta data. Take
// the chance to clean any available meta data tags and provide only tags which were determined by us.
UpdateMetaDataTags();

0 comments:

发表评论