added basic settings page for accounts
This commit is contained in:
+31
-3
@@ -5,12 +5,40 @@ namespace chatterino {
|
||||
AccountManager AccountManager::instance;
|
||||
|
||||
AccountManager::AccountManager()
|
||||
: _anon("justinfan64537", "", "")
|
||||
: _twitchAnon("justinfan64537", "", "")
|
||||
, _twitchUsers()
|
||||
, _twitchUsersMutex()
|
||||
{
|
||||
}
|
||||
|
||||
twitch::TwitchUser &AccountManager::getAnon()
|
||||
twitch::TwitchUser &AccountManager::getTwitchAnon()
|
||||
{
|
||||
return _anon;
|
||||
return _twitchAnon;
|
||||
}
|
||||
|
||||
std::vector<twitch::TwitchUser> AccountManager::getTwitchUsers()
|
||||
{
|
||||
return std::vector<twitch::TwitchUser>(_twitchUsers);
|
||||
}
|
||||
|
||||
bool AccountManager::removeTwitchUser(const QString &userName)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_twitchUsersMutex);
|
||||
|
||||
for (auto it = _twitchUsers.begin(); it != _twitchUsers.end(); it++) {
|
||||
if ((*it).getUserName() == userName) {
|
||||
_twitchUsers.erase(it);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AccountManager::addTwitchUser(const twitch::TwitchUser &user)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_twitchUsersMutex);
|
||||
|
||||
_twitchUsers.push_back(user);
|
||||
}
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user