Nick sorting function type

master
const an teen 2021-12-17 12:07:19 -05:00
parent fcb58fc924
commit a7e3b99298
2 changed files with 8 additions and 5 deletions

View File

@ -288,7 +288,8 @@ void HttpServer::ircUsersOnline(QString server, QString channel, QStringList use
} }
else if (rawOneNick.startsWith('+')) { else if (rawOneNick.startsWith('+')) {
voicedNicks.push_back(rawOneNick); voicedNicks.push_back(rawOneNick);
} else { }
else {
plainNicks.push_back(rawOneNick); plainNicks.push_back(rawOneNick);
} }
} }
@ -309,7 +310,7 @@ void HttpServer::ircUsersOnline(QString server, QString channel, QStringList use
sortedNicknames += adminNicks; sortedNicknames += adminNicks;
} }
if (not voicedNicks.isEmpty()) { if (not voicedNicks.isEmpty()) {
std::sort(adminNicks.begin(), voicedNicks.end()); std::sort(voicedNicks.begin(), voicedNicks.end());
sortedNicknames += voicedNicks; sortedNicknames += voicedNicks;
} }
if (not plainNicks.isEmpty()) { if (not plainNicks.isEmpty()) {

View File

@ -457,9 +457,11 @@ void IrcClient::process(const QString &message)
'@' /*operator*/, '%' /*half-op*/, '@' /*operator*/, '%' /*half-op*/,
'+' /*voiced*/}; '+' /*voiced*/};
for (auto &ch: m_online) { for (auto &ch: m_online) {
ch.second.removeAll(nickname); int removed = ch.second.removeAll(nickname);
for (const auto& p: prefixes) { if (removed == 0) {
ch.second.removeAll(p+nickname); for (const auto& p: prefixes) {
ch.second.removeAll(p+nickname);
}
} }
emit userOnline(m_connectionData.displayName, ch.first, ch.second); emit userOnline(m_connectionData.displayName, ch.first, ch.second);
} }