summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-01-12 20:01:11 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-01-12 20:01:11 +0300
commit5f5eb8eff1b7f7eb7bf21ed25cf14db6e33f2e52 (patch)
treeb4bf6702e4fcd0fa16369bac898682558502eca5 /plugins/CrashDumper
parentf8cfe24d1b96765f628e086da2023755b2577675 (diff)
fixes #2993 (CrashDumper: drop vi.miranda-ng.org support)
Diffstat (limited to 'plugins/CrashDumper')
-rw-r--r--plugins/CrashDumper/crshdmp.vcxproj1
-rw-r--r--plugins/CrashDumper/crshdmp.vcxproj.filters3
-rw-r--r--plugins/CrashDumper/res/crshdmp.rc25
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp60
-rw-r--r--plugins/CrashDumper/src/resource.h5
-rw-r--r--plugins/CrashDumper/src/stdafx.h7
-rw-r--r--plugins/CrashDumper/src/ui.cpp47
-rw-r--r--plugins/CrashDumper/src/upload.cpp247
-rw-r--r--plugins/CrashDumper/src/version.h4
9 files changed, 20 insertions, 379 deletions
diff --git a/plugins/CrashDumper/crshdmp.vcxproj b/plugins/CrashDumper/crshdmp.vcxproj
index 2f7db9e176..f28c05ab97 100644
--- a/plugins/CrashDumper/crshdmp.vcxproj
+++ b/plugins/CrashDumper/crshdmp.vcxproj
@@ -34,7 +34,6 @@
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\ui.cpp" />
- <ClCompile Include="src\upload.cpp" />
<ClCompile Include="src\utils.cpp" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\sdkstuff.h" />
diff --git a/plugins/CrashDumper/crshdmp.vcxproj.filters b/plugins/CrashDumper/crshdmp.vcxproj.filters
index 1a9719db77..e1c9818b1f 100644
--- a/plugins/CrashDumper/crshdmp.vcxproj.filters
+++ b/plugins/CrashDumper/crshdmp.vcxproj.filters
@@ -20,9 +20,6 @@
<ClCompile Include="src\ui.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\upload.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/CrashDumper/res/crshdmp.rc b/plugins/CrashDumper/res/crshdmp.rc
index d38fcc97cd..aaa1f42f4a 100644
--- a/plugins/CrashDumper/res/crshdmp.rc
+++ b/plugins/CrashDumper/res/crshdmp.rc
@@ -7,8 +7,8 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
-#include "richedit.h"
+#include "winres.h"
+
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -32,8 +32,7 @@ END
2 TEXTINCLUDE
BEGIN
- "#include ""afxres.h""\r\n"
- "#include ""richedit.h""\r\0"
+ "#include ""winres.h""\r\0"
END
3 TEXTINCLUDE
@@ -65,20 +64,14 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Support for vi.miranda-ng.org",IDC_STATIC,7,7,253,62
- LTEXT "Username",IDC_STATIC,14,20,107,8
- EDITTEXT IDC_USERNAME,152,18,108,14,ES_AUTOHSCROLL
- LTEXT "Password",IDC_STATIC,14,39,107,8
- EDITTEXT IDC_PASSWORD,153,35,107,14,ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Upload automatically when changed",IDC_UPLOADCHN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,54,245,10
- GROUPBOX "Crash reports",IDC_STATIC,7,70,253,52
- CONTROL "Generate crash reports",IDC_CATCHCRASHES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,83,237,10
+ GROUPBOX "Crash reports",-1,7,3,253,52
+ CONTROL "Generate crash reports",IDC_CATCHCRASHES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,16,237,10
CONTROL "Create reports in subfolders naming as current date",IDC_DATESUBFOLDER,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,95,237,10
- CONTROL "Use classic dates",IDC_CLASSICDATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,107,237,10
- LTEXT "* You need to restart Miranda NG to apply changes",IDC_RESTARTNOTE,7,145,251,22,NOT WS_VISIBLE
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,28,237,10
+ CONTROL "Use classic dates",IDC_CLASSICDATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,40,237,10
+ LTEXT "* You need to restart Miranda NG to apply changes",IDC_RESTARTNOTE,7,78,251,22,NOT WS_VISIBLE
CONTROL "Display popups about successful actions",IDC_SUCCESSPOPUPS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,129,253,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,62,253,10
END
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index e5372288a5..d1cfab0dbc 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -52,8 +52,7 @@ CMPlugin::CMPlugin() :
bCatchCrashes(MODULENAME, "CatchCrashes", 1),
bClassicDates(MODULENAME, "ClassicDates", 1),
bUseSubFolder(MODULENAME, "SubFolders", 1),
- bSuccessPopups(MODULENAME, "SuccessPopups", 1),
- bUploadChanged(MODULENAME, "UploadChanged", 0)
+ bSuccessPopups(MODULENAME, "SuccessPopups", 1)
{
}
@@ -98,20 +97,6 @@ INT_PTR StoreVersionInfoToClipboard(WPARAM, LPARAM lParam)
return 0;
}
-INT_PTR UploadVersionInfo(WPARAM, LPARAM lParam)
-{
- CMStringW buffer;
- PrintVersionInfo(buffer);
-
- VerTrnsfr *trn = (VerTrnsfr*)mir_alloc(sizeof(VerTrnsfr));
- trn->buf = mir_utf8encodeW(buffer.c_str());
- trn->autot = lParam == 0xa1;
-
- mir_forkthread(VersionInfoUploadThread, trn);
-
- return 0;
-}
-
INT_PTR GetVersionInfo(WPARAM wParam, LPARAM lParam)
{
int result = 1; //failure
@@ -128,15 +113,7 @@ INT_PTR GetVersionInfo(WPARAM wParam, LPARAM lParam)
INT_PTR OpenUrl(WPARAM wParam, LPARAM)
{
- switch (wParam) {
- case 0:
- ShellExecute(nullptr, L"explore", CrashLogFolder, nullptr, nullptr, SW_SHOW);
- break;
-
- case 1:
- OpenAuthUrl("https://vi.miranda-ng.org/detail/%s");
- break;
- }
+ ShellExecute(nullptr, L"explore", CrashLogFolder, nullptr, nullptr, SW_SHOW);
return 0;
}
@@ -194,11 +171,6 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM)
ttb.name = ttb.pszTooltipUp = LPGEN("Show Version Information");
ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_VISHOW);
g_plugin.addTTB(&ttb);
-
- ttb.pszService = MS_CRASHDUMPER_UPLOAD;
- ttb.name = ttb.pszTooltipUp = LPGEN("Upload Version Information");
- ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_VIUPLOAD);
- g_plugin.addTTB(&ttb);
return 0;
}
@@ -251,13 +223,6 @@ static int ModulesLoaded(WPARAM, LPARAM)
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1);
- SET_UID(mi, 0xc6e3b558, 0xe1e8, 0x4cce, 0x96, 0x8, 0xc6, 0x89, 0x1b, 0x79, 0xf3, 0x7e);
- mi.position = 2000089999;
- mi.name.a = LPGEN("Upload");
- mi.hIcolibItem = g_plugin.getIconHandle(IDI_VIUPLOAD);
- mi.pszService = MS_CRASHDUMPER_UPLOAD;
- Menu_AddMainMenuItem(&mi);
-
SET_UID(mi, 0xa23da95a, 0x7624, 0x4343, 0x8c, 0xc0, 0xa6, 0x16, 0xbc, 0x30, 0x13, 0x8c);
mi.position = 2000089999;
mi.name.a = LPGEN("Copy link to clipboard");
@@ -274,13 +239,6 @@ static int ModulesLoaded(WPARAM, LPARAM)
Menu_AddMainMenuItem(&mi);
}
- SET_UID(mi, 0x6b19be3, 0xfb7d, 0x457d, 0x85, 0xde, 0xe0, 0x26, 0x4c, 0x87, 0x35, 0xf4);
- mi.position = 2000099991;
- mi.name.a = LPGEN("Open online Version Info");
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL);
- mi.pszService = MS_CRASHDUMPER_URL;
- Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1);
-
HOTKEYDESC hk = {};
hk.szSection.a = MODULENAME;
@@ -294,8 +252,6 @@ static int ModulesLoaded(WPARAM, LPARAM)
hk.pszService = MS_CRASHDUMPER_VIEWINFO;
g_plugin.addHotkey(&hk);
- UploadInit();
-
if (g_plugin.bCatchCrashes && !g_plugin.bNeedRestart)
SetExceptionHandler();
@@ -303,18 +259,10 @@ static int ModulesLoaded(WPARAM, LPARAM)
if (g_plugin.bServiceMode)
ViewVersionInfo(0, 0);
- else if (g_plugin.bUploadChanged && !ProcessVIHash(false))
- UploadVersionInfo(0, 0xa1);
return 0;
}
-static int PreShutdown(WPARAM, LPARAM)
-{
- UploadClose();
- return 0;
-}
-
int CMPlugin::Load()
{
hMsftedit = LoadLibrary(L"Msftedit.dll");
@@ -329,8 +277,7 @@ int CMPlugin::Load()
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_OPT_INITIALISE, OptionsInit);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
-
+
packlcid = (LCID)Langpack_GetDefaultLocale();
InitIcons();
@@ -342,7 +289,6 @@ int CMPlugin::Load()
CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard);
CreateServiceFunction(MS_CRASHDUMPER_VIEWINFO, ViewVersionInfo);
CreateServiceFunction(MS_CRASHDUMPER_GETINFO, GetVersionInfo);
- CreateServiceFunction(MS_CRASHDUMPER_UPLOAD, UploadVersionInfo);
CreateServiceFunction(MS_CRASHDUMPER_URL, OpenUrl);
CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeLaunch);
CreateServiceFunction(MS_CRASHDUMPER_URLTOCLIP, CopyLinkToClipboard);
diff --git a/plugins/CrashDumper/src/resource.h b/plugins/CrashDumper/src/resource.h
index 8a09ec32d6..234d7eca7f 100644
--- a/plugins/CrashDumper/src/resource.h
+++ b/plugins/CrashDumper/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by crshdmp.rc
+// Used by W:\miranda-ng\plugins\CrashDumper\res\crshdmp.rc
//
#define IDD_VIEWVERSION 101
#define IDR_CONTEXT 102
@@ -14,9 +14,6 @@
#define IDC_VIEWVERSIONINFO 1001
#define IDC_FILEVER 1003
#define IDC_CLIPVER 1004
-#define IDC_USERNAME 1006
-#define IDC_PASSWORD 1007
-#define IDC_UPLOADCHN 1008
#define IDC_CLASSICDATES 1009
#define IDC_DATESUBFOLDER 1010
#define IDC_CATCHCRASHES 1011
diff --git a/plugins/CrashDumper/src/stdafx.h b/plugins/CrashDumper/src/stdafx.h
index 06a23e75d3..78db36af2a 100644
--- a/plugins/CrashDumper/src/stdafx.h
+++ b/plugins/CrashDumper/src/stdafx.h
@@ -72,7 +72,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MS_CRASHDUMPER_STORETOCLIP "CrashDmp/StoreVerInfoToClip"
#define MS_CRASHDUMPER_GETINFO "CrashDmp/GetInfo"
#define MS_CRASHDUMPER_VIEWINFO "CrashDmp/ViewInfo"
-#define MS_CRASHDUMPER_UPLOAD "CrashDmp/UploadInfo"
#define MS_CRASHDUMPER_URL "CrashDmp/StartUrl"
#define MS_CRASHDUMPER_URLTOCLIP "CrashDmp/CopyToClip"
@@ -80,7 +79,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMOption<uint8_t> bCatchCrashes, bClassicDates, bUploadChanged, bUseSubFolder, bSuccessPopups;
+ CMOption<uint8_t> bCatchCrashes, bClassicDates, bUseSubFolder, bSuccessPopups;
bool bNeedRestart = false, bServiceMode = false;
@@ -137,7 +136,6 @@ const PLUGININFOEX* GetMirInfo(HMODULE hModule);
void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr);
void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wchar_t* msg);
void PrintVersionInfo(CMStringW& buffer, unsigned flags = VI_FLAG_PRNVAR);
-bool ProcessVIHash(bool store);
void InitExceptionHandler(void);
void DestroyExceptionHandler(void);
@@ -146,10 +144,7 @@ void RemoveExceptionHandler(void);
extern CDlgBase *pViewDialog;
-void UploadInit(void);
-void UploadClose(void);
void OpenAuthUrl(const char* url);
-void __cdecl VersionInfoUploadThread(void* arg);
void InitIcons(void);
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp
index 3fa9ce6046..0959d9d8d6 100644
--- a/plugins/CrashDumper/src/ui.cpp
+++ b/plugins/CrashDumper/src/ui.cpp
@@ -162,8 +162,7 @@ INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM)
class COptDialog : public CDlgBase
{
- CCtrlEdit m_edtUserName, m_edtPass;
- CCtrlCheck m_chkAutoUpload, m_chkClassicDates, m_chkRepSubfolder, m_chkCatchCrashes, m_chkSuccessPopups;
+ CCtrlCheck m_chkClassicDates, m_chkRepSubfolder, m_chkCatchCrashes, m_chkSuccessPopups;
CCtrlLabel m_lblRestart;
void COptDialog::OnCatchCrashesChange(CCtrlCheck*)
@@ -179,16 +178,12 @@ class COptDialog : public CDlgBase
public:
COptDialog() :
CDlgBase(g_plugin, IDD_OPTIONS),
- m_edtUserName(this, IDC_USERNAME),
- m_edtPass(this, IDC_PASSWORD),
- m_chkAutoUpload(this, IDC_UPLOADCHN),
m_chkCatchCrashes(this, IDC_CATCHCRASHES),
m_chkClassicDates(this, IDC_CLASSICDATES),
m_chkRepSubfolder(this, IDC_DATESUBFOLDER),
m_chkSuccessPopups(this, IDC_SUCCESSPOPUPS),
m_lblRestart(this, IDC_RESTARTNOTE)
{
- CreateLink(m_chkAutoUpload, g_plugin.bUploadChanged);
CreateLink(m_chkCatchCrashes, g_plugin.bCatchCrashes);
CreateLink(m_chkClassicDates, g_plugin.bClassicDates);
CreateLink(m_chkRepSubfolder, g_plugin.bUseSubFolder);
@@ -201,33 +196,12 @@ public:
{
CDlgBase::OnInitDialog();
- DBVARIANT dbv;
- if (g_plugin.getString("Username", &dbv) == 0) {
- m_edtUserName.SetTextA(dbv.pszVal);
- db_free(&dbv);
- }
- if (g_plugin.getString("Password", &dbv) == 0) {
- m_edtPass.SetTextA(dbv.pszVal);
- db_free(&dbv);
- }
-
if (!g_plugin.bCatchCrashes)
m_chkRepSubfolder.Disable();
if (g_plugin.bNeedRestart)
m_lblRestart.Show();
return true;
}
-
- bool COptDialog::OnApply()
- {
- char szSetting[100];
- m_edtUserName.GetTextA(szSetting, _countof(szSetting));
- g_plugin.setString("Username", szSetting);
-
- m_edtPass.GetTextA(szSetting, _countof(szSetting));
- g_plugin.setString("Password", szSetting);
- return true;
- }
};
int OptionsInit(WPARAM wParam, LPARAM)
@@ -252,22 +226,9 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_COMMAND:
- switch ((INT_PTR)PUGetPluginData(hWnd)) {
- case 0:
- OpenAuthUrl("https://vi.miranda-ng.org/detail/%s");
- break;
-
- case 1:
- OpenAuthUrl("https://vi.miranda-ng.org/global/%s");
- break;
-
- case 3:
- wchar_t path[MAX_PATH];
- mir_snwprintf(path, L"%s\\VersionInfo.txt", VersionInfoFolder);
- ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);
- break;
-
- }
+ wchar_t path[MAX_PATH];
+ mir_snwprintf(path, L"%s\\VersionInfo.txt", VersionInfoFolder);
+ ShellExecute(nullptr, L"open", path, nullptr, nullptr, SW_SHOW);
PUDeletePopup(hWnd);
break;
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp
deleted file mode 100644
index 075c448336..0000000000
--- a/plugins/CrashDumper/src/upload.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
-Miranda Crash Dumper Plugin
-Copyright (C) 2008 - 2012 Boris Krasnovskiy All Rights Reserved
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-HNETLIBUSER hNetlibUser;
-
-static void arrayToHex(uint8_t* data, size_t datasz, char* res)
-{
- char* resptr = res;
- for (unsigned i = 0; i < datasz; i++) {
- const uint8_t ch = data[i];
-
- const char ch0 = (char)(ch >> 4);
- *resptr++ = (char)((ch0 <= 9) ? ('0' + ch0) : (('a' - 10) + ch0));
-
- const char ch1 = (char)(ch & 0xF);
- *resptr++ = (char)((ch1 <= 9) ? ('0' + ch1) : (('a' - 10) + ch1));
- }
- *resptr = '\0';
-}
-
-void GetLoginStr(char* user, size_t szuser, char* pass)
-{
- DBVARIANT dbv;
-
- if (g_plugin.getString("Username", &dbv) == 0) {
- strncpy_s(user, szuser, dbv.pszVal, _TRUNCATE);
- db_free(&dbv);
- }
- else
- user[0] = 0;
-
- if (g_plugin.getString("Password", &dbv) == 0) {
- uint8_t hash[16];
- mir_md5_state_t context;
-
- mir_md5_init(&context);
- mir_md5_append(&context, (uint8_t*)dbv.pszVal, (int)mir_strlen(dbv.pszVal));
- mir_md5_finish(&context, hash);
-
- arrayToHex(hash, sizeof(hash), pass);
-
- db_free(&dbv);
- }
- else
- pass[0] = 0;
-}
-
-void OpenAuthUrl(const char* url)
-{
- char user[64], pass[40];
- GetLoginStr(user, sizeof(user), pass);
-
- if (user[0] && pass[0]) {
- char str[256];
- mir_snprintf(str, url, user); // XXX: fix me
- mir_snprintf(str, "https://vi.miranda-ng.org/detail/%s", user);
- Utils_OpenUrl(str);
- }
- else Utils_OpenUrl("https://vi.miranda-ng.org/");
-}
-
-void CreateAuthString(char* auth)
-{
- char user[64], pass[40];
- GetLoginStr(user, sizeof(user), pass);
-
- char str[110];
- int len = mir_snprintf(str, "%s:%s", user, pass);
- mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode(str, len)));
-}
-
-
-bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq)
-{
- int result = 0xBADBAD;
- char* szRedirUrl = nullptr;
- NETLIBHTTPREQUEST nlhr = {};
-
- // initialize the netlib request
- nlhr.cbSize = sizeof(nlhr);
- nlhr.requestType = REQUEST_POST;
- nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMP;
- nlhr.szUrl = (char*)szUrl;
-
- nlhr.headersCount = 6;
- nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
- nlhr.headers[0].szName = "Connection";
- nlhr.headers[0].szValue = "close";
- nlhr.headers[1].szName = "Cache-Control";
- nlhr.headers[1].szValue = "no-cache";
- nlhr.headers[2].szName = "Pragma";
- nlhr.headers[2].szValue = "no-cache";
- nlhr.headers[3].szName = "Content-Type";
- nlhr.headers[3].szValue = "text/plain; charset=utf-8";
- nlhr.headers[4].szName = "AutoUpload";
- nlhr.headers[4].szValue = (char*)(szReq->autot ? "1" : "0");
- nlhr.headers[5].szName = "Authorization";
-
- char auth[256];
- CreateAuthString(auth);
- nlhr.headers[5].szValue = auth;
-
- nlhr.pData = szReq->buf;
- nlhr.dataLength = (int)mir_strlen(szReq->buf);
-
- while (result == 0xBADBAD) {
- // download the page
- NLHR_PTR nlhrReply(Netlib_HttpTransaction(hNetlibUser, &nlhr));
- if (nlhrReply) {
- // if the recieved code is 200 OK
- switch (nlhrReply->resultCode) {
- case 200:
- if (g_plugin.bUploadChanged)
- ProcessVIHash(true);
-
- ShowMessage(1, TranslateT("Version Info upload successful."));
- result = 0;
- break;
-
- case 401:
- ShowMessage(0, TranslateT("Cannot upload Version Info. Incorrect username or password"));
- result = 1;
- break;
-
- case 510:
- ShowMessage(0, TranslateT("Cannot upload Version Info. User is banned"));
- result = 1;
- break;
-
- case 511:
- ShowMessage(0, TranslateT("Cannot upload Version Info. Daily upload limit exceeded"));
- result = 1;
- break;
-
- case 301:
- case 302:
- case 307:
- // get the url for the new location and save it to szInfo
- // look for the reply header "Location"
- if (auto *pszUrl = Netlib_GetHeader(nlhrReply, "Location")) {
- size_t rlen = 0;
- if (pszUrl[0] == '/') {
- const char* szPath;
- const char* szPref = strstr(szUrl, "://");
- szPref = szPref ? szPref + 3 : szUrl;
- szPath = strchr(szPref, '/');
- rlen = szPath != nullptr ? szPath - szUrl : mir_strlen(szUrl);
- }
-
- szRedirUrl = (char*)mir_realloc(szRedirUrl,
- rlen + mir_strlen(pszUrl) * 3 + 1);
-
- strncpy(szRedirUrl, szUrl, rlen);
- mir_strcpy(szRedirUrl + rlen, pszUrl);
-
- nlhr.szUrl = szRedirUrl;
- }
- break;
-
- default:
- result = 1;
- ShowMessage(0, TranslateT("Cannot upload Version Info. Unknown error"));
- }
- }
- else {
- result = 1;
- ShowMessage(0, TranslateT("Cannot upload Version Info. Host unreachable."));
- }
- }
-
- mir_free(szRedirUrl);
- mir_free(nlhr.headers);
-
- return result == 0;
-}
-
-void __cdecl VersionInfoUploadThread(void* arg)
-{
- VerTrnsfr* trn = (VerTrnsfr*)arg;
-
- char user[64], pass[40];
- GetLoginStr(user, sizeof(user), pass);
- char str[256];
- mir_snprintf(str, "https://vi.miranda-ng.org/en/upload?login=%s&pass=%s", user, pass);
-
- InternetDownloadFile(str, trn);
- mir_free(trn->buf);
- mir_free(trn);
-}
-
-void UploadInit(void)
-{
- NETLIBUSER nlu = {};
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
- nlu.szSettingsModule = (char*)MODULENAME;
- nlu.szDescriptiveName.w = TranslateT("Crash Dumper HTTP connections");
- hNetlibUser = Netlib_RegisterUser(&nlu);
-}
-
-void UploadClose(void)
-{
- Netlib_CloseHandle(hNetlibUser);
-}
-
-bool ProcessVIHash(bool store)
-{
- CMStringW buffer;
- PrintVersionInfo(buffer, 0);
-
- uint8_t hash[16];
- mir_md5_state_t context;
-
- mir_md5_init(&context);
- mir_md5_append(&context, (uint8_t*)buffer.c_str(), buffer.GetLength()*sizeof(wchar_t));
- mir_md5_finish(&context, hash);
-
- char hashstr[40];
- arrayToHex(hash, sizeof(hash), hashstr);
-
- if (store) {
- g_plugin.setString("VIHash", hashstr);
- return true;
- }
-
- ptrA VIHash(g_plugin.getStringA("VIHash"));
- if (VIHash == NULL)
- return false;
-
- return mir_strcmp(hashstr, VIHash) == 0;
-}
diff --git a/plugins/CrashDumper/src/version.h b/plugins/CrashDumper/src/version.h
index 46429497dc..3a9c750dfc 100644
--- a/plugins/CrashDumper/src/version.h
+++ b/plugins/CrashDumper/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 1
+#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __BUILD_NUM 1
#include <stdver.h>