Fix missing information in locally-generated IRC messages (#3203)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL 2021-08-29 14:05:45 +02:00 committed by GitHub
parent 25cdeb8d9f
commit cd2923c52a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -19,6 +19,7 @@
- Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130)
- Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134)
- Bugfix: Allow starting Streamlink from Chatterino when running as a Flatpak. (#3178)
- Bugfix: Fixed own IRC messages not having metadata and a link to a usercard. (#3203)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
- Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038)

View file

@ -1,6 +1,7 @@
#include "IrcChannel2.hpp"
#include "debug/AssertInGuiThread.hpp"
#include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp"
#include "providers/irc/IrcCommands.hpp"
#include "providers/irc/IrcServer.hpp"
@ -33,9 +34,14 @@ void IrcChannel::sendMessage(const QString &message)
MessageBuilder builder;
builder.emplace<TimestampElement>();
builder.emplace<TextElement>(this->server()->nick() + ":",
MessageElementFlag::Username);
const auto &nick = this->server()->nick();
builder.emplace<TextElement>(nick + ":", MessageElementFlag::Username)
->setLink({Link::UserInfo, nick});
builder.emplace<TextElement>(message, MessageElementFlag::Text);
builder.message().messageText = message;
builder.message().searchText = nick + ": " + message;
builder.message().loginName = nick;
builder.message().displayName = nick;
this->addMessage(builder.release());
}
}