@@ -250,6 +250,7 @@ void Core::onStarted()
250
250
emit idSet (id);
251
251
252
252
loadFriends ();
253
+ loadGroups ();
253
254
254
255
process (); // starts its own timer
255
256
av->start ();
@@ -990,16 +991,15 @@ void Core::loadFriends()
990
991
{
991
992
QMutexLocker ml{coreLoopLock.get ()};
992
993
993
- const uint32_t friendCount = tox_self_get_friend_list_size (tox.get ());
994
+ const size_t friendCount = tox_self_get_friend_list_size (tox.get ());
994
995
if (friendCount == 0 ) {
995
996
return ;
996
997
}
997
998
998
- // assuming there are not that many friends to fill up the whole stack
999
999
uint32_t * ids = new uint32_t [friendCount];
1000
1000
tox_self_get_friend_list (tox.get (), ids);
1001
1001
uint8_t friendPk[TOX_PUBLIC_KEY_SIZE] = {0x00 };
1002
- for (uint32_t i = 0 ; i < friendCount; ++i) {
1002
+ for (size_t i = 0 ; i < friendCount; ++i) {
1003
1003
if (!tox_friend_get_public_key (tox.get (), ids[i], friendPk, nullptr )) {
1004
1004
continue ;
1005
1005
}
@@ -1012,6 +1012,23 @@ void Core::loadFriends()
1012
1012
delete[] ids;
1013
1013
}
1014
1014
1015
+ void Core::loadGroups ()
1016
+ {
1017
+ QMutexLocker ml{coreLoopLock.get ()};
1018
+
1019
+ const size_t groupCnt = tox_conference_get_chatlist_size (tox.get ());
1020
+ if (groupCnt == 0 ) {
1021
+ return ;
1022
+ }
1023
+
1024
+ uint32_t * groupIds = new uint32_t [groupCnt];
1025
+ tox_conference_get_chatlist (tox.get (), groupIds);
1026
+
1027
+ for (size_t i = 0 ; i < groupCnt; ++i) {
1028
+ emit emptyGroupCreated (static_cast <int >(groupIds[i]));
1029
+ }
1030
+ }
1031
+
1015
1032
void Core::checkLastOnline (uint32_t friendId)
1016
1033
{
1017
1034
QMutexLocker ml{coreLoopLock.get ()};
0 commit comments