From 607003509b98dc90607ce6ec822c975ea7b68223 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 2 Dec 2014 19:35:54 -0500 Subject: [PATCH] Fixed bug where group chat would see connection as offline when it was online. Clarified something in the docs. --- docs/Group-Chats.md | 2 +- toxcore/group.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/Group-Chats.md b/docs/Group-Chats.md index ccf3d413..e937d549 100644 --- a/docs/Group-Chats.md +++ b/docs/Group-Chats.md @@ -23,7 +23,7 @@ Response packet Peer online packet: -[uint8_t id 97][uint16_t group chat number][33 bytes group chat identifier[1 byte type][32 bytes id]] +[uint8_t id 97][uint16_t group chat number (local)][33 bytes group chat identifier[1 byte type][32 bytes id]] Peer leave packet: [uint8_t id 98][uint16_t group chat number][uint8_t id 1] diff --git a/toxcore/group.c b/toxcore/group.c index 40372bca..27ad6261 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -1383,12 +1383,17 @@ static int handle_packet_online(Group_Chats *g_c, int friendcon_id, uint8_t *dat if (index == -1) return -1; + if (g->close[index].type == GROUPCHAT_CLOSE_ONLINE) { + return -1; + } + if (count_close_connected(g) == 0) { send_peer_query(g_c, friendcon_id, other_groupnum); } g->close[index].group_number = other_groupnum; g->close[index].type = GROUPCHAT_CLOSE_ONLINE; + send_packet_online(g_c->fr_c, friendcon_id, groupnumber, g->identifier); if (g->number_joined != -1 && count_close_connected(g) >= DESIRED_CLOSE_CONNECTIONS) { int fr_close_index = friend_in_close(g, g->number_joined);