1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include "stdafx.h"
int OnSrmmToolbarLoaded(WPARAM, LPARAM)
{
BBButton bbd = {};
bbd.pszModuleName = MODULENAME;
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_ISARROWBUTTON;
CMStringW tooltip(FORMAT, TranslateT("Upload files to..."));
bbd.pwszTooltip = tooltip;
bbd.hIcon = g_plugin.getIconHandle(IDI_UPLOAD);
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.dwDefPos = 100 + bbd.dwButtonID;
g_plugin.addButton(&bbd);
return 0;
}
int OnSrmmWindowOpened(WPARAM uType, LPARAM lParam)
{
auto *pDlg = (CSrmmBaseDialog *)lParam;
if (uType == MSG_WINDOW_EVT_OPENING && pDlg->m_hContact) {
BBButton bbd = {};
bbd.pszModuleName = MODULENAME;
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.bbbFlags = CanSendToContact(pDlg->m_hContact) ? BBSF_RELEASED : BBSF_DISABLED;
Srmm_SetButtonState(pDlg->m_hContact, &bbd);
}
return 0;
}
int OnSrmmButtonPressed(WPARAM, LPARAM lParam)
{
CustomButtonClickData *cbc = (CustomButtonClickData*)lParam;
if (mir_strcmp(cbc->pszModule, MODULENAME))
return 0;
if (cbc->dwButtonId != BBB_ID_FILE_SEND)
return 0;
if (cbc->flags != BBCF_ARROWCLICKED) {
ptrA defaultService(g_plugin.getStringA("DefaultService"));
if (defaultService) {
CCloudService *service = FindService(defaultService);
if (service)
service->OpenUploadDialog(cbc->hContact);
return 0;
}
}
HMENU hMenu = CreatePopupMenu();
for (auto &it : Services)
AppendMenu(hMenu, MF_STRING, Services.indexOf(&it) + 1, TranslateW(it->GetUserName()));
int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, nullptr);
DestroyMenu(hMenu);
if (pos > 0) {
CCloudService *service = Services[pos - 1];
service->OpenUploadDialog(cbc->hContact);
}
return 0;
}
|