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;
|
return this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Static
|
namespace {
|
||||||
Message *Message::createSystemMessage(const QString &text)
|
|
||||||
{
|
|
||||||
Message *message = new Message;
|
|
||||||
|
|
||||||
|
void AddCurrentTimestamp(Message *message)
|
||||||
|
{
|
||||||
std::time_t t;
|
std::time_t t;
|
||||||
time(&t);
|
time(&t);
|
||||||
char timeStampBuffer[69];
|
char timeStampBuffer[69];
|
||||||
|
@ -90,6 +89,23 @@ Message *Message::createSystemMessage(const QString &text)
|
||||||
QString timestampWithSeconds(timeStampBuffer);
|
QString timestampWithSeconds(timeStampBuffer);
|
||||||
message->getWords().push_back(Word(timestampWithSeconds, Word::TimestampWithSeconds,
|
message->getWords().push_back(Word(timestampWithSeconds, Word::TimestampWithSeconds,
|
||||||
MessageColor(MessageColor::System), QString(), QString()));
|
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);
|
Word word(text, Word::Type::Default, MessageColor(MessageColor::Type::System), text, text);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue