From ab51f1553b92f0168ac345ee3694b8383f2d568c Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Wed, 11 Aug 2021 22:24:28 +0300 Subject: [PATCH] thread-subject: make even laxer: compare subject from the *last* plus any spaces. --- lib/mu-query-threads.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/mu-query-threads.cc b/lib/mu-query-threads.cc index c71651cf..545d0b96 100644 --- a/lib/mu-query-threads.cc +++ b/lib/mu-query-threads.cc @@ -366,15 +366,17 @@ to_string (const ThreadPath& tpath, size_t digits) return str; } -static bool // compare subjects, ignore anything before ':' +static bool // compare subjects, ignore anything before the last ':*' subject_matches (const std::string& sub1, const std::string& sub2) { auto search_str =[](const std::string&s) -> const char* { - const auto pos = s.find_first_of(':'); + const auto pos = s.find_last_of(':'); if (pos == std::string::npos) return s.c_str(); - else - return s.c_str() + pos + 1; + else { + const auto pos2 = s.find_first_not_of(' ', pos + 1); + return s.c_str() + (pos2 == std::string::npos ? pos : pos2); + } }; //g_debug ("'%s' '%s'", search_str(sub1), search_str(sub2));