aboutsummaryrefslogtreecommitdiff
path: root/src/message.cpp
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-24 16:23:19 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-24 16:23:19 +0100
commit1b15465c42a88f750a960a0e73f186245f9bba33 (patch)
treee0ecb976022b606e2872c490718ad5dd182be0d9 /src/message.cpp
parenta919a149fbb192e3fae7aba921ca28e02d9c0d10 (diff)
Separate base64ing from the rest of msg encoding
Factor the actual message encoding/decoding and encrypting/decrypting out to separate functions from the top-level functions which do the base64-wrangling. This is particularly helpful in the 'outbound' code-path where the offsets required to allow room to base64-encode make the flow hard to see when it's all inline.
Diffstat (limited to 'src/message.cpp')
-rw-r--r--src/message.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/message.cpp b/src/message.cpp
index ab4300e..2e841e5 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -347,7 +347,7 @@ size_t _olm_encode_group_message_length(
}
-void _olm_encode_group_message(
+size_t _olm_encode_group_message(
uint8_t version,
const uint8_t *session_id,
size_t session_id_length,
@@ -364,6 +364,7 @@ void _olm_encode_group_message(
std::memcpy(session_id_pos, session_id, session_id_length);
pos = encode(pos, GROUP_MESSAGE_INDEX_TAG, message_index);
pos = encode(pos, GROUP_CIPHERTEXT_TAG, *ciphertext_ptr, ciphertext_length);
+ return pos-output;
}
void _olm_decode_group_message(