aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 688e16e..0d93bd0 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -3476,14 +3476,20 @@ namespace QuickMedia {
return message;
}
- // Returns empty string on error
- static std::string extract_user_name_from_user_id(const std::string &user_id) {
+ std::string extract_user_name_from_user_id(const std::string &user_id) {
size_t index = user_id.find(':');
- if(index == std::string::npos || index == 0 || user_id.empty() || user_id[0] != '@')
+ if(index == std::string::npos || index == 0 || user_id[0] != '@')
return "";
return user_id.substr(1, index - 1);
}
+ std::string extract_user_name_from_email(const std::string &email) {
+ size_t index = email.find('@');
+ if(index == std::string::npos || index == 0)
+ return "";
+ return email.substr(0, index);
+ }
+
static std::string combine_user_display_names_for_room_name(std::vector<std::shared_ptr<UserInfo>> &user_info, const std::string &fallback_user_id) {
std::string result;
if(user_info.size() == 0)