aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Matrix.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-19 17:03:49 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-19 17:03:49 +0100
commitd5da6e47e14831b865d418faa32f32df4de5af42 (patch)
treecf14a47cba90642c50dbba6af0922c26c9cb266c /src/plugins/Matrix.cpp
parent9134914f6065c0b248dd1b4317dbf9b16f5f52b5 (diff)
Matrix: fix too long path in event cache, bug when not using error handler..
Diffstat (limited to 'src/plugins/Matrix.cpp')
-rw-r--r--src/plugins/Matrix.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index f17da30..b0c83cc 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -4,6 +4,7 @@
#include "../../include/NetUtils.hpp"
#include "../../include/Notification.hpp"
#include "../../include/Program.hpp"
+#include "../../include/base64_url.hpp"
#include <rapidjson/document.h>
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
@@ -2767,33 +2768,33 @@ namespace QuickMedia {
}
return true;
- });
+ }, get_cache_dir().join("matrix").join("events").join(base64_url::encode(event_id)));
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());
+ fprintf(stderr, "Failed to get message by id %s, error: %s\n", event_id.c_str(), response.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\n", event_id.c_str());
+ fprintf(stderr, "Failed to get message by id %s, error: %s\n", event_id.c_str(), response.c_str());
room->fetched_messages_by_event_id.insert(std::make_pair(event_id, nullptr));
return nullptr;
}
const rapidjson::Value &errcode_json = GetMember(json_root, "errcode");
if(errcode_json.IsString() && strcmp(errcode_json.GetString(), "M_FORBIDDEN") == 0) {
- fprintf(stderr, "You donm't have permission to access event %s\n", event_id.c_str());
+ fprintf(stderr, "You don't have permission to access event %s\n", event_id.c_str());
room->fetched_messages_by_event_id.insert(std::make_pair(event_id, nullptr));
return nullptr;
}
const rapidjson::Value &error_json = GetMember(json_root, "error");
if(error_json.IsString()) {
- fprintf(stderr, "Matrix::get_message_by_id, error: %s\n", error_json.GetString());
+ fprintf(stderr, "Matrix::get_message_by_id for event id: %s, error: %s\n", event_id.c_str(), error_json.GetString());
room->fetched_messages_by_event_id.insert(std::make_pair(event_id, nullptr));
return nullptr;
}