2014-11-17 09:59:10 +08:00
Group chats.
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
Note: we assume everyone in the chat trusts each other.
2014-01-23 22:05:43 +08:00
2014-11-17 09:59:10 +08:00
These group chats work by temporarily adding the 4 "closest" people defined by a distance function
in group.c in order to form a circle of connected peers. These peers then relay messages to each other.
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
A friend invites another friend to a group chat by sending them an invite packet. The friend either ignores
the invite or responds with a response packet if he wants to join the chat. The friend invite contains the type
of groupchat (text only, A/V) the friend is being invited to.
2013-09-03 20:53:07 +08:00
2014-11-20 09:57:35 +08:00
2014-11-17 09:59:10 +08:00
TODO: write more of this.
2013-09-03 20:53:07 +08:00
## Protocol
2014-11-17 09:59:10 +08:00
Invite packets:
Invite packet:
[uint8_t id 96][uint8_t id 0][uint16_t group chat number][33 bytes group chat identifier[1 byte type][32 bytes id]]
Response packet
[uint8_t id 96][uint8_t id 1][uint16_t group chat number(local)][uint16_t group chat number to join][33 bytes group chat identifier[1 byte type][32 bytes id]]
Peer online packet:
2014-12-03 08:35:54 +08:00
[uint8_t id 97][uint16_t group chat number (local)][33 bytes group chat identifier[1 byte type][32 bytes id]]
2014-11-17 09:59:10 +08:00
Peer leave packet:
[uint8_t id 98][uint16_t group chat number][uint8_t id 1]
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
Peer query packet:
2014-11-20 09:57:35 +08:00
[uint8_t id 98][uint16_t group chat number][uint8_t id 8]
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
Peer response packet:
2014-11-20 09:57:35 +08:00
[uint8_t id 98][uint16_t group chat number][uint8_t id 9][Repeated times number of peers: [uint16_t peer num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key][uint8_t name length][name]]
2013-09-03 20:53:07 +08:00
2014-11-20 09:57:35 +08:00
Title response packet:
[uint8_t id 98][uint16_t group chat number][uint8_t id 10][title]
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
Message packets:
[uint8_t id 99][uint16_t group chat number][uint16_t peer number][uint32_t message number][uint8_t with a value representing id of message][data]
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
Lossy Message packets:
[uint8_t id 199][uint16_t group chat number][uint16_t peer number][uint16_t message number][uint8_t with a value representing id of message][data]
Group chat types:
0: text
1: AV
2013-09-03 20:53:07 +08:00
Note: the message number is increased by 1 for each sent message.
message ids:
0 - ping
sent every ~60 seconds by every peer.
No data.
16 - new_peer
Tell everyone about a new peer in the chat.
2014-11-17 09:59:10 +08:00
[uint16_t peer_num][uint8_t 32bytes real public key][uint8_t 32bytes temp DHT public key]
2013-09-03 20:53:07 +08:00
2014-11-17 09:59:10 +08:00
17 - kill_peer
[uint16_t peer_num]
2013-09-03 20:53:07 +08:00
48 - name change
[uint8_t name[namelen]]
2014-11-20 09:57:35 +08:00
49 - groupchat title change
[uint8_t title[titlelen]]
2013-09-03 20:53:07 +08:00
64 - chat message
[uint8_t message[messagelen]]
65 - action (/me)
2014-04-17 00:08:44 +08:00
[uint8_t message[messagelen]]
2014-11-17 09:59:10 +08:00