From 7478b207dea289dcddb5e1bce5b5191ac92605b1 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 20 Apr 2014 18:52:22 +0000 Subject: Dropbox: service and events reworked git-svn-id: http://svn.miranda-ng.org/main/trunk@9005 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox_menus.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'plugins/Dropbox/src/dropbox_menus.cpp') diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index 615aec238e..d01c1e1f88 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -1,17 +1,40 @@ #include "common.h" +INT_PTR CDropbox::SendFilesToDropboxCommand(void *obj, WPARAM hContact, LPARAM) +{ + CDropbox *instance = (CDropbox*)obj; + + if (!instance->HasAccessToken()) + return 1; + + instance->hTransferContact = hContact; + + HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, instance->GetDefaultContact(), 0); + + instance->dcftp[hwnd] = hContact; + + BBButton bbd = { sizeof(bbd) }; + bbd.pszModuleName = MODULE; + bbd.dwButtonID = BBB_ID_FILE_SEND; + bbd.bbbFlags = BBSF_DISABLED; + + CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&bbd); + + return 0; +} + void CDropbox::InitializeMenus() { CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(CLISTMENUITEM); - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; mi.pszService = MODULE"/SendFilesToDropbox"; mi.ptszName = LPGENT("Send files to Dropbox"); mi.position = -2000020000 + CMI_SEND_FILES; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE); contactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi); - CreateServiceFunctionObj(mi.pszService, SendFilesToDropbox, this); + CreateServiceFunctionObj(mi.pszService, SendFilesToDropboxCommand, this); } int CDropbox::OnPrebuildContactMenu(void *obj, WPARAM hContact, LPARAM lParam) -- cgit v1.2.3