Merge pull request #400 from AttorneyOnline/bugfix/blanklogs

Fix blankposts not showing up in logs
This commit is contained in:
oldmud0 2021-01-18 12:35:19 -06:00 committed by GitHub
commit 2f3ca8613d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 17 deletions

View File

@ -349,6 +349,7 @@ private:
QVector<QString> arup_locks;
QVector<chatlogpiece> ic_chatlog_history;
QString last_ic_message = "";
QQueue<QStringList> chatmessage_queue;

View File

@ -2072,14 +2072,14 @@ void Courtroom::log_chatmessage(QString f_message, int f_char_id, QString f_show
}
}
// If the chat message isn't a blankpost, or the chatlog history is empty, or its last message isn't a blankpost
if (!f_message.isEmpty() ||
ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") {
// If our current message is a blankpost, the chat log isn't empty, the chat log's last message is a blank post, and the blankpost's showname is the same as ours
if (f_message.isEmpty() && !ic_chatlog_history.isEmpty() && ic_chatlog_history.last().get_message().isEmpty() && ic_chatlog_history.last().get_showname() == f_displayname)
return; // Skip adding message
// Add the message to the logs file
log_ic_text(f_showname, f_displayname, f_message, "",
f_color);
}
}
void Courtroom::display_log_chatmessage(QString f_message, int f_char_id, QString f_showname, int f_color)
{
@ -2159,14 +2159,15 @@ void Courtroom::display_log_chatmessage(QString f_message, int f_char_id, QStrin
}
}
// If the chat message isn't a blankpost, or the chatlog history is empty, or its last message isn't a blankpost
if (!f_message.isEmpty() ||
ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") {
// If our current message is a blankpost, the chat log isn't empty, the chat log's last message is a blank post, and the blankpost's showname is the same as ours
if (f_message.isEmpty() && last_ic_message == f_displayname + ":")
return; // Skip adding message
last_ic_message = f_displayname + ":" + f_message;
// Append the message to the IC chatlogs in client
append_ic_text(f_message, f_displayname, "",
f_color);
}
}
bool Courtroom::handle_objection()
{
@ -5212,12 +5213,16 @@ void Courtroom::on_showname_enable_clicked()
void Courtroom::regenerate_ic_chatlog()
{
ui_ic_chatlog->clear();
last_ic_message = "";
foreach (chatlogpiece item, ic_chatlog_history) {
append_ic_text(item.get_message(),
ui_showname_enable->isChecked() ? item.get_showname()
: item.get_name(),
QString message = item.get_message();
QString name = ui_showname_enable->isChecked() ? item.get_showname()
: item.get_name();
append_ic_text(message,
name,
item.get_action(), item.get_chat_color(),
item.get_datetime().toLocalTime());
last_ic_message = name + ":" + message;
}
}