diff options
Diffstat (limited to 'toxcore/group.h')
-rw-r--r-- | toxcore/group.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/toxcore/group.h b/toxcore/group.h index 544fbdb7..51152843 100644 --- a/toxcore/group.h +++ b/toxcore/group.h | |||
@@ -41,7 +41,6 @@ typedef struct { | |||
41 | uint8_t client_id[crypto_box_PUBLICKEYBYTES]; | 41 | uint8_t client_id[crypto_box_PUBLICKEYBYTES]; |
42 | uint64_t pingid; | 42 | uint64_t pingid; |
43 | uint64_t last_pinged; | 43 | uint64_t last_pinged; |
44 | IP_Port ping_via; | ||
45 | 44 | ||
46 | uint64_t last_recv; | 45 | uint64_t last_recv; |
47 | uint64_t last_recv_msgping; | 46 | uint64_t last_recv_msgping; |
@@ -52,12 +51,20 @@ typedef struct { | |||
52 | 51 | ||
53 | uint8_t deleted; | 52 | uint8_t deleted; |
54 | uint64_t deleted_time; | 53 | uint64_t deleted_time; |
55 | } Group_Peer; | ||
56 | 54 | ||
55 | uint16_t peer_number; | ||
56 | } Group_Peer; | ||
57 | 57 | ||
58 | #define MAX_GROUP_CONNECTIONS 4 | 58 | #define DESIRED_CLOSE_CONNECTIONS 3 |
59 | #define MAX_GROUP_CONNECTIONS 16 | ||
59 | #define GROUP_IDENTIFIER_LENGTH crypto_box_KEYBYTES /* So we can use new_symmetric_key(...) to fill it */ | 60 | #define GROUP_IDENTIFIER_LENGTH crypto_box_KEYBYTES /* So we can use new_symmetric_key(...) to fill it */ |
60 | 61 | ||
62 | enum { | ||
63 | GROUPCHAT_CLOSE_NONE, | ||
64 | GROUPCHAT_CLOSE_FRIEND, | ||
65 | GROUPCHAT_CLOSE_GROUPCON | ||
66 | }; | ||
67 | |||
61 | typedef struct { | 68 | typedef struct { |
62 | uint8_t status; | 69 | uint8_t status; |
63 | 70 | ||
@@ -65,11 +72,15 @@ typedef struct { | |||
65 | uint32_t numpeers; | 72 | uint32_t numpeers; |
66 | 73 | ||
67 | struct { | 74 | struct { |
68 | uint8_t type; | 75 | uint8_t type; /* GROUPCHAT_CLOSE_* */ |
69 | uint32_t number; | 76 | uint32_t number; |
77 | uint16_t group_number; | ||
70 | } close[MAX_GROUP_CONNECTIONS]; | 78 | } close[MAX_GROUP_CONNECTIONS]; |
71 | 79 | ||
72 | uint8_t identifier[GROUP_IDENTIFIER_LENGTH]; | 80 | uint8_t identifier[GROUP_IDENTIFIER_LENGTH]; |
81 | |||
82 | uint32_t message_number; | ||
83 | uint16_t peer_number; | ||
73 | } Group_c; | 84 | } Group_c; |
74 | 85 | ||
75 | typedef struct { | 86 | typedef struct { |
@@ -155,19 +166,19 @@ int invite_friend(Group_Chats *g_c, int32_t friendnumber, int groupnumber); | |||
155 | * returns group number on success | 166 | * returns group number on success |
156 | * returns -1 on failure. | 167 | * returns -1 on failure. |
157 | */ | 168 | */ |
158 | int join_groupchat(Group_Chats *g_c, int32_t friendnumber, uint8_t *data, uint16_t length); | 169 | int join_groupchat(Group_Chats *g_c, int32_t friendnumber, const uint8_t *data, uint16_t length); |
159 | 170 | ||
160 | /* send a group message | 171 | /* send a group message |
161 | * return 0 on success | 172 | * return 0 on success |
162 | * return -1 on failure | 173 | * return -1 on failure |
163 | */ | 174 | */ |
164 | int group_message_send(const Group_Chats *g_c, int groupnumber, const uint8_t *message, uint32_t length); | 175 | int group_message_send(const Group_Chats *g_c, int groupnumber, const uint8_t *message, uint16_t length); |
165 | 176 | ||
166 | /* send a group action | 177 | /* send a group action |
167 | * return 0 on success | 178 | * return 0 on success |
168 | * return -1 on failure | 179 | * return -1 on failure |
169 | */ | 180 | */ |
170 | int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *action, uint32_t length); | 181 | int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *action, uint16_t length); |
171 | 182 | ||
172 | /* Return the number of peers in the group chat on success. | 183 | /* Return the number of peers in the group chat on success. |
173 | * return -1 on failure | 184 | * return -1 on failure |