From 020323a39b43152782541fd3897e3d2f6c72cfd1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 Dec 2015 17:13:27 +0000 Subject: 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 --- plugins/Dropbox/src/dropbox_menus.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'plugins/Dropbox/src/dropbox_menus.cpp') 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; + } } } -- cgit v1.2.3