aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Matrix.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-09 16:41:10 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-09 16:41:10 +0200
commit78fce9e810e48095be9d1a81a31df49db9a4d5b3 (patch)
tree233a7943ffa63a1cbba675a8cad2c497862ebbc7 /src/plugins/Matrix.cpp
parent9409d8f67f856da0ecfb2a485c2a757c2338469e (diff)
Show critical notification before abort on critical error
Diffstat (limited to 'src/plugins/Matrix.cpp')
-rw-r--r--src/plugins/Matrix.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 6c7e4bd..89c9984 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1957,18 +1957,6 @@ namespace QuickMedia {
return false;
}
- static size_t string_find_case_insensitive(const char *haystack, size_t index, size_t length, const std::string &needle) {
- const char *haystack_end = haystack + length;
- auto it = std::search(haystack + index, haystack_end, needle.begin(), needle.end(),
- [](char c1, char c2) {
- return std::toupper(c1) == std::toupper(c2);
- });
- if(it != haystack_end)
- return it - haystack;
- else
- return std::string::npos;
- }
-
// TODO: Do not show notification if mention is a reply to somebody else that replies to me? also dont show notification everytime a mention is edited
bool message_contains_user_mention(const std::string &msg, const std::string &username) {
if(msg.empty() || username.empty())
@@ -1976,7 +1964,7 @@ namespace QuickMedia {
size_t index = 0;
while(index < msg.size()) {
- size_t found_index = string_find_case_insensitive(&msg[0], index, msg.size(), username);
+ size_t found_index = str_find_case_insensitive(msg, index, username.c_str(), username.size());
if(found_index == std::string::npos)
break;