From 86935beb2fc04f4cefc47b77c85fb1ab02f0e05d Mon Sep 17 00:00:00 2001 From: "zugz (tox)" Date: Sat, 5 Jan 2019 22:02:45 +0100 Subject: [PATCH] Avoid sending group messages to a peer before we have its group number --- toxcore/group.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/toxcore/group.c b/toxcore/group.c index dfa821a4..d0609b1a 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -1041,7 +1041,10 @@ static void remove_conn_reason(Group_Chats *g_c, uint32_t groupnumber, uint16_t if (reason == GROUPCHAT_CLOSE_REASON_INTRODUCER) { --g->num_introducer_connections; - send_peer_introduced(g_c, g->close[i].number, g->close[i].group_number); + + if (g->close[i].type == GROUPCHAT_CLOSE_ONLINE) { + send_peer_introduced(g_c, g->close[i].number, g->close[i].group_number); + } } if (g->close[i].reasons == 0) { @@ -2237,6 +2240,10 @@ static void handle_direct_packet(Group_Chats *g_c, uint32_t groupnumber, const u return; } + if (g->close[close_index].type != GROUPCHAT_CLOSE_ONLINE) { + return; + } + send_peers(g_c, groupnumber, g->close[close_index].number, g->close[close_index].group_number); } @@ -2582,6 +2589,10 @@ static void handle_message_packet_group(Group_Chats *g_c, uint32_t groupnumber, return; } + if (g->close[close_index].type != GROUPCHAT_CLOSE_ONLINE) { + return; + } + /* If we don't know the peer this packet came from, then we query the * list of peers from the relaying peer. * (They would not have relayed it if they didn't know the peer.) */