Blame lang/qt/src/wkspublishjob.h

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