1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(groups): enable AV groups after load

Fix #5509
This commit is contained in:
Anthony Bilinski 2019-01-25 20:36:45 -08:00
parent e8d48e8788
commit 33d42c9766
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -1038,16 +1038,26 @@ void Core::loadGroups()
QString name; QString name;
const auto groupNumber = groupNumbers[i]; const auto groupNumber = groupNumbers[i];
size_t titleSize = tox_conference_get_title_size(tox.get(), groupNumber, &error); size_t titleSize = tox_conference_get_title_size(tox.get(), groupNumber, &error);
const GroupId persistentId = getGroupPersistentId(groupNumber);
const QString defaultName = tr("Groupchat %1").arg(persistentId.toString().left(8));
if (LogConferenceTitleError(error)) { if (LogConferenceTitleError(error)) {
name = tr("Groupchat %1").arg(getGroupPersistentId(groupNumber).toString().left(8)); name = defaultName;
} else { } else {
QByteArray nameByteArray = QByteArray(static_cast<int>(titleSize), Qt::Uninitialized); QByteArray nameByteArray = QByteArray(static_cast<int>(titleSize), Qt::Uninitialized);
tox_conference_get_title(tox.get(), groupNumber, tox_conference_get_title(tox.get(), groupNumber,
reinterpret_cast<uint8_t*>(nameByteArray.data()), &error); reinterpret_cast<uint8_t*>(nameByteArray.data()), &error);
if (LogConferenceTitleError(error)) {
name = defaultName;
} else {
name = ToxString(nameByteArray).getQString(); name = ToxString(nameByteArray).getQString();
} }
}
emit emptyGroupCreated(groupNumber, getGroupPersistentId(groupNumber), name); if (getGroupAvEnabled(groupNumber)) {
if (toxav_groupchat_enable_av(tox.get(), groupNumber, CoreAV::groupCallCallback, this)) {
qCritical() << "Failed to enable audio on loaded group" << groupNumber;
}
}
emit emptyGroupCreated(groupNumber, persistentId, name);
} }
delete[] groupNumbers; delete[] groupNumbers;