Commit fc43a2eb authored by Heng Ye's avatar Heng Ye
Browse files

Fix encrypted editing

parent 5cd950ff
Pipeline #352899004 passed with stage
in 4 minutes and 54 seconds
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2021-08-11T15:10:05. -->
<!-- Written by QtCreator 4.14.2, 2021-08-12T21:18:49. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......@@ -8,7 +8,7 @@
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">1</value>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
......@@ -86,9 +86,9 @@
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Mer.Device.Type</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-3.4.0.24-armv7hl (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-3.4.0.24-armv7hl (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">SailfishOS-3.4.0.24-armv7hl</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-3.4.0.24-i486 (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-3.4.0.24-i486 (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">SailfishOS-3.4.0.24-i486</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
......@@ -99,8 +99,8 @@
<value type="QString" key="MerBuildConfiguration.SigningUser"></value>
<value type="QString" key="MerSfdkConfigurationAspect.Options"></value>
<value type="QString" key="MerSpecFileAspect.Path"></value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
......@@ -152,8 +152,8 @@
<value type="QString" key="MerBuildConfiguration.SigningUser"></value>
<value type="QString" key="MerSfdkConfigurationAspect.Options"></value>
<value type="QString" key="MerSpecFileAspect.Path"></value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
......@@ -206,8 +206,8 @@
<value type="QString" key="MerBuildConfiguration.SigningUser"></value>
<value type="QString" key="MerSfdkConfigurationAspect.Options"></value>
<value type="QString" key="MerSpecFileAspect.Path"></value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
......@@ -410,9 +410,9 @@
<variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Mer.Device.Type</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-3.4.0.24-i486 (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-3.4.0.24-i486 (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">SailfishOS-3.4.0.24-i486</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-3.4.0.24-armv7hl (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-3.4.0.24-armv7hl (in Sailfish OS Build Engine)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">SailfishOS-3.4.0.24-armv7hl</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
......@@ -423,8 +423,8 @@
<value type="QString" key="MerBuildConfiguration.SigningUser"></value>
<value type="QString" key="MerSfdkConfigurationAspect.Options"></value>
<value type="QString" key="MerSpecFileAspect.Path"></value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
......@@ -476,8 +476,8 @@
<value type="QString" key="MerBuildConfiguration.SigningUser"></value>
<value type="QString" key="MerSfdkConfigurationAspect.Options"></value>
<value type="QString" key="MerSpecFileAspect.Path"></value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
......@@ -530,8 +530,8 @@
<value type="QString" key="MerBuildConfiguration.SigningUser"></value>
<value type="QString" key="MerSfdkConfigurationAspect.Options"></value>
<value type="QString" key="MerSpecFileAspect.Path"></value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_i486_in_Sailfish_OS_Build_Engine-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/heng/ssd-data/SailfishApps/build-harbour-sailtrix-SailfishOS_3_4_0_24_armv7hl_in_Sailfish_OS_Build_Engine-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
......
import QtQuick 2.4
import Sailfish.Silica 1.0
import Messages 1.0
import Rooms 1.0
import Sailfish.Pickers 1.0
import QtMultimedia 5.0
import Nemo.Notifications 1.0
......@@ -14,7 +13,6 @@ Page {
property string room_id
property string room_name
property Rooms rooms;
property string file_name;
property bool downloading;
......
......@@ -680,7 +680,7 @@ void Messages::processMessages(QNetworkReply* reply) {
indicies_arr.append((int) message_index);
if (m_fully_loaded || processed.object().value("content").toObject().value("msgtype").toString() != "m.bad_encrypt")
added = process_message(processed.object(), event_obj.value("event_id").toString(), event_obj.value("unsigned").toObject().value("transaction_id").toString(), event_obj.value("origin_server_ts").toVariant().toLongLong());
added = process_message(processed.object(), event_obj.value("event_id").toString(), event_obj.value("unsigned").toObject().value("transaction_id").toString(), event_obj.value("origin_server_ts").toVariant().toLongLong(), event_obj.value("content").toObject().value("m.relates_to").toObject());
seen_message_indices->insert(content.value("session_id").toString(), indicies_arr);
}
......@@ -1094,7 +1094,7 @@ void Messages::redact(QString event_id) {
}
}
bool Messages::process_message(QJsonObject event_obj, QString old_event_id, QString old_txn_id, qint64 orig_timestamp) {
bool Messages::process_message(QJsonObject event_obj, QString old_event_id, QString old_txn_id, qint64 orig_timestamp, QJsonObject old_relates_to) {
QJsonObject content = event_obj.value("content").toObject();
qint64 timestamp;
......@@ -1104,7 +1104,12 @@ bool Messages::process_message(QJsonObject event_obj, QString old_event_id, QStr
timestamp = orig_timestamp;
if (event_obj.value("type").toString() == QString("m.room.message")) {
QJsonObject relates_to = content.value("m.relates_to").toObject();
QJsonObject relates_to;
if (orig_timestamp != 0L) {
relates_to = old_relates_to;
} else {
relates_to = content.value("m.relates_to").toObject();
}
if (relates_to.value("rel_type").toString() == "m.replace") {
// It is an edit
......
......@@ -149,7 +149,7 @@ private:
void write_cache();
void read_cache();
void process_remote_echo(QString event_id, QString txn_id);
bool process_message(QJsonObject message, QString old_event_id = "", QString old_txn_id = "", qint64 orig_timestamp = 0L);
bool process_message(QJsonObject message, QString old_event_id = "", QString old_txn_id = "", qint64 orig_timestamp = 0L, QJsonObject old_relates_to = QJsonObject());
bool process_state_event(QJsonObject event_obj, QJsonArray* new_users);
bool create_outbound_megolm_session();
void start_olm_session(QString target_user, QString target_device);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment