diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-10-23 09:07:09 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-10-23 09:07:09 +0000 |
commit | 69138332e3c696e058c78180408b3e18ab7f69eb (patch) | |
tree | 055082816a73f8bb5f9fb329c4127ecd05b7dbb0 /protocols/Skype/src | |
parent | 0e13cbe768de6de5cc4dccf5fab7fcd9f51a4b2e (diff) |
я запутался в пунктах меню
git-svn-id: http://svn.miranda-ng.org/main/trunk@2060 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src')
-rw-r--r-- | protocols/Skype/src/resource.h | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype.h | 6 | ||||
-rw-r--r-- | protocols/Skype/src/skype_icons.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_menus.cpp | 70 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 6 |
5 files changed, 79 insertions, 7 deletions
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index e5a3950e49..651a4c1a27 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h @@ -7,7 +7,7 @@ #define IDI_ICON 101
#define IDR_RUNTIME 102
#define IDI_AUTH_GRANT 103
-#define IDI_AUTH_ASK 104
+#define IDI_AUTH_REQUEST 104
#define IDI_AUTH_REVOKE 105
#define IDD_PASSWORDREQUEST 106
#define IDC_SN 1001
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h index b72661ca26..7422e19a1b 100644 --- a/protocols/Skype/src/skype.h +++ b/protocols/Skype/src/skype.h @@ -61,6 +61,12 @@ #define SKYPE_SEARCH_BYEMAIL 1002
#define SKYPE_SEARCH_BYNAMES 1003
+#define CMI_AUTH_REVOKE 0
+#define CMI_AUTH_REQUEST 1
+#define CMI_AUTH_GRANT 2
+
+#define CMITEMS_COUNT 3
+
extern CSkype* g_skype;
extern HINSTANCE g_hInstance;
diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp index 6f46e7d319..f9661572ce 100644 --- a/protocols/Skype/src/skype_icons.cpp +++ b/protocols/Skype/src/skype_icons.cpp @@ -4,7 +4,7 @@ _tag_iconList CSkypeProto::iconList[] = {
{ LPGENT("Protocol icon"), "main", IDI_ICON },
{ LPGENT("Revoke authorization"), "authRevoke", IDI_AUTH_REVOKE },
- { LPGENT("Request authorization"), "authAsk", IDI_AUTH_ASK },
+ { LPGENT("Request authorization"), "authRequest", IDI_AUTH_REQUEST },
{ LPGENT("Grant authorization"), "authGrant", IDI_AUTH_GRANT },
};
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()
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 16d5be39b9..93a7f8a53c 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -96,6 +96,7 @@ public: // icons
static void InitIcons();
static void UninitIcons();
+ HANDLE GetIconHandle(const char *name);
// menus
static void InitMenus();
@@ -210,8 +211,11 @@ protected: // menu
static HANDLE hChooserMenu;
static HANDLE hPrebuildMenuHook;
+ static HANDLE g_hContactMenuItems[CMITEMS_COUNT];
+ static HANDLE g_hContactMenuSvc[CMITEMS_COUNT];
static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam);
- int OnPrebuildContactMenu(WPARAM wParam, LPARAM);
+ int OnPrebuildContactMenu(WPARAM wParam, LPARAM);
+
// database
HANDLE AddDataBaseEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags, DWORD cbBlob, PBYTE pBlob);
|