Skip to content

Commit d55d0e4

Browse files
committed
cleanup: Remove redundant code for checking if group exists
1 parent 2a6dc64 commit d55d0e4

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

toxcore/group_chats.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8428,19 +8428,7 @@ GC_Chat *gc_get_group_by_public_key(const GC_Session *c, const uint8_t *public_k
84288428
/** Return True if chat_id exists in the session chat array */
84298429
static bool group_exists(const GC_Session *c, const uint8_t *chat_id)
84308430
{
8431-
for (uint32_t i = 0; i < c->chats_index; ++i) {
8432-
const GC_Chat *chat = &c->chats[i];
8433-
8434-
if (chat->connection_state == CS_NONE) {
8435-
continue;
8436-
}
8437-
8438-
if (memcmp(get_chat_id(&chat->chat_public_key), chat_id, CHAT_ID_SIZE) == 0) {
8439-
return true;
8440-
}
8441-
}
8442-
8443-
return false;
8431+
return gc_get_group_by_public_key(c, chat_id) != nullptr;
84448432
}
84458433

84468434
/** Creates a new 32-byte session encryption keypair and puts the results in `public_key` and `secret_key`. */

0 commit comments

Comments
 (0)