summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox_menus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-12-22 17:13:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-12-22 17:13:27 +0000
commit020323a39b43152782541fd3897e3d2f6c72cfd1 (patch)
treeb62f0effdf2f6dc2e992e1441f7d6f3dd46b2dff /plugins/Dropbox/src/dropbox_menus.cpp
parent8508d083487e03f6dd0371ab2c67ec0168c7b746 (diff)
Dropbox:
- contact menu to verify PF1_IMSEND flag to disable it for protocols that don't support sending IMs; - code cleaning; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15930 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_menus.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index 4740d75570..7fd0c9a3cb 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -27,22 +27,20 @@ void CDropbox::InitializeMenus()
int CDropbox::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
{
- if (!hContact)
- return 0;
-
bool bShow = false;
- if (HasAccessToken() && !hTransferContact && hContact != GetDefaultContact())
- {
- char *proto = GetContactProto(hContact);
- bool isContact = db_get_b(hContact, proto, "ChatRoom", 0) == 0;
- if (proto && isContact)
- {
- 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 (isProtoOnline && (status != ID_STATUS_OFFLINE || canSendOffline))
- bShow = true;
+ char *proto = GetContactProto(hContact);
+ if (proto != NULL) {
+ bool bHasIM = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) != 0;
+ if (bHasIM && HasAccessToken() && !hTransferContact && hContact != GetDefaultContact()) {
+ bool isContact = db_get_b(hContact, proto, "ChatRoom", 0) == 0;
+ if (isContact) {
+ 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 (isProtoOnline && (status != ID_STATUS_OFFLINE || canSendOffline))
+ bShow = true;
+ }
}
}