1 /*  -*- c++ -*-
2     sievejob.h
3 
4     SPDX-FileCopyrightText: 2002 Marc Mutz <mutz@kde.org>
5 
6     SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 #pragma once
10 
11 #include "session.h"
12 #include "sievejob.h"
13 
14 #include <QPointer>
15 #include <QStack>
16 #include <QUrl>
17 
18 namespace KManageSieve
19 {
20 class Q_DECL_HIDDEN SieveJob::Private
21 {
22 public:
Private(SieveJob * qq)23     Private(SieveJob *qq)
24         : q(qq)
25         , mFileExists(DontKnow)
26     {
27     }
28 
29     enum Command { Get, Put, Activate, Deactivate, SearchActive, List, Delete, Rename, Check };
30 
31     enum Existence { DontKnow, Yes, No };
32 
33     static Session *sessionForUrl(const QUrl &url);
34 
35     void run(Session *session);
36     bool handleResponse(const Response &response, const QByteArray &data);
37     void killed();
38 
39     SieveJob *const q;
40     QUrl mUrl;
41     QString mScript;
42     QString mActiveScriptName;
43     QString mErrorMessage;
44     QString mNewName;
45     QStack<Command> mCommands;
46 
47     // List of Sieve scripts on the server, used by @ref list()
48     QStringList mAvailableScripts;
49 
50     Existence mFileExists;
51 
52     static QHash<QUrl, QPointer<Session>> m_sessionPool;
53 };
54 }
55 
56