From 8a74e7495ce5ad39de4f5c25121a84d35df90c36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 15:08:48 +0300 Subject: CMPlugin to receive a reference to PLUGININFOEX --- plugins/SMS/src/SMSConstans.h | 6 +++--- plugins/SMS/src/SMS_svc.cpp | 4 ++-- plugins/SMS/src/functions.cpp | 4 ++-- plugins/SMS/src/main.cpp | 10 +++++++--- plugins/SMS/src/receive.cpp | 2 +- plugins/SMS/src/recvdlg.cpp | 4 ++-- plugins/SMS/src/senddlg.cpp | 4 ++-- plugins/SMS/src/stdafx.h | 22 ++++++++++------------ 8 files changed, 29 insertions(+), 27 deletions(-) (limited to 'plugins/SMS/src') diff --git a/plugins/SMS/src/SMSConstans.h b/plugins/SMS/src/SMSConstans.h index ba2a7fc19f..fb40a680b2 100644 --- a/plugins/SMS/src/SMSConstans.h +++ b/plugins/SMS/src/SMSConstans.h @@ -1,10 +1,10 @@ #if !defined(AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) #define AFX_SMS_CONSTANS_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_ -#define PROTOCOL_NAMEA "SMSPlugin" +#define MODULENAME "SMSPlugin" #define PROTOCOL_NAMEW L"SMSPlugin" -#define PROTOCOL_NAME_LEN (sizeof(PROTOCOL_NAMEA)-1) -#define PROTOCOL_NAME_SIZE sizeof(PROTOCOL_NAMEA) +#define PROTOCOL_NAME_LEN (sizeof(MODULENAME)-1) +#define PROTOCOL_NAME_SIZE sizeof(MODULENAME) #define PROTOCOL_DISPLAY_NAME_ORIG "SMS" #define TIMEOUT_MSGSEND 60000 // send sms timeout diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 1543d4bb77..153f70b92a 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -4,7 +4,7 @@ int LoadServices(void) { char szServiceFunction[MAX_PATH], *pszServiceFunctionName; - memcpy(szServiceFunction, PROTOCOL_NAMEA, PROTOCOL_NAME_SIZE); + memcpy(szServiceFunction, MODULENAME, PROTOCOL_NAME_SIZE); pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN; // Service creation @@ -25,7 +25,7 @@ int LoadModules(void) HookEvent(ME_PROTO_ACCLISTCHANGED, RefreshAccountList); char szServiceFunction[MAX_PATH]; - mir_snprintf(szServiceFunction, "%s%s", PROTOCOL_NAMEA, SMS_SEND); + mir_snprintf(szServiceFunction, "%s%s", MODULENAME, SMS_SEND); CMenuItem mi; diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index a5cee92a75..1b26639ae9 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -33,9 +33,9 @@ LPSTR GetModuleName(MCONTACT hContact) if (hContact) { lpszRet = GetContactProto(hContact); if (lpszRet == nullptr) - lpszRet = PROTOCOL_NAMEA; + lpszRet = MODULENAME; } - else lpszRet = PROTOCOL_NAMEA; + else lpszRet = MODULENAME; return lpszRet; } diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index 196b53ba3a..12691da51f 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -35,7 +35,7 @@ SMS_SETTINGS ssSMSSettings; ///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -49,9 +49,13 @@ PLUGININFOEX pluginInfo = {0xcf97fd5d, 0xb911, 0x47a8, {0xaf, 0x3, 0xd2, 0x19, 0x68, 0xb5, 0xb8, 0x94}} }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -117,7 +121,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) extern "C" int __declspec(dllexport) Load(void) { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); pcli = Clist_GetInterface(); HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded); diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 71f2d052a5..b446b1b437 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -217,7 +217,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) dbei.pBlob = (PBYTE)MEMALLOC(dbei.cbBlob); if (!dbei.pBlob) return 0; - memcpy(szServiceFunction, PROTOCOL_NAMEA, PROTOCOL_NAME_SIZE); + memcpy(szServiceFunction, MODULENAME, PROTOCOL_NAME_SIZE); pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN; if (db_event_get(hDbEvent, &dbei) == 0) diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 1ec5d5bbc5..eb4ad3ace6 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -86,7 +86,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA } // def pos - if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv")) + if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), MODULENAME, "recv")) SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER); InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE); @@ -235,7 +235,7 @@ void RecvSMSWindowRemove(HWND hWndDlg) RECV_SMS_WINDOW_DATA *prswdWindowData = GET_WINDOW_DATA(hWndDlg); if (prswdWindowData) { - Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv"); + Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), MODULENAME, "recv"); ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); ListMTItemDelete(&ssSMSSettings.lmtRecvSMSWindowsListMT, &prswdWindowData->lmtListMTItem); diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index db9051097e..4b5dbe0cb7 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -158,7 +158,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA SetDlgItemText(hWndDlg, IDC_COUNT, tszSign); } - if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), PROTOCOL_NAMEA, "send")) {// def pos + if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), MODULENAME, "send")) {// def pos SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER); } InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE); @@ -580,7 +580,7 @@ void SendSMSWindowRemove(HWND hWndDlg) if (psswdWindowData) { DB_SMS_SetDword(NULL, "LastProto", SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0)); SendSMSWindowMultipleSet(hWndDlg, FALSE); - Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), PROTOCOL_NAMEA, "send"); + Utils_SaveWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), MODULENAME, "send"); ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); ListMTItemDelete(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem); diff --git a/plugins/SMS/src/stdafx.h b/plugins/SMS/src/stdafx.h index e99ea83b45..e5c66ce515 100644 --- a/plugins/SMS/src/stdafx.h +++ b/plugins/SMS/src/stdafx.h @@ -33,9 +33,7 @@ struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(PROTOCOL_NAMEA) - {} + CMPlugin(); }; // структура содержащая информацию по построению меню или расширенных иконок @@ -74,17 +72,17 @@ extern SMS_SETTINGS ssSMSSettings; #define GET_DLG_ITEM_TEXT_LENGTH(hDlg,nIDDlgItem) SendDlgItemMessage(hDlg,nIDDlgItem,WM_GETTEXTLENGTH,NULL,NULL) #define GET_CURRENT_COMBO_DATA(hWndDlg,ControlID) SendDlgItemMessage(hWndDlg,ControlID,CB_GETITEMDATA,SendDlgItemMessage(hWndDlg,ControlID,CB_GETCURSEL,0,0),0) -#define DB_SMS_DeleteValue(Contact,valueName) db_unset(Contact,PROTOCOL_NAMEA,valueName) -#define DB_SMS_GetDword(Contact,valueName,parDefltValue) db_get_dw(Contact,PROTOCOL_NAMEA,valueName,parDefltValue) -#define DB_SMS_SetDword(Contact,valueName,parValue) db_set_dw(Contact,PROTOCOL_NAMEA,valueName,parValue) -#define DB_SMS_GetWord(Contact,valueName,parDefltValue) db_get_w(Contact,PROTOCOL_NAMEA,valueName,parDefltValue) -#define DB_SMS_SetWord(Contact,valueName,parValue) db_set_w(Contact,PROTOCOL_NAMEA,valueName,parValue) -#define DB_SMS_GetByte(Contact,valueName,parDefltValue) db_get_b(Contact,PROTOCOL_NAMEA,valueName,parDefltValue) -#define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,PROTOCOL_NAMEA,valueName,parValue) +#define DB_SMS_DeleteValue(Contact,valueName) db_unset(Contact,MODULENAME,valueName) +#define DB_SMS_GetDword(Contact,valueName,parDefltValue) db_get_dw(Contact,MODULENAME,valueName,parDefltValue) +#define DB_SMS_SetDword(Contact,valueName,parValue) db_set_dw(Contact,MODULENAME,valueName,parValue) +#define DB_SMS_GetWord(Contact,valueName,parDefltValue) db_get_w(Contact,MODULENAME,valueName,parDefltValue) +#define DB_SMS_SetWord(Contact,valueName,parValue) db_set_w(Contact,MODULENAME,valueName,parValue) +#define DB_SMS_GetByte(Contact,valueName,parDefltValue) db_get_b(Contact,MODULENAME,valueName,parDefltValue) +#define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,MODULENAME,valueName,parValue) BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,size_t dwRetBuffSize,size_t *pdwRetBuffSize); -#define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,PROTOCOL_NAMEA,ValueName,Ret,RetBuffSize,pRetBuffSize) +#define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,MODULENAME,ValueName,Ret,RetBuffSize,pRetBuffSize) #define DB_SetStringW(Contact,Module,valueName,parValue) db_set_ws(Contact,Module,valueName,parValue) -#define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,PROTOCOL_NAMEA,valueName,parValue) +#define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,MODULENAME,valueName,parValue) LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam); -- cgit v1.2.3