From ba8b5469506b3f0caeeead89028a5b61120206e3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 8 Jan 2024 13:22:45 +0300 Subject: no need to call PSS_GETINFO, PSS_GETAWAYMSG, PSS_FILEALLOW, PSS_FILEDENY & PSS_FILECANCEL via Proto_ChainSend with all those filters etc, the simple call of CallContactService is enough --- src/core/stdaway/src/awaymsg.cpp | 2 +- src/core/stduserinfo/src/userinfo.cpp | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/core') diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index d65ee88b31..d7eb3ae8de 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -75,7 +75,7 @@ public: bool OnInitDialog() override { - m_hSeq = (HANDLE)ProtoChainSend(m_hContact, PSS_GETAWAYMSG, 0, 0); + m_hSeq = (HANDLE)CallContactService(m_hContact, PS_GETAWAYMSG); if (m_hSeq == nullptr) { ACKDATA ack = {}; ack.hContact = m_hContact; diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index d7357be8b1..4126dd5974 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -227,7 +227,7 @@ class CUserInfoDlg : public CDlgBase void CheckOnline() { - const char *szProto = GetProto(); + const char *szProto = (m_pCurrent && m_pCurrent->szProto) ? m_pCurrent->szProto : Proto_GetBaseAccountName(m_hContact); if (szProto == nullptr || m_bIsMeta) btnUpdate.Disable(); else { @@ -238,14 +238,6 @@ class CUserInfoDlg : public CDlgBase } } - const char *GetProto() const - { - if (m_pCurrent && m_pCurrent->szProto) - return m_pCurrent->szProto; - - return (m_hContact) ? Proto_GetBaseAccountName(m_hContact) : nullptr; - } - void ResizeCurrent() { RECT rc; @@ -323,7 +315,7 @@ public: m_updateAnimFrame = 0; GetDlgItemText(m_hwnd, IDC_UPDATING, m_szUpdating, _countof(m_szUpdating)); CheckOnline(); - if (!ProtoChainSend(m_hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) { + if (!CallContactService(m_hContact, PS_GETINFO, SGIF_ONOPEN)) { btnUpdate.Disable(); SetTimer(m_hwnd, 1, 100, nullptr); } @@ -555,8 +547,9 @@ public: m_infosUpdated = NULL; } - if (const char *szProto = GetProto()) - if (!CallContactService(m_hContact, szProto, PSS_GETINFO)) { + MCONTACT hContact = (m_pCurrent && m_pCurrent->szProto) ? m_pCurrent->hContact : m_hContact; + if (hContact) + if (!CallContactService(hContact, PS_GETINFO)) { btnUpdate.Disable(); ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_SHOW); updateTimer.Start(100); -- cgit v1.2.3