KIMAP

myrightsjob.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 "myrightsjob.h"
8
9#include <KLocalizedString>
10
11#include "acljobbase_p.h"
12#include "response_p.h"
13#include "rfccodecs.h"
14#include "session_p.h"
15
16namespace KIMAP
17{
18class MyRightsJobPrivate : public AclJobBasePrivate
19{
20public:
21 MyRightsJobPrivate(Session *session, const QString &name)
22 : AclJobBasePrivate(session, name)
23 , myRights(Acl::None)
24 {
25 }
26 ~MyRightsJobPrivate()
27 {
28 }
29
30 Acl::Rights myRights;
31};
32}
33
34using namespace KIMAP;
35
36MyRightsJob::MyRightsJob(Session *session)
37 : AclJobBase(*new MyRightsJobPrivate(session, i18n("MyRights")))
38{
39}
40
41MyRightsJob::~MyRightsJob()
42{
43}
44
45void MyRightsJob::doStart()
46{
48
49 d->tags << d->sessionInternal()->sendCommand("MYRIGHTS", '\"' + KIMAP::encodeImapFolderName(d->mailBox.toUtf8()) + '\"');
50}
51
52void MyRightsJob::handleResponse(const Response &response)
53{
55
56 if (handleErrorReplies(response) == NotHandled) {
57 if (response.content.size() == 4 && response.content[1].toString() == "MYRIGHTS") {
58 d->myRights = Acl::rightsFromString(response.content[3].toString());
59 }
60 }
61}
62
64{
66 return d->myRights & right;
67}
68
70{
72 return d->myRights;
73}
74
75#include "moc_myrightsjob.cpp"
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:30
Determine the rights the currently-logged-in user has on the current mailbox.
Definition myrightsjob.h:43
bool hasRightEnabled(Acl::Right right)
Check whether the current user has the a particular right on the mailbox.
Acl::Rights rights()
Get the rights for the current user on the mailbox.
QString i18n(const char *text, const TYPE &arg...)
QString name(GameStandardAction id)
KIMAP_EXPORT Rights rightsFromString(const QByteArray &string)
Convert the text form of a set of rights into a Rights bitflag.
Definition acl.cpp:55
Right
Possible rights that can be held on a mailbox.
Definition acl.h:23
This file is part of the IMAP support library and defines the RfcCodecs class.
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.