⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 verycd.patch

📁 电驴的源代码
💻 PATCH
📖 第 1 页 / 共 2 页
字号:
diff -Nur srchybrid44a/BaseClient.cpp srchybrid44a_VeryCD/BaseClient.cpp
--- srchybrid44a/BaseClient.cpp	2004-09-03 14:04:06.000000000 +0800
+++ srchybrid44a_VeryCD/BaseClient.cpp	2004-09-08 21:24:46.093750000 +0800
@@ -59,6 +59,8 @@
 #include "ClientUDPSocket.h"
 #include "shahashset.h"
 
+#include "IP2Country.h" //EastShare - added by AndCycle, IP to Country
+
 #ifdef _DEBUG
 #undef THIS_FILE
 static char THIS_FILE[]=__FILE__;
@@ -117,6 +119,9 @@
 	dataratems = 0;
 	m_nUpDatarate = 0;
 	m_pszUsername = 0;
+	
+	m_structUserCountry = theApp.ip2country->GetDefaultIP2Country(); //EastShare - added by AndCycle, IP to Country
+
 	m_nUserIDHybrid = 0;
 	m_dwServerIP = 0;
 	m_nServerPort = 0;
@@ -361,6 +366,7 @@
 		m_strHelloInfo.AppendFormat(_T("  Tags=%u"), tagcount);
 	for (uint32 i = 0;i < tagcount; i++){
 		CTag temptag(data, true);
+		updateScoreAdjustor();	//VeryCD
 		switch (temptag.GetNameID()){
 			case CT_NAME:
 				if (m_pszUsername){
@@ -517,6 +523,15 @@
 	socket->GetPeerName((SOCKADDR*)&sockAddr, &nSockAddrLen);
 	SetIP(sockAddr.sin_addr.S_un.S_addr);
 
+	//EastShare Start - added by AndCycle, IP to Country
+	if(theApp.ip2country->IsIP2Country()){
+		 // Superlexx
+		if (m_structUserCountry == theApp.ip2country->GetDefaultIP2Country()){
+			m_structUserCountry = theApp.ip2country->GetCountryFromIP(m_dwUserIP);
+		}
+	}
+	//EastShare End - added by AndCycle, IP to Country
+
 	if (thePrefs.AddServersFromClient() && m_dwServerIP && m_nServerPort){
 		CServer* addsrv = new CServer(m_nServerPort, ipstr(m_dwServerIP));
 		addsrv->SetListName(addsrv->GetAddress());
@@ -2416,4 +2431,191 @@
 		return utf8strRaw;
 #endif
 	return utf8strNone;
+}
+
+//EastShare Start - added by AndCycle, IP to Country
+// Superlexx - client's location
+CString	CUpDownClient::GetCountryName(bool longName) const {
+
+	//display in client detail
+	if(longName && theApp.ip2country->IsIP2Country() == false)	return GetResString(IDS_DISABLED);
+
+	if(theApp.ip2country->IsIP2Country() == false) return "";
+
+	if(longName) return m_structUserCountry->LongCountryName;
+
+	CString tempStr;
+
+	switch(thePrefs.GetIP2CountryNameMode()){
+		case IP2CountryName_SHORT:
+// EastShare - Modified by Pretender
+//			tempStr.Format("<%s>",m_structUserCountry->ShortCountryName);
+			tempStr.Format("%s: ",m_structUserCountry->ShortCountryName);
+			return tempStr;
+		case IP2CountryName_MID:
+//			tempStr.Format("<%s>",m_structUserCountry->MidCountryName);
+			tempStr.Format("%s: ",m_structUserCountry->MidCountryName);
+			return tempStr;
+		case IP2CountryName_LONG:
+//			tempStr.Format("<%s>",m_structUserCountry->LongCountryName);
+			tempStr.Format("%s: ",m_structUserCountry->LongCountryName);
+			return tempStr;
+// EastShare - Modified by Pretender
+	}
+	return "";
+}
+
+int CUpDownClient::GetCountryFlagIndex() const {
+	return m_structUserCountry->FlagIndex;
+}
+void CUpDownClient::ResetIP2Country(){
+	m_structUserCountry = theApp.ip2country->GetCountryFromIP(m_dwUserIP);
+}
+//EastShare End - added by AndCycle, IP to Country
+
+void CUpDownClient::updateScoreAdjustor(void)	//VeryCD
+{
+	scoreAdjustor.RemoveAll();
+	CString name(m_pszUsername);
+	name.MakeUpper();
+	
+	const char *p = thePrefs.getScoreAdjustor();
+	while (*p) {
+		bool not = false;
+		if (*p == '!') {
+			not = true;
+			p++;
+		}
+
+		// 取得模式
+		if (*p != '\"') {
+			break;
+		}
+		p++;
+		const char *old = p;
+		while (*p && *p!='\"') {
+			p++;
+		}
+		if (*p != '\"') {
+			break;
+		}
+		CString pattern(old, p - old);
+		pattern.MakeUpper();
+		p++;
+
+		// 取操作符
+		sint64 a;
+		switch (*p) {
+			case '+':
+				a = 0;
+				break;
+			case '-':
+				a = 1;
+				break;
+			case '*':
+				a = 2;
+				break;
+			case '/':
+				a = 3;
+				break;
+			default:
+				a = -1;
+				break;
+		}
+		if (a<0) {
+			break;
+		}
+		p++;
+
+		// 取操作数
+		old = p;
+		while (isdigit(*p)) {
+			p++;
+		}
+		if (old == p) {
+			break;
+		}
+		CString n(old, p - old);
+		a = (a << 56) | atol(n);
+
+		if (pattern.GetLength()==32) {
+			// 检查UserHash
+			CString userHash = "";
+			for (uint16 i = 0;i != 16;i++){
+				CString buffer;
+				buffer.Format("%02X", GetUserHash()[i]);
+				userHash += buffer;
+			}
+			if (not ^ (userHash == pattern)) {
+				scoreAdjustor.AddTail(a);
+				if (*p == '!') {
+					break;
+				}
+			}
+		}
+		else if (pattern=="FRIEND"){
+			
+			if(IsFriend())
+			{
+				scoreAdjustor.AddTail(a);
+				if (*p == '!') {
+					break;
+				}
+			}
+		}
+		else if (pattern=="ONQUEUE"){
+			
+			if(IsEmuleClient() && m_nDownloadState==DS_ONQUEUE)
+			{
+				scoreAdjustor.AddTail(a);
+				if (*p == '!') {
+					break;
+				}
+			}
+		}
+		//else if (pattern=="CREDITS"){
+		//	
+		//	if(credits->GetScoreRatio(GetIP())>1)
+		//	{
+		//		scoreAdjustor.AddTail(a);
+		//		if (*p == '!') {
+		//			break;
+		//		}
+		//	}
+		//}
+		else if (pattern=="DOWNLOADING"){
+			
+			if(IsEmuleClient() && m_nDownloadState==DS_DOWNLOADING)
+			{
+				scoreAdjustor.AddTail(a);
+				if (*p == '!') {
+					break;
+				}
+			}
+		}
+		else if (pattern=="NONEEDEDPARTS"){
+			
+			if(IsEmuleClient() && m_nDownloadState==DS_NONEEDEDPARTS)
+			{
+				scoreAdjustor.AddTail(a);
+				if (*p == '!') {
+					break;
+				}
+			}
+		}else if (not ^ (name.Find(pattern)!=-1)) {
+			scoreAdjustor.AddTail(a);
+			if (*p == '!') {
+				break;
+			}
+		}
+
+		if (*p == '!') {
+			p++;
+		}
+
+		if (*p==',') {
+			p++;
+		}
+	}
+
 }
\ No newline at end of file
diff -Nur srchybrid44a/ClientDetailDialog.cpp srchybrid44a_VeryCD/ClientDetailDialog.cpp
--- srchybrid44a/ClientDetailDialog.cpp	2004-08-31 18:49:44.000000000 +0800
+++ srchybrid44a_VeryCD/ClientDetailDialog.cpp	2004-09-08 18:34:54.437500000 +0800
@@ -24,6 +24,7 @@
 #include "Server.h"
 #include "ServerList.h"
 #include "SharedFileList.h"
+#include "IP2Country.h" //EastShare - added by AndCycle, IP to Country
 
 #ifdef _DEBUG
 #undef THIS_FILE
@@ -60,6 +61,17 @@
 	else
 		GetDlgItem(IDC_DNAME)->SetWindowText(_T("?"));
 	
+	//EastShare Start - added by AndCycle, IP to Country
+	if(theApp.ip2country->IsIP2Country()){
+		// Superlexx
+		bool longCountryName = true;
+		GetDlgItem(IDC_DLOC)->SetWindowText(m_client->GetCountryName(longCountryName));
+	}
+	else{
+		GetDlgItem(IDC_DLOC)->SetWindowText(GetResString(IDS_DISABLED));
+	}
+	//EastShare End - added by AndCycle, IP to Country
+	
 	if (m_client->HasValidHash()){
 		buffer = _T("");
 		CString buffer2;
@@ -202,6 +214,9 @@
 	buffer.Format(_T("%s:"), GetResString(IDS_KADEMLIA)); 
 	GetDlgItem(IDC_CLIENTDETAIL_KAD)->SetWindowText(buffer);
 
+
+	GetDlgItem(IDC_DLOC2)->SetWindowText(GetResString(IDS_CD_LOCATION));	//VeryCD版
+
 	GetDlgItem(IDOK)->SetWindowText(GetResString(IDS_FD_CLOSE));
 
 	SetWindowText(GetResString(IDS_CD_TITLE));
diff -Nur srchybrid44a/ClientList.cpp srchybrid44a_VeryCD/ClientList.cpp
--- srchybrid44a/ClientList.cpp	2004-08-25 23:54:08.000000000 +0800
+++ srchybrid44a_VeryCD/ClientList.cpp	2004-09-08 20:50:16.640625000 +0800
@@ -754,6 +754,19 @@
 	m_ItemsList.Add(porthash);
 }
 
+//EastShare Start - added by AndCycle, IP to Country
+void CClientList::ResetIP2Country(){
+
+	CUpDownClient *cur_client;
+
+	for(POSITION pos = list.GetHeadPosition(); pos != NULL; list.GetNext(pos)) { 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -