aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp5
-rw-r--r--src/plugins/Matrix.cpp19
2 files changed, 17 insertions, 7 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 20c2371..5c88322 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3457,7 +3457,10 @@ namespace QuickMedia {
auto message = std::make_shared<Message>();
message->user = matrix->get_me(current_room);
- message->body = text;
+ if(msgtype == "m.emote")
+ message->body = "*" + current_room->get_user_display_name(me) + "* " + text;
+ else
+ message->body = text;
message->type = MessageType::TEXT;
message->timestamp = time(NULL) * 1000;
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 1e35d9e..f6a91e7 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1005,7 +1005,7 @@ namespace QuickMedia {
{ "-H", "Authorization: Bearer " + access_token },
{ "-m", "35" }
};
-
+#if 0
sync_additional_messages_thread = std::thread([this]() {
std::vector<CommandArg> additional_args = {
{ "-H", "Authorization: Bearer " + access_token },
@@ -1031,7 +1031,7 @@ namespace QuickMedia {
additional_messages_queue.pop_wait();
parse_sync_response(json_root, true);
});
-
+#endif
const rapidjson::Value *next_batch_json;
PluginResult result;
bool initial_sync = true;
@@ -2743,13 +2743,20 @@ namespace QuickMedia {
char url[512];
snprintf(url, sizeof(url), "%s/_matrix/client/r0/rooms/%s/event/%s", homeserver.c_str(), room->id.c_str(), event_id.c_str());
#endif
- std::string err_msg;
- rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true, &err_msg);
+ std::string response;
+ DownloadResult download_result = download_to_string_cache(url, response, std::move(additional_args), use_tor, true);
if(download_result != DownloadResult::OK) return nullptr;
+ rapidjson::Document json_root;
+ rapidjson::ParseResult parse_result = json_root.Parse(response.c_str(), response.size());
+ if(parse_result.IsError()) {
+ fprintf(stderr, "Failed to get message by id %s\n", event_id.c_str());
+ room->fetched_messages_by_event_id.insert(std::make_pair(event_id, nullptr));
+ return nullptr;
+ }
+
if(!json_root.IsObject()) {
- fprintf(stderr, "Failed to get message by id %s, error: %s\n", event_id.c_str(), err_msg.c_str());
+ fprintf(stderr, "Failed to get message by id %s\n", event_id.c_str());
room->fetched_messages_by_event_id.insert(std::make_pair(event_id, nullptr));
return nullptr;
}