diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/Modules/m_http.cpp | 5 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Utils.cpp | 3 | ||||
-rw-r--r-- | plugins/PasteIt/src/PasteToWeb.cpp | 3 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 3 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.cpp | 7 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.h | 16 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp | 2 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_imgur.h | 1 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp | 7 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHost_uploadpie.h | 1 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/download.cpp | 3 |
14 files changed, 30 insertions, 35 deletions
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index a3f02f86bb..4fc36e40f2 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -141,7 +141,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) {
HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(nullptr, IDC_WAIT));
- MHttpRequest nlhr;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT;
nlhr.m_szUrl = szURL;
diff --git a/plugins/MirLua/src/Modules/m_http.cpp b/plugins/MirLua/src/Modules/m_http.cpp index fcc0365078..bbad6165fb 100644 --- a/plugins/MirLua/src/Modules/m_http.cpp +++ b/plugins/MirLua/src/Modules/m_http.cpp @@ -4,7 +4,7 @@ static MHttpRequest* CreateRequest() { - MHttpRequest *request = new MHttpRequest(); + MHttpRequest *request = new MHttpRequest(REQUEST_GET); request->flags = NLHRF_HTTP11 | NLHRF_NODUMP; return request; } @@ -269,9 +269,8 @@ static int request_Send(lua_State *L) { MHttpRequest *request = *(MHttpRequest**)luaL_checkudata(L, 1, MT_NETLIBHTTPREQUEST); - MHttpRequest *newRequest = new MHttpRequest(); + MHttpRequest *newRequest = new MHttpRequest(request->requestType); newRequest->flags = request->flags; - newRequest->requestType = request->requestType; newRequest->m_szUrl = request->m_szUrl; newRequest->m_szParam = request->m_szParam; newRequest->timeout = request->timeout; diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 6319ca47c0..7c3212388e 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -107,8 +107,7 @@ void LoadOptions() BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
{
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_REDIRECT | NLHRF_DUMPASTEXT | NLHRF_HTTP11;
nlhr.m_szUrl = _T2A(tszURL);
nlhr.AddHeader("User-Agent", NETLIB_USER_AGENT);
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index 5fdfc7afec..cac74b80de 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -426,8 +426,7 @@ char *PasteToWeb::SendToWeb(char *url, std::map<std::string, std::string> &heade WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, nullptr, nullptr);
--cbLen;
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_POST;
+ MHttpRequest nlhr(REQUEST_POST);
nlhr.flags = NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT | NLHPIF_HTTP11;
nlhr.m_szUrl = url;
nlhr.SetData(contentBytes, cbLen);
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 4cc80eaec1..90921aaa13 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -145,9 +145,8 @@ int DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) ptrA szUrl(mir_u2a(pFileURL->wszDownloadURL));
- MHttpRequest nlhr;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_PERSISTENT;
- nlhr.requestType = REQUEST_GET;
nlhr.nlc = nlc;
nlhr.m_szUrl = szUrl;
nlhr.AddHeader("User-Agent", szUserAgent);
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 57ea415646..a06829a422 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -45,7 +45,8 @@ CSend::CSend(HWND /*Owner*/, MCONTACT hContact, bool bAsync, bool bSilent) : m_hSend(nullptr),
m_hOnSend(nullptr),
m_ErrorMsg(nullptr),
- m_ErrorTitle(nullptr)
+ m_ErrorTitle(nullptr),
+ m_nlhr(REQUEST_POST)
{
SetContact(hContact);
}
@@ -422,7 +423,7 @@ const char* CSend::GetHTMLContent(char* str, const char* startTag, const char* e return begin;
}
-int CSend::HTTPFormCreate(MHttpRequest* nlhr, int requestType, const char* url, HTTPFormData* frm, size_t frmNum)
+int CSend::HTTPFormCreate(MHttpRequest* nlhr, const char* url, HTTPFormData* frm, size_t frmNum)
{
char boundary[16];
strcpy(boundary, "--M461C/");
@@ -439,7 +440,7 @@ int CSend::HTTPFormCreate(MHttpRequest* nlhr, int requestType, const char* url, boundary[9 + i * 2] = (chcode < 0x0a ? '0' : 'a' - 0x0a) + chcode;
}
}
- nlhr->requestType = requestType;
+
nlhr->flags = NLHRF_HTTP11;
if (!strncmp(url, "https://", 8))
nlhr->flags |= NLHRF_SSL;
diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h index 5d9e48247b..fc7985574a 100644 --- a/plugins/SendScreenshotPlus/src/CSend.h +++ b/plugins/SendScreenshotPlus/src/CSend.h @@ -65,7 +65,7 @@ public: void SetContact(MCONTACT hContact);
const char* GetURL() { return m_URL; }
const char* GetURLthumbnail() {return m_URLthumb; }
- uint8_t GetEnableItem() {return m_EnableItem;};
+ uint8_t GetEnableItem() {return m_EnableItem;};
wchar_t* GetErrorMsg() {return m_ErrorMsg;};
bool m_bDeleteAfterSend;
@@ -81,23 +81,25 @@ protected: wchar_t* m_pszSendTyp; // hold string for error mess
char* m_pszProto; // Contact Proto Module
MCONTACT m_hContact; // Contact handle
- uint8_t m_EnableItem; // hold flag for send type
- uint8_t m_ChatRoom; // is Contact chatroom
+ uint8_t m_EnableItem; // hold flag for send type
+ uint8_t m_ChatRoom; // is Contact chatroom
void Error(LPCTSTR pszFormat, ...);
void svcSendFileExit();
void svcSendMsgExit(const char* szMessage);
void Exit(unsigned int Result);
- uint32_t m_cbEventMsg; // sizeof EventMsg(T) buffer
+ uint32_t m_cbEventMsg; // sizeof EventMsg(T) buffer
CMStringA m_szEventMsg; // EventMsg char*
HANDLE m_hSend; // protocol send handle
HANDLE m_hOnSend; // HookEventObj on ME_PROTO_ACK
-
+
MSGBOX m_box;
wchar_t* m_ErrorMsg;
wchar_t* m_ErrorTitle;
-
+
+ MHttpRequest m_nlhr;
+
void Unhook(){if(m_hOnSend) {UnhookEvent(m_hOnSend);m_hOnSend = nullptr;}}
void DB_EventAdd(uint16_t EventType);
@@ -130,7 +132,7 @@ protected: };
static const char* GetHTMLContent(char* str, const char* startTag, const char* endTag); // changes "str", can be successfully used only once
- int HTTPFormCreate(MHttpRequest* nlhr, int requestType, const char* url, HTTPFormData* frm, size_t frmNum); // returns "0" on success, Exit() will be called on failure (stop processing)
+ int HTTPFormCreate(MHttpRequest* nlhr, const char* url, HTTPFormData* frm, size_t frmNum); // returns "0" on success, Exit() will be called on failure (stop processing)
};
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp index 2826dd18c2..981c18f399 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-CSendHost_ImageShack::CSendHost_ImageShack(HWND Owner, MCONTACT hContact, bool bAsync)
- : CSend(Owner, hContact, bAsync)
+CSendHost_ImageShack::CSendHost_ImageShack(HWND Owner, MCONTACT hContact, bool bAsync) :
+ CSend(Owner, hContact, bAsync)
{
m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND;
m_pszSendTyp = LPGENW("Image upload");
@@ -59,7 +59,7 @@ int CSendHost_ImageShack::Send() { "public", "no" },
{ "key", HTTPFORM_8BIT(DEVKEY_IMAGESHACK) },
};
- int error = HTTPFormCreate(&m_nlhr, REQUEST_POST, "http://imageshack.us/upload_api.php", frm, sizeof(frm) / sizeof(HTTPFormData));
+ int error = HTTPFormCreate(&m_nlhr, "http://imageshack.us/upload_api.php", frm, sizeof(frm) / sizeof(HTTPFormData));
mir_free(tmp);
if (error)
return !m_bAsync;
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h index 3b6212eb70..6ba8153342 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.h @@ -40,10 +40,8 @@ public: int Send() override;
protected:
- MHttpRequest m_nlhr;
-
- void SendThread();
- static void SendThreadWrapper(void * Obj);
+ void SendThread();
+ static void SendThreadWrapper(void * Obj);
};
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp index da8010da07..b5bd858ab5 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp @@ -42,7 +42,7 @@ int CSendHost_Imgur::Send() { "image", HTTPFORM_FILE(tmp) },
};
- int error = HTTPFormCreate(&m_nlhr, REQUEST_POST, "https://api.imgur.com/3/image", frm, _countof(frm));
+ int error = HTTPFormCreate(&m_nlhr, "https://api.imgur.com/3/image", frm, _countof(frm));
mir_free(tmp);
if (error)
return !m_bAsync;
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.h b/plugins/SendScreenshotPlus/src/CSendHost_imgur.h index c99aaf8fef..4db1c425ec 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.h +++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.h @@ -24,7 +24,6 @@ class CSendHost_Imgur : public CSend { int Send() override;
protected:
- MHttpRequest m_nlhr;
static void SendThread(void* obj);
};
#endif
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp index e9f975190b..a19d6ebc06 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp @@ -15,8 +15,9 @@ */
#include "stdafx.h"
-CSendHost_UploadPie::CSendHost_UploadPie(HWND Owner, MCONTACT hContact, bool bAsync, int expire)
- : m_expire(expire), CSend(Owner, hContact, bAsync)
+CSendHost_UploadPie::CSendHost_UploadPie(HWND Owner, MCONTACT hContact, bool bAsync, int expire) :
+ CSend(Owner, hContact, bAsync),
+ m_expire(expire)
{
m_EnableItem = SS_DLG_DESCRIPTION | SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND;
m_pszSendTyp = LPGENW("Image upload");
@@ -46,7 +47,7 @@ int CSendHost_UploadPie::Send() { "expire", HTTPFORM_INT(m_expire) },
};
- int error = HTTPFormCreate(&m_nlhr, REQUEST_POST, kHostURL, frm, _countof(frm));
+ int error = HTTPFormCreate(&m_nlhr, kHostURL, frm, _countof(frm));
mir_free(tmp);
if (error)
return !m_bAsync;
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.h b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.h index 7a69e4733e..93f7f33b84 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.h +++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.h @@ -24,7 +24,6 @@ class CSendHost_UploadPie : public CSend { protected:
int m_expire;
- MHttpRequest m_nlhr;
static void SendThread(void* obj);
};
#endif
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 1aa2ac1fd4..0695876acc 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -44,8 +44,7 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwn int result = 0xBADBAD;
// initialize the netlib request
- MHttpRequest nlhr;
- nlhr.requestType = REQUEST_GET;
+ MHttpRequest nlhr(REQUEST_GET);
nlhr.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT | NLHRF_REDIRECT;
nlhr.m_szUrl = szUrl;
nlhr.nlc = hHttpDwnl;
|