Commit 8f170d07 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Remove broken and no longer useful method for parsing keyserver option

It's broken because it breaks LDAP urls which may contain a comma. And
it's no longer useful because, unlike gpg's deprecated keyserver option,
dirmngr's keyserver option doesn't support optional keyserver
configuration options.

GnuPG-bug-id: 5404
parent ae8ddfab
......@@ -929,46 +929,4 @@ void Kleo::CryptoConfigEntryLDAPURL::setURLList(const QList<QUrl> &urlList)
}
}
Kleo::ParsedKeyserver Kleo::parseKeyserver(const QString &str)
{
const QStringList list = str.split(QRegExp(QLatin1String("[\\s,]")), Qt::SkipEmptyParts);
if (list.empty()) {
return Kleo::ParsedKeyserver();
}
Kleo::ParsedKeyserver result;
result.url = list.front();
const auto listMid = list.mid(1);
for (const QString &kvpair : listMid) {
const int idx = kvpair.indexOf(QLatin1Char('='));
if (idx < 0) {
result.options.push_back(qMakePair(kvpair, QString())); // null QString
} else {
const QString key = kvpair.left(idx);
const QString value = kvpair.mid(idx + 1);
if (value.isEmpty()) {
result.options.push_back(qMakePair(key, QStringLiteral(""))); // make sure it's not a null QString, only an empty one
} else {
result.options.push_back(qMakePair(key, value));
}
}
}
return result;
}
QString Kleo::assembleKeyserver(const ParsedKeyserver &keyserver)
{
if (keyserver.options.empty()) {
return keyserver.url;
}
QString result = keyserver.url;
typedef QPair<QString, QString> Pair;
for (const Pair &pair : qAsConst(keyserver.options))
if (pair.second.isNull()) {
result += QLatin1Char(' ') + pair.first;
} else {
result += QLatin1Char(' ') + pair.first + QLatin1Char('=') + pair.second;
}
return result;
}
#include "moc_cryptoconfigmodule_p.cpp"
......@@ -21,13 +21,6 @@ class CryptoConfig;
namespace Kleo
{
class CryptoConfigComponentGUI;
struct ParsedKeyserver {
QString url;
QVector< QPair<QString, QString> > options;
};
KLEO_EXPORT ParsedKeyserver parseKeyserver(const QString &str);
KLEO_EXPORT QString assembleKeyserver(const ParsedKeyserver &keyserver);
/**
* Crypto Config Module widget, dynamically generated from CryptoConfig
......
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