From d4ee5175a2997e313783a416c91dc3d27d4412bb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 12 Dec 2023 16:59:09 +0300 Subject: fixes #4032 (IRC + Tabsrmm: User details windows is without information for IRC users) --- protocols/IRCG/src/input.cpp | 7 ++++--- protocols/IRCG/src/ircproto.cpp | 3 +-- protocols/IRCG/src/tools.cpp | 16 +++++++++++----- protocols/IRCG/src/userinfo.cpp | 3 ++- 4 files changed, 18 insertions(+), 11 deletions(-) (limited to 'protocols/IRCG/src') diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 3fe1e86800..f5a5499348 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -121,12 +121,13 @@ CMStringW CIrcProto::DoAlias(const wchar_t *text, wchar_t *window) wchar_t buf[5]; for (int index = 1; index < 8; index++) { + auto W = GetWord(line, index); mir_snwprintf(buf, L"#$%u", index); - if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index))) - str.Replace(buf, GetWord(line, index)); + if (IsChannel(W)) + str.Replace(buf, W); else { CMStringW S1 = L"#"; - S1 += GetWord(line, index); + S1 += W; str.Replace(buf, S1); } } diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 475be9220c..284590ecba 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -427,8 +427,7 @@ void __cdecl CIrcProto::AckBasicSearch(void *arg) HANDLE CIrcProto::SearchBasic(const wchar_t* szId) { if (szId) { - if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING && - szId && szId[0] && !IsChannel(szId)) { + if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING && !IsChannel(szId)) { AckBasicSearchParam* param = new AckBasicSearchParam; mir_wstrncpy(param->buf, szId, 50); ForkThread(&CIrcProto::AckBasicSearch, param); diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 34acf7dd3c..15969c1b41 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -206,6 +206,17 @@ int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string) bool CIrcProto::IsChannel(const wchar_t* sName) { + if (!sName || !sName[0]) + return false; + + return (sChannelPrefixes.Find(sName[0]) != -1); +} + +bool CIrcProto::IsChannel(const char *sName) +{ + if (!sName || !sName[0]) + return false; + return (sChannelPrefixes.Find(sName[0]) != -1); } @@ -242,11 +253,6 @@ CMStringA __stdcall GetWord(const char* text, int index) return CMStringA(); } -bool CIrcProto::IsChannel(const char* sName) -{ - return (sChannelPrefixes.Find(sName[0]) != -1); -} - static int mapIrc2srmm[] = { 15, 0, 1, 4, 14, 6, 3, 5, 13, 12, 2, 10, 9, 11, 7, 8 }; static const wchar_t* DoEnterNumber(const wchar_t *text, int &res) diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 2515886ac9..2b947b4cb5 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -86,6 +86,7 @@ public: SetDlgItemText(m_hwnd, IDC_HOST, dbv.pwszVal); db_free(&dbv); } + ProtoBroadcastAck(ppro->m_szModuleName, m_hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1); return false; } @@ -198,7 +199,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM hContact) return 0; ptrW wszChannel(getWStringA(hContact, "Default")); - if (!wszChannel || !IsChannel(wszChannel)) + if (IsChannel(wszChannel)) return 0; USERINFOPAGE uip = {}; -- cgit v1.2.3