diff options
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 22 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 24 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 3 |
4 files changed, 26 insertions, 25 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index dab99d6d36..9706ea2af1 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -368,7 +368,7 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t* *tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
// Load list of checked Plugins from database
- Netlib_LogfT(hNetlibUser, L"File %s found", FileInfo->tszOldName);
+ Netlib_LogfW(hNetlibUser, L"File %s found", FileInfo->tszOldName);
FileInfo->bEnabled = db_get_b(NULL, DB_MODULE_NEW_FILES, _T2A(FileInfo->tszOldName)) != 0;
return FileInfo;
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 9f4cb5cf32..3cc172fca8 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -641,7 +641,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t if (hFind == INVALID_HANDLE_VALUE)
return 0;
- Netlib_LogfT(hNetlibUser,L"Scanning folder %s", tszFolder);
+ Netlib_LogfW(hNetlibUser,L"Scanning folder %s", tszFolder);
int count = 0;
do {
@@ -656,7 +656,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t // calculate the current file's relative name and store it into tszNewName
wchar_t tszNewName[MAX_PATH];
if (CheckFileRename(ffd.cFileName, tszNewName)) {
- Netlib_LogfT(hNetlibUser, L"File %s will be renamed to %s.", ffd.cFileName, tszNewName);
+ Netlib_LogfW(hNetlibUser, L"File %s will be renamed to %s.", ffd.cFileName, tszNewName);
// Yes, we need the old file name, because this will be hashed later
mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
}
@@ -684,7 +684,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t if (item == NULL) {
wchar_t *p = wcsrchr(tszNewName, '.');
if (p[-1] != 'w' && p[-1] != 'W') {
- Netlib_LogfT(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
+ Netlib_LogfW(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
continue;
}
@@ -692,7 +692,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t int iPos = int(p - tszNewName) - 1;
strdelw(p - 1, 1);
if ((item = hashes.find((ServListEntry*)&pName)) == NULL) {
- Netlib_LogfT(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
+ Netlib_LogfW(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
continue;
}
@@ -708,11 +708,11 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t CalculateModuleHash(tszBuf, szMyHash);
// hashes are the same, skipping
if (strcmp(szMyHash, item->m_szHash) == 0) {
- Netlib_LogfT(hNetlibUser, L"File %s: Already up-to-date, skipping", ffd.cFileName);
+ Netlib_LogfW(hNetlibUser, L"File %s: Already up-to-date, skipping", ffd.cFileName);
continue;
}
else
- Netlib_LogfT(hNetlibUser, L"File %s: Update available", ffd.cFileName);
+ Netlib_LogfW(hNetlibUser, L"File %s: Update available", ffd.cFileName);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
@@ -720,7 +720,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t }
}
else
- Netlib_LogfT(hNetlibUser, L"File %s: Forcing redownload", ffd.cFileName);
+ Netlib_LogfW(hNetlibUser, L"File %s: Forcing redownload", ffd.cFileName);
#endif
ptszUrl = item->m_name;
@@ -728,7 +728,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t }
else {
// file was marked for deletion, add it to the list anyway
- Netlib_LogfT(hNetlibUser, L"File %s: Marked for deletion", ffd.cFileName);
+ Netlib_LogfW(hNetlibUser, L"File %s: Marked for deletion", ffd.cFileName);
ptszUrl = L"";
MyCRC = 0;
}
@@ -778,7 +778,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t // Thread checks for updates
static void CheckUpdates(void *)
{
- Netlib_LogfT(hNetlibUser, L"Checking for updates");
+ Netlib_LogfW(hNetlibUser, L"Checking for updates");
Thread_SetName("PluginUpdater: CheckUpdates");
wchar_t tszTempPath[MAX_PATH];
@@ -841,7 +841,7 @@ void UninitCheck() // menu item command
static INT_PTR MenuCommand(WPARAM, LPARAM)
{
- Netlib_LogfT(hNetlibUser, L"Update started manually!");
+ Netlib_LogfW(hNetlibUser, L"Update started manually!");
DoCheck(false);
return 0;
}
@@ -867,7 +867,7 @@ void CheckUpdateOnStartup() if ((now - was) < 86400)
return;
}
- Netlib_LogfT(hNetlibUser, L"Update on startup started!");
+ Netlib_LogfW(hNetlibUser, L"Update on startup started!");
DoCheck();
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 6513d66218..7e2555d86e 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -19,7 +19,8 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HANDLE hNetlibUser = NULL, hPipe = NULL;
+HNETLIBUSER hNetlibUser = NULL;
+HANDLE hPipe = NULL;
/////////////////////////////////////////////////////////////////////////////////////
void LoadOptions()
@@ -56,12 +57,11 @@ void InitIcoLib() void InitNetlib()
{
- NETLIBUSER nlu = {0};
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY;
nlu.ptszDescriptiveName = TranslateT("Plugin Updater HTTP connections");
nlu.szSettingsModule = MODNAME;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
}
void UnloadNetlib()
@@ -161,14 +161,14 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) Netlib_CloseHandle(nlc);
if (!ret) {
- Netlib_LogfT(hNetlibUser,L"Downloading list of available updates from %s failed",baseUrl);
+ Netlib_LogfW(hNetlibUser,L"Downloading list of available updates from %s failed",baseUrl);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
SkinPlaySound("updatefailed");
return false;
}
if(!unzip(pFileUrl.tszDiskPath, g_tszTempPath, NULL,true)) {
- Netlib_LogfT(hNetlibUser,L"Unzipping list of available updates from %s failed",baseUrl);
+ Netlib_LogfW(hNetlibUser,L"Unzipping list of available updates from %s failed",baseUrl);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
SkinPlaySound("updatefailed");
return false;
@@ -180,7 +180,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) mir_snwprintf(tszTmpIni, L"%s\\hashes.txt", g_tszTempPath);
FILE *fp = _wfopen(tszTmpIni, L"r");
if (!fp) {
- Netlib_LogfT(hNetlibUser,L"Opening %s failed", g_tszTempPath);
+ Netlib_LogfW(hNetlibUser,L"Opening %s failed", g_tszTempPath);
ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
return false;
}
@@ -258,7 +258,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) bool ret = false;
for (int i = 0; !ret && i < MAX_RETRIES; i++) {
- Netlib_LogfT(hNetlibUser,L"Downloading file %s to %s (attempt %d)",pFileURL->tszDownloadURL,pFileURL->tszDiskPath, i+1);
+ Netlib_LogfW(hNetlibUser,L"Downloading file %s to %s (attempt %d)",pFileURL->tszDownloadURL,pFileURL->tszDiskPath, i+1);
NETLIBHTTPREQUEST *pReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr);
if (pReply) {
nlc = pReply->nlc;
@@ -269,7 +269,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) int crc = Get_CRC((unsigned char*)pReply->pData, pReply->dataLength);
if (crc != pFileURL->CRCsum) {
// crc check failed, try again
- Netlib_LogfT(hNetlibUser,L"crc check failed for file %s",pFileURL->tszDiskPath);
+ Netlib_LogfW(hNetlibUser,L"crc check failed for file %s",pFileURL->tszDiskPath);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply);
continue;
}
@@ -297,16 +297,16 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) ret = true;
}
else
- Netlib_LogfT(hNetlibUser,L"Downloading file %s failed with error %d",pFileURL->tszDownloadURL,pReply->resultCode);
+ Netlib_LogfW(hNetlibUser,L"Downloading file %s failed with error %d",pFileURL->tszDownloadURL,pReply->resultCode);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply);
}
else {
- Netlib_LogfT(hNetlibUser,L"Downloading file %s failed, host is propably temporary down.",pFileURL->tszDownloadURL);
+ Netlib_LogfW(hNetlibUser,L"Downloading file %s failed, host is propably temporary down.",pFileURL->tszDownloadURL);
nlc = NULL;
}
}
if(!ret)
- Netlib_LogfT(hNetlibUser,L"Downloading file %s failed, giving up",pFileURL->tszDownloadURL);
+ Netlib_LogfW(hNetlibUser,L"Downloading file %s failed, giving up",pFileURL->tszDownloadURL);
mir_free(szUrl);
mir_free(nlhr.headers);
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 096ef9e247..182ba3d22f 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -160,7 +160,8 @@ extern HINSTANCE hInst; extern DWORD g_mirandaVersion;
extern wchar_t g_tszRoot[MAX_PATH], g_tszTempPath[MAX_PATH];
extern aPopups PopupsList[POPUPS];
-extern HANDLE hPipe, hNetlibUser;
+extern HANDLE hPipe;
+extern HNETLIBUSER hNetlibUser;
#if MIRANDA_VER >= 0x0A00
extern IconItemT iconList[];
#endif
|