mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Make join and part messages have user links (#3358)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
3a5c2b1d33
commit
b94e21a600
|
@ -33,6 +33,7 @@
|
||||||
- Minor: IRC now parses/displays links like Twitch chat. (#3334)
|
- Minor: IRC now parses/displays links like Twitch chat. (#3334)
|
||||||
- Minor: Added button & label for copying login name of user instead of display name in the user info popout. (#3335)
|
- Minor: Added button & label for copying login name of user instead of display name in the user info popout. (#3335)
|
||||||
- Minor: Make `/delete` errors a bit more verbose (#3350)
|
- Minor: Make `/delete` errors a bit more verbose (#3350)
|
||||||
|
- Minor: Made join and part message have links to usercards. (#3358)
|
||||||
- Minor: Show picked outcome in prediction badges. (#3357)
|
- Minor: Show picked outcome in prediction badges. (#3357)
|
||||||
- Minor: Add support for Emoji in IRC (#3354)
|
- Minor: Add support for Emoji in IRC (#3354)
|
||||||
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
|
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "messages/MessageBuilder.hpp"
|
#include "messages/MessageBuilder.hpp"
|
||||||
|
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
@ -34,8 +35,9 @@ void ChannelChatters::addJoinedUser(const QString &user)
|
||||||
QTimer::singleShot(500, &this->lifetimeGuard_, [this] {
|
QTimer::singleShot(500, &this->lifetimeGuard_, [this] {
|
||||||
auto joinedUsers = this->joinedUsers_.access();
|
auto joinedUsers = this->joinedUsers_.access();
|
||||||
|
|
||||||
MessageBuilder builder(systemMessage,
|
MessageBuilder builder;
|
||||||
"Users joined: " + joinedUsers->join(", "));
|
TwitchMessageBuilder::listOfUsersSystemMessage(
|
||||||
|
"Users joined:", *joinedUsers, &this->channel_, &builder);
|
||||||
builder->flags.set(MessageFlag::Collapsed);
|
builder->flags.set(MessageFlag::Collapsed);
|
||||||
joinedUsers->clear();
|
joinedUsers->clear();
|
||||||
this->channel_.addMessage(builder.release());
|
this->channel_.addMessage(builder.release());
|
||||||
|
@ -56,8 +58,9 @@ void ChannelChatters::addPartedUser(const QString &user)
|
||||||
QTimer::singleShot(500, &this->lifetimeGuard_, [this] {
|
QTimer::singleShot(500, &this->lifetimeGuard_, [this] {
|
||||||
auto partedUsers = this->partedUsers_.access();
|
auto partedUsers = this->partedUsers_.access();
|
||||||
|
|
||||||
MessageBuilder builder(systemMessage,
|
MessageBuilder builder;
|
||||||
"Users parted: " + partedUsers->join(", "));
|
TwitchMessageBuilder::listOfUsersSystemMessage(
|
||||||
|
"Users parted:", *partedUsers, &this->channel_, &builder);
|
||||||
builder->flags.set(MessageFlag::Collapsed);
|
builder->flags.set(MessageFlag::Collapsed);
|
||||||
this->channel_.addMessage(builder.release());
|
this->channel_.addMessage(builder.release());
|
||||||
partedUsers->clear();
|
partedUsers->clear();
|
||||||
|
|
|
@ -865,8 +865,8 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
||||||
auto users = msgParts.at(1)
|
auto users = msgParts.at(1)
|
||||||
.mid(1) // there is a space before the first user
|
.mid(1) // there is a space before the first user
|
||||||
.split(", ");
|
.split(", ");
|
||||||
TwitchMessageBuilder::modsOrVipsSystemMessage(msgParts.at(0), users,
|
TwitchMessageBuilder::listOfUsersSystemMessage(msgParts.at(0),
|
||||||
tc, &builder);
|
users, tc, &builder);
|
||||||
channel->addMessage(builder.release());
|
channel->addMessage(builder.release());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1460,10 +1460,10 @@ void TwitchMessageBuilder::deletionMessage(const DeleteAction &action,
|
||||||
builder->message().timeoutUser = "msg:" + action.messageId;
|
builder->message().timeoutUser = "msg:" + action.messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchMessageBuilder::modsOrVipsSystemMessage(QString prefix,
|
void TwitchMessageBuilder::listOfUsersSystemMessage(QString prefix,
|
||||||
QStringList users,
|
QStringList users,
|
||||||
TwitchChannel *channel,
|
Channel *channel,
|
||||||
MessageBuilder *builder)
|
MessageBuilder *builder)
|
||||||
{
|
{
|
||||||
builder->emplace<TimestampElement>();
|
builder->emplace<TimestampElement>();
|
||||||
builder->message().flags.set(MessageFlag::System);
|
builder->message().flags.set(MessageFlag::System);
|
||||||
|
@ -1471,6 +1471,7 @@ void TwitchMessageBuilder::modsOrVipsSystemMessage(QString prefix,
|
||||||
builder->emplace<TextElement>(prefix, MessageElementFlag::Text,
|
builder->emplace<TextElement>(prefix, MessageElementFlag::Text,
|
||||||
MessageColor::System);
|
MessageColor::System);
|
||||||
bool isFirst = true;
|
bool isFirst = true;
|
||||||
|
auto tc = dynamic_cast<TwitchChannel *>(channel);
|
||||||
for (const QString &username : users)
|
for (const QString &username : users)
|
||||||
{
|
{
|
||||||
if (!isFirst)
|
if (!isFirst)
|
||||||
|
@ -1483,9 +1484,9 @@ void TwitchMessageBuilder::modsOrVipsSystemMessage(QString prefix,
|
||||||
|
|
||||||
MessageColor color = MessageColor::System;
|
MessageColor color = MessageColor::System;
|
||||||
|
|
||||||
if (getSettings()->colorUsernames)
|
if (tc && getSettings()->colorUsernames)
|
||||||
{
|
{
|
||||||
if (auto userColor = channel->getUserColor(username);
|
if (auto userColor = tc->getUserColor(username);
|
||||||
userColor.isValid())
|
userColor.isValid())
|
||||||
{
|
{
|
||||||
color = MessageColor(userColor);
|
color = MessageColor(userColor);
|
||||||
|
|
|
@ -64,9 +64,9 @@ public:
|
||||||
MessageBuilder *builder);
|
MessageBuilder *builder);
|
||||||
static void deletionMessage(const DeleteAction &action,
|
static void deletionMessage(const DeleteAction &action,
|
||||||
MessageBuilder *builder);
|
MessageBuilder *builder);
|
||||||
static void modsOrVipsSystemMessage(QString prefix, QStringList users,
|
static void listOfUsersSystemMessage(QString prefix, QStringList users,
|
||||||
TwitchChannel *channel,
|
Channel *channel,
|
||||||
MessageBuilder *builder);
|
MessageBuilder *builder);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parseUsernameColor() override;
|
void parseUsernameColor() override;
|
||||||
|
|
Loading…
Reference in a new issue