diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 11 |
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; } |