From cd4272ca22d47cdf673bfb0e5ec353acca3d9569 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 16 Jul 2022 21:23:06 +0300 Subject: Contact_IsGroupChat - a helper to detect chat rooms --- protocols/Sametime/src/conference.cpp | 6 +++--- protocols/Sametime/src/sametime.cpp | 4 ++-- protocols/Sametime/src/sametime_proto.cpp | 2 +- protocols/Sametime/src/session_announce_win.cpp | 2 +- protocols/Sametime/src/userlist.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'protocols/Sametime') diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index fe3fcd5957..3dae386909 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -318,7 +318,7 @@ int CSametimeProto::GcEventHook(WPARAM, LPARAM lParam) { int CSametimeProto::ChatDeleted(MCONTACT hContact) { - if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0) + if (!Contact_IsGroupChat(hContact, m_szModuleName)) return 0; debugLogW(L"CSametimeProto::ChatDeleted() hContact=[%x]", hContact); @@ -379,7 +379,7 @@ int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM) MCONTACT hContact = (MCONTACT)wParam; debugLogW(L"CSametimeProto::PrebuildContactMenu() hContact=[%x]", hContact); - Menu_ShowItem(hLeaveChatMenuItem, db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 1); + Menu_ShowItem(hLeaveChatMenuItem, Contact_IsGroupChat(hContact, m_szModuleName)); // if user is already in our meeting, bool not_present = true; @@ -400,7 +400,7 @@ int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM) db_free(&dbv); } - Menu_ShowItem(hCreateChatMenuItem, db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0 && not_present); + Menu_ShowItem(hCreateChatMenuItem, !Contact_IsGroupChat(hContact, m_szModuleName) && not_present); return 0; } diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 0b309c9987..35ab74786b 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -103,7 +103,7 @@ int CSametimeProto::OnWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData *mwed = (MessageWindowEventData*)lParam; - if ((mwed == nullptr) || db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0)) + if ((mwed == nullptr) || Contact_IsGroupChat(mwed->hContact, m_szModuleName)) return 0; if ((mwed->uType == MSG_WINDOW_EVT_CLOSING) || (mwed->uType == MSG_WINDOW_EVT_CLOSE)) @@ -140,7 +140,7 @@ void CSametimeProto::SetAllOffline() debugLogW(L"SetAllOffline() start"); for (auto &hContact : AccContacts()) { - if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) { + if (Contact_IsGroupChat(hContact, m_szModuleName)) { db_delete_contact(hContact); continue; } diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 46b583cddb..02e3dd717f 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -129,7 +129,7 @@ int CSametimeProto::GetInfo(MCONTACT hContact, int infoType) // GetInfo - retrieves a contact info debugLogW(L"CSametimeProto::GetInfo() hContact=[%x], infoType=[%d]", hContact, infoType); - if (getByte(hContact, "ChatRoom", 0)) + if (Contact_IsGroupChat(hContact)) return 1; if (!session) diff --git a/protocols/Sametime/src/session_announce_win.cpp b/protocols/Sametime/src/session_announce_win.cpp index 459a067530..d01f047cc6 100644 --- a/protocols/Sametime/src/session_announce_win.cpp +++ b/protocols/Sametime/src/session_announce_win.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK SessionAnnounceDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPara lvI.iSubItem = 0; for (auto &hContact : proto->AccContacts()) { - if (db_get_b(hContact, proto->m_szModuleName, "ChatRoom", 0) == 0 + if (!Contact_IsGroupChat(hContact, proto->m_szModuleName) && db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { lvI.lParam = (LPARAM)hContact; lvI.pszText = Clist_GetContactDisplayName(hContact); diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index fe90f548c1..ccc5d46a3c 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -373,7 +373,7 @@ int CSametimeProto::ContactDeleted(MCONTACT hContact) { mwAwareIdBlock id_block; - if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) + if (Contact_IsGroupChat(hContact, m_szModuleName)) return 0; debugLogW(L"CSametimeProto::ContactDeleted()"); @@ -586,7 +586,7 @@ void CSametimeProto::UserListCreate() GList *gl = nullptr; for (auto &hContact : AccContacts()) { - if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0 /*&& proto && !mir_strcmp( PROTO, proto)*/) { + if (!Contact_IsGroupChat(hContact, m_szModuleName) /*&& proto && !mir_strcmp( PROTO, proto)*/) { if (!db_get_utf(hContact, m_szModuleName, "stid", &dbv)) { if (dbv.pszVal) { if (GetAwareIdFromContact(hContact, &id_block)) { -- cgit v1.2.3