From 5a3fa95fbe1930c035cd1adffee0792b7d1d8846 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Mar 2013 20:37:12 +0000 Subject: GTalk menu item is inserted now into the Jabber protocol menu git-svn-id: http://svn.miranda-ng.org/main/trunk@4190 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/GTalkExt/src/handlers.cpp | 2 ++ protocols/GTalkExt/src/inbox.cpp | 6 +----- protocols/GTalkExt/src/inbox.h | 4 +++- protocols/GTalkExt/src/menu.cpp | 32 ++++++++++++++++++-------------- 4 files changed, 24 insertions(+), 20 deletions(-) (limited to 'protocols/GTalkExt') diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 3b48137b3c..83e4c036ad 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -22,6 +22,7 @@ #include "StdAfx.h" #include "handlers.h" #include "db.h" +#include "inbox.h" #include "notifications.h" #include "options.h" @@ -423,6 +424,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) japi->Net()->AddSendHandler(SendHandler); } + HookEvent(ME_JABBER_MENUINIT, InitMenus); HookOptionsInitialization(); return 0; } diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 4faf247172..bb699e365c 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -238,12 +238,8 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) mir_forkthread(ShellExecuteThread, mir_tstrdup(url)); } -void OpenContactInbox(HANDLE hContact) +void OpenContactInbox(LPCSTR acc) { - LPSTR acc = GetContactProto(hContact); - if (!acc) - return; - DBVARIANT dbv; if ( DBGetContactSettingTString(0, acc, "jid", &dbv)) return; diff --git a/protocols/GTalkExt/src/inbox.h b/protocols/GTalkExt/src/inbox.h index 0b00128ab9..2b26a074ca 100644 --- a/protocols/GTalkExt/src/inbox.h +++ b/protocols/GTalkExt/src/inbox.h @@ -22,4 +22,6 @@ #pragma once void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url); -void OpenContactInbox(HANDLE hContact); \ No newline at end of file +void OpenContactInbox(LPCSTR acc); + +int InitMenus(WPARAM wParam, LPARAM lParam); diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index 377b776091..ea241e6f55 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -25,26 +25,30 @@ #include "inbox.h" static const LPSTR MS_GTALKEXT_OPENMAILBOX = SHORT_PLUGIN_NAME "/OpenMailbox"; -static const LPTSTR _T(OPEN_MAILBOX_ITEM_CAPTION) = LPGENT("Open mailbox"); extern HICON g_hPopupIcon; -HANDLE hOnPrebuildMenu = 0; - -INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam) +INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam, LPARAM param) { - OpenContactInbox((HANDLE)wParam); + OpenContactInbox((LPCSTR)param); return 0; } -void InitMenus() +int InitMenus(WPARAM wParam, LPARAM lParam) { - CreateServiceFunction(MS_GTALKEXT_OPENMAILBOX, OpenMailboxMenuHandler); -/*!!!!!!!!!!!!!!!!!!!!! - CLISTMENUITEM cmi = { sizeof(cmi) }; - cmi.flags = CMIF_TCHAR; - cmi.hIcon = g_hPopupIcon; - cmi.ptszName = _T(OPEN_MAILBOX_ITEM_CAPTION); - cmi.pszService = MS_GTALKEXT_OPENMAILBOX; - Menu_AddContactMenuItem(&cmi); */ + IJabberInterface *ji = (IJabberInterface*)lParam; + + char szServiceName[100]; + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s/%s", ji->Sys()->GetModuleName(), MS_GTALKEXT_OPENMAILBOX); + CreateServiceFunctionParam(szServiceName, OpenMailboxMenuHandler, (LPARAM)ji->Sys()->GetModuleName()); + + CLISTMENUITEM cmi = { sizeof(cmi) }; + cmi.flags = CMIF_CHILDPOPUP; + cmi.hParentMenu = HGENMENU(wParam); + cmi.hIcon = g_hPopupIcon; + cmi.position = 200101; + cmi.pszName = LPGEN("Open mailbox"); + cmi.pszService = szServiceName; + Menu_AddProtoMenuItem(&cmi); + return 0; } -- cgit v1.2.3