From f9c7760f54c279327a977b0cb5ee028c8f0c0bfb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Dec 2016 20:51:42 +0300 Subject: more fixes --- plugins/QuickReplies/src/events.cpp | 44 ++++++++++++------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'plugins/QuickReplies') diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 1839bc891a..121d9a56ae 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -48,25 +48,21 @@ int OnModulesLoaded(WPARAM, LPARAM) hOnOptInitialized = HookEvent(ME_OPT_INITIALISE, OnOptInitialized); hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed); - if ( ServiceExists(MS_BB_ADDBUTTON)) { - Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1); - - char buttonNameTranslated[32], buttonName[32]; - mir_snprintf(buttonNameTranslated, "%s %x", Translate("Button"), iNumber + 1); - mir_snprintf(buttonName, MODULE" %x", iNumber + 1); - - BBButton bbd = {0}; - bbd.cbSize = sizeof(BBButton); - 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.hIcon = icon.hIcolib; - bbd.dwButtonID = iNumber; - bbd.dwDefPos = 220; - - CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); - } + Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1); + + char buttonNameTranslated[32], buttonName[32]; + mir_snprintf(buttonNameTranslated, "%s %x", Translate("Button"), iNumber + 1); + mir_snprintf(buttonName, MODULE" %x", iNumber + 1); + + 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.hIcon = icon.hIcolib; + bbd.dwButtonID = iNumber; + bbd.dwDefPos = 220; + Srmm_AddButton(&bbd); return 0; } @@ -139,18 +135,6 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) int OnPreShutdown(WPARAM, LPARAM) { - if (ServiceExists(MS_BB_REMOVEBUTTON)) - { - char buttonName[32]; - mir_snprintf(buttonName, MODULE" %x", iNumber + 1); - - BBButton bbd = {0}; - bbd.cbSize = sizeof(BBButton); - bbd.pszModuleName = buttonName; - bbd.dwButtonID = iNumber; - - CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd); - } UnhookEvent(hOnButtonPressed); UnhookEvent(hOnOptInitialized); UnhookEvent(hOnPreShutdown); -- cgit v1.2.3