mirror-chatterino2/src/accountmanager.hpp
2017-06-11 12:00:53 +02:00

42 lines
957 B
C++

#pragma once
#include "twitch/twitchuser.hpp"
#include <mutex>
#include <vector>
namespace chatterino {
class AccountManager
{
public:
static AccountManager &getInstance()
{
static AccountManager instance;
return instance;
}
twitch::TwitchUser &getTwitchAnon();
// Returns first user from twitchUsers, or twitchAnonymousUser if twitchUsers is empty
twitch::TwitchUser &getTwitchUser();
// Return a copy of the current available twitch users
std::vector<twitch::TwitchUser> getTwitchUsers();
// Remove twitch user with the given username
bool removeTwitchUser(const QString &userName);
// Add twitch user to the list of available twitch users
void addTwitchUser(const twitch::TwitchUser &user);
private:
AccountManager();
twitch::TwitchUser twitchAnonymousUser;
std::vector<twitch::TwitchUser> twitchUsers;
std::mutex twitchUsersMutex;
};
} // namespace chatterino