From 500dd4848842f6d4207584417448586d060fbd6a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 Jul 2022 18:07:27 +0300 Subject: Contact: group of functions gathered into the personal namespace --- src/core/stdaway/src/awaymsg.cpp | 2 +- src/core/stdfile/src/file.cpp | 8 ++++---- src/core/stdfile/src/filerecvdlg.cpp | 10 +++++----- src/core/stdfile/src/filesenddlg.cpp | 2 +- src/core/stdfile/src/filexferdlg.cpp | 2 +- src/core/stdmsg/src/msgdialog.cpp | 12 ++++++------ src/core/stdmsg/src/msglog.cpp | 4 ++-- src/core/stdmsg/src/msgs.cpp | 2 +- src/core/stduseronline/src/useronline.cpp | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/core') diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index a2dcca0220..94f097fbe1 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -131,7 +131,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) { char *szProto = Proto_GetBaseAccountName(hContact); if (szProto != nullptr) { - if (!Contact_IsGroupChat(hContact, szProto)) { + 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 39e24e7c50..8dcb922619 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -35,11 +35,11 @@ static HGENMENU hSRFileMenuItem; wchar_t* GetContactID(MCONTACT hContact) { char *szProto = Proto_GetBaseAccountName(hContact); - if (Contact_IsGroupChat(hContact, szProto)) + if (Contact::IsGroupChat(hContact, szProto)) if (wchar_t *theValue = db_get_wsa(hContact, szProto, "ChatRoomID")) return theValue; - return Contact_GetInfo(CNF_UNIQUEID, hContact, szProto); + return Contact::GetInfo(CNF_UNIQUEID, hContact, szProto); } static INT_PTR SendFileCommand(WPARAM hContact, LPARAM) @@ -101,7 +101,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) cle.hContact = hContact; cle.hDbEvent = hdbe; cle.lParam = lParam; - if (g_plugin.bAutoAccept && Contact_OnList(hContact)) { + if (g_plugin.bAutoAccept && Contact::OnList(hContact)) { CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle); } else { @@ -288,7 +288,7 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) bool bEnabled = false; char *szProto = Proto_GetBaseAccountName(wParam); if (szProto != nullptr) { - bool isChat = Contact_IsGroupChat(wParam, szProto); + 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/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 651ae2746a..54aefe44c5 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -244,10 +244,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0); SetDlgItemText(hwndDlg, IDC_DATE, datetimestr); - ptrW info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact)); + ptrW info(Contact::GetInfo(CNF_UNIQUEID, dat->hContact)); SetDlgItemText(hwndDlg, IDC_NAME, (info) ? info : contactName); - if (!Contact_OnList(dat->hContact)) { + if (!Contact::OnList(dat->hContact)) { RECT rcBtn1, rcBtn2, rcDateCtrl; GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rcBtn1); GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rcBtn2); @@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l //don't check auto-min here to fix BUG#647620 PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK)); } - if (Contact_OnList(dat->hContact)) + if (Contact::OnList(dat->hContact)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); } return TRUE; @@ -343,9 +343,9 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case IDC_ADD: - Contact_Add(dat->hContact, hwndDlg); + Contact::Add(dat->hContact, hwndDlg); - if (Contact_OnList(dat->hContact)) + if (Contact::OnList(dat->hContact)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); break; diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 30f6fa84b8..017725e89d 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -238,7 +238,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l wchar_t *contactName = Clist_GetContactDisplayName(dat->hContact); SetDlgItemText(hwndDlg, IDC_TO, contactName); - ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact)); + ptrW id(Contact::GetInfo(CNF_UNIQUEID, dat->hContact)); SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName); if (fsd->ppFiles == nullptr) { diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 81f849acbb..bcd6c16c54 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -260,7 +260,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CreateDirectoryTreeW(dat->szSavePath); dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath); dat->transferStatus.szWorkingDir.w = mir_wstrdup(dat->szSavePath); - if (!Contact_OnList(dat->hContact)) + if (!Contact::OnList(dat->hContact)) dat->resumeBehaviour = FILERESUME_ASK; else dat->resumeBehaviour = g_plugin.getByte("IfExists", FILERESUME_ASK); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 8578ea4b2b..b05f576411 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -290,7 +290,7 @@ void CMsgDialog::OnDestroy() // a temporary contact should be destroyed after removing window from the window list to prevent recursion if (m_hContact && g_plugin.bDeleteTempCont) - if (!Contact_OnList(m_hContact)) + if (!Contact::OnList(m_hContact)) db_delete_contact(m_hContact); } @@ -771,7 +771,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) { case IDC_USERMENU: if (GetKeyState(VK_SHIFT) & 0x8000) { // copy user name - ptrW id(Contact_GetInfo(CNF_UNIQUEID, m_hContact, m_szProto)); + ptrW id(Contact::GetInfo(CNF_UNIQUEID, m_hContact, m_szProto)); if (id != nullptr && OpenClipboard(m_hwnd)) { HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t) + 1); if (hData) { @@ -796,9 +796,9 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case IDC_ADD: - Contact_Add(m_hContact, m_hwnd); + Contact::Add(m_hContact, m_hwnd); - if (Contact_OnList(m_hContact)) + if (Contact::OnList(m_hContact)) ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE); break; } @@ -1262,7 +1262,7 @@ void CMsgDialog::OnOptionsApplied(bool bUpdateAvatar) bool bShow = false; if (m_hContact && g_plugin.bShowButtons) { if (cbd->m_dwButtonCID == IDC_ADD) { - bShow = !Contact_OnList(m_hContact); + bShow = !Contact::OnList(m_hContact); cbd->m_bHidden = !bShow; } else bShow = true; @@ -1395,7 +1395,7 @@ void CMsgDialog::NotifyTyping(int mode) if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) return; - if (!g_plugin.bTypingUnknown && !Contact_OnList(m_hContact)) + if (!g_plugin.bTypingUnknown && !Contact::OnList(m_hContact)) return; // End user check diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 228ec4ea53..8fb1f5edbd 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -265,7 +265,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) wchar_t *szName; if (dbei.flags & DBEF_SENT) { - if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, 0, dbei.szModule)) + if (wchar_t *p = Contact::GetInfo(CNF_DISPLAY, 0, dbei.szModule)) szName = NEWWSTR_ALLOCA(p); else szName = TranslateT("Me"); @@ -285,7 +285,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) case EVENTTYPE_JABBER_CHATSTATES: case EVENTTYPE_JABBER_PRESENCE: if (dbei.flags & DBEF_SENT) { - if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, 0, dbei.szModule)) { + if (wchar_t *p = Contact::GetInfo(CNF_DISPLAY, 0, dbei.szModule)) { szName = NEWWSTR_ALLOCA(p); mir_free(p); } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index a0fb9d874f..95b209fd02 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 (!Contact_IsGroupChat(hContact, szProto)) + if (!Contact::IsGroupChat(hContact, szProto)) if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) bEnabled = true; } diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index ff7feb044b..3b1520a0a6 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -36,7 +36,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) int oldStatus = g_plugin.getWord(hContact, "OldStatus", ID_STATUS_OFFLINE); g_plugin.setWord(hContact, "OldStatus", (uint16_t)newStatus); if (Ignore_IsIgnored(hContact, IGNOREEVENT_USERONLINE)) return 0; - if (Contact_IsHidden(hContact)) return 0; + if (Contact::IsHidden(hContact)) return 0; if (newStatus == ID_STATUS_OFFLINE && oldStatus != ID_STATUS_OFFLINE) { // Remove the event from the queue if it exists since they are now offline MEVENT lastEvent = g_plugin.getDword(hContact, "LastEvent"); -- cgit v1.2.3