Commit aaa16c69 authored by Peter Simonsson's avatar Peter Simonsson
Browse files

implement cap new and cap del (cap-notify)

parent 0276d06d
......@@ -862,6 +862,14 @@ void InputFilter::parseServerCommand(const QString &prefix, const QString &comma
m_server->capInitiateNegotiation (trailing);
}
}
else if (command == QLatin1String("new"))
{
m_server->capInitiateNegotiation(trailing);
}
else if (command == QLatin1String("del"))
{
m_server->capDel(trailing);
}
}
else if (command == QLatin1String("authenticate") && plHas(1))
{
......
......@@ -836,6 +836,21 @@ void Server::capDenied(const QString& name)
getStatusView()->appendServerMessage(i18n("Error"), i18n("SASL capability denied or not supported by server."));
}
void Server::capDel(const QString &unavailableCaps)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList capsList = unavailableCaps.split(QLatin1Char(' '), QString::SkipEmptyParts);
#else
const QStringList capsList = unavailableCaps.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#endif
for (const QString &capString : qAsConst(capsList))
{
if (m_capabilityNames.contains(capString))
m_capabilities &= ~(m_capabilityNames.value(capString));
}
}
void Server::registerWithServices()
{
if (!getIdentity())
......@@ -4451,6 +4466,7 @@ void Server::initCapablityNames()
{ QStringLiteral("account-notify"), AccountNotify },
{ QStringLiteral("znc.in/self-message"), SelfMessage },
{ QStringLiteral("chghost"), ChgHost },
{ QStringLiteral("cap-notify"), CapNofify },
};
}
......
......@@ -102,6 +102,7 @@ class Server : public QObject
AccountNotify = 0x80,
SelfMessage = 0x100,
ChgHost = 0x200,
CapNofify = 0x400,
};
Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag)
......@@ -560,6 +561,7 @@ class Server : public QObject
void capAcknowledged(const QString& name, CapModifiers modifiers);
void capDenied(const QString& name);
void sendAuthenticate(const QString& message);
void capDel(const QString &unavailableCaps);
private Q_SLOTS:
void hostFound();
......
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