From 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 22:27:16 +0000 Subject: - rest of menus cleared; - old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/theme.cpp | 49 ++++++++++++-------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) (limited to 'protocols/FacebookRM/src/theme.cpp') diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index c71e8df0bc..f2b14ce3bf 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -63,9 +63,7 @@ char *GetIconDescription(const char* name) } // Contact List menu stuff -HANDLE hHookPreBuildMenu; -HANDLE g_hContactMenuItems[CMITEMS_COUNT]; -HANDLE g_hContactMenuSvc[CMITEMS_COUNT]; +HGENMENU g_hContactMenuItems[CMITEMS_COUNT]; // Helper functions static FacebookProto * GetInstanceByHContact(HANDLE hContact) @@ -91,9 +89,7 @@ INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) { for (size_t i=0; i(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; @@ -101,7 +97,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) void InitContactMenus() { - hHookPreBuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu); CLISTMENUITEM mi = {sizeof(mi)}; mi.flags = CMIF_ICONFROMICOLIB; @@ -110,35 +106,35 @@ void InitContactMenus() mi.icolibItem = GetIconHandle("homepage"); mi.pszName = GetIconDescription("homepage"); mi.pszService = "FacebookProto/VisitProfile"; - g_hContactMenuSvc[CMI_VISIT_PROFILE] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitProfile>); + CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitProfile>); g_hContactMenuItems[CMI_VISIT_PROFILE] = Menu_AddContactMenuItem(&mi); mi.position=-2000006001; mi.icolibItem = GetIconHandle("authRevoke"); mi.pszName = GetIconDescription("authRevoke"); mi.pszService = "FacebookProto/CancelFriendship"; - g_hContactMenuSvc[CMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::CancelFriendship>); + CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::CancelFriendship>); g_hContactMenuItems[CMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi); mi.position=-2000006001; mi.icolibItem = GetIconHandle("authRevokeReq"); mi.pszName = GetIconDescription("authRevokeReq"); mi.pszService = "FacebookProto/CancelFriendshipRequest"; - g_hContactMenuSvc[CMI_AUTH_CANCEL] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnCancelFriendshipRequest>); + CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnCancelFriendshipRequest>); g_hContactMenuItems[CMI_AUTH_CANCEL] = Menu_AddContactMenuItem(&mi); mi.position=-2000006002; mi.icolibItem = GetIconHandle("authAsk"); mi.pszName = GetIconDescription("authAsk"); mi.pszService = "FacebookProto/RequestFriendship"; - g_hContactMenuSvc[CMI_AUTH_ASK] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::RequestFriendship>); + CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::RequestFriendship>); g_hContactMenuItems[CMI_AUTH_ASK] = Menu_AddContactMenuItem(&mi); mi.position=-2000006003; mi.icolibItem = GetIconHandle("authGrant"); mi.pszName = GetIconDescription("authGrant"); mi.pszService = "FacebookProto/ApproveFriendship"; - g_hContactMenuSvc[CMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::ApproveFriendship>); + CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::ApproveFriendship>); g_hContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi); } @@ -146,39 +142,24 @@ void UninitContactMenus() { for(size_t i=0; i(wParam); - EnableMenuItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true); + Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true); - if (!isOffline() && !DBGetContactSettingByte(hContact, m_szModuleName, "ChatRoom", 0)) + if (!isOffline() && !db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) { bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; - BYTE type = DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0); + BYTE type = db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0); - EnableMenuItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == FACEBOOK_CONTACT_NONE || !type); - EnableMenuItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == FACEBOOK_CONTACT_APPROVE); - EnableMenuItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == FACEBOOK_CONTACT_FRIEND); - EnableMenuItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == FACEBOOK_CONTACT_REQUEST); + Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == FACEBOOK_CONTACT_NONE || !type); + Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == FACEBOOK_CONTACT_APPROVE); + Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == FACEBOOK_CONTACT_FRIEND); + Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == FACEBOOK_CONTACT_REQUEST); } return 0; -- cgit v1.2.3