Commit 208b28a9 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Remove kioslave

It isn't used by anything, and there aren't really many use cases for it

Furthermore it has been broken for over a year due to incorrect metadata and nobody complained
parent 087d103a
Pipeline #214426 passed with stage
in 5 minutes and 18 seconds
......@@ -122,7 +122,6 @@ if(BUILD_TESTING)
endif()
add_subdirectory(src)
add_subdirectory(kioslave)
ecm_qt_install_logging_categories(
EXPORT LIBKSIEVE
FILE libksieve.categories
......
# SPDX-FileCopyrightText: 2011-2022 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(src)
add_subdirectory(doc)
# SPDX-FileCopyrightText: 2011-2022 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(sieve)
# SPDX-FileCopyrightText: 2011-2022 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
########### install files ###############
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kioslave5/sieve)
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
"dtd/kdedbx45.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" > <!-- change language only here -->
]>
<article lang="&language;" id="sieve">
<title>sieve</title>
<articleinfo>
<authorgroup>
<author><personname><firstname>Daniel</firstname><surname>Black</surname></personname>
<email>daniel.subs@internode.on.net</email></author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
<date>2009-11-05</date>
</articleinfo>
<para>Sieve is a protocol that is used to manage filters for email.</para>
<para>The filters are stored and run on the email server.</para>
<para><ulink url="https://www.ietf.org/rfc/rfc5228.txt">IETF
RF5228</ulink> provides more information.</para>
</article>
# SPDX-FileCopyrightText: 2011-2022 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(sieve)
if(BUILD_TESTING)
add_subdirectory(autotests)
endif()
# SPDX-FileCopyrightText: 2011-2022 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
if (QT_MAJOR_VERSION STREQUAL "5")
ecm_add_tests( regexptest.cpp NAME_PREFIX "libksieve-" LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test)
endif()
/*
SPDX-FileCopyrightText: 2018-2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "regexptest.h"
#include <QRegExp>
#include <QRegularExpression>
#include <QTest>
QTEST_GUILESS_MAIN(RegexpTest)
RegexpTest::RegexpTest(QObject *parent)
: QObject(parent)
{
}
void RegexpTest::compareRegexp_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<int>("major");
QTest::addColumn<int>("minor");
QTest::addColumn<int>("patch");
QTest::addColumn<QString>("vendor");
QTest::addColumn<bool>("valid");
QTest::newRow("empty") << QString() << 0 << 0 << 0 << QString() << false;
QTest::newRow("Cyrus timsieved v2.2.12") << QStringLiteral("Cyrus timsieved v2.2.12") << 2 << 2 << 12 << QString() << true;
QTest::newRow("Cyrus timsieved v2.2.12-kolab-nocaps")
<< QStringLiteral("Cyrus timsieved v2.2.12-kolab-nocaps") << 2 << 2 << 12 << QStringLiteral("-kolab-nocaps") << true;
QTest::newRow("Cyrus timsieved v5.2.12") << QStringLiteral("Cyrus timsieved v5.2.12") << 5 << 2 << 12 << QString() << true;
}
void RegexpTest::compareRegexp()
{
QFETCH(QString, input);
QFETCH(int, major);
QFETCH(int, minor);
QFETCH(int, patch);
QFETCH(QString, vendor);
QFETCH(bool, valid);
QRegExp regExp(QStringLiteral("Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)([-\\w]*)"), Qt::CaseInsensitive);
bool ok;
if (regExp.indexIn(input) >= 0) {
QCOMPARE(regExp.cap(1).toInt(), major);
QCOMPARE(regExp.cap(2).toInt(), minor);
QCOMPARE(regExp.cap(3).toInt(), patch);
QCOMPARE(regExp.cap(4), vendor);
ok = true;
} else {
ok = false;
}
QCOMPARE(valid, ok);
QRegularExpression re(QStringLiteral("Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)([-\\w]*)"), QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = re.match(input);
if (match.hasMatch()) {
QCOMPARE(match.captured(1).toInt(), major);
QCOMPARE(match.captured(2).toInt(), minor);
QCOMPARE(match.captured(3).toInt(), patch);
QCOMPARE(match.captured(4), vendor);
ok = true;
} else {
ok = false;
}
QCOMPARE(valid, ok);
}
/*
SPDX-FileCopyrightText: 2018-2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <QObject>
class RegexpTest : public QObject
{
Q_OBJECT
public:
explicit RegexpTest(QObject *parent = nullptr);
~RegexpTest() override = default;
private Q_SLOTS:
void compareRegexp_data();
void compareRegexp();
};
/* This file is part of the KDE project
SPDX-FileCopyrightText: 2008 Jarosław Staniek <staniek@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <cstdio>
extern "C" {
#include <sasl/sasl.h>
}
inline bool initSASL()
{
#ifdef Q_OS_WIN // krazy:exclude=cpp
for (const auto &path : QCoreApplication::libraryPaths()) {
QDir dir(path);
if (dir.exists(QStringLiteral("sasl2"))) {
auto libInstallPath = QFile::encodeName(dir.absoluteFilePath(QStringLiteral("sasl2")));
if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK) {
fprintf(stderr, "SASL path initialization failed!\n");
return false;
}
break;
}
}
#endif
if (sasl_client_init(nullptr) != SASL_OK) {
fprintf(stderr, "SASL library initialization failed!\n");
return false;
}
return true;
}
# SPDX-FileCopyrightText: 2011-2022 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
add_library(kio_sieve MODULE)
target_sources(kio_sieve PRIVATE sieve.cpp sieve.h)
ecm_qt_declare_logging_category(kio_sieve HEADER sieve_debug.h IDENTIFIER SIEVE_LOG CATEGORY_NAME org.kde.pim.sieve
DESCRIPTION "kioslave (sieve)"
OLD_CATEGORY_NAMES log_sieve
EXPORT LIBKSIEVE
)
if (WIN32)
set(extra_LIBS ws2_32)
endif()
target_link_libraries(kio_sieve KF5::KIOCore KF5::I18n Qt${QT_MAJOR_VERSION}::Network KF5::WidgetsAddons Sasl2::Sasl2 ${extra_LIBS})
set_target_properties(kio_sieve PROPERTIES OUTPUT_NAME "sieve")
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(kio_sieve PROPERTIES UNITY_BUILD ON)
endif()
install(TARGETS kio_sieve DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf${QT_MAJOR_VERSION}/kio/)
#! /bin/sh
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: none
$XGETTEXT *.cpp -o $podir/kio_sieve.pot
3028: Sieve: A Mail Filtering Language
3431: Sieve Extension: Relational Tests
This diff is collapsed.
/*
sieve.h
SPDX-FileCopyrightText: 2001 Hamish Rodda <meddie@yoyo.cc.monash.edu.au>
SPDX-License-Identifier: GPL-2.0-only
*/
#pragma once
#include <KIO/AuthInfo>
#include <KIO/TCPSlaveBase>
#include <QByteArray>
#include <QString>
#include <QStringList>
class kio_sieveResponse
{
public:
enum responses { NONE, KEY_VAL_PAIR, ACTION, QUANTITY };
kio_sieveResponse();
const uint &getType() const;
const QByteArray &getAction() const;
uint getQuantity() const;
const QByteArray &getKey() const;
const QByteArray &getVal() const;
const QByteArray &getExtra() const;
void setQuantity(uint quantity);
void setAction(const QByteArray &newAction);
void setKey(const QByteArray &newKey);
void setVal(const QByteArray &newVal);
void setExtra(const QByteArray &newExtra);
void clear();
protected:
uint rType;
uint quantity;
QByteArray key;
QByteArray val;
QByteArray extra;
};
class kio_sieveProtocol : public KIO::TCPSlaveBase
{
public:
enum connectionModes { NORMAL, CONNECTION_ORIENTED };
enum Results { OK, NO, BYE, OTHER };
kio_sieveProtocol(const QByteArray &pool_socket, const QByteArray &app_socket);
~kio_sieveProtocol() override;
void mimetype(const QUrl &url) override;
void get(const QUrl &url) override;
void put(const QUrl &url, int permissions, KIO::JobFlags flags) override;
void del(const QUrl &url, bool isfile) override;
void listDir(const QUrl &url) override;
void chmod(const QUrl &url, int permissions) override;
virtual void urlStat(const QUrl &url);
void setHost(const QString &host, quint16 port, const QString &user, const QString &pass) override;
void openConnection() override;
void closeConnection() override;
// virtual void slave_status();
/**
* Special commands supported by this slave:
* 1 - activate script
* 2 - deactivate (all - only one active at any one time) scripts
* 3 - request capabilities, returned as metadata
*/
void special(const QByteArray &data) override;
bool activate(const QUrl &url);
bool deactivate();
protected:
bool connect(bool useTLSIfAvailable = true);
bool authenticate();
void disconnect(bool forcibly = false);
void changeCheck(const QUrl &url);
bool sendData(const QByteArray &data);
bool receiveData(bool waitForData = true, const QByteArray &reparse = QByteArray());
bool operationSuccessful();
int operationResult();
bool parseCapabilities(bool requestCapabilities = false);
bool saslInteract(void *in, KIO::AuthInfo &ai);
// IOSlave global data
uint m_connMode;
// Host-specific data
QStringList m_sasl_caps;
bool m_supportsTLS;
// Global server response class
kio_sieveResponse r;
// connection details
QString m_sServer;
QString m_sUser;
QString m_sPass;
QString m_sAuth;
bool m_shouldBeConnected;
bool m_allowUnencrypted;
quint16 m_port;
private:
bool requestCapabilitiesAfterStartTLS() const;
QString m_implementation;
};
{
"KDE-KIO-Protocols": {
"ldap": {
"Icon": "view-filter",
"X-DocPath": "kioslave5/sieve/index.html",
"deleting": true,
"determineMimetypeFromExtension": false,
"input": "none",
"listing": [
"Name",
"Access",
"Type",
"MimeType"
],
"output": "filesystem",
"protocol": "sieve",
"reading": true,
"source": true,
"writing": true
}
}
}
Supports Markdown
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