fix: Display Sent IRC Messages Like Received Ones (#4027)

This commit is contained in:
nerix
2022-10-01 17:36:22 +02:00
committed by GitHub
parent a275a1793a
commit ba586f01d0
8 changed files with 230 additions and 186 deletions
+24
View File
@@ -64,6 +64,13 @@ public:
QString matchLink(const QString &string);
void addLink(const QString &origLink, const QString &matchedLink);
/**
* Adds the text, applies irc colors, adds links,
* and updates the message's messageText.
* See https://modern.ircdocs.horse/formatting.html
*/
void addIrcMessageText(const QString &text);
template <typename T, typename... Args>
// clang-format off
// clang-format can be enabled once clang-format v11+ has been installed in CI
@@ -79,6 +86,12 @@ public:
return pointer;
}
protected:
virtual void addTextOrEmoji(EmotePtr emote);
virtual void addTextOrEmoji(const QString &value);
MessageColor textColor_ = MessageColor::Text;
private:
// Helper method that emplaces some text stylized as system text
// and then appends that text to the QString parameter "toUpdate".
@@ -86,6 +99,17 @@ private:
TextElement *emplaceSystemTextAndUpdate(const QString &text,
QString &toUpdate);
/**
* This will add the text and replace any emojis
* with an emoji emote-element.
*
* @param text Text to add
* @param color Color of the text
* @param addSpace true if a trailing space should be added after emojis
*/
void addIrcWord(const QString &text, const QColor &color,
bool addSpace = true);
std::shared_ptr<Message> message_;
};