blob: 0b526437e3ea3523812a5bbcabd3d6d7223f7bdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "BridgeService.hpp"
namespace dchat
{
BridgeServiceUser::BridgeServiceUser(Type _type, const std::string &_name) :
User(User::Type::OTHER),
type(_type),
name(_name)
{
}
BridgeService::BridgeService()
{
}
BridgeService::~BridgeService()
{
for(User *user : users)
{
delete user;
}
}
bool BridgeService::addUser(BridgeServiceUser *user)
{
for(User *existingUser : users)
{
if(static_cast<BridgeServiceUser*>(existingUser)->equals(user))
return false;
}
users.push_back(user);
return true;
}
const std::vector<User*>& BridgeService::getUsers() const
{
return users;
}
}
|