From fa5c1b20964e669cf50de378d02ed72c5f9d789b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Apr 2017 12:10:10 +0300 Subject: Quick Replies: - perversion with copying dlls removed; - click on the Options button now leads to the correct options page; - bunch of old crap removed; - version bump --- plugins/QuickReplies/src/events.cpp | 38 +++++-------------------------- plugins/QuickReplies/src/quickreplies.cpp | 7 +----- plugins/QuickReplies/src/stdafx.h | 12 +--------- plugins/QuickReplies/src/version.h | 2 +- 4 files changed, 9 insertions(+), 50 deletions(-) diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 73f918c9d7..73a8172070 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -21,32 +21,14 @@ Boston, MA 02111-1307, USA. using namespace std; -BYTE iNumber; - -HANDLE hOnOptInitialized; -HANDLE hOnButtonPressed; -HANDLE hQuickRepliesService; - -INT_PTR QuickRepliesService(WPARAM, LPARAM) -{ - return TRUE; -} - static IconItem icon = { LPGEN("Button"), "qr_button", IDI_QICON }; +int iNumber = 0; + int OnModulesLoaded(WPARAM, LPARAM) { - UnhookEvent(hOnModulesLoaded); - - if (!ServiceExists(MS_QUICKREPLIES_SERVICE)) { - iNumber = 0; - hQuickRepliesService = CreateServiceFunction(MS_QUICKREPLIES_SERVICE, QuickRepliesService); - } - else iNumber = db_get_b(NULL, MODULE, "InstancesCount", 0); - db_set_b(NULL, MODULE, "InstancesCount", iNumber + 1); - - hOnOptInitialized = HookEvent(ME_OPT_INITIALISE, OnOptInitialized); - hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed); + HookEvent(ME_OPT_INITIALISE, OnOptInitialized); + HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed); Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1); @@ -57,7 +39,7 @@ int OnModulesLoaded(WPARAM, LPARAM) BBButton bbd = {}; bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON; bbd.pszModuleName = buttonName; - bbd.pwszTooltip = LPGENW("Quick Replies\r\nLeft button - open menu\r\nRight button - options page"); + bbd.pwszTooltip = LPGENW("Quick Replies"); bbd.hIcon = icon.hIcolib; bbd.dwButtonID = iNumber; bbd.dwDefPos = 220; @@ -83,7 +65,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON) { mir_snprintf(buttonName, "%s %x", Translate("Button"), iNumber + 1); - Options_Open(L"Message Sessions", L"Quick Replies", _A2T(buttonName)); + Options_Open(L"Message sessions", L"Quick Replies", _A2T(buttonName)); return 0; } @@ -121,11 +103,3 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) return 1; } - -int OnPreShutdown(WPARAM, LPARAM) -{ - UnhookEvent(hOnButtonPressed); - UnhookEvent(hOnOptInitialized); - UnhookEvent(hOnPreShutdown); - return 0; -} diff --git a/plugins/QuickReplies/src/quickreplies.cpp b/plugins/QuickReplies/src/quickreplies.cpp index 8e452608ff..69707049fa 100644 --- a/plugins/QuickReplies/src/quickreplies.cpp +++ b/plugins/QuickReplies/src/quickreplies.cpp @@ -22,9 +22,6 @@ Boston, MA 02111-1307, USA. HINSTANCE hInstance = NULL; int hLangpack; -HANDLE hOnModulesLoaded; -HANDLE hOnPreShutdown; - PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -54,13 +51,11 @@ extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); - hOnModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hOnPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); return 0; } extern "C" __declspec(dllexport) int Unload(void) { - DestroyServiceFunction(hQuickRepliesService); return 0; } diff --git a/plugins/QuickReplies/src/stdafx.h b/plugins/QuickReplies/src/stdafx.h index 356ee7891c..3c5ae4b296 100644 --- a/plugins/QuickReplies/src/stdafx.h +++ b/plugins/QuickReplies/src/stdafx.h @@ -42,20 +42,10 @@ Boston, MA 02111-1307, USA. #define MS_QUICKREPLIES_SERVICE MODULE"/Service" extern HINSTANCE hInstance; - -extern BYTE iNumber; - -extern HANDLE hOnOptInitialized; -extern HANDLE hOnButtonPressed; -extern HANDLE hQuickRepliesService; -extern HANDLE hOnModulesLoaded; -extern HANDLE hOnPreShutdown; - -INT_PTR QuickRepliesService(WPARAM wParam, LPARAM lParam); +extern int iNumber; int OnModulesLoaded(WPARAM wParam, LPARAM lParam); int OnOptInitialized(WPARAM wParam, LPARAM lParam); int OnButtonPressed(WPARAM wParam, LPARAM lParam); -int OnPreShutdown(WPARAM wParam, LPARAM lParam); #endif //__QUICK_REPLY_H__ \ No newline at end of file diff --git a/plugins/QuickReplies/src/version.h b/plugins/QuickReplies/src/version.h index bb1331a137..d9977bad25 100644 --- a/plugins/QuickReplies/src/version.h +++ b/plugins/QuickReplies/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 #define __RELEASE_NUM 1 -#define __BUILD_NUM 0 +#define __BUILD_NUM 2 #include -- cgit v1.2.3