amule: bump to latest HEAD
This commit is contained in:
parent
f3ec86266f
commit
b11d2f51b3
@ -8,9 +8,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=aMule
|
||||
PKG_VERSION:=2.3.2
|
||||
PKG_RELEASE:=2
|
||||
PKG_REV=4b87b20
|
||||
PKG_VERSION:=20190827
|
||||
PKG_RELEASE:=1
|
||||
PKG_REV=2a1b092
|
||||
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REV).tar.bz2
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,23 +0,0 @@
|
||||
diff -Naur a/m4/libupnp.m4 b/m4/libupnp.m4
|
||||
--- a/m4/libupnp.m4 2016-10-06 19:01:54.000000000 +0800
|
||||
+++ b/m4/libupnp.m4 2016-10-11 07:36:39.198318574 +0800
|
||||
@@ -52,7 +52,6 @@
|
||||
[export PKG_CONFIG_PATH=$withval/lib/pkgconfig])
|
||||
|
||||
dnl Check for libupnp >= MIN_LIBUPNP_VERSION
|
||||
- AS_IF([test $cross_compiling = no], [
|
||||
AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION])
|
||||
AS_IF([test -n "$PKG_CONFIG"], [
|
||||
AS_IF([$PKG_CONFIG libupnp --exists], [
|
||||
@@ -79,11 +78,6 @@
|
||||
])
|
||||
AC_MSG_RESULT([$result$resultstr])
|
||||
libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr"
|
||||
- ], [
|
||||
-dnl Currently cross-compilation with libupnp is not supported.
|
||||
- result=no
|
||||
- libupnp_error="cross compiling"
|
||||
- ])
|
||||
|
||||
dnl Execute the right action.
|
||||
AS_IF([test ${result:-no} = yes], [$2], [$3])
|
||||
@ -1,78 +0,0 @@
|
||||
diff --git a/src/amule.h b/src/amule.h
|
||||
index f25702f..240c02d 100644
|
||||
--- a/src/amule.h
|
||||
+++ b/src/amule.h
|
||||
@@ -553,6 +553,13 @@ class CamuleDaemonApp : public CamuleApp
|
||||
int OnExit();
|
||||
|
||||
virtual int InitGui(bool geometry_enable, wxString &geometry_string);
|
||||
+ // The GTK wxApps sets its file name conversion properly
|
||||
+ // in wxApp::Initialize(), while wxAppConsole::Initialize()
|
||||
+ // does not, leaving wxConvFile being set to wxConvLibc. File
|
||||
+ // name conversion should be set otherwise amuled will abort to
|
||||
+ // handle non-ASCII file names which monolithic amule can handle.
|
||||
+ // This function are overrided to perform this.
|
||||
+ virtual bool Initialize(int& argc_, wxChar **argv_);
|
||||
|
||||
#ifdef AMULED_APPTRAITS
|
||||
struct sigaction m_oldSignalChildAction;
|
||||
diff --git a/src/amuled.cpp b/src/amuled.cpp
|
||||
index 486da59..86e1ff8 100644
|
||||
--- a/src/amuled.cpp
|
||||
+++ b/src/amuled.cpp
|
||||
@@ -704,6 +704,41 @@ int CamuleDaemonApp::InitGui(bool ,wxString &)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+bool CamuleDaemonApp::Initialize(int& argc_, wxChar **argv_)
|
||||
+{
|
||||
+ if ( !wxAppConsole::Initialize(argc_, argv_) ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+#ifdef __UNIX__
|
||||
+ wxString encName;
|
||||
+#if wxUSE_INTL
|
||||
+ // if a non default locale is set,
|
||||
+ // assume that the user wants his
|
||||
+ // filenames in this locale too
|
||||
+ encName = wxLocale::GetSystemEncodingName().Upper();
|
||||
+
|
||||
+ // But don't consider ASCII in this case.
|
||||
+ if ( !encName.empty() ) {
|
||||
+ if ( encName == wxT("US-ASCII") ) {
|
||||
+ // This means US-ASCII when returned
|
||||
+ // from GetEncodingFromName().
|
||||
+ encName.clear();
|
||||
+ }
|
||||
+ }
|
||||
+#endif // wxUSE_INTL
|
||||
+
|
||||
+ // in this case, UTF-8 is used by default.
|
||||
+ if ( encName.empty() ) {
|
||||
+ encName = wxT("UTF-8");
|
||||
+ }
|
||||
+
|
||||
+ static wxConvBrokenFileNames fileconv(encName);
|
||||
+ wxConvFileName = &fileconv;
|
||||
+#endif // __UNIX__
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
|
||||
int CamuleDaemonApp::OnExit()
|
||||
{
|
||||
diff --git a/src/libs/common/Path.cpp b/src/libs/common/Path.cpp
|
||||
index 28152a2..5efefd0 100644
|
||||
--- a/src/libs/common/Path.cpp
|
||||
+++ b/src/libs/common/Path.cpp
|
||||
@@ -229,7 +229,8 @@ CPath::CPath(const wxString& filename)
|
||||
}
|
||||
|
||||
wxCharBuffer fn = filename2char(filename);
|
||||
- if (fn.data()) {
|
||||
+ // add fn.length() for wx 3.x
|
||||
+ if (fn.data()) {
|
||||
// Filename is valid in the current locale. This means that
|
||||
// it either originated from a (wx)system-call, or from a
|
||||
// user with a properly setup system.
|
||||
@ -1,174 +0,0 @@
|
||||
diff --git a/src/SearchList.cpp b/src/SearchList.cpp
|
||||
index 32b28e9..342a18f 100644
|
||||
--- a/src/SearchList.cpp
|
||||
+++ b/src/SearchList.cpp
|
||||
@@ -75,7 +75,7 @@ void ParsedSearchExpression(const CSearchExpr* pexpr)
|
||||
int iOpNot = 0;
|
||||
|
||||
for (unsigned int i = 0; i < pexpr->m_aExpr.GetCount(); i++) {
|
||||
- wxString str(pexpr->m_aExpr[i]);
|
||||
+ const wxString& str = pexpr->m_aExpr[i];
|
||||
if (str == SEARCHOPTOK_AND) {
|
||||
iOpAnd++;
|
||||
} else if (str == SEARCHOPTOK_OR) {
|
||||
@@ -108,6 +108,25 @@ void ParsedSearchExpression(const CSearchExpr* pexpr)
|
||||
|
||||
// optimize search expression, if no OR nor NOT specified
|
||||
if (iOpAnd > 0 && iOpOr == 0 && iOpNot == 0) {
|
||||
+ // figure out if we can use a better keyword than the one the user selected
|
||||
+ // for example most user will search like this "The oxymoronaccelerator 2", which would ask the node which indexes "the"
|
||||
+ // This causes higher traffic for such nodes and makes them a viable target to attackers, while the kad result should be
|
||||
+ // the same or even better if we ask the node which indexes the rare keyword "oxymoronaccelerator", so we try to rearrange
|
||||
+ // keywords and generally assume that the longer keywords are rarer
|
||||
+ if (/*thePrefs::GetRearrangeKadSearchKeywords() &&*/ !s_strCurKadKeyword.IsEmpty()) {
|
||||
+ for (unsigned int i = 0; i < pexpr->m_aExpr.GetCount(); i++) {
|
||||
+ if (pexpr->m_aExpr[i] != SEARCHOPTOK_AND) {
|
||||
+ if (pexpr->m_aExpr[i] != s_strCurKadKeyword
|
||||
+ && pexpr->m_aExpr[i].find_first_of(Kademlia::CSearchManager::GetInvalidKeywordChars()) == wxString::npos
|
||||
+ && pexpr->m_aExpr[i].Find('"') != 0 // no quoted expressions as keyword
|
||||
+ && pexpr->m_aExpr[i].length() >= 3
|
||||
+ && s_strCurKadKeyword.length() < pexpr->m_aExpr[i].length())
|
||||
+ {
|
||||
+ s_strCurKadKeyword = pexpr->m_aExpr[i];
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
wxString strAndTerms;
|
||||
for (unsigned int i = 0; i < pexpr->m_aExpr.GetCount(); i++) {
|
||||
if (pexpr->m_aExpr[i] != SEARCHOPTOK_AND) {
|
||||
@@ -285,7 +304,7 @@ void CSearchList::RemoveResults(long searchID)
|
||||
}
|
||||
|
||||
|
||||
-wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, const CSearchParams& params)
|
||||
+wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, CSearchParams& params)
|
||||
{
|
||||
// Check that we can actually perform the specified desired search.
|
||||
if ((type == KadSearch) && !Kademlia::CKademlia::IsRunning()) {
|
||||
@@ -306,6 +325,16 @@ wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, const CS
|
||||
m_resultType.Clear();
|
||||
}
|
||||
|
||||
+ if (type == KadSearch) {
|
||||
+ Kademlia::WordList words;
|
||||
+ Kademlia::CSearchManager::GetWords(params.searchString, &words);
|
||||
+ if (!words.empty()) {
|
||||
+ params.strKeyword = words.front();
|
||||
+ } else {
|
||||
+ return _("No keyword for Kad search - aborting");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
bool supports64bit = type == KadSearch ? true : theApp->serverconnect->GetCurrentServer() != NULL && (theApp->serverconnect->GetCurrentServer()->GetTCPFlags() & SRV_TCPFLG_LARGEFILES);
|
||||
bool packetUsing64bit;
|
||||
|
||||
@@ -332,8 +361,7 @@ wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, const CS
|
||||
|
||||
// searchstring will get tokenized there
|
||||
// The tab must be created with the Kad search ID, so searchID is updated.
|
||||
- Kademlia::CSearch* search = Kademlia::CSearchManager::PrepareFindKeywords(
|
||||
- params.searchString, data->GetLength(), data->GetRawBuffer(), *searchID);
|
||||
+ Kademlia::CSearch* search = Kademlia::CSearchManager::PrepareFindKeywords(params.strKeyword, data->GetLength(), data->GetRawBuffer(), *searchID);
|
||||
|
||||
*searchID = search->GetSearchID();
|
||||
m_currentSearch = *searchID;
|
||||
@@ -632,7 +660,7 @@ void CSearchList::StopSearch(bool globalOnly)
|
||||
}
|
||||
|
||||
|
||||
-CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& params, SearchType WXUNUSED(type), bool supports64bit, bool& packetUsing64bit)
|
||||
+CSearchList::CMemFilePtr CSearchList::CreateSearchData(CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit)
|
||||
{
|
||||
// Count the number of used parameters
|
||||
unsigned int parametercount = 0;
|
||||
@@ -659,14 +687,16 @@ CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& para
|
||||
_astrParserErrors.Empty();
|
||||
_SearchExpr.m_aExpr.Empty();
|
||||
|
||||
+ s_strCurKadKeyword.Clear();
|
||||
+ if (type == KadSearch) {
|
||||
+ wxASSERT( !params.strKeyword.IsEmpty() );
|
||||
+ s_strCurKadKeyword = params.strKeyword;
|
||||
+ }
|
||||
+
|
||||
LexInit(params.searchString);
|
||||
int iParseResult = yyparse();
|
||||
LexFree();
|
||||
|
||||
-#ifdef __DEBUG__
|
||||
- AddLogLineNS(CFormat(wxT("Search parsing result for \"%s\": %i"))
|
||||
- % params.searchString % iParseResult);
|
||||
-#endif
|
||||
if (_astrParserErrors.GetCount() > 0) {
|
||||
for (unsigned int i=0; i < _astrParserErrors.GetCount(); ++i) {
|
||||
AddLogLineNS(CFormat(wxT("Error %u: %s\n")) % i % _astrParserErrors[i]);
|
||||
@@ -681,21 +711,13 @@ CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& para
|
||||
return CMemFilePtr(NULL);
|
||||
}
|
||||
|
||||
- #ifdef __DEBUG__
|
||||
- wxString mes(wxT("Search expression:"));
|
||||
- for (unsigned int i = 0; i < _SearchExpr.m_aExpr.GetCount(); i++) {
|
||||
- mes << wxT(" ") << _SearchExpr.m_aExpr[i];
|
||||
+ if (type == KadSearch && s_strCurKadKeyword != params.strKeyword) {
|
||||
+ AddDebugLogLineN(logSearch, CFormat(wxT("Keyword was rearranged, using '%s' instead of '%s'")) % s_strCurKadKeyword % params.strKeyword);
|
||||
+ params.strKeyword = s_strCurKadKeyword;
|
||||
}
|
||||
- AddLogLineNS(mes);
|
||||
- AddLogLineNS(CFormat(wxT("Expression count: %i")) % _SearchExpr.m_aExpr.GetCount());
|
||||
- #endif
|
||||
|
||||
parametercount += _SearchExpr.m_aExpr.GetCount();
|
||||
|
||||
- #ifdef __DEBUG__
|
||||
- AddLogLineNS(CFormat(wxT("Parameters: %i")) % parametercount);
|
||||
- #endif
|
||||
-
|
||||
/* Leave the unicode comment there, please... */
|
||||
CSearchExprTarget target(data.get(), true /*I assume everyone is unicoded */ ? utf8strRaw : utf8strNone, supports64bit, packetUsing64bit);
|
||||
|
||||
diff --git a/src/SearchList.h b/src/SearchList.h
|
||||
index 35b0fc6..6db7508 100644
|
||||
--- a/src/SearchList.h
|
||||
+++ b/src/SearchList.h
|
||||
@@ -64,6 +64,8 @@ class CSearchList : public wxEvtHandler
|
||||
|
||||
//! The actual string to search for.
|
||||
wxString searchString;
|
||||
+ //! The keyword selected for Kad search
|
||||
+ wxString strKeyword;
|
||||
//! The type of files to search for (may be empty), one of ED2KFTSTR_*
|
||||
wxString typeText;
|
||||
//! The filename extension. May be empty.
|
||||
@@ -90,7 +92,7 @@ class CSearchList : public wxEvtHandler
|
||||
* @param params The search parameters, see CSearchParams.
|
||||
* @return An empty string on success, otherwise an error-message.
|
||||
*/
|
||||
- wxString StartNewSearch(uint32* searchID, SearchType type, const CSearchParams& params);
|
||||
+ wxString StartNewSearch(uint32* searchID, SearchType type, CSearchParams& params);
|
||||
|
||||
/** Stops the current search (global or Kad), if any is in progress. */
|
||||
void StopSearch(bool globalOnly = false);
|
||||
@@ -189,7 +191,7 @@ class CSearchList : public wxEvtHandler
|
||||
typedef std::auto_ptr<CMemFile> CMemFilePtr;
|
||||
|
||||
/** Create a basic search-packet for the given search-type. */
|
||||
- CMemFilePtr CreateSearchData(const CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit);
|
||||
+ CMemFilePtr CreateSearchData(CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit);
|
||||
|
||||
|
||||
//! Timer used for global search intervals.
|
||||
diff --git a/src/kademlia/kademlia/SearchManager.cpp b/src/kademlia/kademlia/SearchManager.cpp
|
||||
index e7f25d4..f9ee924 100644
|
||||
--- a/src/kademlia/kademlia/SearchManager.cpp
|
||||
+++ b/src/kademlia/kademlia/SearchManager.cpp
|
||||
@@ -127,7 +127,7 @@ CSearch* CSearchManager::PrepareFindKeywords(const wxString& keyword, uint32_t s
|
||||
|
||||
wxString wstrKeyword = s->m_words.front();
|
||||
|
||||
- AddLogLineNS(CFormat(_("Keyword for search: %s")) % wstrKeyword);
|
||||
+ AddDebugLogLineN(logSearch, CFormat(wxT("Keyword for search: %s")) % wstrKeyword);
|
||||
|
||||
// Kry - I just decided to assume everyone is unicoded
|
||||
// GonoszTopi - seconded
|
||||
Loading…
Reference in New Issue
Block a user