mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix minor switching bug introduced by 07ea2e
This commit is contained in:
parent
76a8affcdc
commit
3dd15f0a5f
@ -991,9 +991,9 @@ void Core::acceptFileRecvRequest(int friendId, int fileNum, QString path)
|
||||
tox_file_send_control(tox, file->friendId, 1, file->fileNum, TOX_FILECONTROL_ACCEPT, nullptr, 0);
|
||||
}
|
||||
|
||||
void Core::removeFriend(int friendId)
|
||||
void Core::removeFriend(int friendId, bool fake)
|
||||
{
|
||||
if (!tox)
|
||||
if (!tox || fake)
|
||||
return;
|
||||
if (tox_del_friend(tox, friendId) == -1) {
|
||||
emit failedToRemoveFriend(friendId);
|
||||
@ -1003,9 +1003,9 @@ void Core::removeFriend(int friendId)
|
||||
}
|
||||
}
|
||||
|
||||
void Core::removeGroup(int groupId)
|
||||
void Core::removeGroup(int groupId, bool fake)
|
||||
{
|
||||
if (!tox)
|
||||
if (!tox || fake)
|
||||
return;
|
||||
tox_del_groupchat(tox, groupId);
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ public slots:
|
||||
void groupInviteFriend(int friendId, int groupId);
|
||||
void createGroup(uint8_t type = TOX_GROUPCHAT_TYPE_AV);
|
||||
|
||||
void removeFriend(int friendId);
|
||||
void removeGroup(int groupId);
|
||||
void removeFriend(int friendId, bool fake = false);
|
||||
void removeGroup(int groupId, bool fake = false);
|
||||
|
||||
void setStatus(Status status);
|
||||
void setUsername(const QString& username);
|
||||
|
@ -587,8 +587,8 @@ VideoSource *Core::getVideoSourceFromCall(int callNumber)
|
||||
return &calls[callNumber].videoSource;
|
||||
}
|
||||
|
||||
void Core::playGroupAudio(Tox* tox, int groupnumber, int friendgroupnumber, const int16_t* out_audio,
|
||||
unsigned out_audio_samples, uint8_t decoder_channels, unsigned audio_sample_rate, void* userdata)
|
||||
void Core::playGroupAudio(Tox* /*tox*/, int /*groupnumber*/, int /*friendgroupnumber*/, const int16_t* out_audio,
|
||||
unsigned out_audio_samples, uint8_t decoder_channels, unsigned audio_sample_rate, void* /*userdata*/)
|
||||
{
|
||||
/// TODO: FIXME: Don't play groupchat audio on the main source!
|
||||
/// We'll need some sort of call[] array but for groupchats, when that's done use this source
|
||||
|
@ -46,12 +46,13 @@ Friend* FriendList::findFriend(int friendId)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FriendList::removeFriend(int friendId)
|
||||
void FriendList::removeFriend(int friendId, bool fake)
|
||||
{
|
||||
auto f_it = friendList.find(friendId);
|
||||
if (f_it != friendList.end())
|
||||
{
|
||||
Settings::getInstance().removeFriendSettings(f_it.value()->getToxID());
|
||||
if (!fake)
|
||||
Settings::getInstance().removeFriendSettings(f_it.value()->getToxID());
|
||||
friendList.erase(f_it);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
static Friend* findFriend(int friendId);
|
||||
static Friend* findFriend(QString userId);
|
||||
static QList<Friend*> getAllFriends();
|
||||
static void removeFriend(int friendId);
|
||||
static void removeFriend(int friendId, bool fake = false);
|
||||
static void clear();
|
||||
|
||||
private:
|
||||
|
@ -34,7 +34,7 @@ Group* GroupList::findGroup(int groupId)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GroupList::removeGroup(int groupId)
|
||||
void GroupList::removeGroup(int groupId, bool /*fake*/)
|
||||
{
|
||||
for (int i=0; i<groupList.size(); i++)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
GroupList();
|
||||
static Group* addGroup(int groupId, const QString& name);
|
||||
static Group* findGroup(int groupId);
|
||||
static void removeGroup(int groupId);
|
||||
static void removeGroup(int groupId, bool fake = false);
|
||||
|
||||
public:
|
||||
static QList<Group*> groupList;
|
||||
|
@ -830,7 +830,7 @@ void Widget::onFriendRequestReceived(const QString& userId, const QString& messa
|
||||
emit friendRequestAccepted(userId);
|
||||
}
|
||||
|
||||
void Widget::removeFriend(Friend* f)
|
||||
void Widget::removeFriend(Friend* f, bool fake)
|
||||
{
|
||||
f->getFriendWidget()->setAsInactiveChatroom();
|
||||
if (static_cast<GenericChatroomWidget*>(f->getFriendWidget()) == activeChatroomWidget)
|
||||
@ -838,10 +838,10 @@ void Widget::removeFriend(Friend* f)
|
||||
activeChatroomWidget = nullptr;
|
||||
onAddClicked();
|
||||
}
|
||||
FriendList::removeFriend(f->getFriendID());
|
||||
core->removeFriend(f->getFriendID());
|
||||
FriendList::removeFriend(f->getFriendID(), fake);
|
||||
core->removeFriend(f->getFriendID(), fake);
|
||||
delete f;
|
||||
if (ui->mainHead->layout()->isEmpty())
|
||||
if (ui->mainHead->layout()->isEmpty()) // tux3: this should have covered the case of the bug you "fixed" 5 lines above
|
||||
onAddClicked();
|
||||
|
||||
contactListWidget->hide();
|
||||
@ -850,16 +850,16 @@ void Widget::removeFriend(Friend* f)
|
||||
|
||||
void Widget::removeFriend(int friendId)
|
||||
{
|
||||
removeFriend(FriendList::findFriend(friendId));
|
||||
removeFriend(FriendList::findFriend(friendId), false);
|
||||
}
|
||||
|
||||
void Widget::clearContactsList()
|
||||
{
|
||||
QList<Friend*> friends = FriendList::getAllFriends();
|
||||
for (Friend* f : friends)
|
||||
removeFriend(f);
|
||||
removeFriend(f, true);
|
||||
for (Group* g : GroupList::groupList)
|
||||
removeGroup(g);
|
||||
removeGroup(g, true);
|
||||
}
|
||||
|
||||
void Widget::copyFriendIdToClipboard(int friendId)
|
||||
@ -945,7 +945,7 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha
|
||||
g->updatePeer(peernumber,core->getGroupPeerName(groupnumber, peernumber));
|
||||
}
|
||||
|
||||
void Widget::removeGroup(Group* g)
|
||||
void Widget::removeGroup(Group* g, bool fake)
|
||||
{
|
||||
g->widget->setAsInactiveChatroom();
|
||||
if (static_cast<GenericChatroomWidget*>(g->widget) == activeChatroomWidget)
|
||||
@ -953,8 +953,8 @@ void Widget::removeGroup(Group* g)
|
||||
activeChatroomWidget = nullptr;
|
||||
onAddClicked();
|
||||
}
|
||||
GroupList::removeGroup(g->groupId);
|
||||
core->removeGroup(g->groupId);
|
||||
GroupList::removeGroup(g->groupId, fake);
|
||||
core->removeGroup(g->groupId, fake);
|
||||
delete g;
|
||||
if (ui->mainHead->layout()->isEmpty())
|
||||
onAddClicked();
|
||||
|
@ -133,8 +133,8 @@ private:
|
||||
void hideMainForms();
|
||||
virtual bool event(QEvent * e);
|
||||
Group* createGroup(int groupId);
|
||||
void removeFriend(Friend* f);
|
||||
void removeGroup(Group* g);
|
||||
void removeFriend(Friend* f, bool fake = false);
|
||||
void removeGroup(Group* g, bool fake = false);
|
||||
QString askProfiles();
|
||||
QString detectProfile();
|
||||
QSystemTrayIcon *icon;
|
||||
|
Loading…
x
Reference in New Issue
Block a user