summaryrefslogtreecommitdiff
path: root/plugins/SMS
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 19:41:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 19:41:35 +0300
commit11e70d8c4e224d80015fffe0378c53abee5fd824 (patch)
tree8b21511f57aad4a9aaaa9391450cf5b83146a2f8 /plugins/SMS
parent0c12fe889baeced3e7d8c3f2558d10f563a43612 (diff)
Popup, PManagerEx, QuickContacts, RemovePersonalSettings, Restart, SeenPlugin, SendSS, ShlExt, SimpleAR, SimpleStatusMsg, SkypeStatusChange, SmileyAdd, SMS => CMPlugin
Diffstat (limited to 'plugins/SMS')
-rw-r--r--plugins/SMS/src/main.cpp93
-rw-r--r--plugins/SMS/src/stdafx.h23
2 files changed, 57 insertions, 59 deletions
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 <malloc.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_clistint.h>
@@ -32,7 +31,12 @@
#include "SMSConstans.h"
#include "senddlg.h"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(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