1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/friendlist.cpp
Tux3 / Mlkj / !Lev.uXFMLA 18cee41cfb Initial commit
2014-06-24 22:11:11 +02:00

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;
}
}
}