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());
|
std::sort(plainNicks.begin(), plainNicks.end());
|
||||||
sortedNicknames += plainNicks;
|
sortedNicknames += plainNicks;
|
||||||
}
|
}
|
||||||
|
sortedNicknames.removeAll("");
|
||||||
m_onlineUsers[server][channel] = sortedNicknames;
|
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();
|
int currentOnline = 0;
|
||||||
if (currentOnline > 0) currentOnline -= 1;
|
|
||||||
replaceTag(page, "ONLINE", QString::number(currentOnline));
|
|
||||||
|
|
||||||
QString onlineUserS;
|
QString onlineUserS;
|
||||||
for (const auto &user: m_onlineUsers[originalServerName][originalChannelName]) {
|
for (const auto &user: m_onlineUsers[originalServerName][originalChannelName]) {
|
||||||
if (QRegularExpression("^(@|\\&|\\+|~)?"+m_botsNick[originalServerName]+"$").match(user).hasMatch()) {
|
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;
|
QString onlineUser = HTML_ONLINE_POINT;
|
||||||
replaceTag(onlineUser, "NICKNAME", user);
|
replaceTag(onlineUser, "NICKNAME", user);
|
||||||
onlineUserS += onlineUser;
|
onlineUserS += onlineUser;
|
||||||
|
currentOnline++;
|
||||||
}
|
}
|
||||||
|
replaceTag(page, "ONLINE", QString::number(currentOnline));
|
||||||
replaceTag(page, "ONLINE_LIST", onlineUserS);
|
replaceTag(page, "ONLINE_LIST", onlineUserS);
|
||||||
|
|
||||||
if (middlePath == "/") {
|
if (middlePath == "/") {
|
||||||
|
|
|
@ -457,12 +457,10 @@ void IrcClient::process(const QString &message)
|
||||||
'@' /*operator*/, '%' /*half-op*/,
|
'@' /*operator*/, '%' /*half-op*/,
|
||||||
'+' /*voiced*/};
|
'+' /*voiced*/};
|
||||||
for (auto &ch: m_online) {
|
for (auto &ch: m_online) {
|
||||||
int removed = ch.second.removeAll(nickname);
|
ch.second.removeAll(nickname);
|
||||||
if (removed == 0) {
|
|
||||||
for (const auto& p: prefixes) {
|
for (const auto& p: prefixes) {
|
||||||
ch.second.removeAll(p+nickname);
|
ch.second.removeAll(p+nickname);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
emit userOnline(m_connectionData.displayName, ch.first, ch.second);
|
emit userOnline(m_connectionData.displayName, ch.first, ch.second);
|
||||||
}
|
}
|
||||||
consoleLog("QUIT " + nickname);
|
consoleLog("QUIT " + nickname);
|
||||||
|
|
Loading…
Reference in New Issue