summaryrefslogtreecommitdiff
path: root/plugins/QuickReplies/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/QuickReplies/src
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/QuickReplies/src')
-rw-r--r--plugins/QuickReplies/src/events.cpp10
-rw-r--r--plugins/QuickReplies/src/options.cpp16
-rw-r--r--plugins/QuickReplies/src/quickreplies.cpp4
-rw-r--r--plugins/QuickReplies/src/stdafx.h8
4 files changed, 20 insertions, 18 deletions
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp
index efb7cab324..14488e58ab 100644
--- a/plugins/QuickReplies/src/events.cpp
+++ b/plugins/QuickReplies/src/events.cpp
@@ -37,7 +37,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
char buttonNameTranslated[32], buttonName[32];
mir_snprintf(buttonNameTranslated, "%s %x", Translate("Button"), iNumber + 1);
- mir_snprintf(buttonName, MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonName, MODULENAME" %x", iNumber + 1);
BBButton bbd = {};
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
@@ -55,7 +55,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
char buttonName[32];
- mir_snprintf(buttonName, MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonName, MODULENAME" %x", iNumber + 1);
if (mir_strcmp(cbcd->pszModule, buttonName))
return 0;
@@ -64,7 +64,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
char key[64];
mir_snprintf(key, "RepliesCount_%x", iNumber);
- int count = db_get_w(NULL, MODULE, key, 0);
+ int count = db_get_w(NULL, MODULENAME, key, 0);
if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON) {
mir_snprintf(buttonName, "%s %x", Translate("Button"), iNumber + 1);
@@ -77,7 +77,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
LIST<wchar_t> replyList(1);
for (int i = 0; i < count; i++) {
mir_snprintf(key, "Reply_%x_%x", iNumber, i);
- ptrW value(db_get_wsa(NULL, MODULE, key));
+ ptrW value(db_get_wsa(NULL, MODULENAME, key));
if (value == nullptr)
replyList.insert(mir_wstrdup(L""));
else
@@ -95,7 +95,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
CallService(MS_MSG_SENDMESSAGEW, cbcd->hContact, (LPARAM)replyList[index - 1]);
mir_snprintf(key, "ImmediatelySend_%x", iNumber);
- if (db_get_b(NULL, MODULE, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
+ if (db_get_b(NULL, MODULENAME, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
}
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp
index 46abcd6ba6..70dc1fb2ca 100644
--- a/plugins/QuickReplies/src/options.cpp
+++ b/plugins/QuickReplies/src/options.cpp
@@ -69,14 +69,14 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
mir_snprintf(key, "ImmediatelySend_%x", iNumber);
- CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, db_get_w(NULL, MODULE, key, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, db_get_w(NULL, MODULENAME, key, 1) ? BST_CHECKED : BST_UNCHECKED);
mir_snprintf(key, "RepliesCount_%x", iNumber);
- count = db_get_w(NULL, MODULE, key, 0);
+ count = db_get_w(NULL, MODULENAME, key, 0);
for (int i = 0; i < count; i++) {
mir_snprintf(key, "Reply_%x_%x", iNumber, i);
- wchar_t *value = db_get_wsa(NULL, MODULE, key);
+ wchar_t *value = db_get_wsa(NULL, MODULENAME, key);
if (value) {
replies.Append(value);
replies.Append(L"\r\n");
@@ -113,11 +113,11 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
wchar_t *tszReplies;
mir_snprintf(key, "RepliesCount_%x", iNumber);
- count = db_get_b(NULL, MODULE, key, 0);
+ count = db_get_b(NULL, MODULENAME, key, 0);
for (int i = 0; i < count; i++) {
mir_snprintf(key, "Reply_%x_%x", iNumber, i);
- db_unset(NULL, MODULE, key);
+ db_unset(NULL, MODULENAME, key);
}
int length = SendDlgItemMessage(hwndDlg, IDC_REPLIES, WM_GETTEXTLENGTH, 0, 0);
@@ -133,17 +133,17 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int pos = -1, prev = 0;
while ((pos = replies.Find(L"\r\n", prev)) != -1) {
mir_snprintf(key, "Reply_%x_%x", iNumber, count++);
- db_set_ws(NULL, MODULE, key, replies.Mid(prev, pos - prev).GetBuffer());
+ db_set_ws(NULL, MODULENAME, key, replies.Mid(prev, pos - prev).GetBuffer());
prev = pos + 2;
}
}
mir_free(tszReplies);
mir_snprintf(key, "RepliesCount_%x", iNumber);
- db_set_w(NULL, MODULE, key, count);
+ db_set_w(NULL, MODULENAME, key, count);
mir_snprintf(key, "ImmediatelySend_%x", iNumber);
- db_set_b(NULL, MODULE, key, IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
+ db_set_b(NULL, MODULENAME, key, IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
return TRUE;
}
diff --git a/plugins/QuickReplies/src/quickreplies.cpp b/plugins/QuickReplies/src/quickreplies.cpp
index 22754bf120..d3bfe12faa 100644
--- a/plugins/QuickReplies/src/quickreplies.cpp
+++ b/plugins/QuickReplies/src/quickreplies.cpp
@@ -38,6 +38,10 @@ PLUGININFOEX pluginInfoEx =
{0xa6a031b6, 0xd32f, 0x4842, {0x98, 0xc6, 0xec, 0x71, 0x6c, 0x57, 0x6b, 0x77}}
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
diff --git a/plugins/QuickReplies/src/stdafx.h b/plugins/QuickReplies/src/stdafx.h
index f56d5845d1..821c91bab3 100644
--- a/plugins/QuickReplies/src/stdafx.h
+++ b/plugins/QuickReplies/src/stdafx.h
@@ -35,16 +35,14 @@ Boston, MA 02111-1307, USA.
#include "version.h"
#include "resource.h"
-#define MODULE "QuickReplies"
+#define MODULENAME "QuickReplies"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULE)
- {}
+ CMPlugin();
};
-#define MS_QUICKREPLIES_SERVICE MODULE"/Service"
+#define MS_QUICKREPLIES_SERVICE MODULENAME"/Service"
extern int iNumber;