Start of device storing

This commit is contained in:
timoreo 2023-12-11 20:58:32 +01:00
parent 25819c346a
commit fb37deb948
Signed by: timoreo
GPG key ID: 121A72C3512BA288
4 changed files with 33 additions and 2 deletions

View file

@ -48,7 +48,7 @@ private:
Store* store;
std::string userIdCache;
std::string deviceIdCache;
std::atomic_uint32_t requestId = 0;
uint32_t requestId = 0; //TODO make atomic
bool stopSyncing = false;
bool isSyncing = false;
Thread syncThread;
@ -133,6 +133,8 @@ public:
void save_keys();
void upload_keys();
void start_encryption();
void getDevices();
void processToDevice(json_t* data);
};
}; // namespace Matrix

5
source/devicestore.cpp Normal file
View file

@ -0,0 +1,5 @@
//
// Created by timoreo on 11/12/23.
//
#include "devicestore.h"

10
source/devicestore.h Normal file
View file

@ -0,0 +1,10 @@
//
// Created by timoreo on 11/12/23.
//
#ifndef MATRIX_3DS_CLIENT_DEVICESTORE_H
#define MATRIX_3DS_CLIENT_DEVICESTORE_H
class DeviceStore {};
#endif // MATRIX_3DS_CLIENT_DEVICESTORE_H

View file

@ -483,6 +483,10 @@ void Client::setRoomLimitedCallback(roomLimitedCallback cb) {
}
void Client::processSync(json_t* sync) {
json_t* to_device = json_object_get(sync, "to_device");
if(to_device){
processToDevice(to_device);
}
json_t* rooms = json_object_get(sync, "rooms");
if (!rooms) {
return; // nothing to do
@ -1083,5 +1087,15 @@ void Client::start_encryption() {
ifs.read(reinterpret_cast<char*>(data.get()), static_cast<std::streamsize>(fsize));
olm::unpickle(data.get(), data.get() + fsize, acc);
}
}
void Client::getDevices(){
// To get the devices, we need to do a /keys/query req
// We then need to keep up to date using /sync to_device (see processToDevice)
// This will need to all be cached
}
void Client::processToDevice(json_t* data) {
}
}; // namespace Matrix