nick colors in real time mode

master
const an teen 2021-12-29 13:49:01 -05:00
parent 4b91d372c2
commit 0e03abdea4
2 changed files with 5 additions and 9 deletions

View File

@ -55,7 +55,7 @@ function toAJAX()
xhttp.onload = function() { xhttp.onload = function() {
if (reqIsFailed) { if (reqIsFailed) {
reqIsFailed = false; reqIsFailed = false;
objPath.removeAttribute("style", "color: red"); objPath.removeAttribute("style");
} }
const answer = JSON.parse(xhttp.responseText); const answer = JSON.parse(xhttp.responseText);
@ -65,7 +65,7 @@ function toAJAX()
} }
if (answer.serverStatusChanged) { if (answer.serverStatusChanged) {
if (answer.serverStatus) { if (answer.serverStatus) {
objPath.removeAttribute("style", "color: red"); objPath.removeAttribute("style");
objCurrentServerStatus.innerText = HTML_SERVER_ONLINE_MARKER; objCurrentServerStatus.innerText = HTML_SERVER_ONLINE_MARKER;
} else { } else {
objPath.setAttribute("style", "color: red"); objPath.setAttribute("style", "color: red");

View File

@ -1299,13 +1299,9 @@ void HttpServer::writeRealTimeChatPage(QTcpSocket *socket, QString &urlPath, boo
} }
QString message = HTML_PAYLOAD_LIST_CHAT_MESSAGE; QString message = HTML_PAYLOAD_LIST_CHAT_MESSAGE;
for (const auto &user: m_onlineUsers[originalServerName][originalChannelName]) { message.replace("<div class=\"main_payload__chat_username\">",
if (QRegularExpression("^(.*;|~|@|\\&|\\+)?"+rawMessage.first+"$").match(user).hasMatch()) { "<div class=\"main_payload__chat_username\" style=\"color: #e34f10\">");
message.replace("<div class=\"main_payload__chat_username\">",
"<div class=\"main_payload__chat_username\" style=\"color: green\">");
break;
}
}
replaceTag(message, "USERNAME", rawMessage.first); replaceTag(message, "USERNAME", rawMessage.first);
replaceTag(message, "MESSAGE_TEXT", rawMessage.second); replaceTag(message, "MESSAGE_TEXT", rawMessage.second);
payloadBlock += message; payloadBlock += message;