From 46be94cd275231bb124f2887878d5a78be5abf9a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 20 May 2021 17:18:15 +0300 Subject: mir_wstrstri - case-insensitive search of substring, Unicode version --- protocols/IRCG/src/commandmonitor.cpp | 2 +- protocols/IRCG/src/options.cpp | 2 +- protocols/IRCG/src/stdafx.h | 1 - protocols/IRCG/src/tools.cpp | 11 ----------- 4 files changed, 2 insertions(+), 14 deletions(-) (limited to 'protocols/IRCG/src') diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index b8b8c7ba78..80159a7eb5 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2384,7 +2384,7 @@ int CIrcProto::DoPerform(const char* event) if (pwszPerform == nullptr) return 0; - if (my_strstri(pwszPerform, L"/away")) { + if (mir_wstrstri(pwszPerform, L"/away")) { mir_free(pwszPerform); mir_forkthread(AwayWarningThread); } diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index dff900a683..f8bb7c8dab 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -787,7 +787,7 @@ public: { ptrW temp(m_pertormEdit.GetText()); - if (my_strstri(temp, L"/away")) + if (mir_wstrstri(temp, L"/away")) MessageBox(nullptr, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK); else { PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetCurData(); diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index e5278318ac..9822e052fb 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -212,7 +212,6 @@ char* __stdcall IrcLoadFile(wchar_t * szPath); CMStringW __stdcall GetWord(const wchar_t* text, int index); const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index); void __stdcall RemoveLinebreaks(CMStringW& Message); -wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2); wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent); CMStringA __stdcall GetWord(const char* text, int index); diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 6cc196b42c..133a8f9346 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -220,17 +220,6 @@ bool CIrcProto::IsChannel(const char* sName) return (sChannelPrefixes.Find(sName[0]) != -1); } -wchar_t* __stdcall my_strstri(const wchar_t* s1, const wchar_t* s2) -{ - int i, j, k; - for (i = 0; s1[i]; i++) - for (j = i, k = 0; towlower(s1[j]) == towlower(s2[k]); j++, k++) - if (!s2[k + 1]) - return (wchar_t*)(s1 + i); - - return nullptr; -} - 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) -- cgit v1.2.3