summaryrefslogtreecommitdiff
path: root/plugins/PasteIt
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/PasteIt
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/PasteIt')
-rw-r--r--plugins/PasteIt/src/Options.cpp46
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp16
-rw-r--r--plugins/PasteIt/src/stdafx.h6
3 files changed, 35 insertions, 33 deletions
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp
index 8a23ecc154..70a578ce7c 100644
--- a/plugins/PasteIt/src/Options.cpp
+++ b/plugins/PasteIt/src/Options.cpp
@@ -630,7 +630,7 @@ unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int
void Options::SetDefWeb(int web)
{
defWeb = web;
- db_set_ws(0, MODULE, "defWeb", pasteToWebs[web]->GetName());
+ db_set_ws(0, MODULENAME, "defWeb", pasteToWebs[web]->GetName());
DefWebPageChanged();
}
@@ -698,11 +698,11 @@ int Options::InitOptions(WPARAM wParam, LPARAM)
void Options::Save()
{
- db_set_ws(0, MODULE, "defWeb", pasteToWebs[defWeb]->GetName());
- db_set_dw(0, MODULE, "codepage", codepage);
- db_set_b(0, MODULE, "autoUTF", autoUTF ? 1 : 0);
- db_set_b(0, MODULE, "confDlg", confDlg ? 1 : 0);
- db_set_b(0, MODULE, "autoSend", autoSend ? 1 : 0);
+ db_set_ws(0, MODULENAME, "defWeb", pasteToWebs[defWeb]->GetName());
+ db_set_dw(0, MODULENAME, "codepage", codepage);
+ db_set_b(0, MODULENAME, "autoUTF", autoUTF ? 1 : 0);
+ db_set_b(0, MODULENAME, "confDlg", confDlg ? 1 : 0);
+ db_set_b(0, MODULENAME, "autoSend", autoSend ? 1 : 0);
for (int i = 0; i < PasteToWeb::pages; ++i) {
char buf[256];
wchar_t* name = pasteToWebs[i]->GetName();
@@ -719,29 +719,29 @@ void Options::Save()
forms += it->id + L'=' + it->name + L';';
}
- db_set_ws(0, MODULE, buf, forms.c_str());
+ db_set_ws(0, MODULENAME, buf, forms.c_str());
mir_strncpy(buf + j, "defFormatId", _countof(buf) - j);
- db_set_ws(0, MODULE, buf, webOptions[i]->defFormatId.c_str());
+ db_set_ws(0, MODULENAME, buf, webOptions[i]->defFormatId.c_str());
if (webOptions[i]->isSendFileName) {
mir_strncpy(buf + j, "sendFileName", _countof(buf) - j);
- db_set_b(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0);
+ db_set_b(0, MODULENAME, buf, webOptions[i]->sendFileName ? 1 : 0);
}
if (webOptions[i]->isPublicPaste) {
mir_strncpy(buf + j, "publicPaste", _countof(buf) - j);
- db_set_b(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0);
+ db_set_b(0, MODULENAME, buf, webOptions[i]->publicPaste ? 1 : 0);
}
if (webOptions[i]->isCombo1) {
mir_strncpy(buf + j, "combo1", _countof(buf) - j);
- db_set_ws(0, MODULE, buf, webOptions[i]->combo1.c_str());
+ db_set_ws(0, MODULENAME, buf, webOptions[i]->combo1.c_str());
}
if (webOptions[i]->isPastebin) {
mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j);
- db_set_ws(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str());
+ db_set_ws(0, MODULENAME, buf, webOptions[i]->pastebinUserKey.c_str());
}
}
}
@@ -749,7 +749,7 @@ void Options::Save()
void Options::Load()
{
DBVARIANT defWebV;
- if (!db_get_ws(0, MODULE, "defWeb", &defWebV)) {
+ if (!db_get_ws(0, MODULENAME, "defWeb", &defWebV)) {
for (int i = 0; i < PasteToWeb::pages; ++i) {
if (!mir_wstrcmp(pasteToWebs[i]->GetName(), defWebV.pwszVal)) {
defWeb = i;
@@ -758,10 +758,10 @@ void Options::Load()
}
db_free(&defWebV);
}
- codepage = db_get_dw(0, MODULE, "codepage", CP_ACP);
- autoUTF = db_get_b(0, MODULE, "autoUTF", 1) ? true : false;
- confDlg = db_get_b(0, MODULE, "confDlg", 1) ? true : false;
- autoSend = db_get_b(0, MODULE, "autoSend", 0) ? true : false;
+ codepage = db_get_dw(0, MODULENAME, "codepage", CP_ACP);
+ autoUTF = db_get_b(0, MODULENAME, "autoUTF", 1) ? true : false;
+ confDlg = db_get_b(0, MODULENAME, "confDlg", 1) ? true : false;
+ autoSend = db_get_b(0, MODULENAME, "autoSend", 0) ? true : false;
for (int i = 0; i < PasteToWeb::pages; ++i) {
char buf[256];
int j = 0;
@@ -776,7 +776,7 @@ void Options::Load()
mir_strncpy(buf + j, "formats", _countof(buf) - j);
DBVARIANT forms;
- if (!db_get_ws(0, MODULE, buf, &forms)) {
+ if (!db_get_ws(0, MODULENAME, buf, &forms)) {
webOptions[i]->formats.clear();
int k = 0;
wchar_t *id = forms.pwszVal;
@@ -803,25 +803,25 @@ void Options::Load()
mir_strncpy(buf + j, "defFormatId", _countof(buf) - j);
DBVARIANT defForm;
- if (!db_get_ws(0, MODULE, buf, &defForm)) {
+ if (!db_get_ws(0, MODULENAME, buf, &defForm)) {
webOptions[i]->defFormatId = defForm.pwszVal;
db_free(&defForm);
}
if (webOptions[i]->isSendFileName) {
mir_strncpy(buf + j, "sendFileName", _countof(buf) - j);
- webOptions[i]->sendFileName = db_get_b(0, MODULE, buf, 1) ? true : false;
+ webOptions[i]->sendFileName = db_get_b(0, MODULENAME, buf, 1) ? true : false;
}
if (webOptions[i]->isPublicPaste) {
mir_strncpy(buf + j, "publicPaste", _countof(buf) - j);
- webOptions[i]->publicPaste = db_get_b(0, MODULE, buf, 0) ? true : false;
+ webOptions[i]->publicPaste = db_get_b(0, MODULENAME, buf, 0) ? true : false;
}
if (webOptions[i]->isCombo1) {
mir_strncpy(buf + j, "combo1", _countof(buf) - j);
DBVARIANT combo1;
- if (!db_get_ws(0, MODULE, buf, &combo1)) {
+ if (!db_get_ws(0, MODULENAME, buf, &combo1)) {
webOptions[i]->combo1 = combo1.pwszVal;
db_free(&combo1);
}
@@ -830,7 +830,7 @@ void Options::Load()
if (webOptions[i]->isPastebin) {
mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j);
DBVARIANT pastebinUserKey;
- if (!db_get_ws(0, MODULE, buf, &pastebinUserKey)) {
+ if (!db_get_ws(0, MODULENAME, buf, &pastebinUserKey)) {
webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal;
db_free(&pastebinUserKey);
}
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 0a3341afe2..fa66646577 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -45,7 +45,7 @@ CHAT_MANAGER *pci;
/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo =
+PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -59,9 +59,13 @@ PLUGININFOEX pluginInfo =
{ 0x1aac15e8, 0xdcec, 0x4050, { 0xb6, 0x6f, 0x2a, 0xa0, 0xe6, 0x12, 0xc, 0x22 } }
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -184,7 +188,7 @@ static int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam)
{
CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
- if (!mir_strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) {
+ if (!mir_strcmp(cbc->pszModule, MODULENAME) && cbc->dwButtonId == 1 && hContact) {
if (cbc->flags == BBCF_ARROWCLICKED) {
HMENU hMenu = CreatePopupMenu();
if (hMenu) {
@@ -307,7 +311,7 @@ static void InitTabsrmmButton()
{
BBButton btn = {};
btn.dwButtonID = 1;
- btn.pszModuleName = MODULE;
+ btn.pszModuleName = MODULENAME;
btn.dwDefPos = 110;
btn.hIcon = iconList[0].hIcolib;
btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON;
@@ -351,14 +355,14 @@ static int ModulesLoaded(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load(void)
{
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
pci = Chat_GetInterface();
g_plugin.registerIcon(LPGEN("Paste It"), iconList);
NETLIBUSER nlu = {};
nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_HTTPCONNS;
- nlu.szSettingsModule = MODULE;
+ nlu.szSettingsModule = MODULENAME;
nlu.szDescriptiveName.w = TranslateT("Paste It HTTP connections");
g_hNetlibUser = Netlib_RegisterUser(&nlu);
diff --git a/plugins/PasteIt/src/stdafx.h b/plugins/PasteIt/src/stdafx.h
index 139b7ed2dc..347e4e0dff 100644
--- a/plugins/PasteIt/src/stdafx.h
+++ b/plugins/PasteIt/src/stdafx.h
@@ -38,11 +38,9 @@
extern PasteToWeb* pasteToWebs[PasteToWeb::pages];
-#define MODULE "PasteIt"
+#define MODULENAME "PasteIt"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULE)
- {}
+ CMPlugin();
};