From 1b5bd29c57f85bdeddc1b24552e169bdd514bbc5 Mon Sep 17 00:00:00 2001 From: jak1 Date: Sat, 17 Dec 2022 13:35:24 +0100 Subject: disable SSL for downloads, since Windows\' OpenSSL doesnt support it. --- src/net/download.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/net') diff --git a/src/net/download.cpp b/src/net/download.cpp index 521c40eb9..a8ee03f77 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -308,6 +308,11 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(d->mCurl, CURLOPT_HTTPHEADER, d->mHeaders); + // ignore SSL verificytion, windows' OpenSSL is very limited + if (strstr(d->mUrl.c_str(), "https://") != NULL) + { + curl_easy_setopt(d->mCurl, CURLOPT_SSL_VERIFYPEER, 0L); + } if (d->mOptions.memoryWrite != 0U) { curl_easy_setopt(d->mCurl, CURLOPT_FAILONERROR, 1); -- cgit v1.2.3-70-g09d2 From fb262ec89ebc0ce8461f9f03716281b99115e2be Mon Sep 17 00:00:00 2001 From: ccc Date: Fri, 16 Dec 2022 10:05:36 +0100 Subject: increase trade window items to 20 --- src/net/ea/inventoryhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 20dbda7c0..7c3a5688b 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -87,7 +87,7 @@ size_t InventoryHandler::getSize(const InventoryTypeT type) const case InventoryType::Storage: return 0; // Comes from server after items case InventoryType::Trade: - return 12; + return 20; case InventoryType::Npc: case InventoryType::Cart: case InventoryType::Vending: -- cgit v1.2.3-70-g09d2 From 252ab4b6bcc73c4a798ed4fce5768daf4eac779a Mon Sep 17 00:00:00 2001 From: ccc Date: Wed, 21 Dec 2022 11:17:02 +0100 Subject: Add mobinfo command to popup menu --- src/gui/popups/popupmenu.cpp | 7 +++++++ src/net/tmwa/adminhandler.cpp | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 0542fd72a..3ef275aae 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -414,6 +414,13 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) // TRANSLATORS: popup menu item // TRANSLATORS: add monster to ignore list _("Add to ignore list")); + if (isAllowCommand(ServerCommandType::mobinfo)) + { + mBrowserBox->addRow("/monsterinfo 'BEINGSUBTYPEID'", + // TRANSLATORS: popup menu item + // TRANSLATORS: show monster info + _("Monster info")); + } } } break; diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 3ec67f1e0..748e9c444 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -127,8 +127,9 @@ void AdminHandler::requestStats(const std::string &name A_UNUSED) const { } -void AdminHandler::monsterInfo(const std::string &name A_UNUSED) const +void AdminHandler::monsterInfo(const std::string &name) const { + Gm::runCommand("mobinfo", name); } void AdminHandler::itemInfo(const std::string &name A_UNUSED) const -- cgit v1.2.3-70-g09d2 From f683acc05a4edf5ae95a72d3ecffc7ed7c6b248f Mon Sep 17 00:00:00 2001 From: jak1 Date: Fri, 7 Apr 2023 03:04:54 +0200 Subject: fixed curl deprecation --- src/net/download.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++--------- src/net/download.h | 7 +++++-- 2 files changed, 49 insertions(+), 11 deletions(-) (limited to 'src/net') diff --git a/src/net/download.cpp b/src/net/download.cpp index a8ee03f77..0c0008d0e 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -70,7 +70,11 @@ Download::Download(void *const ptr, mThread(nullptr), mCurl(nullptr), mHeaders(nullptr), +#if LIBCURL_VERSION_NUM < 0x073800 mFormPost(nullptr), +#else + mMime(nullptr), +#endif // LIBCURL_VERSION_NUM < 0x073800 mError(static_cast(calloc(CURL_ERROR_SIZE + 1, 1))), mIgnoreError(ignoreError), mUpload(isUpload), @@ -99,11 +103,20 @@ Download::Download(void *const ptr, Download::~Download() { +#if LIBCURL_VERSION_NUM < 0x073800 if (mFormPost != nullptr) { curl_formfree(mFormPost); mFormPost = nullptr; } +#else + if (mMime != nullptr) + { + curl_mime_free(mMime); + mMime = nullptr; + } +#endif // LIBCURL_VERSION_NUM < 0x073800 + if (mHeaders != nullptr) { @@ -256,7 +269,7 @@ int Download::downloadThread(void *ptr) if (d->mUpload) { outFilename = d->mFileName; - prepareForm(&d->mFormPost, outFilename); + prepareForm(d, outFilename); } else { @@ -297,7 +310,11 @@ int Download::downloadThread(void *ptr) { logger->log_r("Uploading: %s", d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str()); +#if LIBCURL_VERSION_NUM < 0x073800 curl_easy_setopt(d->mCurl, CURLOPT_HTTPPOST, d->mFormPost); +#else + curl_easy_setopt(d->mCurl, CURLOPT_MIMEPOST, d->mMime); +#endif // LIBCURL_VERSION_NUM < 0x073800 curl_easy_setopt(d->mCurl, CURLOPT_WRITEFUNCTION, &Download::writeFunction); mUploadResponse.clear(); @@ -336,12 +353,18 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_ERRORBUFFER, d->mError); curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_NOPROGRESS, 0); +#if LIBCURL_VERSION_NUM < 0x072000 curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSFUNCTION, - &downloadProgress); + &downloadProgress); +#else + curl_easy_setopt(d->mCurl, CURLOPT_XFERINFOFUNCTION, + &downloadProgress); + +#endif // LIBCURL_VERSION_NUM < 0x072000 curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSDATA, ptr); #if LIBCURL_VERSION_NUM >= 0x070a00 curl_easy_setopt(d->mCurl, CURLOPT_NOSIGNAL, 1); -#endif // LIBCURL_VERSION_NUM >= 0x070a00 +#endif // LIBCURL_VERSION_NUM >= 0x070a00 curl_easy_setopt(d->mCurl, CURLOPT_CONNECTTIMEOUT, 30); curl_easy_setopt(d->mCurl, CURLOPT_TIMEOUT, 1800); addHeaders(d->mCurl); @@ -578,12 +601,18 @@ void Download::secureCurl(CURL *const curl) void Download::secureCurl(CURL *const curl A_UNUSED) #endif // LIBCURL_VERSION_NUM >= 0x070f01 { -#if LIBCURL_VERSION_NUM >= 0x071304 +#if LIBCURL_VERSION_NUM >= 0x071304 && LIBCURL_VERSION_NUM <= 0x075500 curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); -#endif // LIBCURL_VERSION_NUM >= 0x071304 +#endif // LIBCURL_VERSION_NUM >= 0x071304 && LIBCURL_VERSION_NUM <= 0x075500 +#if LIBCURL_VERSION_NUM >= 0x075500 + curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, + "http,https"); + curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, + "http,https"); +#endif // LIBCURL_VERSION_NUM >= 0x075500 #if LIBCURL_VERSION_NUM >= 0x071500 curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 0); #endif // LIBCURL_VERSION_NUM >= 0x071500 @@ -622,10 +651,8 @@ void Download::addCommonFlags(CURL *const curl) #endif // LIBCURL_VERSION_NUM >= 0x072D00 } -void Download::prepareForm(curl_httppost **form, const std::string &fileName) +void Download::prepareForm(Download *const d, const std::string &fileName) { - curl_httppost *lastPtr = nullptr; - std::ifstream file; file.open(fileName.c_str(), std::ios::in); if (!file.is_open()) @@ -638,10 +665,18 @@ void Download::prepareForm(curl_httppost **form, const std::string &fileName) delete [] line; - curl_formadd(form, &lastPtr, +#if LIBCURL_VERSION_NUM < 0x073800 + curl_httppost *lastPtr = nullptr; + curl_formadd(&d->mFormPost, &lastPtr, CURLFORM_COPYNAME, "f:1", CURLFORM_COPYCONTENTS, str.str().c_str(), CURLFORM_END); +#else + curl_mimepart *part = curl_mime_addpart(d->mMime); + curl_mime_init(d->mCurl); + curl_mime_name(part, "f:1"); + curl_mime_data(part, str.str().c_str(), str.str().length()); +#endif } size_t Download::writeFunction(void *ptr, diff --git a/src/net/download.h b/src/net/download.h index 75dcf9b4b..c838943b7 100644 --- a/src/net/download.h +++ b/src/net/download.h @@ -95,8 +95,7 @@ class Download final static size_t writeFunction(void *ptr, size_t size, size_t nmemb, void *stream); - static void prepareForm(curl_httppost **form, - const std::string &fileName); + static void prepareForm(Download *const d, const std::string &fileName); static unsigned long fadler32(FILE *const file) A_WARN_UNUSED; @@ -135,7 +134,11 @@ class Download final SDL_Thread *mThread; CURL *mCurl; curl_slist *mHeaders; +#if LIBCURL_VERSION_NUM < 0x073800 curl_httppost *mFormPost; +#else + curl_mime *mMime; +#endif char *mError; bool mIgnoreError; bool mUpload; -- cgit v1.2.3-70-g09d2 From 8eb07f82959ea0b97df848386dda0538c63995e7 Mon Sep 17 00:00:00 2001 From: jak1 Date: Fri, 7 Apr 2023 03:06:17 +0200 Subject: added missing cstdint include --- src/const/net/maxpacketversion.h | 4 ++++ src/const/net/net.h | 4 ++++ src/net/ea/chatrecv.h | 2 ++ src/net/ea/traderecv.h | 2 ++ src/net/eathena/beingrecv.h | 4 ++++ src/net/tmwa/beingrecv.h | 4 ++++ src/net/worldinfo.h | 4 ++++ src/options.h | 4 ++++ src/render/opengl/mgltypes.h | 6 ++++++ 9 files changed, 34 insertions(+) (limited to 'src/net') diff --git a/src/const/net/maxpacketversion.h b/src/const/net/maxpacketversion.h index ba075b651..044459bc3 100644 --- a/src/const/net/maxpacketversion.h +++ b/src/const/net/maxpacketversion.h @@ -22,7 +22,11 @@ #define CONST_NET_MAXPACKETVERSION_H #if defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(__APPLE__) +#include +#else // defined(__APPLE__) #include +#endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) diff --git a/src/const/net/net.h b/src/const/net/net.h index 8d515732d..0077ca815 100644 --- a/src/const/net/net.h +++ b/src/const/net/net.h @@ -22,7 +22,11 @@ #define CONST_NET_NET_H #if defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(__APPLE__) +#include +#else // defined(__APPLE__) #include +#endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) diff --git a/src/net/ea/chatrecv.h b/src/net/ea/chatrecv.h index 5c1bf20e6..ec762bc25 100644 --- a/src/net/ea/chatrecv.h +++ b/src/net/ea/chatrecv.h @@ -26,6 +26,8 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include +#else // defined(__APPLE__) +#include #endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include diff --git a/src/net/ea/traderecv.h b/src/net/ea/traderecv.h index 1b5eb4693..69b96d689 100644 --- a/src/net/ea/traderecv.h +++ b/src/net/ea/traderecv.h @@ -26,6 +26,8 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include +#else // defined(__APPLE__) +#include #endif // defined(__APPLE__) #else // defined(__GXX_EXPERIMENTAL_CXX0X__) #include diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h index 16a788ab3..f9b3c01a6 100644 --- a/src/net/eathena/beingrecv.h +++ b/src/net/eathena/beingrecv.h @@ -32,7 +32,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include +#else // defined(__APPLE__) +#include #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include "localconsts.h" diff --git a/src/net/tmwa/beingrecv.h b/src/net/tmwa/beingrecv.h index 91059e50c..89fc75f0f 100644 --- a/src/net/tmwa/beingrecv.h +++ b/src/net/tmwa/beingrecv.h @@ -26,7 +26,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include +#else // defined(__APPLE__) +#include #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include "localconsts.h" diff --git a/src/net/worldinfo.h b/src/net/worldinfo.h index b9c16f0e4..03063c682 100644 --- a/src/net/worldinfo.h +++ b/src/net/worldinfo.h @@ -28,7 +28,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include +#else // defined(__APPLE__) +#include #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include diff --git a/src/options.h b/src/options.h index d4d8bb8bd..011919533 100644 --- a/src/options.h +++ b/src/options.h @@ -28,7 +28,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__APPLE__) #include +#else // defined(__APPLE__) +#include #endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #include "localconsts.h" diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h index bf5a34fc7..53af6d129 100644 --- a/src/render/opengl/mgltypes.h +++ b/src/render/opengl/mgltypes.h @@ -72,7 +72,13 @@ RENDER_OPENGL_MGLDEFINES_H #ifndef USE_SDL2 #if defined(__GXX_EXPERIMENTAL_CXX0X__) +#if defined(__APPLE__) +#include +#else // defined(__APPLE__) #include +#endif // defined(__APPLE__) +#else // defined(__GXX_EXPERIMENTAL_CXX0X__) +#include #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) #endif // USE_SDL2 -- cgit v1.2.3-70-g09d2 From 279c7ba28804960ae3b2ec0753b4c3a92d5a6ede Mon Sep 17 00:00:00 2001 From: jak1 Date: Fri, 7 Apr 2023 03:35:07 +0200 Subject: fix formating --- src/net/download.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/net') diff --git a/src/net/download.cpp b/src/net/download.cpp index 0c0008d0e..973302c67 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -74,7 +74,7 @@ Download::Download(void *const ptr, mFormPost(nullptr), #else mMime(nullptr), -#endif // LIBCURL_VERSION_NUM < 0x073800 +#endif // LIBCURL_VERSION_NUM < 0x073800 mError(static_cast(calloc(CURL_ERROR_SIZE + 1, 1))), mIgnoreError(ignoreError), mUpload(isUpload), @@ -115,7 +115,7 @@ Download::~Download() curl_mime_free(mMime); mMime = nullptr; } -#endif // LIBCURL_VERSION_NUM < 0x073800 +#endif // LIBCURL_VERSION_NUM < 0x073800 if (mHeaders != nullptr) @@ -314,7 +314,7 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_HTTPPOST, d->mFormPost); #else curl_easy_setopt(d->mCurl, CURLOPT_MIMEPOST, d->mMime); -#endif // LIBCURL_VERSION_NUM < 0x073800 +#endif // LIBCURL_VERSION_NUM < 0x073800 curl_easy_setopt(d->mCurl, CURLOPT_WRITEFUNCTION, &Download::writeFunction); mUploadResponse.clear(); @@ -360,11 +360,11 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_XFERINFOFUNCTION, &downloadProgress); -#endif // LIBCURL_VERSION_NUM < 0x072000 +#endif // LIBCURL_VERSION_NUM < 0x072000 curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSDATA, ptr); #if LIBCURL_VERSION_NUM >= 0x070a00 curl_easy_setopt(d->mCurl, CURLOPT_NOSIGNAL, 1); -#endif // LIBCURL_VERSION_NUM >= 0x070a00 +#endif // LIBCURL_VERSION_NUM >= 0x070a00 curl_easy_setopt(d->mCurl, CURLOPT_CONNECTTIMEOUT, 30); curl_easy_setopt(d->mCurl, CURLOPT_TIMEOUT, 1800); addHeaders(d->mCurl); @@ -606,7 +606,7 @@ void Download::secureCurl(CURL *const curl A_UNUSED) CURLPROTO_HTTP | CURLPROTO_HTTPS); curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); -#endif // LIBCURL_VERSION_NUM >= 0x071304 && LIBCURL_VERSION_NUM <= 0x075500 +#endif // LIBCURL_VERSION_NUM >= 0x071304 && LIBCURL_VERSION_NUM <= 0x075500 #if LIBCURL_VERSION_NUM >= 0x075500 curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,https"); -- cgit v1.2.3-70-g09d2