File indexing completed on 2024-06-23 05:14:13

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     uiserver/echocommand.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "assuancommand.h"
0013 #include <QObject>
0014 
0015 namespace Kleo
0016 {
0017 
0018 /*!
0019   \brief GnuPG UI Server command for testing
0020 
0021   <h3>Usage</h3>
0022 
0023   \code
0024   ECHO [--inquire <keyword>] [--nohup]
0025   \endcode
0026 
0027   <h3>Description</h3>
0028 
0029   The ECHO command is a simple tool for testing. If a bulk input
0030   channel has been set up by the client, ECHO will read data from
0031   it, and pipe it right back into the bulk output channel. It is
0032   an error for an input channel to exist without an output
0033   channel.
0034 
0035   ECHO will also send back any non-option command line arguments
0036   in a status message. If the --inquire command line option has
0037   been given, ECHO will inquire with that keyword, and send the
0038   received data back on the status channel.
0039 */
0040 class EchoCommand : public QObject, public AssuanCommandMixin<EchoCommand>
0041 {
0042     Q_OBJECT
0043 public:
0044     EchoCommand();
0045     ~EchoCommand() override;
0046 
0047     static const char *staticName()
0048     {
0049         return "ECHO";
0050     }
0051 
0052 private:
0053     int doStart() override;
0054     void doCanceled() override;
0055 
0056 private Q_SLOTS:
0057     void slotInquireData(int, const QByteArray &);
0058     void slotInputReadyRead();
0059     void slotOutputBytesWritten();
0060 
0061 private:
0062     class Private;
0063     kdtools::pimpl_ptr<Private> d;
0064 };
0065 
0066 }