Skip to content

Commit 25d65a5

Browse files
committed
return bool
1 parent acb348b commit 25d65a5

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

toxcore/group.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ int add_groupchat(Group_Chats *g_c, uint8_t type)
10841084
return groupnumber;
10851085
}
10861086

1087-
static int group_leave(const Group_Chats *g_c, uint32_t groupnumber, bool permanent);
1087+
static bool group_leave(const Group_Chats *g_c, uint32_t groupnumber, bool permanent);
10881088

10891089
/* Delete a groupchat from the chats array, informing the group first as
10901090
* appropriate.
@@ -1654,39 +1654,37 @@ static int group_new_peer_send(const Group_Chats *g_c, uint32_t groupnumber, uin
16541654
}
16551655

16561656
/* send a kill_peer message
1657-
* return 0 on success
1658-
* return -1 on failure
1657+
* return true on success
16591658
*/
1660-
static int group_kill_peer_send(const Group_Chats *g_c, uint32_t groupnumber, uint16_t peer_num)
1659+
static bool group_kill_peer_send(const Group_Chats *g_c, uint32_t groupnumber, uint16_t peer_num)
16611660
{
16621661
uint8_t packet[GROUP_MESSAGE_KILL_PEER_LENGTH];
16631662

16641663
peer_num = net_htons(peer_num);
16651664
memcpy(packet, &peer_num, sizeof(uint16_t));
16661665

16671666
if (send_message_group(g_c, groupnumber, GROUP_MESSAGE_KILL_PEER_ID, packet, sizeof(packet)) > 0) {
1668-
return 0;
1667+
return true;
16691668
}
16701669

1671-
return -1;
1670+
return false;
16721671
}
16731672

16741673
/* send a freeze_peer message
1675-
* return 0 on success
1676-
* return -1 on failure
1674+
* return true on success
16771675
*/
1678-
static int group_freeze_peer_send(const Group_Chats *g_c, uint32_t groupnumber, uint16_t peer_num)
1676+
static bool group_freeze_peer_send(const Group_Chats *g_c, uint32_t groupnumber, uint16_t peer_num)
16791677
{
16801678
uint8_t packet[GROUP_MESSAGE_KILL_PEER_LENGTH];
16811679

16821680
peer_num = net_htons(peer_num);
16831681
memcpy(packet, &peer_num, sizeof(uint16_t));
16841682

16851683
if (send_message_group(g_c, groupnumber, GROUP_MESSAGE_FREEZE_PEER_ID, packet, sizeof(packet)) > 0) {
1686-
return 0;
1684+
return true;
16871685
}
16881686

1689-
return -1;
1687+
return false;
16901688
}
16911689

16921690
/* send a name message
@@ -1707,15 +1705,14 @@ static int group_name_send(const Group_Chats *g_c, uint32_t groupnumber, const u
17071705
}
17081706

17091707
/* send message to announce leaving group
1710-
* return 0 on success
1711-
* return -1 on failure
1708+
* return true on success
17121709
*/
1713-
static int group_leave(const Group_Chats *g_c, uint32_t groupnumber, bool permanent)
1710+
static bool group_leave(const Group_Chats *g_c, uint32_t groupnumber, bool permanent)
17141711
{
17151712
Group_c *g = get_group_c(g_c, groupnumber);
17161713

17171714
if (!g) {
1718-
return -1;
1715+
return false;
17191716
}
17201717

17211718
if (permanent) {

0 commit comments

Comments
 (0)