From 7e7e977e3dd74fe09c62d7b345bbbbecf33602a4 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 4 Apr 2014 19:43:40 +0000 Subject: Dropbox: hides "Send to Dropbox" item when protocol is offline git-svn-id: http://svn.miranda-ng.org/main/trunk@8857 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox_events.cpp | 3 ++- plugins/Dropbox/src/dropbox_menus.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index df5dfc14a4..efd8687762 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -92,6 +92,7 @@ int CDropbox::OnSrmmWindowOpened(void *obj, WPARAM wParam, LPARAM lParam) if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact) { char *proto = GetContactProto(ev->hContact); + bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE; WORD status = db_get_w(ev->hContact, proto, "Status", ID_STATUS_OFFLINE); bool canSendOffline = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0; @@ -101,7 +102,7 @@ int CDropbox::OnSrmmWindowOpened(void *obj, WPARAM wParam, LPARAM lParam) bbd.bbbFlags = BBSF_RELEASED; if (!instance->HasAccessToken() || ev->hContact == instance->GetDefaultContact() || !instance->HasAccessToken()) bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED; - else if (status == ID_STATUS_OFFLINE && !canSendOffline) + else if (!isProtoOnline || (status == ID_STATUS_OFFLINE && !canSendOffline)) bbd.bbbFlags = BBSF_DISABLED; CallService(MS_BB_SETBUTTONSTATE, ev->hContact, (LPARAM)&bbd); diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp index fe5f38d234..615aec238e 100644 --- a/plugins/Dropbox/src/dropbox_menus.cpp +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -27,10 +27,11 @@ int CDropbox::OnPrebuildContactMenu(void *obj, WPARAM hContact, LPARAM lParam) return 0; char *proto = GetContactProto(hContact); + bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE; WORD status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE); bool canSendOffline = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0; - if (hContact != instance->GetDefaultContact() && (status != ID_STATUS_OFFLINE || canSendOffline) && instance->HasAccessToken() && !instance->hTransferContact) + if (hContact != instance->GetDefaultContact() && isProtoOnline && (status != ID_STATUS_OFFLINE || canSendOffline) && instance->HasAccessToken() && !instance->hTransferContact) Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], TRUE); return 0; -- cgit v1.2.3