From cbbd47079533e4da06f1342df071894c7fa11c10 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Dec 2023 15:57:24 +0300 Subject: StdUserInfo: fix for protocol calculation --- src/core/stduserinfo/src/userinfo.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index d843147daf..7e3793af1c 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() { - auto *szProto = (m_pCurrent) ? m_pCurrent->szProto : nullptr; + const char *szProto = GetProto(); if (szProto == nullptr || m_bIsMeta) btnUpdate.Disable(); else { @@ -238,6 +238,14 @@ 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; @@ -547,7 +555,7 @@ public: m_infosUpdated = NULL; } - if (auto *szProto = (m_pCurrent) ? m_pCurrent->szProto : nullptr) + if (const char *szProto = GetProto()) if (!CallProtoService(szProto, PSS_GETINFO, 0, 0)) { btnUpdate.Disable(); ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_SHOW); -- cgit v1.2.3