diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-02-24 17:38:35 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-02-24 17:38:35 +0000 |
commit | e62bc2a6f28f6a7b7fcb3996e9fab86fae3239f7 (patch) | |
tree | 6fc970809eb2fbbbf383c1639f83c93a2edf406b /plugins/Dropbox/src/dropbox_events.cpp | |
parent | 994443d6cdca5a5a1204575a0cea2a198c9d01bb (diff) |
Dropbox:
- added ability to send files to contacts of other protocols
- many other little improvements
git-svn-id: http://svn.miranda-ng.org/main/trunk@8263 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_events.cpp')
-rw-r--r-- | plugins/Dropbox/src/dropbox_events.cpp | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index 02e2a788bd..b670370ae2 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -2,13 +2,16 @@ int CDropbox::OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
+ HookEvent(ME_FILEDLG_CANCELED, CDropbox::OnFileDoalogCancelled);
+ HookEvent(ME_FILEDLG_SUCCEEDED, CDropbox::OnFileDoalogSuccessed);
+
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = MODULE;
nlu.szSettingsModule = MODULE;
nlu.ptszDescriptiveName = L"Dropbox";
- Singleton<CDropbox>::GetInstance()->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ INSTANCE->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
MCONTACT hContact = GetDefaultContact();
if (!hContact)
@@ -20,6 +23,22 @@ int CDropbox::OnModulesLoaded(WPARAM wParam, LPARAM lParam) }
}
+ if (ServiceExists(MS_BB_ADDBUTTON))
+ {
+ BBButton bbd = { sizeof(bbd) };
+ bbd.pszModuleName = MODULE;
+
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.ptszTooltip = TranslateT("Send files to Dropbox");
+ bbd.hIcon = LoadSkinnedIconHandle(SKINICON_EVENT_FILE);
+ bbd.dwButtonID = BBB_ID_FILE_SEND;
+ bbd.dwDefPos = 100 + bbd.dwButtonID;
+ CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
+
+ HookEvent(ME_MSG_WINDOWEVENT, CDropbox::OnSrmmWindowOpened);
+ HookEvent(ME_MSG_BUTTONPRESSED, CDropbox::OnSrmmButtonPressed);
+ }
+
return 0;
}
@@ -37,4 +56,48 @@ int CDropbox::OnOptionsInit(WPARAM wParam, LPARAM lParam) //Options_AddPage(wParam, &odp);
return 0;
+}
+
+int CDropbox::OnContactDeleted(WPARAM hContact, LPARAM lParam)
+{
+ if (lstrcmpiA(GetContactProto(hContact), MODULE) == 0)
+ {
+ if (INSTANCE->HasAccessToken())
+ INSTANCE->DestroyAcceessToken(hContact);
+ }
+
+ return 0;
+}
+
+int CDropbox::OnSrmmWindowOpened(WPARAM hContact, LPARAM lParam)
+{
+ MessageWindowEventData *ev = (MessageWindowEventData*)lParam;
+ if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact)
+ {
+ WORD status = CallContactService(hContact, PS_GETSTATUS, 0, 0);
+
+ BBButton bbd = { sizeof(bbd) };
+ bbd.pszModuleName = MODULE;
+ bbd.bbbFlags = (ev->hContact != INSTANCE->GetDefaultContact() || status == ID_STATUS_OFFLINE) ? 0 : BBSF_HIDDEN | BBSF_DISABLED;
+
+ bbd.dwButtonID = BBB_ID_FILE_SEND;
+ CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
+ }
+
+ return 0;
+}
+
+int CDropbox::OnSrmmButtonPressed(WPARAM hContact, LPARAM lParam)
+{
+ CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
+ if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == BBB_ID_FILE_SEND && hContact)
+ {
+ INSTANCE->hContactTransfer = hContact;
+
+ HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, INSTANCE->GetDefaultContact(), 0);
+
+ dcftp[hwnd] = hContact;
+ }
+
+ return 0;
}
\ No newline at end of file |