mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
show all irc messages for debugging
This commit is contained in:
parent
64362d687a
commit
13c9aabf29
4 changed files with 39 additions and 5 deletions
|
@ -328,6 +328,9 @@ std::shared_ptr<Channel> AbstractIrcServer::getCustomChannel(
|
|||
|
||||
QString AbstractIrcServer::cleanChannelName(const QString &dirtyChannelName)
|
||||
{
|
||||
if (dirtyChannelName.startsWith('#'))
|
||||
return dirtyChannelName.mid(1);
|
||||
else
|
||||
return dirtyChannelName;
|
||||
}
|
||||
|
||||
|
@ -356,7 +359,20 @@ void AbstractIrcServer::privateMessageReceived(
|
|||
void AbstractIrcServer::readConnectionMessageReceived(
|
||||
Communi::IrcMessage *message)
|
||||
{
|
||||
(void)message;
|
||||
/* XXX: only print this message once
|
||||
if (message->type() == Communi::IrcMessage::Join)
|
||||
{
|
||||
auto x = static_cast<Communi::IrcJoinMessage *>(message);
|
||||
|
||||
if (auto it = this->channels.find(this->cleanChannelName(x->channel()));
|
||||
it != this->channels.end())
|
||||
{
|
||||
if (auto shared = it->lock())
|
||||
shared->addMessage(
|
||||
MessageBuilder(systemMessage, "joined").release());
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void AbstractIrcServer::forEachChannel(std::function<void(ChannelPtr)> func)
|
||||
|
|
|
@ -13,7 +13,7 @@ IrcConnection::IrcConnection(QObject *parent)
|
|||
{
|
||||
if (!this->recentlyReceivedMessage_.load())
|
||||
{
|
||||
this->sendRaw("PING");
|
||||
this->sendRaw("PING chatterino/ping");
|
||||
this->reconnectTimer_.start();
|
||||
}
|
||||
this->recentlyReceivedMessage_ = false;
|
||||
|
|
|
@ -131,7 +131,20 @@ void IrcServer::privateMessageReceived(Communi::IrcPrivateMessage *message)
|
|||
|
||||
void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
|
||||
{
|
||||
qDebug() << QString(message->toData());
|
||||
AbstractIrcServer::readConnectionMessageReceived(message);
|
||||
|
||||
MessageBuilder builder;
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
builder.emplace<TextElement>(message->toData(), MessageElementFlag::Text);
|
||||
|
||||
auto msg = builder.release();
|
||||
|
||||
for (auto &&weak : this->channels)
|
||||
{
|
||||
if (auto shared = weak.lock())
|
||||
shared->addMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -131,6 +131,8 @@ void TwitchIrcServer::privateMessageReceived(
|
|||
void TwitchIrcServer::readConnectionMessageReceived(
|
||||
Communi::IrcMessage *message)
|
||||
{
|
||||
AbstractIrcServer::readConnectionMessageReceived(message);
|
||||
|
||||
if (message->type() == Communi::IrcMessage::Type::Private)
|
||||
{
|
||||
// We already have a handler for private messages
|
||||
|
@ -287,6 +289,9 @@ std::shared_ptr<Channel> TwitchIrcServer::getChannelOrEmptyByID(
|
|||
|
||||
QString TwitchIrcServer::cleanChannelName(const QString &dirtyChannelName)
|
||||
{
|
||||
if (dirtyChannelName.startsWith('#'))
|
||||
return dirtyChannelName.mid(1).toLower();
|
||||
else
|
||||
return dirtyChannelName.toLower();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue