online counter fix (op/owners/etc nick reading)

master
const an teen 2021-12-17 02:15:39 -05:00
parent 9056f209f4
commit fba0afb3df
3 changed files with 9 additions and 2 deletions

View File

@ -548,8 +548,10 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath, bool isHead
replaceTag(page, "ONLINE", QString::number(currentOnline));
QString onlineUserS;
std::sort(m_onlineUsers[originalServerName][originalChannelName].begin(),
m_onlineUsers[originalServerName][originalChannelName].end());
for (const auto &user: m_onlineUsers[originalServerName][originalChannelName]) {
if (QRegularExpression("^.?"+m_botsNick[originalServerName]+"$").match(user).hasMatch()) {
if (QRegularExpression("^(@|\\&|\\+|~)?"+m_botsNick[originalServerName]+"$").match(user).hasMatch()) {
continue;
}
QString onlineUser = HTML_ONLINE_POINT;

View File

@ -450,8 +450,13 @@ void IrcClient::process(const QString &message)
}
}
else if (m_rgxQuit.match(message).hasMatch()) {
const std::array<char, 4> prefixes {'~' /*admin*/, '@' /*operator*/,
'%' /*half-op*/, '+' /*voiced*/};
for (auto &ch: m_online) {
ch.second.removeAll(nickname);
for (const auto& p: prefixes) {
ch.second.removeAll(p+nickname);
}
emit userOnline(m_connectionData.displayName, ch.first, ch.second);
}
consoleLog("QUIT " + nickname);

View File

@ -42,7 +42,7 @@ private:
ConnectionData m_connectionData;
QTimer m_timerToJoin;
QTimer m_nickRecover;
QTimer m_usersActualize; // really need it?
QTimer m_usersActualize; // to get all users status (op, owner, etc)
QTimer m_pingTimeout;
const QRegularExpression m_rgxPrivmsg {"^[^\\s]*\\sPRIVMSG"};