aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 60fc8a9..32cabe1 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -542,6 +542,20 @@ namespace QuickMedia {
message->url = homeserver + "/_matrix/media/r0/download/" + url_json.asString().substr(6);
message->thumbnail_url = message_content_extract_thumbnail_url(content_json, homeserver);
message->type = MessageType::VIDEO;
+ } else if(strcmp(content_type.asCString(), "m.audio") == 0) {
+ const Json::Value &url_json = content_json["url"];
+ if(!url_json.isString() || strncmp(url_json.asCString(), "mxc://", 6) != 0)
+ continue;
+
+ message->url = homeserver + "/_matrix/media/r0/download/" + url_json.asString().substr(6);
+ message->type = MessageType::AUDIO;
+ } else if(strcmp(content_type.asCString(), "m.file") == 0) {
+ const Json::Value &url_json = content_json["url"];
+ if(!url_json.isString() || strncmp(url_json.asCString(), "mxc://", 6) != 0)
+ continue;
+
+ message->url = homeserver + "/_matrix/media/r0/download/" + url_json.asString().substr(6);
+ message->type = MessageType::FILE;
} else {
continue;
}
@@ -890,6 +904,12 @@ namespace QuickMedia {
case MessageType::VIDEO:
related_to_body = "sent a video";
break;
+ case MessageType::AUDIO:
+ related_to_body = "sent an audio file";
+ break;
+ case MessageType::FILE:
+ related_to_body = "sent a file";
+ break;
}
return "> <" + room_data->user_info[message->user_id].user_id + "> " + std::move(related_to_body) + "\n\n" + body;
}
@@ -1157,6 +1177,10 @@ namespace QuickMedia {
new_message->type = MessageType::IMAGE;
} else if(strcmp(content_type.asCString(), "m.video") == 0) {
new_message->type = MessageType::VIDEO;
+ } else if(strcmp(content_type.asCString(), "m.audio") == 0) {
+ new_message->type = MessageType::AUDIO;
+ } else if(strcmp(content_type.asCString(), "m.file") == 0) {
+ new_message->type = MessageType::FILE;
} else {
return nullptr;
}