diff options
Diffstat (limited to 'toxcore/group.c')
-rw-r--r-- | toxcore/group.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/group.c b/toxcore/group.c index 987e2fbd..f2061d7c 100644 --- a/toxcore/group.c +++ b/toxcore/group.c | |||
@@ -3209,6 +3209,11 @@ static uint32_t saved_conf_size(const Group_c *g) | |||
3209 | return len; | 3209 | return len; |
3210 | } | 3210 | } |
3211 | 3211 | ||
3212 | /* Save a future message number; the save will remain valid until we have sent | ||
3213 | * this many more messages. */ | ||
3214 | #define SAVE_OFFSET_MESSAGE_NUMBER (1 << 16) | ||
3215 | #define SAVE_OFFSET_LOSSY_MESSAGE_NUMBER (1 << 13) | ||
3216 | |||
3212 | static uint8_t *save_conf(const Group_c *g, uint8_t *data) | 3217 | static uint8_t *save_conf(const Group_c *g, uint8_t *data) |
3213 | { | 3218 | { |
3214 | *data = g->type; | 3219 | *data = g->type; |
@@ -3217,10 +3222,10 @@ static uint8_t *save_conf(const Group_c *g, uint8_t *data) | |||
3217 | memcpy(data, g->id, GROUP_ID_LENGTH); | 3222 | memcpy(data, g->id, GROUP_ID_LENGTH); |
3218 | data += GROUP_ID_LENGTH; | 3223 | data += GROUP_ID_LENGTH; |
3219 | 3224 | ||
3220 | host_to_lendian_bytes32(data, g->message_number); | 3225 | host_to_lendian_bytes32(data, g->message_number + SAVE_OFFSET_MESSAGE_NUMBER); |
3221 | data += sizeof(uint32_t); | 3226 | data += sizeof(uint32_t); |
3222 | 3227 | ||
3223 | host_to_lendian_bytes16(data, g->lossy_message_number); | 3228 | host_to_lendian_bytes16(data, g->lossy_message_number + SAVE_OFFSET_LOSSY_MESSAGE_NUMBER); |
3224 | data += sizeof(uint16_t); | 3229 | data += sizeof(uint16_t); |
3225 | 3230 | ||
3226 | host_to_lendian_bytes16(data, g->peer_number); | 3231 | host_to_lendian_bytes16(data, g->peer_number); |