From 87643a27f1e2b1bdfd30a06f162112908aa6ac17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 9 Jul 2014 09:04:03 +0000 Subject: Nudge: - Don't show menu item for accounts that are disabled in nudge options - Don't show menu item for group chats - Version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@9741 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Nudge/src/Version.h | 2 +- plugins/Nudge/src/main.cpp | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'plugins/Nudge') diff --git a/plugins/Nudge/src/Version.h b/plugins/Nudge/src/Version.h index 04ec37b438..965767c3bb 100644 --- a/plugins/Nudge/src/Version.h +++ b/plugins/Nudge/src/Version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 0 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index bf6258f156..9ded94b5ae 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -28,13 +28,15 @@ PLUGININFOEX pluginInfo = { { 0xe47cc215, 0xd28, 0x462d, { 0xa0, 0xf6, 0x3a, 0xe4, 0x44, 0x3d, 0x29, 0x26 } } }; -INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam) +INT_PTR NudgeShowMenu(WPARAM wParam, LPARAM lParam) { - for (NudgeElementList *n = NudgeList; n != NULL; n = n->next) + for (NudgeElementList *n = NudgeList; n != NULL; n = n->next) { if (!strcmp((char *)wParam, n->item.ProtocolName)) { - Menu_ShowItem(n->item.hContactMenu, lParam != 0); + bool bEnabled = GlobalNudge.useByProtocol ? n->item.enabled : DefaultNudge.enabled; + Menu_ShowItem(n->item.hContactMenu, bEnabled && lParam != 0); break; } + } return 0; } @@ -263,7 +265,7 @@ void HideNudgeButton(MCONTACT hContact) } } -static int ContactWindowOpen(WPARAM wparam, LPARAM lParam) +static int ContactWindowOpen(WPARAM wParam, LPARAM lParam) { MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact) @@ -272,11 +274,24 @@ static int ContactWindowOpen(WPARAM wparam, LPARAM lParam) return 0; } +static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) +{ + char *szProto = GetContactProto(wParam); + if (szProto != NULL) { + bool isChat = db_get_b(wParam, szProto, "ChatRoom", false) != 0; + NudgeShowMenu((WPARAM)szProto, (LPARAM)!isChat); + } + + return 0; +} + int ModulesLoaded(WPARAM, LPARAM) { LoadProtocols(); LoadPopupClass(); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); + if (HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonInit)) { HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); HookEvent(ME_MSG_WINDOWEVENT, ContactWindowOpen); -- cgit v1.2.3