Last active
June 2, 2023 14:46
-
-
Save zoff99/81917ddb2e55b2ce602cac4772a7b68c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mini review:
- seconds for
timestamp
is a bit too imprecise. multiple messages per second is very humanly possible and common - looks like
sync delta
is an optional field...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NGC group history sync
specification and workflow
tox_group_peer_join_cb()
each time a peer joins we ask that peer to send all non-private group chat messages
from 130 minutes ago up to now.
to make sure that peer is actually really online (tox has a bit of an issue there), wait
n
seconds before sendingngch_request
n
= 9 + random(0 .. 7)ngch_request
packet data:allowed values from 5 to 130 minutes (both inclusive)
tox_group_custom_private_packet_cb()
and it's thengch_request
packetthe tox client needs to get authorization from the user that it's ok to
share group chat history with the requesting peer
then we send all non-private group chats messages from 130 minutes ago up to now
sorted by oldest (first) to newest (last)
each message is sent as a seperate lossless custom packet
wait
n
milliseconds seconds before sending the next message.n
= 300 + random(0 .. 300)ngch_syncmsg
packet data:MAX_GC_CUSTOM_PACKET_SIZE 40000
header_size = 6 + 1 + 1 + 4 + 32 + 4 + 25 = 73
max sync message text bytes = MAX_GC_CUSTOM_PACKET_SIZE - header_size = 39927
tox_group_custom_private_packet_cb()
and it's thengch_syncmsg
packetthe tox client needs to sort these messages into the group chat view
since the dates can be in the past and newer messages can already be present in the current uservisible view.
if a message with that
msg id
for this group chat and thissender
within the last 300 days already exists,then assume it is a duplicate and keep the current message and discard the incoming sync message.
since
name
could have been cut at the maximum byte limit, the tox client needs to check for cut off UTF-8 and handle this accordingly.