summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Skype/res/Resource.rc2
-rw-r--r--protocols/Skype/res/auth_request.ico (renamed from protocols/Skype/res/auth_ask.ico)bin2038 -> 2038 bytes
-rw-r--r--protocols/Skype/src/resource.h2
-rw-r--r--protocols/Skype/src/skype.h6
-rw-r--r--protocols/Skype/src/skype_icons.cpp2
-rw-r--r--protocols/Skype/src/skype_menus.cpp70
-rw-r--r--protocols/Skype/src/skype_proto.h6
7 files changed, 80 insertions, 8 deletions
diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc
index 24bf49d7e3..8f36797779 100644
--- a/protocols/Skype/res/Resource.rc
+++ b/protocols/Skype/res/Resource.rc
@@ -136,7 +136,7 @@ END
// remains consistent on all systems.
IDI_ICON ICON "Main.ico"
IDI_AUTH_GRANT ICON "auth_grant.ico"
-IDI_AUTH_ASK ICON "auth_ask.ico"
+IDI_AUTH_REQUEST ICON "auth_request.ico"
IDI_AUTH_REVOKE ICON "auth_revoke.ico"
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Skype/res/auth_ask.ico b/protocols/Skype/res/auth_request.ico
index 1db6f7f23e..1db6f7f23e 100644
--- a/protocols/Skype/res/auth_ask.ico
+++ b/protocols/Skype/res/auth_request.ico
Binary files differ
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);