summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2021-08-11 22:24:28 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2021-08-11 22:24:28 +0300
commitab51f1553b92f0168ac345ee3694b8383f2d568c (patch)
tree4466fefd889719c052811bd394356c7b8f181ecf
parent9a31225ef46c474d78c8cbaa0808302c5939893d (diff)
thread-subject: make even laxer:
compare subject from the *last* plus any spaces.
-rw-r--r--lib/mu-query-threads.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/mu-query-threads.cc b/lib/mu-query-threads.cc
index c71651c..545d0b9 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 ':<space>*'
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));