Blame lang/qt/src/wkspublishjob.h

Packit d7e8d0
/* wkspublishjob.h
Packit d7e8d0
Packit d7e8d0
    Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Packit d7e8d0
    Software engineering by Intevation GmbH
Packit d7e8d0
Packit d7e8d0
    QGpgME is free software; you can redistribute it and/or
Packit d7e8d0
    modify it under the terms of the GNU General Public License as
Packit d7e8d0
    published by the Free Software Foundation; either version 2 of the
Packit d7e8d0
    License, or (at your option) any later version.
Packit d7e8d0
Packit d7e8d0
    QGpgME is distributed in the hope that it will be useful,
Packit d7e8d0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit d7e8d0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit d7e8d0
    General Public License for more details.
Packit d7e8d0
Packit d7e8d0
    You should have received a copy of the GNU General Public License along
Packit d7e8d0
    with this program; if not, write to the Free Software Foundation, Inc.,
Packit d7e8d0
    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit d7e8d0
Packit d7e8d0
    In addition, as a special exception, the copyright holders give
Packit d7e8d0
    permission to link the code of this program with any edition of
Packit d7e8d0
    the Qt library by Trolltech AS, Norway (or with modified versions
Packit d7e8d0
    of Qt that use the same license as Qt), and distribute linked
Packit d7e8d0
    combinations including the two.  You must obey the GNU General
Packit d7e8d0
    Public License in all respects for all of the code used other than
Packit d7e8d0
    Qt.  If you modify this file, you may extend this exception to
Packit d7e8d0
    your version of the file, but you are not obligated to do so.  If
Packit d7e8d0
    you do not wish to do so, delete this exception statement from
Packit d7e8d0
    your version.
Packit d7e8d0
*/
Packit d7e8d0
#ifndef QGPGME_WKSPUBLISHJOB_H
Packit d7e8d0
#define QGPGME_WKSPUBLISHJOB_H
Packit d7e8d0
Packit d7e8d0
#include "job.h"
Packit d7e8d0
Packit d7e8d0
#include "qgpgme_export.h"
Packit d7e8d0
Packit d7e8d0
namespace GpgME
Packit d7e8d0
{
Packit d7e8d0
    class Key;
Packit d7e8d0
} // namespace GpgME
Packit d7e8d0
Packit d7e8d0
namespace QGpgME {
Packit d7e8d0
Packit d7e8d0
/**
Packit d7e8d0
 * Handles Web Key Service Publishing. Needs WKS tools installed and
Packit d7e8d0
 * server support.
Packit d7e8d0
 *
Packit d7e8d0
 * Remember that after a result is emitted the job is auto deleted
Packit d7e8d0
 * so you can only use it for a single action.
Packit d7e8d0
 *
Packit d7e8d0
 * The workflow is to call startCreate, check for errors and then
Packit d7e8d0
 * send the RFC822 mail returned in returnedData.
Packit d7e8d0
 *
Packit d7e8d0
 * When the response is received start a startRecieve with the
Packit d7e8d0
 * RFC822 mail received as paramater response. Check for errors
Packit d7e8d0
 * and then send again send the result from returnedData back to
Packit d7e8d0
 * the server.
Packit d7e8d0
 *
Packit d7e8d0
 */
Packit d7e8d0
class QGPGME_EXPORT WKSPublishJob: public Job
Packit d7e8d0
{
Packit d7e8d0
    Q_OBJECT
Packit d7e8d0
protected:
Packit d7e8d0
    explicit WKSPublishJob(QObject *parent);
Packit d7e8d0
public:
Packit d7e8d0
    ~WKSPublishJob();
Packit d7e8d0
Packit d7e8d0
Packit d7e8d0
    /** Start a check if WKS Publishing is supported. As this involves
Packit d7e8d0
     * an HTTP Query it might take a while. Returns GPG_ERR_NOT_SUPPORED
Packit d7e8d0
     * result if GnuPG is too old or the required tools are not installed.
Packit d7e8d0
     *
Packit d7e8d0
     * The error GPG_ERR_NOT_ENABLED indicates that wks-tools failed to
Packit d7e8d0
     * detect a working wks service for this.
Packit d7e8d0
     *
Packit d7e8d0
     * @param the mailbox to check for.
Packit d7e8d0
     **/
Packit d7e8d0
    virtual void startCheck(const QString &mailbox) = 0;
Packit d7e8d0
Packit d7e8d0
    /** Create a publish request.
Packit d7e8d0
     * The returnedData from the result signal will contain
Packit d7e8d0
     * the full Request as returned by gpg-wks-client --create
Packit d7e8d0
     *
Packit d7e8d0
     * @param fpr the fingerprint of the key to create the request for.
Packit d7e8d0
     * @param mailbox A simple mail address without a Name.
Packit d7e8d0
     */
Packit d7e8d0
    virtual void startCreate(const char *fpr, const QString &mailbox) = 0;
Packit d7e8d0
Packit d7e8d0
    /** Handle a submisson response. The returnedData in the result singnal
Packit d7e8d0
     * will contain the confirmation response as returned by gpg-wks-client --receive
Packit d7e8d0
     *
Packit d7e8d0
     * @param response The response of the server.
Packit d7e8d0
     **/
Packit d7e8d0
    virtual void startReceive(const QByteArray &response) = 0;
Packit d7e8d0
Packit d7e8d0
Q_SIGNALS:
Packit d7e8d0
    /* Result of the operation returned Data and returned Error are
Packit d7e8d0
     * the results from gpg-wks-client's stdout or stderr respectively.
Packit d7e8d0
     *
Packit d7e8d0
     * As usual auditLogAsHtml and auditLogError can be ignored.
Packit d7e8d0
     **/
Packit d7e8d0
    void result(const GpgME::Error &error, const QByteArray &returnedData,
Packit d7e8d0
                const QByteArray &returnedError,
Packit d7e8d0
                const QString &auditLogAsHtml = QString(),
Packit d7e8d0
                const GpgME::Error &auditLogError = GpgME::Error());
Packit d7e8d0
};
Packit d7e8d0
Packit d7e8d0
}
Packit d7e8d0
Packit d7e8d0
#endif