Fix blankposts never appearing in the IC log (#449)

* remove broken blankpost check

* Revert "remove broken blankpost check"

This reverts commit 9f3013b9f5d9c1f859e7e6bb42bed0be3eb15cfb.

* restore functionality
This commit is contained in:
in1tiate 2021-02-08 19:21:17 -06:00 committed by GitHub
parent 6e4b621992
commit 8162783e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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_log_mode != IO_ONLY) && // if we're not in I/O only mode,
if (!f_message.isEmpty() || f_message.isEmpty() && // our current message is a blankpost,
ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") { !ic_chatlog_history.isEmpty() && // the chat log isn't empty,
switch (f_log_mode) { last_ic_message == f_displayname + ":" && // the chat log's last message is a blank post, and
case IO_ONLY: last_ic_message.mid(0, last_ic_message.lastIndexOf(":")) == f_displayname) // the blankpost's showname is the same as ours
log_ic_text(f_showname, f_displayname, f_message, "",f_color); return; // Skip adding message
break; switch (f_log_mode) {
case DISPLAY_AND_IO: case IO_ONLY:
log_ic_text(f_showname, f_displayname, f_message, "",f_color); log_ic_text(f_showname, f_displayname, f_message, "",f_color);
[[fallthrough]]; break;
case DISPLAY_ONLY: case DISPLAY_AND_IO:
append_ic_text(f_message, f_displayname, "",f_color); log_ic_text(f_showname, f_displayname, f_message, "",f_color);
break; [[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, void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action,
int color, QDateTime timestamp) int color, QDateTime timestamp)
{ {
last_ic_message = p_name + ":" + p_text;
QTextCharFormat bold; QTextCharFormat bold;
QTextCharFormat normal; QTextCharFormat normal;
QTextCharFormat italics; QTextCharFormat italics;
@ -5350,7 +5353,6 @@ void Courtroom::regenerate_ic_chatlog()
name, 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;
} }
} }