mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Move message timestamp-code to its own function
This commit is contained in:
parent
87203c1120
commit
b39034ab74
1 changed files with 20 additions and 4 deletions
|
@ -70,11 +70,10 @@ const QString &Message::getId() const
|
|||
return this->id;
|
||||
}
|
||||
|
||||
/// Static
|
||||
Message *Message::createSystemMessage(const QString &text)
|
||||
{
|
||||
Message *message = new Message;
|
||||
namespace {
|
||||
|
||||
void AddCurrentTimestamp(Message *message)
|
||||
{
|
||||
std::time_t t;
|
||||
time(&t);
|
||||
char timeStampBuffer[69];
|
||||
|
@ -90,6 +89,23 @@ Message *Message::createSystemMessage(const QString &text)
|
|||
QString timestampWithSeconds(timeStampBuffer);
|
||||
message->getWords().push_back(Word(timestampWithSeconds, Word::TimestampWithSeconds,
|
||||
MessageColor(MessageColor::System), QString(), QString()));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
/// Static
|
||||
Message *Message::createSystemMessage(const QString &text)
|
||||
{
|
||||
Message *message = new Message;
|
||||
|
||||
AddCurrentTimestamp(message);
|
||||
|
||||
Word word(text, Word::Type::Default, MessageColor(MessageColor::Type::System), text, text);
|
||||
|
||||
message->getWords().push_back(word);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
Word word(text, Word::Type::Default, MessageColor(MessageColor::Type::System), text, text);
|
||||
|
||||
|
|
Loading…
Reference in a new issue