mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Add a message if you're trying to type without being logged in
Fix #484
This commit is contained in:
parent
8b4f9d066e
commit
be931df4f4
3 changed files with 22 additions and 0 deletions
|
@ -137,6 +137,17 @@ void TwitchAccountManager::load()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TwitchAccountManager::isLoggedIn() const
|
||||||
|
{
|
||||||
|
if (!this->currentUser) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once `TwitchAccount` class has a way to check, we should also return false if the credentials
|
||||||
|
// are incorrect
|
||||||
|
return !this->currentUser->isAnon();
|
||||||
|
}
|
||||||
|
|
||||||
bool TwitchAccountManager::removeUser(TwitchAccount *account)
|
bool TwitchAccountManager::removeUser(TwitchAccount *account)
|
||||||
{
|
{
|
||||||
const auto &accs = this->accounts.getVector();
|
const auto &accs = this->accounts.getVector();
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
void reloadUsers();
|
void reloadUsers();
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
bool isLoggedIn() const;
|
||||||
|
|
||||||
pajlada::Settings::Setting<std::string> currentUsername = {"/accounts/current", ""};
|
pajlada::Settings::Setting<std::string> currentUsername = {"/accounts/current", ""};
|
||||||
pajlada::Signals::NoArgSignal currentUserChanged;
|
pajlada::Signals::NoArgSignal currentUserChanged;
|
||||||
pajlada::Signals::NoArgSignal userListUpdated;
|
pajlada::Signals::NoArgSignal userListUpdated;
|
||||||
|
|
|
@ -142,6 +142,15 @@ void TwitchChannel::sendMessage(const QString &message)
|
||||||
{
|
{
|
||||||
auto app = getApp();
|
auto app = getApp();
|
||||||
|
|
||||||
|
if (!app->accounts->twitch.isLoggedIn()) {
|
||||||
|
// XXX: It would be nice if we could add a link here somehow that opened the "account
|
||||||
|
// manager" dialog
|
||||||
|
this->addMessage(
|
||||||
|
messages::Message::createSystemMessage("You need to log in to send messages. You can "
|
||||||
|
"link your Twitch account in the settings."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debug::Log("[TwitchChannel:{}] Send message: {}", this->name, message);
|
debug::Log("[TwitchChannel:{}] Send message: {}", this->name, message);
|
||||||
|
|
||||||
// Do last message processing
|
// Do last message processing
|
||||||
|
|
Loading…
Reference in a new issue