mirror-chatterino2/src/providers/twitch/twitchaccount.cpp

74 lines
1.4 KiB
C++
Raw Normal View History

2018-02-05 15:11:50 +01:00
#include "providers/twitch/twitchaccount.hpp"
#include "const.hpp"
namespace chatterino {
namespace providers {
namespace twitch {
2018-02-05 15:11:50 +01:00
TwitchAccount::TwitchAccount(const QString &_username, const QString &_oauthToken,
const QString &_oauthClient, const QString &_userID)
2018-05-06 12:52:47 +02:00
: controllers::accounts::Account("Twitch")
, oauthClient(_oauthClient)
2018-02-05 15:11:50 +01:00
, oauthToken(_oauthToken)
, userName(_username)
, userId(_userID)
2018-02-05 15:11:50 +01:00
, _isAnon(_username == ANONYMOUS_USERNAME)
{
}
2018-05-06 12:52:47 +02:00
QString TwitchAccount::toString() const
{
return this->getUserName();
}
2018-02-05 15:11:50 +01:00
const QString &TwitchAccount::getUserName() const
{
return this->userName;
}
const QString &TwitchAccount::getOAuthClient() const
{
return this->oauthClient;
}
const QString &TwitchAccount::getOAuthToken() const
{
return this->oauthToken;
}
const QString &TwitchAccount::getUserId() const
{
return this->userId;
}
bool TwitchAccount::setOAuthClient(const QString &newClientID)
{
if (this->oauthClient.compare(newClientID) == 0) {
return false;
}
this->oauthClient = newClientID;
return true;
}
bool TwitchAccount::setOAuthToken(const QString &newOAuthToken)
{
if (this->oauthToken.compare(newOAuthToken) == 0) {
return false;
}
this->oauthToken = newOAuthToken;
return true;
}
bool TwitchAccount::isAnon() const
{
return this->_isAnon;
}
2018-02-05 15:11:50 +01:00
} // namespace twitch
} // namespace providers
} // namespace chatterino