aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
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()) {