diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-27 19:09:26 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-29 08:22:35 +0200 |
commit | 0f8335a32debc4c61d9fc9875c79c0ba6ba05357 (patch) | |
tree | fb78230a898754b2df982b890a4129839937f110 /lib/e2ee/qolmsession.cpp | |
parent | 64797165f04a16d290dd27c2f962060b40f85be3 (diff) | |
download | libquotient-0f8335a32debc4c61d9fc9875c79c0ba6ba05357.tar.gz libquotient-0f8335a32debc4c61d9fc9875c79c0ba6ba05357.zip |
Move some Meg/Olm session logic from Room::Private to Connection::Private
Functions (Room::Private::)createOlmSession, payloadForUserDevice
and sendRoomKeyToDevices don't have a lot to do with the given Room
object but deal with quite a few things stored in Connection. This
commit moves them to Connection::Private, exposing
sendSessionKeyToDevices (the new name for sendRoomKeyToDevices) in
Connection so that Room could call it from Room::P::sendMegolmSession().
While moving these over, a few additional things were adjusted:
- more functions marked as const
- a few functions could be moved now from Connection
to Connection::Private
- false slots in Connection (such as picklingMode) are moved out of
the slots block
- keys.yml in Matrix CS API definitions has been adjusted to match
the real structure of `/claim` response (see quotient-im/matrix-spec
repo); csapi/keys.h has been regenerated accordingly.
Diffstat (limited to 'lib/e2ee/qolmsession.cpp')
-rw-r--r-- | lib/e2ee/qolmsession.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/e2ee/qolmsession.cpp b/lib/e2ee/qolmsession.cpp index 2b149aac..2a98d5d8 100644 --- a/lib/e2ee/qolmsession.cpp +++ b/lib/e2ee/qolmsession.cpp @@ -96,12 +96,13 @@ QOlmExpected<QOlmSessionPtr> QOlmSession::createOutboundSession( return std::make_unique<QOlmSession>(olmOutboundSession); } -QOlmExpected<QByteArray> QOlmSession::pickle(const PicklingMode &mode) +QOlmExpected<QByteArray> QOlmSession::pickle(const PicklingMode &mode) const { QByteArray pickledBuf(olm_pickle_session_length(m_session), '0'); QByteArray key = toKey(mode); const auto error = olm_pickle_session(m_session, key.data(), key.length(), - pickledBuf.data(), pickledBuf.length()); + pickledBuf.data(), + pickledBuf.length()); if (error == olm_error()) { return lastError(m_session); |