From 11e70d8c4e224d80015fffe0378c53abee5fd824 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 19:41:35 +0300 Subject: Popup, PManagerEx, QuickContacts, RemovePersonalSettings, Restart, SeenPlugin, SendSS, ShlExt, SimpleAR, SimpleStatusMsg, SkypeStatusChange, SmileyAdd, SMS => CMPlugin --- plugins/SMS/src/main.cpp | 93 +++++++++++++++++++++++++----------------------- plugins/SMS/src/stdafx.h | 23 +++++------- 2 files changed, 57 insertions(+), 59 deletions(-) (limited to 'plugins/SMS/src') diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index 37269f9ff7..939ed8ecc0 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -27,13 +27,16 @@ Enjoy the code and use it smartly! #include "stdafx.h" -CLIST_INTERFACE *pcli; int hLangpack; -HINSTANCE hInst; +CMPlugin g_plugin; +CLIST_INTERFACE *pcli; SMS_SETTINGS ssSMSSettings; -PLUGININFOEX pluginInfo = { +///////////////////////////////////////////////////////////////////////////////////////// + +PLUGININFOEX pluginInfo = +{ sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -51,9 +54,42 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfo; } -int OnModulesLoaded (WPARAM wParam,LPARAM lParam); -int OnPreShutdown (WPARAM wParam,LPARAM lParam); -void VersionConversions(); +///////////////////////////////////////////////////////////////////////////////////////// + +static void VersionConversions() +{ + WCHAR wsztm[MAX_PATH]; + + if (DB_SMS_GetStaticStringW(NULL, "UseSignature", wsztm, _countof(wsztm), nullptr)) + DB_SMS_SetByte(NULL, "UseSignature", (wsztm[0] == '0')); + else + DB_SMS_SetByte(NULL, "UseSignature", SMS_DEFAULT_USESIGNATURE); + + if (DB_SMS_GetStaticStringW(NULL, "SignaturePos", wsztm, _countof(wsztm), nullptr)) + DB_SMS_SetByte(NULL, "SignaturePos", (wsztm[0] == '0')); + else + DB_SMS_SetByte(NULL, "SignaturePos", SMS_DEFAULT_SIGNATUREPOS); + + if (DB_SMS_GetStaticStringW(NULL, "ShowACK", wsztm, _countof(wsztm), nullptr)) + DB_SMS_SetByte(NULL, "ShowACK", (wsztm[0] == '0')); + else + DB_SMS_SetByte(NULL, "ShowACK", SMS_DEFAULT_SHOWACK); +} + +static int OnModulesLoaded(WPARAM, LPARAM) +{ + VersionConversions(); + LoadModules(); + return 0; +} + +static int OnPreShutdown(WPARAM, LPARAM) +{ + RecvSMSWindowDestroy(); + SendSMSWindowDestroy(); + FreeAccountList(); + return 0; +} BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) { @@ -64,9 +100,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) ssSMSSettings.hHeap = HeapCreate(0, 0, 0); DisableThreadLibraryCalls((HMODULE)hInstance); break; + case DLL_PROCESS_DETACH: HeapDestroy(ssSMSSettings.hHeap); ssSMSSettings.hHeap = nullptr; + case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: break; @@ -75,6 +113,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) return TRUE; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); @@ -87,49 +127,12 @@ extern "C" int __declspec(dllexport) Load(void) RecvSMSWindowInitialize(); LoadServices(); - return 0; } -extern "C" int __declspec(dllexport) Unload(void) -{ - return 0; -} - -int OnModulesLoaded(WPARAM,LPARAM) -{ - VersionConversions(); - - LoadModules(); +///////////////////////////////////////////////////////////////////////////////////////// - return 0; -} - -int OnPreShutdown(WPARAM,LPARAM) +extern "C" int __declspec(dllexport) Unload(void) { - RecvSMSWindowDestroy(); - SendSMSWindowDestroy(); - FreeAccountList(); - return 0; } - -void VersionConversions() -{ - WCHAR wsztm[MAX_PATH]; - - if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),nullptr)) - DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0')); - else - DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE); - - if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),nullptr)) - DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0')); - else - DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS); - - if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),nullptr)) - DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0')); - else - DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK); -} diff --git a/plugins/SMS/src/stdafx.h b/plugins/SMS/src/stdafx.h index e3747bae9b..e99ea83b45 100644 --- a/plugins/SMS/src/stdafx.h +++ b/plugins/SMS/src/stdafx.h @@ -9,7 +9,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -32,7 +31,12 @@ #include "SMSConstans.h" #include "senddlg.h" -extern HINSTANCE hInst; +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(PROTOCOL_NAMEA) + {} +}; // структура содержащая информацию по построению меню или расширенных иконок struct GUI_DISPLAY_ITEM @@ -43,12 +47,10 @@ struct GUI_DISPLAY_ITEM LPVOID lpFunc; // функция вызываемая меню }; - #define MAIN_MENU_ITEMS_COUNT 1 #define CONTACT_MENU_ITEMS_COUNT 1 - -typedef struct +struct SMS_SETTINGS { HANDLE hHeap; HINSTANCE hInstance; @@ -61,21 +63,14 @@ typedef struct PROTOACCOUNT **ppaSMSAccounts; size_t dwSMSAccountsCount; - -} SMS_SETTINGS; - - +}; extern SMS_SETTINGS ssSMSSettings; - - - #define MEMALLOC(Size) HeapAlloc(ssSMSSettings.hHeap,HEAP_ZERO_MEMORY,(Size+sizeof(size_t))) #define MEMREALLOC(Mem,Size) HeapReAlloc(ssSMSSettings.hHeap,(HEAP_ZERO_MEMORY),(LPVOID)Mem,(Size+sizeof(size_t))) #define MEMFREE(Mem) if (Mem) {HeapFree(ssSMSSettings.hHeap,0,(LPVOID)Mem);Mem=NULL;} - #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) @@ -129,4 +124,4 @@ int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam); void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwPhoneSize,LPWSTR lpwszMessage,size_t dwMessageSize); -#endif \ No newline at end of file +#endif -- cgit v1.2.3