aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-02-07 08:29:09 +0100
committerdec05eba <dec05eba@protonmail.com>2021-02-07 08:29:09 +0100
commit8c7e64991b6c05d57aaa8dda2df2dc53d789d6c4 (patch)
tree20fe0960166fa8842b69a4d36f0ca6d7a80054dc /src/plugins
parent0d4b8bacce933e34a41769b1051b25f82f922201 (diff)
Dont download video with --no-video option, ignore events with state_key set if the event is not a m.room.member type
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 3a2c02c..9a785b6 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1732,9 +1732,17 @@ namespace QuickMedia {
if(!sender_json->IsString())
return nullptr;
+ const rapidjson::Value &type_json = GetMember(event_item_json, "type");
+ if(!type_json.IsString())
+ return nullptr;
+
bool sent_by_somebody_else = false;
const rapidjson::Value *state_key_json = &GetMember(event_item_json, "state_key");
if(state_key_json->IsString() && state_key_json->GetStringLength() != 0) {
+ if(strcmp(type_json.GetString(), "m.room.member") != 0) {
+ fprintf(stderr, "Matrix: received state key %s but event type is %s, expected m.room.member\n", type_json.GetString(), state_key_json->GetString());
+ return nullptr;
+ }
if(strcmp(sender_json->GetString(), state_key_json->GetString()) != 0)
sent_by_somebody_else = true;
sender_json = state_key_json;
@@ -1768,10 +1776,6 @@ namespace QuickMedia {
if(origin_server_ts.IsInt64())
timestamp = origin_server_ts.GetInt64();
- const rapidjson::Value &type_json = GetMember(event_item_json, "type");
- if(!type_json.IsString())
- return nullptr;
-
bool provisional = false;
const rapidjson::Value &unsigned_json = GetMember(event_item_json, "unsigned");
if(unsigned_json.IsObject()) {