aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-02-08 19:21:17 -0600
committerGitHub <noreply@github.com>2021-02-09 04:21:17 +0300
commit8162783e8b3cb5fb6c136aba072328b3d0de76d5 (patch)
treeb7c2ab9d9c321bcac1f60a1ea31a0d3dc464981d
parent6e4b6219923b25a6b58dc8d63a27b3bf0a6e0df4 (diff)
Fix blankposts never appearing in the IC log (#449)
* remove broken blankpost check * Revert "remove broken blankpost check" This reverts commit 9f3013b9f5d9c1f859e7e6bb42bed0be3eb15cfb. * restore functionality
-rw-r--r--src/courtroom.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index d0fdc883..7127f374 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -2161,20 +2161,22 @@ 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() != "") {
- switch (f_log_mode) {
- case IO_ONLY:
- log_ic_text(f_showname, f_displayname, f_message, "",f_color);
- break;
- case DISPLAY_AND_IO:
- log_ic_text(f_showname, f_displayname, f_message, "",f_color);
- [[fallthrough]];
- case DISPLAY_ONLY:
- append_ic_text(f_message, f_displayname, "",f_color);
- break;
- }
+ if ((f_log_mode != IO_ONLY) && // if we're not in I/O only mode,
+ f_message.isEmpty() && // our current message is a blankpost,
+ !ic_chatlog_history.isEmpty() && // the chat log isn't empty,
+ last_ic_message == f_displayname + ":" && // the chat log's last message is a blank post, and
+ last_ic_message.mid(0, last_ic_message.lastIndexOf(":")) == f_displayname) // the blankpost's showname is the same as ours
+ return; // Skip adding message
+ switch (f_log_mode) {
+ case IO_ONLY:
+ log_ic_text(f_showname, f_displayname, f_message, "",f_color);
+ break;
+ case DISPLAY_AND_IO:
+ log_ic_text(f_showname, f_displayname, f_message, "",f_color);
+ [[fallthrough]];
+ case DISPLAY_ONLY:
+ append_ic_text(f_message, f_displayname, "",f_color);
+ break;
}
}
@@ -3027,6 +3029,7 @@ void Courtroom::log_ic_text(QString p_name, QString p_showname,
void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
int color, QDateTime timestamp)
{
+ last_ic_message = p_name + ":" + p_text;
QTextCharFormat bold;
QTextCharFormat normal;
QTextCharFormat italics;
@@ -5350,7 +5353,6 @@ void Courtroom::regenerate_ic_chatlog()
name,
item.get_action(), item.get_chat_color(),
item.get_datetime().toLocalTime());
- last_ic_message = name + ":" + message;
}
}