summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_menus.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-10-23 09:07:09 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-10-23 09:07:09 +0000
commit69138332e3c696e058c78180408b3e18ab7f69eb (patch)
tree055082816a73f8bb5f9fb329c4127ecd05b7dbb0 /protocols/Skype/src/skype_menus.cpp
parent0e13cbe768de6de5cc4dccf5fab7fcd9f51a4b2e (diff)
я запутался в пунктах меню
git-svn-id: http://svn.miranda-ng.org/main/trunk@2060 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_menus.cpp')
-rw-r--r--protocols/Skype/src/skype_menus.cpp70
1 files changed, 66 insertions, 4 deletions
diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp
index e2a7c222d2..128862dc03 100644
--- a/protocols/Skype/src/skype_menus.cpp
+++ b/protocols/Skype/src/skype_menus.cpp
@@ -2,6 +2,8 @@
HANDLE CSkypeProto::hChooserMenu;
HANDLE CSkypeProto::hPrebuildMenuHook;
+HANDLE CSkypeProto::g_hContactMenuSvc[CMITEMS_COUNT];
+HANDLE CSkypeProto::g_hContactMenuItems[CMITEMS_COUNT];
INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam)
{
@@ -34,12 +36,41 @@ CSkypeProto* CSkypeProto::GetInstanceByHContact(HANDLE hContact)
return NULL;
}
+INT_PTR SkypeMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam)
+{
+ CSkypeProto* ppro = CSkypeProto::GetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuHandleRequestAuth(wParam, lParam) : 0;
+}
+
+INT_PTR SkypeMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam)
+{
+ CSkypeProto* ppro = CSkypeProto::GetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuHandleGrantAuth(wParam, lParam) : 0;
+}
+
+INT_PTR SkypeMenuRevokeAuth(WPARAM wParam, LPARAM lParam)
+{
+ CSkypeProto* ppro = CSkypeProto::GetInstanceByHContact((HANDLE)wParam);
+ return(ppro) ? ppro->OnMenuRevokeAuth(wParam, lParam) : 0;
+}
+
+static void sttEnableMenuItem(HANDLE hMenuItem, BOOL bEnable)
+{
+ CLISTMENUITEM clmi = {0};
+ clmi.cbSize = sizeof(CLISTMENUITEM);
+ clmi.flags = CMIM_FLAGS;
+ if (!bEnable)
+ clmi.flags |= CMIF_HIDDEN;
+
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
+}
+
int CSkypeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- /*sttEnableMenuItem( g_hMenuRequestAuth, FALSE );
- sttEnableMenuItem( g_hMenuGrantAuth, FALSE );
- sttEnableMenuItem( g_hMenuRevokeAuth, FALSE );
- sttEnableMenuItem( g_hMenuCommands, FALSE );
+ sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_REQUEST], FALSE );
+ sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_GRANT], FALSE );
+ sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_REVOKE], FALSE );
+ /*sttEnableMenuItem( g_hMenuCommands, FALSE );
sttEnableMenuItem( g_hMenuSendNote, FALSE );
sttEnableMenuItem( g_hMenuConvert, FALSE );
sttEnableMenuItem( g_hMenuRosterAdd, FALSE );
@@ -64,6 +95,37 @@ void CSkypeProto::InitMenus()
mnu.name = "SkypeAccountChooser";
mnu.ExecService = "Skype/MenuChoose";
hChooserMenu = (HANDLE)::CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu);
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ // Contact menu initialization
+
+ CLISTMENUITEM mi = { 0 };
+ mi.cbSize = sizeof(CLISTMENUITEM);
+
+ // "Request authorization"
+ mi.ptszName = LPGENT("Request authorization");
+ mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
+ mi.position = -2000001000;
+ mi.icolibItem = GetIconHandle("authReuest");
+ mi.pszService = "Skype/ReqAuth";
+ g_hContactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
+ g_hContactMenuSvc[CMI_AUTH_REQUEST] = CreateServiceFunction(mi.pszService, SkypeMenuHandleRequestAuth);
+
+ // "Grant authorization"
+ mi.pszService = "Skype/GrantAuth";
+ mi.ptszName = LPGENT("Grant authorization");
+ mi.position = -2000001001;
+ mi.icolibItem = GetIconHandle("authGrant");
+ g_hContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
+ g_hContactMenuSvc[CMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService, SkypeMenuHandleGrantAuth);
+
+ // Revoke auth
+ mi.pszService = "Skype/RevokeAuth";
+ mi.ptszName = LPGENT("Revoke authorization");
+ mi.position = -2000001002;
+ mi.icolibItem = GetIconHandle("authRevoke");
+ g_hContactMenuItems[CMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
+ g_hContactMenuSvc[CMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService, SkypeMenuRevokeAuth);
}
void CSkypeProto::UninitMenus()