Commit 93c937e8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add method to renamescript + check script.

But too bad no all server support it :(
So I need to reimplement by hand
parent ce1d6dbd
......@@ -167,7 +167,6 @@ void SessionThread::doSendData(const QByteArray &data)
void SessionThread::slotDataReceived()
{
Q_ASSERT(QThread::currentThread() == thread());
if (m_pendingQuantity > 0) {
const QByteArray buffer = m_socket->read(qMin(m_pendingQuantity, m_socket->bytesAvailable()));
m_data += buffer;
......
......@@ -102,7 +102,11 @@ void SieveJob::Private::run(Session *session)
break;
}
case Check: {
//TODO
const QString filename = mUrl.fileName(/*QUrl::ObeyTrailingSlash*/);
QByteArray encodedData;
append_lf2crlf(encodedData, mScript.toUtf8());
session->sendData("RENAMESCRIPT {" + QByteArray::number(encodedData.size()) + "+}");
session->sendData(encodedData);
break;
}
......@@ -368,6 +372,20 @@ SieveJob *SieveJob::rename(const QUrl &url, const QString &newName)
return job;
}
SieveJob *SieveJob::check(const QUrl &url, const QString &script)
{
QStack<Private::Command> commands;
commands.push(Private::Check);
SieveJob *job = new SieveJob;
job->d->mUrl = url;
job->d->mScript = script;
job->d->mCommands = commands;
Private::sessionForUrl(url)->scheduleJob(job);
return job;
}
SieveJob *SieveJob::activate(const QUrl &url)
{
QStack<Private::Command> commands;
......
......@@ -87,9 +87,16 @@ public:
/**
* Rename the script with the given sieve @p url and new name @p newName.
* Not supported by all sieve server
*/
static SieveJob *rename(const QUrl &url, const QString &newName);
/**
* Check the script with the given sieve @p url.
* Not supported by all sieve server
*/
static SieveJob *check(const QUrl &url, const QString &script);
/**
* Kills the sieve job.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment