diff options
author | George Hazan <ghazan@miranda.im> | 2022-07-16 21:23:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-07-16 21:23:06 +0300 |
commit | cd4272ca22d47cdf673bfb0e5ec353acca3d9569 (patch) | |
tree | 0e2a4879766d8197cdf8a8fb6d5f5033399a0ea4 /src/core | |
parent | d6a052756f58211067a7a67d7e3c1dbe7e6c9465 (diff) |
Contact_IsGroupChat - a helper to detect chat rooms
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdaway/src/awaymsg.cpp | 3 | ||||
-rw-r--r-- | src/core/stdfile/src/file.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index 1b4d5d25f9..a2dcca0220 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -131,8 +131,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) {
char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto != nullptr) {
- int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
- if (!chatRoom) {
+ if (!Contact_IsGroupChat(hContact, szProto)) {
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index e257013663..39e24e7c50 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -35,7 +35,7 @@ static HGENMENU hSRFileMenuItem; wchar_t* GetContactID(MCONTACT hContact)
{
char *szProto = Proto_GetBaseAccountName(hContact);
- if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
+ if (Contact_IsGroupChat(hContact, szProto))
if (wchar_t *theValue = db_get_wsa(hContact, szProto, "ChatRoomID"))
return theValue;
@@ -288,7 +288,7 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) bool bEnabled = false;
char *szProto = Proto_GetBaseAccountName(wParam);
if (szProto != nullptr) {
- bool isChat = db_get_b(wParam, szProto, "ChatRoom", false) != 0;
+ bool isChat = Contact_IsGroupChat(wParam, szProto);
if (CallProtoService(szProto, PS_GETCAPS, isChat ? PFLAGNUM_4 : PFLAGNUM_1, 0) & (isChat ? PF4_GROUPCHATFILES : PF1_FILESEND)) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
bEnabled = true;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 89e5395ace..fbe29a10b3 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -488,7 +488,7 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
// leave this menu item hidden for chats
- if (!db_get_b(hContact, szProto, "ChatRoom", 0))
+ if (!Contact_IsGroupChat(hContact, szProto))
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
bEnabled = true;
}
|