atrooney-online-2/chatlogpiece.cpp
Cerapter 29c91e63ea The IC chatlog can now show both name and showname, and can be exported.
- Toggle the 'Custom shownames' tickbox to switch between real names and
custom shownames.
- Type `/save_chatlog` in the OOC to export your IC chatlog into a file.
- Exporting the chatlog will append the date and time of the message,
too.
2018-09-15 12:35:01 +02:00

77 lines
1.3 KiB
C++

#include "chatlogpiece.h"
chatlogpiece::chatlogpiece()
{
name = "UNKNOWN";
showname = "UNKNOWN";
message = "UNKNOWN";
is_song = false;
datetime = QDateTime::currentDateTime().toUTC();
}
chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song)
{
name = p_name;
showname = p_showname;
message = p_message;
is_song = p_song;
datetime = QDateTime::currentDateTime().toUTC();
}
chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime)
{
name = p_name;
showname = p_showname;
message = p_message;
is_song = p_song;
datetime = p_datetime.toUTC();
}
QString chatlogpiece::get_name()
{
return name;
}
QString chatlogpiece::get_showname()
{
return showname;
}
QString chatlogpiece::get_message()
{
return message;
}
QDateTime chatlogpiece::get_datetime()
{
return datetime;
}
bool chatlogpiece::get_is_song()
{
return is_song;
}
QString chatlogpiece::get_datetime_as_string()
{
return datetime.toString();
}
QString chatlogpiece::get_full()
{
QString full = "[";
full.append(get_datetime_as_string());
full.append(" UTC] ");
full.append(get_showname());
full.append(" (");
full.append(get_name());
full.append(")");
if (is_song)
full.append(" has played a song: ");
full.append(get_message());
return full;
}