/*
 * Squawk messenger.
 * Copyright (C) 2019  Yury Gubich <blue@macaw.me>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <KF5/KWallet/KWallet>

extern "C" KWallet::Wallet* openWallet(const QString &name, WId w, KWallet::Wallet::OpenType ot = KWallet::Wallet::Synchronous) {
    return KWallet::Wallet::openWallet(name, w, ot);
}

extern "C" void deleteWallet(KWallet::Wallet* w) {
    w->deleteLater();
}

extern "C" void networkWallet(QString& str) {
    str = KWallet::Wallet::NetworkWallet();
}

extern "C" int readPassword(KWallet::Wallet* w, const QString &key, QString &value) {
    return w->readPassword(key, value);
}

extern "C" int writePassword(KWallet::Wallet* w, const QString &key, const QString &value) {
    return w->writePassword(key, value);
}

extern "C" bool hasFolder(KWallet::Wallet* w, const QString &f) {
    return w->hasFolder(f);
}

extern "C" bool createFolder(KWallet::Wallet* w, const QString &f) {
    return w->createFolder(f);
}

extern "C" bool setFolder(KWallet::Wallet* w, const QString &f) {
    return w->setFolder(f);
}