diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-07-09 09:04:03 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-07-09 09:04:03 +0000 |
commit | 87643a27f1e2b1bdfd30a06f162112908aa6ac17 (patch) | |
tree | f10e7ec2e4bf31cd075175bacc18fac77d03f88e /plugins | |
parent | 047076a15f1588d173e09dbb33f9beb15756f408 (diff) |
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
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Nudge/src/Version.h | 2 | ||||
-rw-r--r-- | plugins/Nudge/src/main.cpp | 23 |
2 files changed, 20 insertions, 5 deletions
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 <stdver.h>
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);
|