diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-11 22:23:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-11 22:24:06 +0300 |
commit | d958e3fb847813075cc059bd5a7aa28252982268 (patch) | |
tree | d9c02a7ddee830628248219e9c83c7de3c335140 /plugins | |
parent | c8e1c429321ed8aa2efce0fc00b6dfd08f1b2735 (diff) |
strong typization - better typization
Diffstat (limited to 'plugins')
50 files changed, 154 insertions, 179 deletions
diff --git a/plugins/ClientChangeNotify/src/stdafx.h b/plugins/ClientChangeNotify/src/stdafx.h index 1b8d6404f6..3fae08172e 100644 --- a/plugins/ClientChangeNotify/src/stdafx.h +++ b/plugins/ClientChangeNotify/src/stdafx.h @@ -28,6 +28,7 @@ #include <stdlib.h>
#include <crtdbg.h>
#include <shellapi.h>
+#include <WinSock.h>
#include <commdlg.h>
#include "newpluginapi.h"
@@ -47,6 +48,7 @@ #include "m_genmenu.h"
#include "win2k.h"
#include "m_metacontacts.h"
+#include "m_netlib.h"
#include "m_fingerprint.h"
@@ -118,7 +120,7 @@ static __inline CString LogMessage(const char *Format, ...) va_start(va, Format);
mir_vsnprintf(szText + _countof(LOG_PREFIX)-1, _countof(szText) - (_countof(LOG_PREFIX)-1), Format, va);
va_end(va);
- CallService(MS_NETLIB_LOG, NULL, (LPARAM)szText);
+ Netlib_Log(NULL, szText);
return CString(szText);
}
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index dd7583cf79..dc95363449 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -214,11 +214,11 @@ void __cdecl VersionInfoUploadThread(void* arg) void UploadInit(void)
{
- NETLIBUSER nlu = { sizeof(nlu) };
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = (char*)PluginName;
nlu.ptszDescriptiveName = TranslateT("Crash Dumper HTTP connections");
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
}
void UploadClose(void)
diff --git a/plugins/CryptoPP/src/commonheaders.h b/plugins/CryptoPP/src/commonheaders.h index 3da70a4494..ff27ce934c 100644 --- a/plugins/CryptoPP/src/commonheaders.h +++ b/plugins/CryptoPP/src/commonheaders.h @@ -74,7 +74,7 @@ std::string base64decode(const std::string&); std::string base64decode(const char *);
#if defined(_DEBUG) || defined(NETLIB_LOG)
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
void InitNetlib();
void DeinitNetlib();
int Sent_NetLog(const char *,...);
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index 62a75b02b3..3b2c814f29 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -115,17 +115,15 @@ size_t rtrim(LPCSTR str) #if defined(_DEBUG) || defined(NETLIB_LOG)
-HANDLE hNetlibUser;
+HNETLIBUSER hNetlibUser;
void InitNetlib()
{
- NETLIBUSER nl_user;
- memset(&nl_user, 0, sizeof(nl_user));
- nl_user.cbSize = sizeof(nl_user);
+ NETLIBUSER nl_user = {};
nl_user.szSettingsModule = (LPSTR)szModuleName;
nl_user.szDescriptiveName = (LPSTR)szModuleName;
nl_user.flags = NUF_NOOPTIONS;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+ hNetlibUser = Netlib_RegisterUser(&nl_user);
}
void DeinitNetlib()
@@ -142,7 +140,7 @@ int Sent_NetLog(const char *fmt, ...) mir_vsnprintf(szText, sizeof(szText), fmt, va);
va_end(va);
if (hNetlibUser)
- return CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)szText);
+ return Netlib_Log(hNetlibUser, szText);
return 0;
}
#endif
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index 36a91d650e..1d82a7fe58 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -242,7 +242,7 @@ EXTERN_C void LMDB_Log(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
- CallService(MS_NETLIB_LOG, 0, (LPARAM)(CMStringA().FormatV(fmt, args)));
+ Netlib_Log(0, CMStringA().FormatV(fmt, args));
va_end(args);
}
diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h index b6dcb340e6..32a58691ec 100644 --- a/plugins/Dropbox/src/dropbox.h +++ b/plugins/Dropbox/src/dropbox.h @@ -26,7 +26,7 @@ public: virtual ~CDropbox();
private:
- HANDLE hNetlibConnection;
+ HNETLIBUSER hNetlibConnection;
ULONG hMessageProcess;
HANDLE hUploadedEventHook;
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index 0d5c915006..0384bb127c 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -23,11 +23,11 @@ int CDropbox::OnModulesLoaded(WPARAM, LPARAM) HookEventObj(ME_MSG_WINDOWEVENT, GlobalEvent<&CDropbox::OnSrmmWindowOpened>, this);
HookEventObj(ME_FILEDLG_CANCELED, GlobalEvent<&CDropbox::OnFileDialogCancelled>, this);
- NETLIBUSER nlu = { sizeof(nlu) };
+ NETLIBUSER nlu = {};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szSettingsModule = MODULE;
nlu.ptszDescriptiveName = L"Dropbox";
- hNetlibConnection = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibConnection = Netlib_RegisterUser(&nlu);
GetDefaultContact();
diff --git a/plugins/HTTPServer/src/Glob.h b/plugins/HTTPServer/src/Glob.h index c556f73786..7d21925204 100644 --- a/plugins/HTTPServer/src/Glob.h +++ b/plugins/HTTPServer/src/Glob.h @@ -60,7 +60,7 @@ using namespace std; extern HINSTANCE hInstance;
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
extern bool bShutdownInProgress;
bool bWriteConfigurationFile();
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 3f52469e90..1f9c89dc22 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -45,7 +45,7 @@ const char* pszDefaultShares[] = { void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP);
int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/);
-HANDLE hNetlibUser;
+HNETLIBUSER hNetlibUser;
HANDLE hDirectBoundPort;
HINSTANCE hInstance = NULL;
@@ -740,12 +740,11 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) bWriteConfigurationFile();
}
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_INCOMING;
nlu.szSettingsModule = MODULE;
nlu.szDescriptiveName = Translate("HTTP Server");
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)& nlu);
+ hNetlibUser = Netlib_RegisterUser(& nlu);
if (!hNetlibUser) {
MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
return 0;
diff --git a/plugins/LotusNotify/src/debug.cpp b/plugins/LotusNotify/src/debug.cpp index 8acf5c0a63..e814d6f508 100644 --- a/plugins/LotusNotify/src/debug.cpp +++ b/plugins/LotusNotify/src/debug.cpp @@ -1,16 +1,15 @@ #include "stdafx.h"
#include "debug.h"
-HANDLE netlibHandle;
+HNETLIBUSER netlibHandle;
void logRegister(){
// Register netlib user for logging function
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_UNICODE | NUF_NOOPTIONS;
nlu.szSettingsModule = PLUGINNAME;
nlu.ptszDescriptiveName = mir_a2u(PLUGINNAME);
- netlibHandle = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ netlibHandle = Netlib_RegisterUser(&nlu);
}
void logUnregister(){
@@ -21,7 +20,7 @@ void logUnregister(){ void log(const wchar_t* szText){
if (netlibHandle) {
- CallService(MS_NETLIB_LOGW, (WPARAM)netlibHandle, (LPARAM)szText);
+ Netlib_LogW(netlibHandle, szText);
}
#ifdef _DEBUG
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index dfaf7d73f0..4ce2bf8165 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -20,7 +20,7 @@ void MirandaUtils::netlibLog(const wchar_t* szText){ void MirandaUtils::netlibLog_int(const wchar_t* szText){
if (netlibHandle) {
- CallService(MS_NETLIB_LOGW, (WPARAM)netlibHandle, (LPARAM)szText);
+ Netlib_LogfW(netlibHandle, szText);
}
#ifdef _DEBUG
OutputDebugString(szText);
@@ -29,13 +29,12 @@ void MirandaUtils::netlibLog_int(const wchar_t* szText){ void MirandaUtils::netlibRegister(){
// Register netlib user for logging function
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_UNICODE | NUF_NOOPTIONS;
nlu.szSettingsModule = PLUGIN_DB_ID;
nlu.ptszDescriptiveName = TranslateT("MirFox log");
- netlibHandle = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ netlibHandle = Netlib_RegisterUser(&nlu);
}
void MirandaUtils::netlibUnregister(){
diff --git a/plugins/MirFox/src/MirandaUtils.h b/plugins/MirFox/src/MirandaUtils.h index f08b90da5f..47ee0ed1db 100644 --- a/plugins/MirFox/src/MirandaUtils.h +++ b/plugins/MirFox/src/MirandaUtils.h @@ -91,7 +91,7 @@ private: static void ForceForegroundWindow(HWND hWnd);
- HANDLE netlibHandle;
+ HNETLIBUSER netlibHandle;
std::wstring profileName;
std::wstring displayName;
diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp index ce2d3aa589..0539404a7d 100644 --- a/plugins/MirLua/src/main.cpp +++ b/plugins/MirLua/src/main.cpp @@ -9,7 +9,7 @@ CMLua *g_mLua; HANDLE g_hCLibsFolder;
HANDLE g_hScriptsFolder;
-HANDLE hNetlib = NULL;
+HNETLIBUSER hNetlib = NULL;
PLUGININFOEX pluginInfo =
{
@@ -60,12 +60,11 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_NOOPTIONS;
nlu.szDescriptiveName = MODULE;
nlu.szSettingsModule = MODULE;
- hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlib = Netlib_RegisterUser(&nlu);
PROTOCOLDESCRIPTOR pd = { 0 };
pd.cbSize = sizeof(pd);
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index 7323755ea5..5c84fb5c74 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -4,7 +4,7 @@ void Log(const char *format, ...) {
va_list args;
va_start(args, format);
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)(CMStringA().FormatV(format, args)));
+ Netlib_Log(hNetlib, CMStringA().FormatV(format, args));
va_end(args);
}
@@ -12,7 +12,7 @@ void Log(const wchar_t *format, ...) {
va_list args;
va_start(args, format);
- CallService(MS_NETLIB_LOGW, (WPARAM)hNetlib, (LPARAM)(CMStringW().FormatV(format, args)));
+ Netlib_LogW(hNetlib, CMStringW().FormatV(format, args));
va_end(args);
}
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index 645e30c906..dda365dd82 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -98,7 +98,7 @@ LUAMOD_API int (luaopen_m_sounds)(lua_State *L); /* utils */
-extern HANDLE hNetlib;
+extern HNETLIBUSER hNetlib;
void Log(const char *format, ...);
void Log(const wchar_t *format, ...);
diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index 1c2966b9be..466f31ffd9 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -321,7 +321,7 @@ static __inline int LogMessage(const char *Format, ...) va_start(va, Format);
mir_vsnprintf(szText + (_countof(LOG_PREFIX) - 1), sizeof(szText) - (_countof(LOG_PREFIX) - 1), Format, va);
va_end(va);
- return CallService(MS_NETLIB_LOG, NULL, (LPARAM)szText);
+ return Netlib_Log(NULL, szText);
}
__inline int CallAllowedPS_SETAWAYMSG(const char *szProto, int iMode, const wchar_t *szMsg)
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 96d80c6298..7435337b2d 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg)
{
- Netlib_LogfT(hNetlibUser, L"Started validating feed %s.", tszURL);
+ Netlib_LogfW(hNetlibUser, L"Started validating feed %s.", tszURL);
char *szData = NULL;
GetNewsData(tszURL, &szData, NULL, hwndDlg);
if (szData) {
@@ -91,7 +91,7 @@ LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) }
xmlDestroyNode(hXml);
}
- Netlib_LogfT(hNetlibUser, L"%s is not a valid feed's address.", tszURL);
+ Netlib_LogfW(hNetlibUser, L"%s is not a valid feed's address.", tszURL);
wchar_t mes[MAX_PATH];
mir_snwprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL);
MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR);
@@ -187,7 +187,7 @@ void CheckCurrentFeed(MCONTACT hContact) if (szURL == NULL)
return;
- Netlib_LogfT(hNetlibUser, L"Started checking feed %s.", szURL);
+ Netlib_LogfW(hNetlibUser, L"Started checking feed %s.", szURL);
char *szData = NULL;
GetNewsData(szURL, &szData, hContact, NULL);
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index dc7302c2e3..0f16b5664e 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -19,7 +19,8 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-HANDLE hNetlibUser = NULL, hNetlibHttp;
+HNETLIBUSER hNetlibUser = NULL;
+HANDLE hNetlibHttp;
bool UpdateListFlag = FALSE;
bool IsMyContact(MCONTACT hContact)
@@ -30,11 +31,11 @@ bool IsMyContact(MCONTACT hContact) void NetlibInit()
{
- NETLIBUSER nlu = { sizeof(nlu) };
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY;
nlu.ptszDescriptiveName = TranslateT("NewsAggregator HTTP connection");
nlu.szSettingsModule = MODULE;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
}
void NetlibUnInit()
@@ -45,7 +46,7 @@ void NetlibUnInit() void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg)
{
- Netlib_LogfT(hNetlibUser, L"Getting feed data %s.", tszUrl);
+ Netlib_LogfW(hNetlibUser, L"Getting feed data %s.", tszUrl);
NETLIBHTTPREQUEST nlhr = { 0 };
// initialize the netlib request
@@ -84,26 +85,25 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg if (nlhrReply) {
// if the recieved code is 200 OK
if (nlhrReply->resultCode == 200 && nlhrReply->dataLength > 0) {
- Netlib_LogfT(hNetlibUser, L"Code 200: Succeeded getting feed data %s.", tszUrl);
+ Netlib_LogfW(hNetlibUser, L"Code 200: Succeeded getting feed data %s.", tszUrl);
// allocate memory and save the retrieved data
*szData = (char *)mir_alloc((size_t)(nlhrReply->dataLength + 2));
memcpy(*szData, nlhrReply->pData, (size_t)nlhrReply->dataLength);
(*szData)[nlhrReply->dataLength] = 0;
}
else if (nlhrReply->resultCode == 401) {
- Netlib_LogfT(hNetlibUser, L"Code 401: feed %s needs auth data.", tszUrl);
+ Netlib_LogfW(hNetlibUser, L"Code 401: feed %s needs auth data.", tszUrl);
ItemInfo SelItem = { 0 };
SelItem.hwndList = hwndDlg;
SelItem.hContact = hContact;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_AUTHENTICATION), hwndDlg, AuthenticationProc, (LPARAM)&SelItem) == IDOK)
GetNewsData(tszUrl, szData, hContact, hwndDlg);
}
- else
- Netlib_LogfT(hNetlibUser, L"Code %d: Failed getting feed data %s.", nlhrReply->resultCode, tszUrl);
+ else Netlib_LogfW(hNetlibUser, L"Code %d: Failed getting feed data %s.", nlhrReply->resultCode, tszUrl);
+
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
}
- else
- Netlib_LogfT(hNetlibUser, L"Failed getting feed data %s, no response.", tszUrl);
+ else Netlib_LogfW(hNetlibUser, L"Failed getting feed data %s, no response.", tszUrl);
mir_free(szUrl);
}
diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h index 2636e380b0..c1091c1f63 100644 --- a/plugins/NewsAggregator/Src/stdafx.h +++ b/plugins/NewsAggregator/Src/stdafx.h @@ -57,7 +57,7 @@ Boston, MA 02111-1307, USA. extern HINSTANCE hInst;
extern HWND hAddFeedDlg;
extern MWindowList hChangeFeedDlgList;
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
extern UINT_PTR timerId;
// check if Feeds is currently updating
extern bool ThreadRunning;
diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp index 9ffaf1383d..e63521df09 100644 --- a/plugins/Non-IM Contact/src/http.cpp +++ b/plugins/Non-IM Contact/src/http.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char *szInfo;
char *szData;
-HANDLE hNetlibUser;
+HNETLIBUSER hNetlibUser;
// function to download webpage from the internet
// szUrl = URL of the webpage to be retrieved
@@ -73,7 +73,7 @@ int InternetDownloadFile(char *szUrl) }
}
// log the new url into netlib log
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)szData);
+ Netlib_Log(hNetlibUser, szData);
}
}
// if the data does not downloaded successfully (ie. disconnected), then return 1 as error code
@@ -92,10 +92,9 @@ int InternetDownloadFile(char *szUrl) void NetlibInit()
{
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = MODNAME;
nlu.ptszDescriptiveName = TranslateT("Non-IM Contacts");
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
}
diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h index dcacf5841c..ce265a31bd 100644 --- a/plugins/Non-IM Contact/src/stdafx.h +++ b/plugins/Non-IM Contact/src/stdafx.h @@ -116,7 +116,7 @@ void NetlibInit(); int InternetDownloadFile (CHAR *szUrl);
extern char *szInfo;
extern char *szData;
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
#endif
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 59ee647c3a..84827faa0b 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -48,12 +48,11 @@ void IcoLibInit() BOOL NetlibInit()
{
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY;
nlu.ptszDescriptiveName = TranslateT("Pack Updater HTTP connection");
nlu.szSettingsModule = MODNAME;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
return hNetlibUser != NULL;
}
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index c36034cd26..6c0ca19da0 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -22,8 +22,8 @@ PasteToWeb* pasteToWebs[PasteToWeb::pages]; std::map<MCONTACT, HWND>* contactWindows;
DWORD gMirandaVersion;
+HNETLIBUSER g_hNetlibUser;
HANDLE hModulesLoaded, hTabsrmmButtonPressed;
-HANDLE g_hNetlibUser;
HANDLE hPrebuildContactMenu;
HANDLE hServiceContactMenu;
HGENMENU hContactMenu;
@@ -392,12 +392,11 @@ extern "C" int __declspec(dllexport) Load(void) Icon_Register(hInst, LPGEN("Paste It"), &icon, 1);
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_HTTPCONNS;
nlu.szSettingsModule = MODULE;
nlu.ptszDescriptiveName = TranslateT("Paste It HTTP connections");
- g_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ g_hNetlibUser = Netlib_RegisterUser(&nlu);
pasteToWebs[0] = new PasteToWeb1();
pasteToWebs[0]->pageIndex = 0;
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index 3e62035de1..ec6cdd9878 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -498,7 +498,7 @@ void PasteToWeb::FromFile(std::wstring file) }
}
-extern HANDLE g_hNetlibUser;
+extern HNETLIBUSER g_hNetlibUser;
wchar_t* PasteToWeb::SendToWeb(char* url, std::map<std::string, std::string>& headers, std::wstring content)
{
diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 8c7f9497ab..45096e79c7 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -4,7 +4,7 @@ CLIST_INTERFACE *pcli; HINSTANCE hInst;
int hLangpack = 0;
-HANDLE hNetlibUser = 0;
+HNETLIBUSER hNetlibUser = 0;
HANDLE hFillListEvent = 0;
bool use_raw_ping = true;
@@ -83,8 +83,7 @@ int OnShutdown(WPARAM, LPARAM) { int OnModulesLoaded(WPARAM, LPARAM)
{
- NETLIBUSER nl_user = { 0 };
- nl_user.cbSize = sizeof(nl_user);
+ NETLIBUSER nl_user = {};
nl_user.szSettingsModule = PLUG;
nl_user.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nl_user.ptszDescriptiveName = TranslateT("Ping Plugin");
@@ -94,7 +93,7 @@ int OnModulesLoaded(WPARAM, LPARAM) nl_user.pfnHttpGatewayWrapSend = 0;
nl_user.pfnHttpGatewayUnwrapRecv = 0;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+ hNetlibUser = Netlib_RegisterUser(&nl_user);
InitUtils();
diff --git a/plugins/Ping/src/stdafx.h b/plugins/Ping/src/stdafx.h index 1e92a443d8..7bdfa5be69 100644 --- a/plugins/Ping/src/stdafx.h +++ b/plugins/Ping/src/stdafx.h @@ -107,7 +107,7 @@ typedef std::list<PINGADDRESS> PINGLIST; typedef std::list<PINGADDRESS>::iterator pinglist_it;
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
extern HINSTANCE hInst;
extern bool use_raw_ping;
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
diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index 1d201389ca..ae0679b758 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -32,12 +32,11 @@ public: {
assert(NULL == g_hNetLib);
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = QUOTES_PROTOCOL_NAME;
nlu.ptszDescriptiveName = TranslateT("Quotes HTTP connections");
- g_hNetLib = reinterpret_cast<HANDLE>(CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu));
+ g_hNetLib = reinterpret_cast<HANDLE>(Netlib_RegisterUser(&nlu));
return (NULL != g_hNetLib);
}
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 0ac3f749e3..199942925c 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -93,16 +93,16 @@ void CopyToClipboard(HWND hwnd, LPSTR msg) }
}
-HANDLE hNetlibUser;
+HNETLIBUSER hNetlibUser;
void InitNetlib()
{
- NETLIBUSER nl_user = { sizeof(nl_user) };
+ NETLIBUSER nl_user = {};
nl_user.szSettingsModule = (LPSTR)MODULENAME;
nl_user.szDescriptiveName = (LPSTR)MODULENAME;
nl_user.flags = NUF_NOOPTIONS;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+ hNetlibUser = Netlib_RegisterUser(&nl_user);
}
void DeinitNetlib()
@@ -118,5 +118,5 @@ int Sent_NetLog(const char *fmt, ...) va_start(va, fmt);
mir_vsnprintf(szText, sizeof(szText), fmt, va);
va_end(va);
- return CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)szText);
+ return Netlib_Log(hNetlibUser, szText);
}
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index cc629fa102..4afa278eee 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -89,7 +89,7 @@ __forceinline int SendBroadcast(MCONTACT hContact, int type, int result, HANDLE return ProtoBroadcastAck( GetContactProto(hContact), hContact, type, result, hProcess, lParam);
}
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
void InitNetlib();
void DeinitNetlib();
int Sent_NetLog(const char *,...);
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 4c289bde45..9ad0d286f5 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -32,11 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////// CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; -HINSTANCE g_hSendSS; -MGLOBAL g_myGlobals; -HANDLE g_hNetlibUser=0;//!< Netlib Register User -FI_INTERFACE* FIP=NULL; -int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP() +HINSTANCE g_hSendSS; +MGLOBAL g_myGlobals; +HNETLIBUSER g_hNetlibUser=0;//!< Netlib Register User +FI_INTERFACE *FIP=NULL; +int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP() IconItem ICONS[ICO_END_] = { @@ -232,11 +232,11 @@ int hook_ModulesLoaded(WPARAM, LPARAM) g_myGlobals.PluginFTPExist = ServiceExists(MS_FTPFILE_UPLOAD); g_myGlobals.PluginDropboxExist = ServiceExists(MS_DROPBOX_UPLOAD); // Netlib register - NETLIBUSER nlu = { sizeof(nlu) }; + NETLIBUSER nlu = {}; nlu.szSettingsModule = __PLUGIN_NAME; nlu.ptszDescriptiveName = TranslateT("SendSS HTTP connections"); nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; //|NUF_NOHTTPSOPTION; - g_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + g_hNetlibUser = Netlib_RegisterUser(&nlu); // load my button class / or use UInfoEx CtrlButtonLoadModule(); // Folders plugin support diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h index 5cdeed4d41..a9f907c99d 100644 --- a/plugins/SendScreenshotPlus/src/stdafx.h +++ b/plugins/SendScreenshotPlus/src/stdafx.h @@ -117,10 +117,9 @@ typedef struct _MGLOBAL { #define SZ_SENDSS "SendSS" extern ATOM g_clsTargetHighlighter; -extern HINSTANCE g_hSendSS; -extern MGLOBAL g_myGlobals; -extern HANDLE g_hNetlibUser; - +extern HINSTANCE g_hSendSS; +extern MGLOBAL g_myGlobals; +extern HNETLIBUSER g_hNetlibUser; enum{ ICO_MAIN=0, diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 1a68a8c86b..dd5e1e05a2 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE hNetlibUser;
+HNETLIBUSER hNetlibUser;
static HANDLE hFolder;
struct QueueElem
@@ -218,11 +218,11 @@ void GetSmileyCacheFolder(void) void DownloadInit(void)
{
- NETLIBUSER nlu = { sizeof(nlu) };
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = MODULENAME;
nlu.ptszDescriptiveName = TranslateT("SmileyAdd HTTP connections");
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
GetSmileyCacheFolder();
g_hDlMutex = CreateMutex(NULL, FALSE, NULL);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 09066d74f0..65b8ed9564 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -520,7 +520,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMStringW &tbuf, bool onlyInfo, CMStringW static const wchar_t errmsg[] = LPGENW("Smiley #%u in file %s for smiley pack %s not found.");
wchar_t msgtxt[1024];
mir_snwprintf(msgtxt, TranslateW(errmsg), smnum, resname.c_str(), modpath.c_str());
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
+ Netlib_LogW(hNetlibUser, msgtxt);
errorFound = true;
}
smnum++;
@@ -1078,7 +1078,7 @@ SmileyLookup::SmileyLookup(const CMStringW &str, const bool regexs, const int in }
if (!m_valid)
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
+ Netlib_LogW(hNetlibUser, msgtxt);
}
else {
m_text = str;
diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index f467be8697..754d4078db 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -92,7 +92,7 @@ typedef WCMatcher _TMatcher; extern FI_INTERFACE *fei;
extern HINSTANCE g_hInst;
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
extern HANDLE hEvent1;
extern HGENMENU hContactMenuItem;
extern SmileyCategoryListType g_SmileyCategories;
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 4ede3640a2..5b3e87a33b 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -434,10 +434,9 @@ begin if hNetLib=0 then
begin
FillChar(nlu,SizeOf(nlu),0);
- nlu.cbSize :=SizeOf(nlu);
- nlu.flags :=NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
+ nlu.flags :=NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
nlu.szSettingsModule:='dummy';
- hTmpNetLib:=CallService(MS_NETLIB_REGISTERUSER,0,lparam(@nlu));
+ hTmpNetLib:=Netlib_RegisterUser(@nlu);
end
else
hTmpNetLib:=hNetLib;
@@ -457,7 +456,7 @@ begin CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,lparam(resp));
end;
- if (hNetLib=0) and (nlu.cbSize<>0) then
+ if (hNetLib=0) and (nlu.flags<>0) then
Netlib_CloseHandle(hTmpNetLib);
end;
@@ -466,8 +465,7 @@ static int __inline NLog(AnsiChar *msg) { return CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)msg);
}
*)
-function GetFile(url:PAnsiChar;save_file:PAnsiChar;
- hNetLib:THANDLE=0;recurse_count:integer=0):bool;
+function GetFile(url:PAnsiChar; save_file:PAnsiChar; hNetLib:THANDLE=0; recurse_count:integer=0):bool;
var
nlu:TNETLIBUSER;
req :TNETLIBHTTPREQUEST;
@@ -491,10 +489,9 @@ begin FillChar(nlu,SizeOf(nlu),0);
if hNetLib=0 then
begin
- nlu.cbSize :=SizeOf(nlu);
- nlu.flags :=NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
+ nlu.flags := NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
nlu.szSettingsModule:='dummy';
- hNetLib:=CallService(MS_NETLIB_REGISTERUSER,0,lparam(@nlu));
+ hNetLib:=Netlib_RegisterUser(@nlu);
end;
resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hNetLib,lparam(@req)));
@@ -536,7 +533,7 @@ begin end;
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,lparam(resp));
- if nlu.cbSize<>0 then
+ if nlu.flags<>0 then
Netlib_CloseHandle(hNetLib);
end;
end;
@@ -619,10 +616,9 @@ begin req.flags :=NLHRF_NODUMP;
FillChar(nlu,SizeOf(nlu),0);
- nlu.cbSize :=SizeOf(nlu);
- nlu.flags :=NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
+ nlu.flags := NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
nlu.szSettingsModule:='dummy';
- hNetLib:=CallService(MS_NETLIB_REGISTERUSER,0,lparam(@nlu));
+ hNetLib:=Netlib_RegisterUser(@nlu);
resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hNetLib,lparam(@req)));
diff --git a/plugins/Watrack/myshows/i_cookies.inc b/plugins/Watrack/myshows/i_cookies.inc index 3241134cf3..62563e7afc 100644 --- a/plugins/Watrack/myshows/i_cookies.inc +++ b/plugins/Watrack/myshows/i_cookies.inc @@ -62,13 +62,11 @@ begin end;
FillChar(nlu,SizeOf(nlu),0);
- nlu.cbSize :=SizeOf(nlu);
- nlu.flags :=NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
+ nlu.flags := NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING or NUF_NOOPTIONS;
nlu.szSettingsModule:='dummy';
- hTmpNetLib:=CallService(MS_NETLIB_REGISTERUSER,0,lparam(@nlu));
+ hTmpNetLib:=Netlib_RegisterUser(@nlu);
resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hTmpNetLib,lparam(@req)));
-
if resp<>nil then
begin
if resp^.resultCode=200 then
diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp index eedf62bd0c..2d2989289c 100755 --- a/plugins/Watrack_MPD/src/init.cpp +++ b/plugins/Watrack_MPD/src/init.cpp @@ -21,7 +21,7 @@ BOOL bWatrackService = FALSE; int hLangpack = 0;
wchar_t *gbHost, *gbPassword;
WORD gbPort;
-HANDLE ghNetlibUser;
+HNETLIBUSER ghNetlibUser;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -57,12 +57,11 @@ void InitVars() static int OnModulesLoaded(WPARAM, LPARAM)
{
- NETLIBUSER nlu = {0};
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.ptszDescriptiveName = TranslateT("Watrack MPD connection");
nlu.szSettingsModule = __PLUGIN_NAME;
- ghNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ ghNetlibUser = Netlib_RegisterUser(&nlu);
InitVars();
if (ServiceExists(MS_WAT_PLAYER))
bWatrackService = TRUE;
diff --git a/plugins/Watrack_MPD/src/stdafx.h b/plugins/Watrack_MPD/src/stdafx.h index f339704541..8d40410cd9 100755 --- a/plugins/Watrack_MPD/src/stdafx.h +++ b/plugins/Watrack_MPD/src/stdafx.h @@ -34,7 +34,7 @@ #define szModuleName "Watrack_MPD"
extern HINSTANCE hInst;
-extern HANDLE ghNetlibUser;
+extern HNETLIBUSER ghNetlibUser;
extern BOOL bWatrackService;
extern wchar_t *gbHost, *gbPassword;
extern WORD gbPort;
diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h index 73a3eb9a60..677cca67d1 100644 --- a/plugins/Weather/src/stdafx.h +++ b/plugins/Weather/src/stdafx.h @@ -357,7 +357,8 @@ extern unsigned status, old_status; extern MWindowList hDataWindowList, hWindowList;
-extern HANDLE hNetlibUser, hNetlibHttp, hHookWeatherUpdated, hHookWeatherError, hTBButton, hUpdateMutex;
+extern HNETLIBUSER hNetlibUser;
+extern HANDLE hNetlibHttp, hHookWeatherUpdated, hHookWeatherError, hTBButton, hUpdateMutex;
extern UINT_PTR timerId;
extern HGENMENU hMwinMenu;
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp index 82b9707d80..5fdf2cb22f 100644 --- a/plugins/Weather/src/weather_http.cpp +++ b/plugins/Weather/src/weather_http.cpp @@ -25,7 +25,8 @@ from the web using netlib #include "stdafx.h"
-HANDLE hNetlibUser, hNetlibHttp;
+HNETLIBUSER hNetlibUser;
+HANDLE hNetlibHttp;
static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr)
{
@@ -152,12 +153,11 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s // initialize netlib support for weather protocol
void NetlibInit(void)
{
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
nlu.szSettingsModule = WEATHERPROTONAME;
nlu.ptszDescriptiveName = TranslateT("Weather HTTP connections");
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
}
void NetlibHttpDisconnect(void)
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 578bec0a8d..5331c2be74 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -44,10 +44,10 @@ int UpdateWeather(MCONTACT hContact) dbv.pszVal = "";
// log to netlib log for debug purpose
- Netlib_LogfT(hNetlibUser, L"************************************************************************");
+ Netlib_LogfW(hNetlibUser, L"************************************************************************");
int dbres = db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv);
- Netlib_LogfT(hNetlibUser, L"<-- Start update for station -->");
+ Netlib_LogfW(hNetlibUser, L"<-- Start update for station -->");
// download the info and parse it
// result are stored in database
@@ -65,8 +65,8 @@ int UpdateWeather(MCONTACT hContact) mir_free(tszError);
}
// log to netlib
- Netlib_LogfT(hNetlibUser, L"Error! Update cannot continue... Start to free memory");
- Netlib_LogfT(hNetlibUser, L"<-- Error occurs while updating station: %s -->", dbv.ptszVal);
+ Netlib_LogfW(hNetlibUser, L"Error! Update cannot continue... Start to free memory");
+ Netlib_LogfW(hNetlibUser, L"<-- Error occurs while updating station: %s -->", dbv.ptszVal);
if (!dbres) db_free(&dbv);
return 1;
}
@@ -203,8 +203,8 @@ int UpdateWeather(MCONTACT hContact) NotifyEventHooks(hHookWeatherUpdated, hContact, (LPARAM)Ch);
}
- Netlib_LogfT(hNetlibUser, L"Update Completed - Start to free memory");
- Netlib_LogfT(hNetlibUser, L"<-- Update successful for station -->");
+ Netlib_LogfW(hNetlibUser, L"Update Completed - Start to free memory");
+ Netlib_LogfW(hNetlibUser, L"<-- Update successful for station -->");
// Update frame data
UpdateMwinData(hContact);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index e8b7bfd899..bcb0c4a2e2 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -24,7 +24,7 @@ #include "webview.h"
MWindowList hWindowList;
-HANDLE hNetlibUser;
+HNETLIBUSER hNetlibUser;
HANDLE hHookDisplayDataAlert, hHookAlertPopup, hHookAlertWPopup, hHookErrorPopup, hHookAlertOSD;
int hLangpack = 0;
@@ -147,11 +147,11 @@ extern "C" int __declspec(dllexport) Load() char tempNdesc[50];
mir_snprintf(tempNdesc, "%s connection settings", MODULENAME);
- NETLIBUSER nlu = { sizeof(nlu) };
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
- nlu.szSettingsModule = MODULENAME;
- nlu.szDescriptiveName = tempNdesc;
- hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu);
+ NETLIBUSER nlu = {};
+ nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
+ nlu.szSettingsModule = MODULENAME;
+ nlu.szDescriptiveName = tempNdesc;
+ hNetlibUser = Netlib_RegisterUser(&nlu);
// register webview protocol
PROTOCOLDESCRIPTOR pd = { 0 };
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index 837fa18083..28a897de58 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -144,7 +144,7 @@ extern HWND ContactHwnd; extern HINSTANCE hInst;
extern HMENU hMenu;
extern int bpStatus;
-extern HANDLE hNetlibUser;
+extern HNETLIBUSER hNetlibUser;
extern MWindowList hWindowList;
extern HGENMENU hMenuItem1, hMenuItemCountdown;
extern char optionsname[80];
diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index cc8f73a602..df4dc150e6 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -10,7 +10,7 @@ //--------------------------------------------------------------------------------------------------
BOOL SSLLoaded = FALSE;
-HANDLE hNetlibUser = NULL;
+HNETLIBUSER hNetlibUser = NULL;
void __stdcall SSL_DebugLog(const char *fmt, ...)
{
@@ -27,13 +27,12 @@ void __stdcall SSL_DebugLog(const char *fmt, ...) else
str[sizeof(str) - 1] = 0;
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)str);
+ Netlib_Log(hNetlibUser, str);
va_end(vararg);
}
HANDLE RegisterNLClient(const char *name)
{
- static NETLIBUSER nlu = { 0 };
char desc[128];
mir_snprintf(desc, Translate("%s connection"), name);
@@ -41,11 +40,12 @@ HANDLE RegisterNLClient(const char *name) #ifdef DEBUG_COMM
DebugLog(CommFile, "<Register PROXY support>");
#endif
- nlu.cbSize = sizeof(nlu);
+
+ NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
nlu.szDescriptiveName = desc;
nlu.szSettingsModule = (char *)name;
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
#ifdef DEBUG_COMM
if (NULL == hNetlibUser)
@@ -227,7 +227,7 @@ char* CNLClient::Recv(char *buf, int buflen) throw(DWORD) void CNLClient::Disconnect()
{
Netlib_CloseHandle(hConnection);
- hConnection = (HANDLE)NULL;
+ hConnection = NULL;
}
//Uninitializes netlib library
@@ -238,7 +238,7 @@ void UnregisterNLClient() #endif
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = (HANDLE)NULL;
+ hNetlibUser = NULL;
#ifdef DEBUG_COMM
DebugLog(CommFile, "</Unregister PROXY support>\n");
#endif
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index c397936b37..76c7491280 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -63,16 +63,7 @@ wchar_t *Hlp_GetWindowText(HWND hwndDlg) // Logging
static int WriteToDebugLogA(const char *szMsg)
{
-
- int res = 0;
- if (ServiceExists(MS_NETLIB_LOG))
- res = CallService(MS_NETLIB_LOG, 0, (LPARAM)szMsg);
- else {
- OutputDebugStringA(szMsg);
- OutputDebugStringA("\r\n");
- }
-
- return res;
+ return Netlib_Log(0, szMsg);
}
int AddDebugLogMessageA(const char* fmt, ...)
diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr index 3c3a5c3050..28ee6d3e9c 100644 --- a/plugins/mRadio/mradio.dpr +++ b/plugins/mRadio/mradio.dpr @@ -79,10 +79,9 @@ begin StrCopy(szTemp,Translate('%s server connection'));
StrReplace(szTemp,'%s',PluginName);
nlu.szDescriptiveName.a:=szTemp;
- nlu.cbSize :=SizeOf(nlu);
nlu.flags :=NUF_HTTPCONNS or NUF_NOHTTPSOPTION or NUF_OUTGOING;
nlu.szSettingsModule :=PluginName;
- hNetLib:=CallService(MS_NETLIB_REGISTERUSER,0,tlparam(@nlu));
+ hNetLib:=Netlib_RegisterUser(@nlu);
// CallService(MS_RADIO_COMMAND,MRC_RECORD,2); record off - not so necessary
|