mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
commit
27c4873dc5
|
@ -978,6 +978,12 @@ ToxId Core::getGroupPeerToxId(int groupId, int peerId) const
|
||||||
QList<QString> Core::getGroupPeerNames(int groupId) const
|
QList<QString> Core::getGroupPeerNames(int groupId) const
|
||||||
{
|
{
|
||||||
QList<QString> names;
|
QList<QString> names;
|
||||||
|
if (!tox)
|
||||||
|
{
|
||||||
|
qWarning() << "Can't get group peer names, tox is null";
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
int result = getGroupNumberPeers(groupId);
|
int result = getGroupNumberPeers(groupId);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1502,8 +1502,11 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha
|
||||||
{
|
{
|
||||||
qDebug() << "onGroupNamelistChanged: Group "<<groupnumber<<" not found, creating it";
|
qDebug() << "onGroupNamelistChanged: Group "<<groupnumber<<" not found, creating it";
|
||||||
g = createGroup(groupnumber);
|
g = createGroup(groupnumber);
|
||||||
|
if (!g)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TOX_CHAT_CHANGE change = static_cast<TOX_CHAT_CHANGE>(Change);
|
TOX_CHAT_CHANGE change = static_cast<TOX_CHAT_CHANGE>(Change);
|
||||||
if (change == TOX_CHAT_CHANGE_PEER_ADD)
|
if (change == TOX_CHAT_CHANGE_PEER_ADD)
|
||||||
{
|
{
|
||||||
|
@ -1586,14 +1589,29 @@ Group *Widget::createGroup(int groupId)
|
||||||
Group* g = GroupList::findGroup(groupId);
|
Group* g = GroupList::findGroup(groupId);
|
||||||
if (g)
|
if (g)
|
||||||
{
|
{
|
||||||
qWarning() << "createGroup: Group already exists";
|
qWarning() << "Group already exists";
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core* core = Nexus::getCore();
|
Core* core = Nexus::getCore();
|
||||||
|
|
||||||
|
if (!core)
|
||||||
|
{
|
||||||
|
qWarning() << "Can't create group. Core does not exist";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
QString groupName = QString("Groupchat #%1").arg(groupId);
|
QString groupName = QString("Groupchat #%1").arg(groupId);
|
||||||
Group* newgroup = GroupList::addGroup(groupId, groupName, core->getAv()->isGroupAvEnabled(groupId));
|
CoreAV* coreAv = core->getAv();
|
||||||
|
|
||||||
|
if (!coreAv)
|
||||||
|
{
|
||||||
|
qWarning() << "Can't create group. CoreAv does not exist";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool enabled = coreAv->isGroupAvEnabled(groupId);
|
||||||
|
Group* newgroup = GroupList::addGroup(groupId, groupName, enabled);
|
||||||
|
|
||||||
contactListWidget->addGroupWidget(newgroup->getGroupWidget());
|
contactListWidget->addGroupWidget(newgroup->getGroupWidget());
|
||||||
newgroup->getGroupWidget()->updateStatusLight();
|
newgroup->getGroupWidget()->updateStatusLight();
|
||||||
|
@ -1616,6 +1634,8 @@ Group *Widget::createGroup(int groupId)
|
||||||
void Widget::onEmptyGroupCreated(int groupId)
|
void Widget::onEmptyGroupCreated(int groupId)
|
||||||
{
|
{
|
||||||
Group* group = createGroup(groupId);
|
Group* group = createGroup(groupId);
|
||||||
|
if (!group)
|
||||||
|
return;
|
||||||
|
|
||||||
// Only rename group if groups are visible.
|
// Only rename group if groups are visible.
|
||||||
if (Widget::getInstance()->groupsVisible())
|
if (Widget::getInstance()->groupsVisible())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user