mirror of https://notabug.org/acetone/ircabot.git
online users counter fix
parent
a7e3b99298
commit
aed027c21c
|
@ -317,6 +317,7 @@ void HttpServer::ircUsersOnline(QString server, QString channel, QStringList use
|
|||
std::sort(plainNicks.begin(), plainNicks.end());
|
||||
sortedNicknames += plainNicks;
|
||||
}
|
||||
sortedNicknames.removeAll("");
|
||||
m_onlineUsers[server][channel] = sortedNicknames;
|
||||
}
|
||||
|
||||
|
@ -594,10 +595,7 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath, bool isHead
|
|||
}
|
||||
}
|
||||
|
||||
int currentOnline = m_onlineUsers[originalServerName][originalChannelName].size();
|
||||
if (currentOnline > 0) currentOnline -= 1;
|
||||
replaceTag(page, "ONLINE", QString::number(currentOnline));
|
||||
|
||||
int currentOnline = 0;
|
||||
QString onlineUserS;
|
||||
for (const auto &user: m_onlineUsers[originalServerName][originalChannelName]) {
|
||||
if (QRegularExpression("^(@|\\&|\\+|~)?"+m_botsNick[originalServerName]+"$").match(user).hasMatch()) {
|
||||
|
@ -606,7 +604,9 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath, bool isHead
|
|||
QString onlineUser = HTML_ONLINE_POINT;
|
||||
replaceTag(onlineUser, "NICKNAME", user);
|
||||
onlineUserS += onlineUser;
|
||||
currentOnline++;
|
||||
}
|
||||
replaceTag(page, "ONLINE", QString::number(currentOnline));
|
||||
replaceTag(page, "ONLINE_LIST", onlineUserS);
|
||||
|
||||
if (middlePath == "/") {
|
||||
|
|
|
@ -457,11 +457,9 @@ void IrcClient::process(const QString &message)
|
|||
'@' /*operator*/, '%' /*half-op*/,
|
||||
'+' /*voiced*/};
|
||||
for (auto &ch: m_online) {
|
||||
int removed = ch.second.removeAll(nickname);
|
||||
if (removed == 0) {
|
||||
for (const auto& p: prefixes) {
|
||||
ch.second.removeAll(p+nickname);
|
||||
}
|
||||
ch.second.removeAll(nickname);
|
||||
for (const auto& p: prefixes) {
|
||||
ch.second.removeAll(p+nickname);
|
||||
}
|
||||
emit userOnline(m_connectionData.displayName, ch.first, ch.second);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue