aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-02 18:33:41 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-02 18:33:41 +0200
commit2d4772337df47794fb0b1734bda209177a989515 (patch)
tree90898435bccf5fb6062014b40a94774b75eb8cf1
parent87c7a3c659735dbe4bda63712372e3dbdf807c3b (diff)
Matrix: show m.emote, m.notice and m.location
-rw-r--r--TODO7
-rw-r--r--src/plugins/Matrix.cpp18
2 files changed, 22 insertions, 3 deletions
diff --git a/TODO b/TODO
index 7d2fb94..b5b808e 100644
--- a/TODO
+++ b/TODO
@@ -47,7 +47,7 @@ Show the rooms menu on the left side when the window is large in matrix.
Use https://github.com/simdjson/simdjson as a json library.
Sanitize check: do not allow pasting more than 2gb of text.
Add search bar for matrix rooms.
-Put rooms with recent messages at the top and the ones that mention us further at the top (matrix).
+Put rooms with recent messages at the top and the ones that mention us further at the top (matrix), and also add a tab for favorited rooms? or tag them, whatever.
Allow setting matrix room priority (if it should always be at top).
Use Entry instead of SearchBar for 4chan commenting as well.
Only add related videos to recommendations if its the first time we watch the video. This is to prevent rewatching a video multiple times from messing up recommendations.
@@ -71,4 +71,7 @@ Provide a way to go to the first unread message in matrix and also show a marker
Sort matrix messages by timestamp. This may be needed to make notification messages show properly in the timeline?
Load already downloaded images/thumbnails in a separate thread, to instantly load them instead of waiting for new downloads...
Make text that mentions us red in matrix.
-Allow scrolling body item. A body item can be long and we wont be able to read all of it otherwise (such as a message on matrix). Pressing up/down should scroll such a large body item rather than moving to another one. \ No newline at end of file
+Allow scrolling body item. A body item can be long and we wont be able to read all of it otherwise (such as a message on matrix). Pressing up/down should scroll such a large body item rather than moving to another one.
+Cleanup keybindings. Some require ctrl, some dont (4chan vs matrix for example).
+Add room topic beside room name in matrix (in messages tab).
+Move rooms in matrix to previous page instead, then messages can be beside users, pinned messages, settings, etc and they would all be connected to that one room, then beside rooms tab there would be a global settings tab. \ No newline at end of file
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 32cabe1..585664a 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -523,6 +523,9 @@ namespace QuickMedia {
}
auto message = std::make_shared<Message>();
+ std::string prefix;
+
+ // TODO: Also show joins, leave, invites, bans, kicks, mutes, etc
if(strcmp(content_type.asCString(), "m.text") == 0) {
message->type = MessageType::TEXT;
@@ -556,13 +559,26 @@ namespace QuickMedia {
message->url = homeserver + "/_matrix/media/r0/download/" + url_json.asString().substr(6);
message->type = MessageType::FILE;
+ } else if(strcmp(content_type.asCString(), "m.emote") == 0) { // this is a /me message, TODO: show /me messages differently
+ message->type = MessageType::TEXT;
+ prefix = "*" + room_data->user_info[user_it->second].display_name + "* ";
+ } else if(strcmp(content_type.asCString(), "m.notice") == 0) { // TODO: show notices differently
+ message->type = MessageType::TEXT;
+ prefix = "* NOTICE * ";
+ } else if(strcmp(content_type.asCString(), "m.location") == 0) { // TODO: show locations differently
+ const Json::Value &geo_uri_json = content_json["geo_uri"];
+ if(geo_uri_json.isString())
+ prefix = geo_uri_json.asString() + " | ";
+
+ message->type = MessageType::TEXT;
+ message->thumbnail_url = message_content_extract_thumbnail_url(content_json, homeserver);
} else {
continue;
}
message->user_id = user_it->second;
message->event_id = event_id_str;
- message->body = body_json.asString();
+ message->body = prefix + body_json.asString();
message->replaces_event_id = std::move(replaces_event_id);
// TODO: Is @room ok? shouldn't we also check if the user has permission to do @room? (only when notifications are limited to @mentions)
if(has_unread_notifications && !username.empty())