Simple logging implemented
Message now stores a copy of the content string Use .nick() instead of .account() to get the users lowercase name (login name)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "messages/message.h"
|
||||
#include "channel.h"
|
||||
#include "colorscheme.h"
|
||||
#include "emojis.h"
|
||||
#include "emotes.h"
|
||||
@@ -30,6 +31,7 @@ Message::Message(const QString &text)
|
||||
Message::Message(const IrcPrivateMessage &ircMessage, Channel &channel,
|
||||
bool enablePingSound, bool isReceivedWhisper,
|
||||
bool isSentWhisper, bool includeChannel)
|
||||
: content(ircMessage.content())
|
||||
{
|
||||
this->parseTime = std::chrono::system_clock::now();
|
||||
|
||||
@@ -144,14 +146,10 @@ Message::Message(const IrcPrivateMessage &ircMessage, Channel &channel,
|
||||
}
|
||||
|
||||
// username
|
||||
this->userName = ircMessage.account();
|
||||
this->userName = ircMessage.nick();
|
||||
|
||||
if (this->userName.isEmpty()) {
|
||||
auto iterator = tags.find("login");
|
||||
|
||||
if (iterator != tags.end()) {
|
||||
this->userName = iterator.value().toString();
|
||||
}
|
||||
this->userName = tags.value(QLatin1String("login")).toString();
|
||||
}
|
||||
|
||||
QString displayName;
|
||||
|
||||
+17
-1
@@ -1,15 +1,18 @@
|
||||
#ifndef MESSAGE_H
|
||||
#define MESSAGE_H
|
||||
|
||||
#include "channel.h"
|
||||
#include "messages/word.h"
|
||||
#include "messages/wordpart.h"
|
||||
|
||||
#include <IrcMessage>
|
||||
#include <QVector>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Channel;
|
||||
|
||||
namespace messages {
|
||||
|
||||
class Message
|
||||
@@ -54,6 +57,18 @@ public:
|
||||
return displayName;
|
||||
}
|
||||
|
||||
inline const QString &
|
||||
getContent() const
|
||||
{
|
||||
return this->content;
|
||||
}
|
||||
|
||||
inline const std::chrono::time_point<std::chrono::system_clock> &
|
||||
getParseTime() const
|
||||
{
|
||||
return this->parseTime;
|
||||
}
|
||||
|
||||
std::vector<Word> &
|
||||
getWords()
|
||||
{
|
||||
@@ -91,6 +106,7 @@ private:
|
||||
|
||||
QString userName = "";
|
||||
QString displayName = "";
|
||||
QString content;
|
||||
QString id = "";
|
||||
|
||||
std::vector<Word> words;
|
||||
|
||||
+3
-2
@@ -33,5 +33,6 @@ Word::Word(const QString &text, Type type, const QColor &color,
|
||||
, characterWidthCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace messages
|
||||
} // namespace chatterino
|
||||
|
||||
+3
-2
@@ -208,7 +208,8 @@ private:
|
||||
|
||||
std::vector<short> characterWidthCache;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace messages
|
||||
} // namespace chatterino
|
||||
|
||||
#endif // WORD_H
|
||||
|
||||
Reference in New Issue
Block a user