BUILD FAILS! some ideas of storage and cache

This commit is contained in:
Blue 2022-09-03 14:39:42 +03:00
parent 87973b3b67
commit 820dc845ea
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
10 changed files with 198 additions and 89 deletions

View file

@ -7,4 +7,6 @@ target_sources(squawk PRIVATE
vcardhandler.h
discoveryhandler.cpp
discoveryhandler.h
omemohandler.cpp
omemohandler.h
)

View file

@ -0,0 +1,17 @@
// Squawk messenger.
// Copyright (C) 2019 Yury Gubich <blue@macaw.me>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "omemohandler.h"

View file

@ -0,0 +1,57 @@
// Squawk messenger.
// Copyright (C) 2019 Yury Gubich <blue@macaw.me>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CORE_OMEMOHANDLER_H
#define CORE_OMEMOHANDLER_H
#include <QXmppOmemoStorage.h>
#include <core/storage/cache.h>
namespace Core {
class OmemoHandler : public QXmppOmemoStorage
{
public:
OmemoHandler();
~OmemoHandler() override;
QFuture<OmemoData> allData() override;
QFuture<void> setOwnDevice(const std::optional<OwnDevice> &device) override;
QFuture<void> addSignedPreKeyPair(uint32_t keyId, const SignedPreKeyPair &keyPair) override;
QFuture<void> removeSignedPreKeyPair(uint32_t keyId) override;
QFuture<void> addPreKeyPairs(const QHash<uint32_t, QByteArray> &keyPairs) override;
QFuture<void> removePreKeyPair(uint32_t keyId) override;
QFuture<void> addDevice(const QString &jid, uint32_t deviceId, const Device &device) override;
QFuture<void> removeDevice(const QString &jid, uint32_t deviceId) override;
QFuture<void> removeDevices(const QString &jid) override;
QFuture<void> resetAll() override;
private:
std::optional<OwnDevice> ownDevice;
Cache<QString, QHash<uint32_t, Device>> devices;
Cache<uint32_t, QByteArray> preKeyPairs;
Cache<uint32_t, QXmppOmemoStorage::SignedPreKeyPair> signedPreKeyPairs;
};
}
#endif // CORE_OMEMOHANDLER_H