mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
33 lines
668 B
C++
33 lines
668 B
C++
#include "friend.h"
|
|
#include "friendlist.h"
|
|
#include <QMenu>
|
|
|
|
QList<Friend*> FriendList::friendList;
|
|
|
|
Friend* FriendList::addFriend(int friendId, QString userId)
|
|
{
|
|
Friend* newfriend = new Friend(friendId, userId);
|
|
friendList.append(newfriend);
|
|
return newfriend;
|
|
}
|
|
|
|
Friend* FriendList::findFriend(int friendId)
|
|
{
|
|
for (Friend* f : friendList)
|
|
if (f->friendId == friendId)
|
|
return f;
|
|
return nullptr;
|
|
}
|
|
|
|
void FriendList::removeFriend(int friendId)
|
|
{
|
|
for (int i=0; i<friendList.size(); i++)
|
|
{
|
|
if (friendList[i]->friendId == friendId)
|
|
{
|
|
friendList.removeAt(i);
|
|
return;
|
|
}
|
|
}
|
|
}
|