diff options
| author | Melvin Keskin <melvo@olomono.de> | 2022-01-27 16:50:20 +0000 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-04-07 19:33:45 +0200 |
| commit | e59434b9085d90628352897c3dfc287766996797 (patch) | |
| tree | 110a4df5802342995a4f188be4472c6a4f9cb559 /src/base/QXmppOmemoData.cpp | |
| parent | ec7a90955bc14905e966b3f08ad2de9f1fc87016 (diff) | |
| download | qxmpp-e59434b9085d90628352897c3dfc287766996797.tar.gz | |
OmemoDeviceBundle: Use methods for adding / removing public pre keys
Diffstat (limited to 'src/base/QXmppOmemoData.cpp')
| -rw-r--r-- | src/base/QXmppOmemoData.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/base/QXmppOmemoData.cpp b/src/base/QXmppOmemoData.cpp index 1ab62b3e..7897731d 100644 --- a/src/base/QXmppOmemoData.cpp +++ b/src/base/QXmppOmemoData.cpp @@ -365,23 +365,27 @@ QHash<uint32_t, QByteArray> QXmppOmemoDeviceBundle::publicPreKeys() const } /// -/// Sets the public pre keys. +/// Adds a public pre key. /// -/// The key of a key-value pair represents the ID of the corresponding public -/// pre key. -/// The ID must be at least 1 and at most 2^32-1, otherwise the corresponding -/// key-value pair is ignored. -/// The value of a key-value pair represents the public pre key. +/// The ID must be at least 1 and at most 2^32-1. /// -/// \param keys public pre keys +/// \param id ID of the public pre key +/// \param key public pre key /// -void QXmppOmemoDeviceBundle::setPublicPreKeys(const QMap<uint32_t, QByteArray> &keys) +void QXmppOmemoDeviceBundle::addPublicPreKey(const uint32_t id, const QByteArray &key) { - for (auto it = keys.cbegin(); it != keys.cend(); it++) { - if (it.key() > 0) { - d->publicPreKeys.insert(it.key(), it.value()); - } - } + d->publicPreKeys.insert(id, key); +} + +/// +/// Removes a public pre key. +/// +/// \param id ID of the public pre key +/// \param key public pre key +/// +void QXmppOmemoDeviceBundle::removePublicPreKey(const uint32_t id) +{ + d->publicPreKeys.remove(id); } /// \cond |
