diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-02-24 18:08:46 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-02-24 18:08:46 +0000 |
commit | 03563512f9572fe74bc60adba3f7b6cdcc1d1047 (patch) | |
tree | fc2989c4c6a495ab461a5234184711624362e714 /plugins/Dropbox/src | |
parent | e62bc2a6f28f6a7b7fcb3996e9fab86fae3239f7 (diff) |
Dropbox: fixed status detection
git-svn-id: http://svn.miranda-ng.org/main/trunk@8264 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src')
-rw-r--r-- | plugins/Dropbox/src/dropbox_events.cpp | 17 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_menus.cpp | 13 |
2 files changed, 17 insertions, 13 deletions
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index b670370ae2..8f234b770d 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -69,16 +69,19 @@ int CDropbox::OnContactDeleted(WPARAM hContact, LPARAM lParam) return 0;
}
-int CDropbox::OnSrmmWindowOpened(WPARAM hContact, LPARAM lParam)
+int CDropbox::OnSrmmWindowOpened(WPARAM wParam, LPARAM lParam)
{
MessageWindowEventData *ev = (MessageWindowEventData*)lParam;
if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact)
{
- WORD status = CallContactService(hContact, PS_GETSTATUS, 0, 0);
+ WORD status = db_get_w(ev->hContact, GetContactProto(ev->hContact), "Status", ID_STATUS_OFFLINE);
BBButton bbd = { sizeof(bbd) };
bbd.pszModuleName = MODULE;
- bbd.bbbFlags = (ev->hContact != INSTANCE->GetDefaultContact() || status == ID_STATUS_OFFLINE) ? 0 : BBSF_HIDDEN | BBSF_DISABLED;
+ if (ev->hContact == INSTANCE->GetDefaultContact())
+ bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED;
+ else if (status == ID_STATUS_OFFLINE)
+ bbd.bbbFlags = BBSF_DISABLED;
bbd.dwButtonID = BBB_ID_FILE_SEND;
CallService(MS_BB_SETBUTTONSTATE, (WPARAM)ev->hContact, (LPARAM)&bbd);
@@ -87,16 +90,16 @@ int CDropbox::OnSrmmWindowOpened(WPARAM hContact, LPARAM lParam) return 0;
}
-int CDropbox::OnSrmmButtonPressed(WPARAM hContact, LPARAM lParam)
+int CDropbox::OnSrmmButtonPressed(WPARAM wParam, LPARAM lParam)
{
CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
- if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == BBB_ID_FILE_SEND && hContact)
+ if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == BBB_ID_FILE_SEND && cbc->hContact)
{
- INSTANCE->hContactTransfer = hContact;
+ INSTANCE->hContactTransfer = cbc->hContact;
HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, INSTANCE->GetDefaultContact(), 0);
- dcftp[hwnd] = hContact;
+ dcftp[hwnd] = cbc->hContact;
}
return 0;
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index f510858240..a4047d4be8 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -40,17 +40,18 @@ int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM lParam) return 0;
//bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- WORD status = CallContactService(hContact, PS_GETSTATUS, 0, 0);
+ char *module = GetContactProto(hContact);
+ WORD status = db_get_w(hContact, module, "Status", ID_STATUS_OFFLINE);
+ CallContactService(hContact, PS_GETSTATUS, 0, 0);
if (hContact == INSTANCE->GetDefaultContact() || status == ID_STATUS_OFFLINE)
Menu_ShowItem(INSTANCE->ContactMenuItems[CMI_SEND_FILES], FALSE);
else
- {
Menu_DisableItem(INSTANCE->ContactMenuItems[CMI_SEND_FILES], INSTANCE->hContactTransfer);
- if (strcmp(GetContactProto(hContact), MODULE))
- {
- Menu_ShowItem(INSTANCE->ContactMenuItems[CMI_API_REQUEST_AUTH], FALSE);
- }
+
+ if (strcmp(module, MODULE))
+ {
+ Menu_ShowItem(INSTANCE->ContactMenuItems[CMI_API_REQUEST_AUTH], FALSE);
}
return 0;
|