Commit 6eef4101 authored by Laurent Montel's avatar Laurent Montel 😁

Move here

parent 6047e473
......@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12)
project(libksieve)
find_package(ECM 5.19.0 CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH ${libksieve_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
set(LIBRARY_NAMELINK)
include(GenerateExportHeader)
include(ECMSetupVersion)
......@@ -45,6 +45,14 @@ find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQU
find_package(KF5MailTransport ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED)
find_package(Sasl2)
set_package_properties(Sasl2 PROPERTIES
DESCRIPTION "The Cyrus-sasl library"
URL "http://www.cyrussasl.org"
TYPE OPTIONAL
)
option(QTWEBENGINE_SUPPORT_OPTION "Enable support for QtWebEngine. False by default." FALSE)
if (QTWEBENGINE_SUPPORT_OPTION)
......@@ -89,6 +97,7 @@ install(FILES
add_subdirectory(src)
add_subdirectory(kioslave)
if(BUILD_TESTING)
add_subdirectory(autotests)
endif()
......
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# - Try to find the sasl2 directory library
# Once done this will define
#
# Sasl2_FOUND - system has SASL2
# Sasl2_INCLUDE_DIRS - the SASL2 include directory
# Sasl2_LIBRARIES - The libraries needed to use SASL2
# Copyright (c) 2006, 2007 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Note: libsasl2.pc doesn't export the include dir.
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Sasl2 libsasl2)
find_path(Sasl2_INCLUDE_DIRS sasl/sasl.h
)
# libsasl2 add for windows, because the windows package of cyrus-sasl2
# contains a libsasl2 also for msvc which is not standard conform
find_library(Sasl2_LIBRARIES
NAMES sasl2 libsasl2
HINTS ${PC_Sasl2_LIBRARY_DIRS}
)
set(Sasl2_VERSION ${PC_Sasl2_VERSION})
if(NOT Sasl2_VERSION)
if(EXISTS ${Sasl2_INCLUDE_DIRS}/sasl/sasl.h)
file(READ ${Sasl2_INCLUDE_DIRS}/sasl/sasl.h SASL2_H_CONTENT)
string(REGEX MATCH "#define SASL_VERSION_MAJOR[ ]+[0-9]+" SASL2_VERSION_MAJOR_MATCH ${SASL2_H_CONTENT})
string(REGEX MATCH "#define SASL_VERSION_MINOR[ ]+[0-9]+" SASL2_VERSION_MINOR_MATCH ${SASL2_H_CONTENT})
string(REGEX MATCH "#define SASL_VERSION_STEP[ ]+[0-9]+" SASL2_VERSION_STEP_MATCH ${SASL2_H_CONTENT})
string(REGEX REPLACE ".*_MAJOR[ ]+(.*)" "\\1" SASL2_VERSION_MAJOR ${SASL2_VERSION_MAJOR_MATCH})
string(REGEX REPLACE ".*_MINOR[ ]+(.*)" "\\1" SASL2_VERSION_MINOR ${SASL2_VERSION_MINOR_MATCH})
string(REGEX REPLACE ".*_STEP[ ]+(.*)" "\\1" SASL2_VERSION_STEP ${SASL2_VERSION_STEP_MATCH})
set(Sasl2_VERSION "${SASL2_VERSION_MAJOR}.${SASL2_VERSION_MINOR}.${SASL2_VERSION_STEP}")
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sasl2
FOUND_VAR Sasl2_FOUND
REQUIRED_VARS Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS
VERSION_VAR Sasl2_VERSION
)
mark_as_advanced(Sasl2_LIBRARIES Sasl2_INCLUDE_DIRS Sasl2_VERSION)
SKIP /tests/
REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
#REPOSITORY = "git://anongit.kde.org/kioslave"
BRANCH = "master"
TARGET_GROUPS = "kdepimlibs"
TARGET_PEOPLE = "mlaurent"
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
add_subdirectory(src)
add_subdirectory(docs)
add_subdirectory(sieve)
########### 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="http://www.ietf.org/rfc/rfc5228.txt">IETF
RF5228</ulink> provides more information.</para>
</article>
#remove it
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_subdirectory(sieve)
/* This file is part of the KDE project
Copyright (C) 2008 Jarosław Staniek <staniek@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KIOSLAVE_COMMON_H
#define _KIOSLAVE_COMMON_H
#include <stdio.h>
#include <QFile>
#include <QDir>
extern "C" {
#include <sasl/sasl.h>
}
inline bool initSASL()
{
#ifdef Q_OS_WIN32 //krazy:exclude=cpp
QByteArray libInstallPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib") + QLatin1String("sasl2"))));
QByteArray configPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config") + QLatin1String("sasl2"))));
if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK ||
sasl_set_path(SASL_PATH_TYPE_CONFIG, configPath.data()) != SASL_OK) {
fprintf(stderr, "SASL path initialization failed!\n");
return false;
}
#endif
if (sasl_client_init(NULL) != SASL_OK) {
fprintf(stderr, "SASL library initialization failed!\n");
return false;
}
return true;
}
#endif
configure_file (sieve-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/sieve-config.h )
########### next target ###############
set(kio_sieve_PART_SRCS sieve.cpp )
ecm_qt_declare_logging_category(kio_sieve_PART_SRCS HEADER sieve_debug.h IDENTIFIER SIEVE_LOG CATEGORY_NAME log_sieve)
add_library(kio_sieve MODULE ${kio_sieve_PART_SRCS})
target_link_libraries(kio_sieve KF5::KIOCore KF5::I18n Qt5::Network KF5::WidgetsAddons ${Sasl2_LIBRARIES})
set_target_properties(kio_sieve PROPERTIES OUTPUT_NAME "sieve")
install(TARGETS kio_sieve DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio/)
########### install files ###############
install( FILES sieve.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
#! /bin/sh
$XGETTEXT *.cpp -o $podir/kio_sieve.pot
3028: Sieve: A Mail Filtering Language
3431: Sieve Extension: Relational Tests
Documents at http://ktown.kde.org/~dirk/sieve/
/* Define if you have cyrus-sasl2 libraries */
#cmakedefine HAVE_LIBSASL2 1
This diff is collapsed.
/***************************************************************************
sieve.h - description
-------------------
begin : Thu Dec 20 18:47:08 EST 2001
copyright : (C) 2001 by Hamish Rodda
email : meddie@yoyo.cc.monash.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 as *
* published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef __sieve_h__
#define __sieve_h__
#include "sieve-config.h"
#include <kio/tcpslavebase.h>
#include <kio/authinfo.h>
#include <QString>
#include <QByteArray>
#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(const 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);
virtual ~kio_sieveProtocol();
void mimetype(const QUrl &url) Q_DECL_OVERRIDE;
void get(const QUrl &url) Q_DECL_OVERRIDE;
void put(const QUrl &url, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE;
void del(const QUrl &url, bool isfile) Q_DECL_OVERRIDE;
void listDir(const QUrl &url) Q_DECL_OVERRIDE;
void chmod(const QUrl &url, int permissions) Q_DECL_OVERRIDE;
virtual void urlStat(const QUrl &url);
void setHost(const QString &host, quint16 port, const QString &user, const QString &pass) Q_DECL_OVERRIDE;
void openConnection() Q_DECL_OVERRIDE;
void closeConnection() Q_DECL_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) Q_DECL_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 respose 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;
};
#endif
[Protocol]
exec=kf5/kio/sieve
protocol=sieve
input=none
output=filesystem
listing=Name,Access,Type,MimeType,
reading=true
writing=true
makedir=false
deleting=true
linking=false
moving=false
Icon=view-filter
X-DocPath=kioslave5/sieve/index.html
Description=An ioslave for the Sieve mail filtering protocol
Description[ast]=Un esclavu ES pal protocolu de peñera de corréu Sieve
Description[bs]=U/I program za Sieve protokol filtriranja e-pošte
Description[ca]=Un «ioslave» pel protocol de filtratge de correu «Sieve»
Description[ca@valencia]=Un «ioslave» pel protocol de filtratge de correu «Sieve»
Description[cs]=Protokol pro filtrování pošty Sieve
Description[da]=En ioslave til mail-filtreringsprotokollen Sieve
Description[de]=Ein Ein-/Ausgabemodul für das Mailfilter-Protokoll Sieve
Description[el]=Ένα ioslave για το πρωτόκολλο φιλτραρίσματος αλληλογραφίας Sieve
Description[en_GB]=An ioslave for the Sieve mail filtering protocol
Description[es]=Un esclavo de E/S para el protocolo de filtrado de correo Sieve
Description[et]=Sieve kirjade filtreerimise protokolli IO-moodul
Description[fi]=I/O-asiakas Sieve-postinsuodatusyhteyskäytännölle
Description[fr]=Un module d'entrées / sorties pour le protocole de filtrage de messagerie « Sieve »
Description[ga]=Sclábhaí I/A le haghaidh prótacail scagtha ríomhphoist Sieve
Description[gl]=Un ioslave para o protocolo de filtrado de correo Sieve.
Description[he]=תוסף ioslave עבור פרוטוקול מסנני דואר של Sieve
Description[hne]=सीव मेल फिल्टरिंग प्रोटोकाल बर आईओस्लेव
Description[hu]=KDE-protokoll a Sieve levélszűrő protokollhoz
Description[ia]=Un ioslave (sclavo de i/e) per le protocollo per filtrar posta Sieve
Description[it]=Un IOSlave per il protocollo di filtraggio della posta Sieve
Description[ja]=Sieve メールフィルタリングプロトコルのための ioslave
Description[kk]=Sieve пошта сүзгілеу протоколының ioslav-модулі
Description[km]=ioslave សម្រាប់​ពិធីការ​តម្រង​សំបុត្រ​របស់ Sieve
Description[ko]=Sieve 메일 필터링 프로토콜을 위한 IO 슬레이브
Description[lt]=Sieve pašto filtravimo protokolo palaikymas
Description[lv]=IO apstrādātājs Sieve pasta filtrēšanas protokolam
Description[mr]=सीव्ह मेल गाळणी शिष्टाचार करिता आयओस्लेव्ह
Description[nb]=En ioslave for Sieve e-postfiltrering
Description[nds]=In-/Utgaavmoduul för't Nettpostfilter-Protokoll Sieve
Description[nl]=Een KIO-slave voor het Sieve-mail filterprotocol
Description[nn]=Ein IO-slave for e-postfiltreringsprotokollen Sieve
Description[pl]=Moduł ioslave dla protokołu filtrowania poczty Sieve
Description[pt]=Um 'ioslave' para o protocolo de filtragem de correio Sieve
Description[pt_BR]=Um ioslave para o protocolo de filtragem de e-mail Sieve
Description[ro]=Un „ioslave” pentru protocolul de filtrare a poștei Sieve
Description[ru]=Поддержка протокола фильтрации почты Sieve
Description[se]=SO-šláva Sieve e-boastasillenprotokolla várás
Description[sk]=Ioslave pre Sieve mail filtrovací protokol
Description[sl]=Ioslave za protokol poštnega filtriranja Sieve
Description[sr]=У/И захват за сито, протокол филтрирања поште
Description[sr@ijekavian]=У/И захват за сито, протокол филтрирања поште
Description[sr@ijekavianlatin]=U/I zahvat za sito, protokol filtriranja pošte
Description[sr@latin]=U/I zahvat za sito, protokol filtriranja pošte
Description[sv]=En I/O-slav för brevfiltreringsprotokollet Sieve
Description[th]=ส่วนเสริม ioslave สำหรับโพรโทคอลการกรองจดหมาย Sieve
Description[tr]=Sieve e-posta filtrelemesi için bir kioslave
Description[uk]=Підлеглий В/В для протоколу фільтрування пошти Sieve
Description[x-test]=xxAn ioslave for the Sieve mail filtering protocolxx
Description[zh_CN]=Sieve 邮件过滤协议的 ioslave
Description[zh_TW]=Sieve 郵件過濾協定的 ioslave
log_libksieve kdepim (libksieve)
log_kmanagersieve kdepim (libksieve manager)
log_sieve kioslave (sieve)
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