An error should now be printed if you connect with bad credentials.

This fix relies on #163 being closed, so for now #132 will be left open.
This commit is contained in:
Rasmus Karlsson 2017-12-28 18:37:39 +01:00
parent caddb2c778
commit 7d259fe7e6

View file

@ -449,7 +449,16 @@ void IrcManager::handleNoticeMessage(Communi::IrcNoticeMessage *message)
{ {
auto rawChannelName = message->target(); auto rawChannelName = message->target();
assert(rawChannelName.length() >= 2); bool broadcast = rawChannelName.length() < 2;
std::shared_ptr<Message> msg(Message::createSystemMessage(message->content()));
if (broadcast) {
this->channelManager.doOnAll([msg](const auto &c) {
c->addMessage(msg); //
});
return;
}
auto trimmedChannelName = rawChannelName.mid(1); auto trimmedChannelName = rawChannelName.mid(1);
@ -461,27 +470,11 @@ void IrcManager::handleNoticeMessage(Communi::IrcNoticeMessage *message)
return; return;
} }
std::shared_ptr<Message> msg(Message::createSystemMessage(message->content()));
c->addMessage(msg); c->addMessage(msg);
} }
void IrcManager::handleWriteConnectionNoticeMessage(Communi::IrcNoticeMessage *message) void IrcManager::handleWriteConnectionNoticeMessage(Communi::IrcNoticeMessage *message)
{ {
auto rawChannelName = message->target();
assert(rawChannelName.length() >= 2);
auto trimmedChannelName = rawChannelName.mid(1);
auto c = this->channelManager.getTwitchChannel(trimmedChannelName);
if (!c) {
debug::Log("[IrcManager:handleNoticeMessage] Channel {} not found in channel manager",
trimmedChannelName);
return;
}
QVariant v = message->tag("msg-id"); QVariant v = message->tag("msg-id");
if (!v.isValid()) { if (!v.isValid()) {
return; return;
@ -495,9 +488,7 @@ void IrcManager::handleWriteConnectionNoticeMessage(Communi::IrcNoticeMessage *m
return; return;
} }
std::shared_ptr<Message> msg(Message::createSystemMessage(message->content())); this->handleNoticeMessage(message);
c->addMessage(msg);
} }
void IrcManager::onConnected() void IrcManager::onConnected()