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

refactor(core): cleanup Core public functions

This commit is contained in:
sudden6 2019-03-03 21:53:25 +01:00
parent 216766061c
commit 93a7fdfe03
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
3 changed files with 12 additions and 8 deletions

View File

@ -807,11 +807,11 @@ void Core::acceptFileRecvRequest(uint32_t friendId, uint32_t fileNum, QString pa
CoreFile::acceptFileRecvRequest(this, friendId, fileNum, path); CoreFile::acceptFileRecvRequest(this, friendId, fileNum, path);
} }
void Core::removeFriend(uint32_t friendId, bool fake) void Core::removeFriend(uint32_t friendId)
{ {
QMutexLocker ml{coreLoopLock.get()}; QMutexLocker ml{coreLoopLock.get()};
if (!isReady() || fake) { if (!isReady()) {
return; return;
} }
@ -824,11 +824,11 @@ void Core::removeFriend(uint32_t friendId, bool fake)
emit friendRemoved(friendId); emit friendRemoved(friendId);
} }
void Core::removeGroup(int groupId, bool fake) void Core::removeGroup(int groupId)
{ {
QMutexLocker ml{coreLoopLock.get()}; QMutexLocker ml{coreLoopLock.get()};
if (!isReady() || fake) { if (!isReady()) {
return; return;
} }

View File

@ -113,8 +113,8 @@ public slots:
void groupInviteFriend(uint32_t friendId, int groupId); void groupInviteFriend(uint32_t friendId, int groupId);
int createGroup(uint8_t type = TOX_CONFERENCE_TYPE_AV); int createGroup(uint8_t type = TOX_CONFERENCE_TYPE_AV);
void removeFriend(uint32_t friendId, bool fake = false); void removeFriend(uint32_t friendId);
void removeGroup(int groupId, bool fake = false); void removeGroup(int groupId);
void setStatus(Status status); void setStatus(Status status);
void setUsername(const QString& username); void setUsername(const QString& username);

View File

@ -1525,7 +1525,9 @@ void Widget::removeFriend(Friend* f, bool fake)
} }
FriendList::removeFriend(friendId, fake); FriendList::removeFriend(friendId, fake);
Nexus::getCore()->removeFriend(friendId, fake); if (!fake) {
Nexus::getCore()->removeFriend(friendId);
}
friendWidgets.remove(friendId); friendWidgets.remove(friendId);
delete widget; delete widget;
@ -1854,7 +1856,9 @@ void Widget::removeGroup(Group* g, bool fake)
contentDialog->removeGroup(groupId); contentDialog->removeGroup(groupId);
} }
Nexus::getCore()->removeGroup(groupId, fake); if (!fake) {
Nexus::getCore()->removeGroup(groupId);
}
contactListWidget->removeGroupWidget(widget); // deletes widget contactListWidget->removeGroupWidget(widget); // deletes widget
groupWidgets.remove(groupId); groupWidgets.remove(groupId);