Commit 7cb2e5d1 authored by David Faure's avatar David Faure
Browse files

pop3: merge common.h into pop3.cpp, it's not used anywhere else

parent d0930c90
Pipeline #92658 failed with stage
in 14 minutes and 58 seconds
/* 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 <QDir>
#include <QFile>
#include <stdio.h>
extern "C" {
#include <sasl/sasl.h>
}
inline bool initSASL()
{
#ifdef Q_OS_WIN32 // krazy:exclude=cpp
#if 0
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
#endif
if (sasl_client_init(nullptr) != SASL_OK) {
fprintf(stderr, "SASL library initialization failed!\n");
return false;
}
return true;
}
......@@ -7,7 +7,6 @@
*
*/
#include "pop3.h"
#include "common.h"
extern "C" {
#include <sasl/sasl.h>
......@@ -16,12 +15,12 @@ extern "C" {
#include "pop3_debug.h"
#include <QByteArray>
#include <QCoreApplication>
#include <QRegularExpression>
#include <KLocalizedString>
#include <QCryptographicHash>
#include <QFile>
#include <QNetworkProxy>
#include <QRegularExpression>
#include <KLocalizedString>
#include <KIO/SlaveInterface>
......@@ -66,6 +65,27 @@ static const sasl_callback_t callbacks[] = {
{SASL_CB_LIST_END, nullptr, nullptr},
};
static bool initSASL()
{
#ifdef Q_OS_WIN32 // krazy:exclude=cpp
#if 0
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
#endif
if (sasl_client_init(nullptr) != SASL_OK) {
fprintf(stderr, "SASL library initialization failed!\n");
return false;
}
return true;
}
int kdemain(int argc, char **argv)
{
if (argc != 4) {
......
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