add logging to ooc, modcalls, and clean up default config.ini

This commit is contained in:
scatterflower 2020-10-06 14:23:01 -05:00
parent 0b9e394dc4
commit 83751d025a
4 changed files with 41 additions and 4 deletions

View File

@ -3,13 +3,9 @@ version=1
[Options]
advertise=true
hostname=$H
language=en
max_message_size=256
max_players=100
ms_ip=master.aceattorneyonline.com
ms_port=27016
multiclient_limit=16
port=27016
server_description=This is a placeholder server description. Tell the world of AO who you are here!
server_name=An Unnamed Server

View File

@ -34,6 +34,8 @@ public:
Logger(int p_max_length);
void logIC(AOClient* client, AOPacket* packet);
void logOOC(AOClient* client, AOPacket* packet);
void logModcall(AOClient* client, AOPacket* packet);
void flush();
private:

View File

@ -24,6 +24,7 @@ Logger::Logger(int p_max_length)
void Logger::logIC(AOClient *client, AOPacket *packet)
{
// TODO: copy pasted code
QString time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss");
QString area_name = client->getServer()->area_names.value(client->current_area);
QString char_name = client->current_char;
@ -39,6 +40,42 @@ void Logger::logIC(AOClient *client, AOPacket *packet)
addEntry(log_entry);
}
void Logger::logOOC(AOClient* client, AOPacket* packet)
{
// TODO: copy pasted code
QString time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss");
QString area_name = client->getServer()->area_names.value(client->current_area);
QString char_name = client->current_char;
QString ipid = client->getIpid();
QString message = packet->contents[1];
QString log_entry = QStringLiteral("[%1][%2][OOC] %3(%4): %5\n")
.arg(time)
.arg(area_name)
.arg(char_name)
.arg(ipid)
.arg(message);
addEntry(log_entry);
}
void Logger::logModcall(AOClient* client, AOPacket* packet)
{
// TODO: copy pasted code
QString time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss");
QString area_name = client->getServer()->area_names.value(client->current_area);
QString char_name = client->current_char;
QString ipid = client->getIpid();
QString message = packet->contents[1];
QString log_entry = QStringLiteral("[%1][%2][MODCALL] %3(%4): %5\n")
.arg(time)
.arg(area_name)
.arg(char_name)
.arg(ipid)
.arg(message);
addEntry(log_entry);
}
void Logger::addEntry(QString entry)
{
if (buffer.length() < max_length) {

View File

@ -153,6 +153,7 @@ void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket pa
void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket packet)
{
ooc_name = argv[0];
area->logger->logOOC(this, &packet);
if(argv[1].at(0) == '/') {
QStringList cmd_argv = argv[1].split(" ", QString::SplitBehavior::SkipEmptyParts);
QString command = cmd_argv[0].trimmed().toLower();
@ -245,6 +246,7 @@ void AOClient::pktModCall(AreaData* area, int argc, QStringList argv, AOPacket p
if (client->authenticated)
client->sendPacket(packet);
}
area->logger->logModcall(this, &packet);
area->logger->flush();
}