kioslave
common.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _KIOSLAVE_COMMON_H
00021 #define _KIOSLAVE_COMMON_H
00022
00023 #ifdef HAVE_LIBSASL2
00024
00025 #include <stdio.h>
00026 #include <QFile>
00027 #include <QDir>
00028 #include <KStandardDirs>
00029
00030 extern "C" {
00031 #include <sasl/sasl.h>
00032 }
00033
00034 inline bool initSASL()
00035 {
00036 #ifdef Q_OS_WIN32 //krazy:exclude=cpp
00037 QByteArray libInstallPath( QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib")+"sasl2")) );
00038 QByteArray configPath( QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config")+"sasl2")) );
00039 if ( sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK
00040 || sasl_set_path(SASL_PATH_TYPE_CONFIG, configPath.data()) != SASL_OK )
00041 {
00042 fprintf(stderr, "SASL path initialization failed!\n");
00043 return false;
00044 }
00045 #endif
00046
00047 if ( sasl_client_init( NULL ) != SASL_OK ) {
00048 fprintf(stderr, "SASL library initialization failed!\n");
00049 return false;
00050 }
00051 return true;
00052 }
00053
00054 #endif // HAVE_LIBSASL2
00055
00056 #endif