mirror-chatterino2/accountmanager.h
Rasmus Karlsson fa914c152a you can now log in with username/oauth token from an env variable
useful while testing (especially on stream)
2017-05-30 18:24:55 +02:00

40 lines
837 B
C++

#ifndef ACCOUNTMANAGER_H
#define ACCOUNTMANAGER_H
#include "twitch/twitchuser.h"
#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 _twitchAnon if _twitchUsers is empty
twitch::TwitchUser &getTwitchUser();
std::vector<twitch::TwitchUser> getTwitchUsers();
bool removeTwitchUser(const QString &userName);
void addTwitchUser(const twitch::TwitchUser &user);
private:
AccountManager();
twitch::TwitchUser _twitchAnon;
std::vector<twitch::TwitchUser> _twitchUsers;
std::mutex _twitchUsersMutex;
};
} // namespace chatterino
#endif // ACCOUNTMANAGER_H