summaryrefslogtreecommitdiff
path: root/plugins/QuickMessages/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
commit8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch)
tree03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/QuickMessages/src
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/QuickMessages/src')
-rw-r--r--plugins/QuickMessages/src/Utils.cpp40
-rw-r--r--plugins/QuickMessages/src/main.cpp20
-rw-r--r--plugins/QuickMessages/src/options.cpp24
-rw-r--r--plugins/QuickMessages/src/stdafx.h6
4 files changed, 46 insertions, 44 deletions
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp
index 1fa555b4c6..626df47e54 100644
--- a/plugins/QuickMessages/src/Utils.cpp
+++ b/plugins/QuickMessages/src/Utils.cpp
@@ -153,22 +153,22 @@ void SaveModuleSettings(int buttonnum, ButtonData* bd)
char szMEntry[256] = { '\0' };
mir_snprintf(szMEntry, "EntryName_%u_%u", buttonnum, bd->dwPos);
- db_set_ws(NULL, PLGNAME, szMEntry, bd->pszName);
+ db_set_ws(NULL, MODULENAME, szMEntry, bd->pszName);
mir_snprintf(szMEntry, "EntryValue_%u_%u", buttonnum, bd->dwPos);
if (bd->pszValue)
- db_set_ws(NULL, PLGNAME, szMEntry, bd->pszValue);
+ db_set_ws(NULL, MODULENAME, szMEntry, bd->pszValue);
else
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "EntryRel_%u_%u", buttonnum, bd->dwPos);
- db_set_b(NULL, PLGNAME, szMEntry, bd->fEntryType);
+ db_set_b(NULL, MODULENAME, szMEntry, bd->fEntryType);
mir_snprintf(szMEntry, "EntryToQMenu_%u_%u", buttonnum, bd->dwPos);
- db_set_b(NULL, PLGNAME, szMEntry, bd->bInQMenu);
+ db_set_b(NULL, MODULENAME, szMEntry, bd->bInQMenu);
mir_snprintf(szMEntry, "EntryIsServiceName_%u_%u", buttonnum, bd->dwPos);
- db_set_b(NULL, PLGNAME, szMEntry, bd->bIsServName);
+ db_set_b(NULL, MODULENAME, szMEntry, bd->bIsServName);
}
void CleanSettings(int buttonnum, int from)
@@ -177,24 +177,24 @@ void CleanSettings(int buttonnum, int from)
DBVARIANT dbv = { 0 };
if (from == -1) {
mir_snprintf(szMEntry, "ButtonName_%u", buttonnum);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "ButtonValue_%u", buttonnum);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "RCEntryIsServiceName_%u", buttonnum);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
}
mir_snprintf(szMEntry, "EntryName_%u_%u", buttonnum, from);
- while (!db_get_ws(NULL, PLGNAME, szMEntry, &dbv)) {
- db_unset(NULL, PLGNAME, szMEntry);
+ while (!db_get_ws(NULL, MODULENAME, szMEntry, &dbv)) {
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "EntryValue_%u_%u", buttonnum, from);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "EntryRel_%u_%u", buttonnum, from);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "EntryToQMenu_%u_%u", buttonnum, from);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "EntryIsServiceName_%u_%u", buttonnum, from);
- db_unset(NULL, PLGNAME, szMEntry);
+ db_unset(NULL, MODULENAME, szMEntry);
mir_snprintf(szMEntry, "EntryName_%u_%u", buttonnum, ++from);
}
@@ -219,7 +219,7 @@ BYTE getEntryByte(int buttonnum, int entrynum, BOOL mode)
mir_snprintf(szMEntry, "RCEntryIsServiceName_%u", buttonnum);
break;
}
- return db_get_b(NULL, PLGNAME, szMEntry, 0);
+ return db_get_b(NULL, MODULENAME, szMEntry, 0);
}
static HANDLE AddIcon(char* szIcoName)
@@ -240,7 +240,7 @@ static HANDLE AddIcon(char* szIcoName)
DWORD BalanceButtons(int buttonsWas, int buttonsNow)
{
BBButton bb = {};
- bb.pszModuleName = PLGNAME;
+ bb.pszModuleName = MODULENAME;
while (buttonsWas > buttonsNow) {
bb.dwButtonID = --buttonsWas;
@@ -270,7 +270,7 @@ void InitButtonsList()
ListData* ld = nullptr;
if (!(pszBName = getMenuEntry(i, 0, 3))) {
g_iButtonsCount = i;
- db_set_b(NULL, PLGNAME, "ButtonsCount", (BYTE)g_iButtonsCount);
+ db_set_b(NULL, MODULENAME, "ButtonsCount", (BYTE)g_iButtonsCount);
break;
}
@@ -352,7 +352,7 @@ wchar_t* getMenuEntry(int buttonnum, int entrynum, BYTE mode)
break;
}
- if (!db_get_ws(NULL, PLGNAME, szMEntry, &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, szMEntry, &dbv)) {
if (mir_wstrlen(dbv.ptszVal))
buffer = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
@@ -374,7 +374,7 @@ int RegisterCustomButton(WPARAM, LPARAM)
bbd.dwButtonID = i;
bbd.dwDefPos = 320 + i;
bbd.hIcon = AddIcon(iconname);
- bbd.pszModuleName = PLGNAME;
+ bbd.pszModuleName = MODULENAME;
bbd.pwszTooltip = ld->ptszButtonName;
Srmm_AddButton(&bbd);
}
diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp
index 974abd24d0..b6de6a8e11 100644
--- a/plugins/QuickMessages/src/main.cpp
+++ b/plugins/QuickMessages/src/main.cpp
@@ -32,7 +32,7 @@ BOOL g_bQuickMenu = 0;
/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo =
+PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -46,9 +46,13 @@ PLUGININFOEX pluginInfo =
{ 0x37ed754b, 0x6cf9, 0x40ed, { 0x9e, 0xb6, 0xf, 0xef, 0x8e, 0x82, 0x24, 0x75 } }
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -136,7 +140,7 @@ static int InputMenuPopup(WPARAM, LPARAM lParam)
static int CustomButtonPressed(WPARAM, LPARAM lParam)
{
CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
- if (mir_strcmp(cbcd->pszModule, PLGNAME))
+ if (mir_strcmp(cbcd->pszModule, MODULENAME))
return 0;
if (!ButtonsList[cbcd->dwButtonId])
@@ -266,10 +270,10 @@ static int PluginInit(WPARAM, LPARAM)
HookTemporaryEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton);
- g_bRClickAuto = db_get_b(NULL, PLGNAME, "RClickAuto", 0);
- g_bLClickAuto = db_get_b(NULL, PLGNAME, "LClickAuto", 0);
- g_iButtonsCount = db_get_b(NULL, PLGNAME, "ButtonsCount", 0);
- g_bQuickMenu = db_get_b(NULL, PLGNAME, "QuickMenu", 1);
+ g_bRClickAuto = db_get_b(NULL, MODULENAME, "RClickAuto", 0);
+ g_bLClickAuto = db_get_b(NULL, MODULENAME, "LClickAuto", 0);
+ g_iButtonsCount = db_get_b(NULL, MODULENAME, "ButtonsCount", 0);
+ g_bQuickMenu = db_get_b(NULL, MODULENAME, "QuickMenu", 1);
InitButtonsList();
@@ -279,7 +283,7 @@ static int PluginInit(WPARAM, LPARAM)
extern "C" __declspec(dllexport) int Load(void)
{
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp
index 22da0bf26b..a298bba934 100644
--- a/plugins/QuickMessages/src/options.cpp
+++ b/plugins/QuickMessages/src/options.cpp
@@ -249,25 +249,25 @@ void SaveMenuTree()
if (ld->ptszQValue) {
mir_snprintf(szMEntry, "ButtonValue_%u", iBl);
- db_set_ws(NULL, PLGNAME, szMEntry, ld->ptszQValue);
+ db_set_ws(NULL, MODULENAME, szMEntry, ld->ptszQValue);
}
if (((ld->dwOPFlags & QMF_NEW) || (ld->dwOPFlags & QMF_RENAMED) || bDeleted)) {
BBButton bb = {};
- bb.pszModuleName = PLGNAME;
+ bb.pszModuleName = MODULENAME;
bb.dwButtonID = iBl;
bb.pwszTooltip = ld->ptszButtonName;
Srmm_ModifyButton(&bb);
}
mir_snprintf(szMEntry, "ButtonName_%u", iBl);
- db_set_ws(NULL, PLGNAME, szMEntry, ld->ptszButtonName);
+ db_set_ws(NULL, MODULENAME, szMEntry, ld->ptszButtonName);
ld->dwOPFlags = 0;
ld->dwPos = iBl;
ld->bIsServName = ld->bIsOpServName;
mir_snprintf(szMEntry, "RCEntryIsServiceName_%u", iBl);
- db_set_b(NULL, PLGNAME, szMEntry, ld->bIsServName);
+ db_set_b(NULL, MODULENAME, szMEntry, ld->bIsServName);
bDeleted = FALSE;
@@ -314,7 +314,7 @@ void SaveMenuTree()
iBl++;
}
- db_set_b(NULL, PLGNAME, "ButtonsCount", (BYTE)g_iButtonsCount);
+ db_set_b(NULL, MODULENAME, "ButtonsCount", (BYTE)g_iButtonsCount);
}
void RestoreModuleData()
@@ -504,7 +504,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
g_opHdlg = hdlg;
bOptionsInit = TRUE;
TranslateDialogDefault(hdlg);
- if (g_iButtonsCount != db_get_b(NULL, PLGNAME, "ButtonsCount", 0)) {
+ if (g_iButtonsCount != db_get_b(NULL, MODULENAME, "ButtonsCount", 0)) {
LOGFONT logFont;
HFONT hFont;
bNeedRestart = TRUE;
@@ -553,9 +553,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
EnableWindow(GetDlgItem(hdlg, IDC_MENUVALUE), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_INQMENU), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_ISSERVNAME), FALSE);
- CheckDlgButton(hdlg, IDC_RAUTOSEND, (g_bRClickAuto = db_get_b(NULL, PLGNAME, "RClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_LAUTOSEND, (g_bLClickAuto = db_get_b(NULL, PLGNAME, "LClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_ENABLEQUICKMENU, (g_bQuickMenu = db_get_b(NULL, PLGNAME, "QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_RAUTOSEND, (g_bRClickAuto = db_get_b(NULL, MODULENAME, "RClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_LAUTOSEND, (g_bLClickAuto = db_get_b(NULL, MODULENAME, "LClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_ENABLEQUICKMENU, (g_bQuickMenu = db_get_b(NULL, MODULENAME, "QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED);
bOptionsInit = FALSE;
}break;
@@ -694,9 +694,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
SetMenuEntryProperties(hdlg);
SaveMenuTree();
}
- db_set_b(NULL, PLGNAME, "RClickAuto", (BYTE)(g_bRClickAuto = IsDlgButtonChecked(hdlg, IDC_RAUTOSEND)));
- db_set_b(NULL, PLGNAME, "LClickAuto", (BYTE)(g_bLClickAuto = IsDlgButtonChecked(hdlg, IDC_LAUTOSEND)));
- db_set_b(NULL, PLGNAME, "QuickMenu", (BYTE)(g_bQuickMenu = IsDlgButtonChecked(hdlg, IDC_ENABLEQUICKMENU)));
+ db_set_b(NULL, MODULENAME, "RClickAuto", (BYTE)(g_bRClickAuto = IsDlgButtonChecked(hdlg, IDC_RAUTOSEND)));
+ db_set_b(NULL, MODULENAME, "LClickAuto", (BYTE)(g_bLClickAuto = IsDlgButtonChecked(hdlg, IDC_LAUTOSEND)));
+ db_set_b(NULL, MODULENAME, "QuickMenu", (BYTE)(g_bQuickMenu = IsDlgButtonChecked(hdlg, IDC_ENABLEQUICKMENU)));
return 1;
}
else if (((LPNMHDR)lparam)->code == PSN_RESET) {
diff --git a/plugins/QuickMessages/src/stdafx.h b/plugins/QuickMessages/src/stdafx.h
index f41f46e448..278bea3676 100644
--- a/plugins/QuickMessages/src/stdafx.h
+++ b/plugins/QuickMessages/src/stdafx.h
@@ -41,13 +41,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "version.h"
#include "Utils.h"
-#define PLGNAME "QuickMessages"
+#define MODULENAME "QuickMessages"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(PLGNAME)
- {}
+ CMPlugin();
};
extern HANDLE hIcolib;