Commit fd65a2c3 authored by Ahmad Samir's avatar Ahmad Samir

[Server] Don't use deprecated QSet methods and minor code improvements

Drop one usage of QSet::fromList(), and use QList::removeDuplicates()
instead, assuming the conversion for QList to QSet was to remove

Return early if nameValue is empty, this also guards against accesing
an out of bounds index.

Use QList::at() instead of [], to prevent detaching.

Test Plan: using sasl still works

Reviewers: #konversation, psn, hein, mlaurent

Reviewed By: #konversation, psn

Differential Revision:
parent bb979d43
......@@ -735,7 +735,10 @@ void Server::capInitiateNegotiation(const QString &availableCaps)
nameValue = cap.split(QChar('='));
if(nameValue[0] == QLatin1String("sasl"))
if (nameValue.isEmpty())
if( == QLatin1String("sasl"))
QString authCommand;
......@@ -754,10 +757,11 @@ void Server::capInitiateNegotiation(const QString &availableCaps)
QSet<QString> supportedSaslTypes;
QStringList supportedSaslTypes;
if(nameValue.size() > 1)
supportedSaslTypes =','));
if(nameValue.count() > 1)
supportedSaslTypes = QSet<QString>::fromList(nameValue[1].split(QChar(',')));
if(!supportedSaslTypes.isEmpty() && !supportedSaslTypes.contains(authCommand))
getStatusView()->appendServerMessage(i18n("Error"), i18n("Server does not support %1 as SASL authentication mechanism, skipping SASL authentication.", authCommand));
......@@ -765,15 +769,15 @@ void Server::capInitiateNegotiation(const QString &availableCaps)
requestCaps.append (QStringLiteral("sasl"));
else if(m_capabilityNames.contains(nameValue[0]))
else if(m_capabilityNames.contains(
requestCaps.append (nameValue[0]);
requestCaps.append (;
// HACK:'s IRC server doesn't handle WHO so
// let's disable all WHO requests for servers that has
// capabilities
m_whoRequestsDisabled = true;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment