2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "twitch/twitchuser.hpp"
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-04-13 16:06:23 +02:00
|
|
|
#include <mutex>
|
2017-04-14 14:08:57 +02:00
|
|
|
#include <vector>
|
2017-04-13 16:06:23 +02:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class AccountManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static AccountManager &getInstance()
|
|
|
|
{
|
2017-04-19 15:25:05 +02:00
|
|
|
static AccountManager instance;
|
2017-04-12 17:46:44 +02:00
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2017-04-13 16:06:23 +02:00
|
|
|
twitch::TwitchUser &getTwitchAnon();
|
|
|
|
|
2017-06-11 12:00:53 +02:00
|
|
|
// Returns first user from twitchUsers, or twitchAnonymousUser if twitchUsers is empty
|
2017-05-30 18:24:55 +02:00
|
|
|
twitch::TwitchUser &getTwitchUser();
|
|
|
|
|
2017-06-11 12:00:53 +02:00
|
|
|
// Return a copy of the current available twitch users
|
2017-04-13 16:06:23 +02:00
|
|
|
std::vector<twitch::TwitchUser> getTwitchUsers();
|
2017-06-11 12:00:53 +02:00
|
|
|
|
|
|
|
// Remove twitch user with the given username
|
2017-04-13 16:06:23 +02:00
|
|
|
bool removeTwitchUser(const QString &userName);
|
2017-06-11 12:00:53 +02:00
|
|
|
|
|
|
|
// Add twitch user to the list of available twitch users
|
2017-04-13 16:06:23 +02:00
|
|
|
void addTwitchUser(const twitch::TwitchUser &user);
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
AccountManager();
|
|
|
|
|
2017-06-11 12:00:53 +02:00
|
|
|
twitch::TwitchUser twitchAnonymousUser;
|
|
|
|
std::vector<twitch::TwitchUser> twitchUsers;
|
|
|
|
std::mutex twitchUsersMutex;
|
2017-04-12 17:46:44 +02:00
|
|
|
};
|
2017-05-27 17:45:40 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|