KIMAP

metadatajobbase.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "metadatajobbase.h"
8#include "metadatajobbase_p.h"
9#include "response_p.h"
10#include "session_p.h"
11
12#include <KLocalizedString>
13
14using namespace KIMAP;
15
16QByteArray MetaDataJobBasePrivate::addPrefix(const QByteArray &entry, const QByteArray &attribute) const
17{
18 if (serverCapability == MetaDataJobBase::Annotatemore) {
19 if (attribute == "value.shared") {
20 return QByteArray("/shared").append(entry);
21 } else if (attribute == "value.priv") {
22 return QByteArray("/private").append(entry);
23 }
24 }
25 return entry;
26}
27
28QByteArray MetaDataJobBasePrivate::removePrefix(const QByteArray &entry) const
29{
30 if (serverCapability == MetaDataJobBase::Annotatemore) {
31 if (entry.startsWith("/shared")) {
32 return entry.mid(QByteArray("/shared").size());
33 } else if (entry.startsWith("/private")) {
34 return entry.mid(QByteArray("/private").size());
35 }
36 }
37 return entry;
38}
39
40QByteArray MetaDataJobBasePrivate::getAttribute(const QByteArray &entry) const
41{
42 if (serverCapability == MetaDataJobBase::Annotatemore) {
43 if (entry.startsWith("/shared")) {
44 return QByteArray("value.shared");
45 } else if (entry.startsWith("/private")) {
46 return QByteArray("value.priv");
47 }
48 }
49 return QByteArray();
50}
51
52MetaDataJobBase::MetaDataJobBase(Session *session)
53 : Job(*new MetaDataJobBasePrivate(session, i18n("MetaDataJobBase")))
54{
55}
56
57MetaDataJobBase::MetaDataJobBase(JobPrivate &dd)
58 : Job(dd)
59{
60}
61
62MetaDataJobBase::~MetaDataJobBase()
63{
64}
65
67{
69 d->mailBox = mailBox;
70}
71
73{
74 Q_D(const MetaDataJobBase);
75 return d->mailBox;
76}
77
79{
81 d->serverCapability = capability;
82}
83
85{
86 Q_D(const MetaDataJobBase);
87 return d->serverCapability;
88}
89
90#include "moc_metadatajobbase.cpp"
Base class for jobs that operate on mailbox metadata.
QString mailBox() const
The mailbox that will be acted upon.
void setServerCapability(ServerCapability capability)
Set what version of the metadata extension to be compatible with.
ServerCapability serverCapability() const
The version of the metadata extension that will be used.
void setMailBox(const QString &mailBox)
Set the mailbox to act on.
ServerCapability
Represents the capability level of the server.
@ Annotatemore
Used to indicate that the server supports the draft-daboo-imap-annotatemore-07 version of the extensi...
QString i18n(const char *text, const TYPE &arg...)
QByteArray & append(QByteArrayView data)
QByteArray mid(qsizetype pos, qsizetype len) const const
bool startsWith(QByteArrayView bv) const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:12:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.