summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-03-15 10:10:51 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-03-15 10:10:51 +0000
commitccd3481caa5dda6816747901108166298c8037d9 (patch)
treee72418c55d54631c06c389a4179867525ad2b9e6 /plugins
parent40989eb0a17169c3b2e44a51a7db91b1876bbd62 (diff)
Dropbox: fixed sending link after upload
git-svn-id: http://svn.miranda-ng.org/main/trunk@16484 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dropbox/src/dropbox.h6
-rw-r--r--plugins/Dropbox/src/dropbox_events.cpp29
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp11
-rw-r--r--plugins/Dropbox/src/dropbox_services.cpp10
-rw-r--r--plugins/Dropbox/src/stdafx.h2
-rw-r--r--plugins/Dropbox/src/version.h4
6 files changed, 39 insertions, 23 deletions
diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h
index 1910731f18..1b2272729d 100644
--- a/plugins/Dropbox/src/dropbox.h
+++ b/plugins/Dropbox/src/dropbox.h
@@ -35,6 +35,8 @@ private:
HGENMENU contactMenuItems[CMI_MAX];
+ std::map<MCONTACT, HWND> interceptedContacts;
+
LIST<FileTransferParam> transfers;
// hooks
@@ -46,6 +48,7 @@ private:
int OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam);
int OnSrmmWindowOpened(WPARAM wParam, LPARAM lParam);
int OnTabSrmmButtonPressed(WPARAM wParam, LPARAM lParam);
+ int OnFileDialogCancelled(WPARAM wParam, LPARAM lParam);
// services
static INT_PTR ProtoGetCaps(WPARAM wParam, LPARAM lParam);
@@ -104,9 +107,6 @@ private:
static INT_PTR SendFilesToDropboxCommand(void *obj, WPARAM wParam, LPARAM lParam);
- // SRMM
- static void DisableSrmmButton(MCONTACT hContact);
-
// utils
static char* PreparePath(const char *oldPath, char *newPath);
static char* PreparePath(const TCHAR *oldPath, char *newPath);
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp
index 02c1d7184f..8b7785da2d 100644
--- a/plugins/Dropbox/src/dropbox_events.cpp
+++ b/plugins/Dropbox/src/dropbox_events.cpp
@@ -7,6 +7,7 @@ int CDropbox::OnModulesLoaded(WPARAM, LPARAM)
HookEventObj(ME_CLIST_PREBUILDCONTACTMENU, GlobalEvent<&CDropbox::OnPrebuildContactMenu>, this);
HookEventObj(ME_MSG_WINDOWEVENT, GlobalEvent<&CDropbox::OnSrmmWindowOpened>, this);
+ HookEventObj(ME_FILEDLG_CANCELED, GlobalEvent<&CDropbox::OnFileDialogCancelled>, this);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -88,28 +89,26 @@ int CDropbox::OnTabSrmmButtonPressed(WPARAM, LPARAM lParam)
{
CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
if (!mir_strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == BBB_ID_FILE_SEND && cbc->hContact) {
- CallService(MS_FILE_SENDFILE, GetDefaultContact(), 0);
+ auto it = interceptedContacts.find(cbc->hContact);
+ if (it == interceptedContacts.end())
+ {
+ HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, cbc->hContact, 0);
+ interceptedContacts[cbc->hContact] = hwnd;
+ }
+ else
+ FlashWindow(it->second, FALSE);
}
return 0;
}
-void CDropbox::DisableSrmmButton(MCONTACT hContact)
+int CDropbox::OnFileDialogCancelled(WPARAM hContact, LPARAM lParam)
{
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
- bbd.dwButtonID = BBB_ID_FILE_SEND;
- bbd.bbbFlags = BBSF_DISABLED;
- CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&bbd);
-}
+ auto it = interceptedContacts.find(hContact);
+ if (it != interceptedContacts.end())
+ interceptedContacts.erase(it);
-void __stdcall EnableTabSrmmButtonSync(void *arg)
-{
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
- bbd.dwButtonID = BBB_ID_FILE_SEND;
- bbd.bbbFlags = BBSF_RELEASED;
- CallService(MS_BB_SETBUTTONSTATE, (UINT_PTR)arg, (LPARAM)&bbd);
+ return 0;
}
int CDropbox::OnProtoAck(WPARAM, LPARAM lParam)
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index e99b92abf4..c4949ee421 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -1,12 +1,19 @@
#include "stdafx.h"
-INT_PTR CDropbox::SendFilesToDropboxCommand(void *obj, WPARAM, LPARAM)
+INT_PTR CDropbox::SendFilesToDropboxCommand(void *obj, WPARAM hContact, LPARAM)
{
CDropbox *instance = (CDropbox*)obj;
if (!instance->HasAccessToken())
return 1;
- CallService(MS_FILE_SENDFILE, instance->GetDefaultContact(), 0);
+ auto it = instance->interceptedContacts.find(hContact);
+ if (it == instance->interceptedContacts.end())
+ {
+ HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, hContact, 0);
+ instance->interceptedContacts[hContact] = hwnd;
+ }
+ else
+ SetActiveWindow(it->second);
return 0;
}
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp
index 08774cef96..ead7cac8f1 100644
--- a/plugins/Dropbox/src/dropbox_services.cpp
+++ b/plugins/Dropbox/src/dropbox_services.cpp
@@ -70,8 +70,16 @@ INT_PTR CDropbox::ProtoSendFileInterceptor(WPARAM wParam, LPARAM lParam)
const char *proto = GetContactProto(pccsd->hContact);
if (!IsAccountIntercepted(proto))
- return CALLSERVICE_NOTFOUND;
+ {
+ auto it = interceptedContacts.find(pccsd->hContact);
+ if (it == interceptedContacts.end())
+ return CALLSERVICE_NOTFOUND;
+ }
+ auto it = interceptedContacts.find(pccsd->hContact);
+ if (it != interceptedContacts.end())
+ interceptedContacts.erase(it);
+
return ProtoSendFile(wParam, lParam);
}
diff --git a/plugins/Dropbox/src/stdafx.h b/plugins/Dropbox/src/stdafx.h
index b83d80895b..22489fabd8 100644
--- a/plugins/Dropbox/src/stdafx.h
+++ b/plugins/Dropbox/src/stdafx.h
@@ -8,6 +8,8 @@
#include <malloc.h>
#include <time.h>
+#include <map>
+
#include <newpluginapi.h>
#include <m_options.h>
diff --git a/plugins/Dropbox/src/version.h b/plugins/Dropbox/src/version.h
index a54c801dad..75ee9ec7f6 100644
--- a/plugins/Dropbox/src/version.h
+++ b/plugins/Dropbox/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 12
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 2
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 1
#include <stdver.h>