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/FileAsMessage/src/dialog.cpp | 16 ++++---- plugins/FileAsMessage/src/main.cpp | 64 ++++++++++++++++---------------- plugins/FileAsMessage/src/optionsdlg.cpp | 10 ++--- plugins/FileAsMessage/src/stdafx.h | 6 +-- 4 files changed, 48 insertions(+), 48 deletions(-) (limited to 'plugins/FileAsMessage/src') diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index ea5b0f7aed..8f426f9fb6 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -136,17 +136,17 @@ int RetrieveFileSize(wchar_t *filename) FILEECHO::FILEECHO(MCONTACT Contact) { hContact = Contact; - dwSendInterval = db_get_dw(NULL, SERVICE_NAME, "SendDelay", 6000); + dwSendInterval = db_get_dw(NULL, MODULENAME, "SendDelay", 6000); - chunkMaxLen = db_get_dw(NULL, SERVICE_NAME, "ChunkSize", 5000); + chunkMaxLen = db_get_dw(NULL, MODULENAME, "ChunkSize", 5000); chunkCount = 0; filename = nullptr; - rgbRecv = db_get_dw(NULL, SERVICE_NAME, "colorRecv", RGB(64, 255, 64)); - rgbSent = db_get_dw(NULL, SERVICE_NAME, "colorSent", RGB(255, 255, 64)); - rgbUnSent = db_get_dw(NULL, SERVICE_NAME, "colorUnsent", RGB(128, 128, 128)); - rgbToSend = db_get_dw(NULL, SERVICE_NAME, "colorTosend", RGB(192, 192, 192)); - asBinary = db_get_dw(NULL, SERVICE_NAME, "base64", 1) == 0; + rgbRecv = db_get_dw(NULL, MODULENAME, "colorRecv", RGB(64, 255, 64)); + rgbSent = db_get_dw(NULL, MODULENAME, "colorSent", RGB(255, 255, 64)); + rgbUnSent = db_get_dw(NULL, MODULENAME, "colorUnsent", RGB(128, 128, 128)); + rgbToSend = db_get_dw(NULL, MODULENAME, "colorTosend", RGB(192, 192, 192)); + asBinary = db_get_dw(NULL, MODULENAME, "base64", 1) == 0; } uint controlEnabled[][2] = @@ -419,7 +419,7 @@ void FILEECHO::incomeRequest(char *param) cle.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SMALLICON)); cle.flags = CLEF_URGENT; cle.hDbEvent = 0; - cle.pszService = SERVICE_NAME "/FERecvFile"; + cle.pszService = MODULENAME "/FERecvFile"; pcli->pfnAddEvent(&cle); MakePopupMsg(hDlg, hContact, L"Incoming file..."); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index f02052c03c..6821f3a25e 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -1,19 +1,5 @@ #include "stdafx.h" -PLUGININFOEX pluginInfo = -{ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {34B5A402-1B79-4246-B041-43D0B590AE2C} - { 0x34b5a402, 0x1b79, 0x4246, { 0xb0, 0x41, 0x43, 0xd0, 0xb5, 0x90, 0xae, 0x2c } } -}; - CLIST_INTERFACE *pcli; MWindowList hFileList; CMPlugin g_plugin; @@ -36,10 +22,35 @@ IconItem iconList[] = int iIconId[5] = { 3, 2, 4, 1, 0 }; -// +///////////////////////////////////////////////////////////////////////////////////////// + +PLUGININFOEX pluginInfoEx = +{ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {34B5A402-1B79-4246-B041-43D0B590AE2C} + { 0x34b5a402, 0x1b79, 0x4246, { 0xb0, 0x41, 0x43, 0xd0, 0xb5, 0x90, 0xae, 0x2c } } +}; + +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) +{ + return &pluginInfoEx; +} + +///////////////////////////////////////////////////////////////////////////////////////// // wParam - Section name // lParam - Icon ID -// + int OnSkinIconsChanged(WPARAM, LPARAM) { for (int indx = 0; indx < _countof(hIcons); indx++) @@ -156,15 +167,6 @@ int OnOptInitialise(WPARAM wParam, LPARAM) return 0; } -// -// MirandaPluginInfo() -// Called by Miranda to get Version -// -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) -{ - return &pluginInfo; -} - // // Startup initializing // @@ -181,7 +183,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) mi.position = 200011; mi.hIcolibItem = iconList[ICON_MAIN].hIcolib; mi.name.a = LPGEN("File As Message..."); - mi.pszService = SERVICE_NAME "/FESendFile"; + mi.pszService = MODULENAME "/FESendFile"; mi.flags = CMIF_NOTOFFLINE; Menu_AddContactMenuItem(&mi); return 0; @@ -189,7 +191,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load(void) { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); pcli = Clist_GetInterface(); InitCRC32(); @@ -198,11 +200,11 @@ extern "C" __declspec(dllexport) int Load(void) hFileList = WindowList_Create(); - CreateServiceFunction(SERVICE_NAME PSR_MESSAGE, OnRecvMessage); - CreateServiceFunction(SERVICE_NAME "/FESendFile", OnSendFile); - CreateServiceFunction(SERVICE_NAME "/FERecvFile", OnRecvFile); + CreateServiceFunction(MODULENAME PSR_MESSAGE, OnRecvMessage); + CreateServiceFunction(MODULENAME "/FESendFile", OnSendFile); + CreateServiceFunction(MODULENAME "/FERecvFile", OnRecvFile); - Proto_RegisterModule(PROTOTYPE_FILTER, SERVICE_NAME); + Proto_RegisterModule(PROTOTYPE_FILTER, MODULENAME); HookEvent(ME_OPT_INITIALISE, OnOptInitialise); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/plugins/FileAsMessage/src/optionsdlg.cpp b/plugins/FileAsMessage/src/optionsdlg.cpp index c889e3cf95..2a1a2d0786 100644 --- a/plugins/FileAsMessage/src/optionsdlg.cpp +++ b/plugins/FileAsMessage/src/optionsdlg.cpp @@ -44,11 +44,11 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (int indx = 0; indx < _countof(settingId); indx++) if (settingId[indx] > 0) - SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, db_get_dw(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx])); + SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULENAME, settingName[indx], settingDefault[indx])); else - SetDlgItemInt(hwndDlg, -settingId[indx], db_get_dw(NULL, SERVICE_NAME, settingName[indx], settingDefault[indx]), FALSE); + SetDlgItemInt(hwndDlg, -settingId[indx], db_get_dw(NULL, MODULENAME, settingName[indx], settingDefault[indx]), FALSE); - CheckDlgButton(hwndDlg, IDC_ALPHANUM, db_get_dw(NULL, SERVICE_NAME, "base64", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ALPHANUM, db_get_dw(NULL, MODULENAME, "base64", 1) ? BST_CHECKED : BST_UNCHECKED); return TRUE; @@ -93,9 +93,9 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l value = GetDlgItemInt(hwndDlg, -settingId[indx], &succ, FALSE); if (!succ) value = settingDefault[indx]; } - db_set_dw(NULL, SERVICE_NAME, settingName[indx], value); + db_set_dw(NULL, MODULENAME, settingName[indx], value); } - db_set_dw(NULL, SERVICE_NAME, "base64", (IsDlgButtonChecked(hwndDlg, IDC_ALPHANUM) == BST_CHECKED) ? 1 : 0); + db_set_dw(NULL, MODULENAME, "base64", (IsDlgButtonChecked(hwndDlg, IDC_ALPHANUM) == BST_CHECKED) ? 1 : 0); return TRUE; } diff --git a/plugins/FileAsMessage/src/stdafx.h b/plugins/FileAsMessage/src/stdafx.h index 519c80745d..3cc13e9f15 100644 --- a/plugins/FileAsMessage/src/stdafx.h +++ b/plugins/FileAsMessage/src/stdafx.h @@ -27,7 +27,7 @@ #define MAXBUFSIZE 4096 #define SERVICE_TITLE LPGEN("File As Message") -#define SERVICE_NAME "FileAsMessage" +#define MODULENAME "FileAsMessage" #define SERVICE_PREFIX "<%fAM-0023%>" @@ -35,9 +35,7 @@ struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(SERVICE_NAME) - {} + CMPlugin(); }; extern char *szServiceTitle; -- cgit v1.2.3