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<QString> arup_locks;
QVector<chatlogpiece> ic_chatlog_history; QVector<chatlogpiece> ic_chatlog_history;
QString last_ic_message = "";
QQueue<QStringList> chatmessage_queue; QQueue<QStringList> chatmessage_queue;

View File

@ -2072,13 +2072,13 @@ 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 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() || if (f_message.isEmpty() && !ic_chatlog_history.isEmpty() && ic_chatlog_history.last().get_message().isEmpty() && ic_chatlog_history.last().get_showname() == f_displayname)
ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") { return; // Skip adding message
// Add the message to the logs file
log_ic_text(f_showname, f_displayname, f_message, "", // Add the message to the logs file
f_color); 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) void Courtroom::display_log_chatmessage(QString f_message, int f_char_id, QString f_showname, int f_color)
@ -2159,13 +2159,14 @@ 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 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() || if (f_message.isEmpty() && last_ic_message == f_displayname + ":")
ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") { return; // Skip adding message
// Append the message to the IC chatlogs in client
append_ic_text(f_message, f_displayname, "", last_ic_message = f_displayname + ":" + f_message;
f_color); // Append the message to the IC chatlogs in client
} append_ic_text(f_message, f_displayname, "",
f_color);
} }
bool Courtroom::handle_objection() bool Courtroom::handle_objection()
@ -5212,12 +5213,16 @@ void Courtroom::on_showname_enable_clicked()
void Courtroom::regenerate_ic_chatlog() void Courtroom::regenerate_ic_chatlog()
{ {
ui_ic_chatlog->clear(); ui_ic_chatlog->clear();
last_ic_message = "";
foreach (chatlogpiece item, ic_chatlog_history) { foreach (chatlogpiece item, ic_chatlog_history) {
append_ic_text(item.get_message(), QString message = item.get_message();
ui_showname_enable->isChecked() ? item.get_showname() QString name = ui_showname_enable->isChecked() ? item.get_showname()
: item.get_name(), : item.get_name();
append_ic_text(message,
name,
item.get_action(), item.get_chat_color(), item.get_action(), item.get_chat_color(),
item.get_datetime().toLocalTime()); item.get_datetime().toLocalTime());
last_ic_message = name + ":" + message;
} }
} }