• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KIMAP Library

  • kimap
listrightsjob.cpp
1/*
2 Copyright (c) 2009 Andras Mantia <amantia@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#include "listrightsjob.h"
21
22#include <KDE/KLocalizedString>
23#include <KDE/KDebug>
24
25#include "acljobbase_p.h"
26#include "message_p.h"
27#include "session_p.h"
28#include "rfccodecs.h"
29
30namespace KIMAP
31{
32 class ListRightsJobPrivate : public AclJobBasePrivate
33 {
34 public:
35 ListRightsJobPrivate( Session *session, const QString& name ) : AclJobBasePrivate( session, name ), defaultRights( Acl::None ) {}
36 ~ListRightsJobPrivate() { }
37
38 Acl::Rights defaultRights;
39 QList<Acl::Rights> possibleRights;
40
41 };
42}
43
44using namespace KIMAP;
45
46ListRightsJob::ListRightsJob( Session *session )
47 : AclJobBase( *new ListRightsJobPrivate( session, i18n( "ListRights" ) ) )
48{
49
50}
51
52ListRightsJob::~ListRightsJob()
53{
54}
55
56void ListRightsJob::doStart()
57{
58 Q_D( ListRightsJob );
59
60 d->tags << d->sessionInternal()->sendCommand( "LISTRIGHTS", '\"' + KIMAP::encodeImapFolderName( d->mailBox.toUtf8() ) + "\" \"" + d->id + "\"" );
61}
62
63void ListRightsJob::handleResponse( const Message &response )
64{
65 Q_D( ListRightsJob );
66
67 if ( handleErrorReplies( response ) == NotHandled ) {
68 if ( response.content.size() >= 4 &&
69 response.content[1].toString() == "LISTRIGHTS" ) {
70 QByteArray s = response.content[4].toString();
71 d->defaultRights = Acl::rightsFromString( s );
72 int i = 5;
73 while ( i < response.content.size() ) {
74 s = response.content[i].toString();
75 d->possibleRights.append( Acl::rightsFromString( s ) );
76 i++;
77 }
78 }
79 }
80}
81
82void ListRightsJob::setIdentifier( const QByteArray &identifier )
83{
84 Q_D( ListRightsJob );
85 d->setIdentifier( identifier );
86}
87
88QByteArray ListRightsJob::identifier()
89{
90 Q_D( ListRightsJob );
91 return d->identifier();
92}
93
94Acl::Rights ListRightsJob::defaultRights()
95{
96 Q_D( ListRightsJob );
97 return d->defaultRights;
98}
99
100QList<Acl::Rights> ListRightsJob::possibleRights()
101{
102 Q_D( ListRightsJob );
103 return d->possibleRights;
104}
KIMAP::AclJobBase
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:44
KIMAP::ListRightsJob
Lists the possible and automatic rights for an identifier on a mailbox.
Definition listrightsjob.h:49
KIMAP::ListRightsJob::possibleRights
QList< Acl::Rights > possibleRights()
The rights it is possible to assign to the identifier.
Definition listrightsjob.cpp:100
KIMAP::ListRightsJob::identifier
QByteArray identifier()
The identifier that will be looked up.
Definition listrightsjob.cpp:88
KIMAP::ListRightsJob::defaultRights
Acl::Rights defaultRights()
The rights that will always be assigned to the identifier, regardless of the access control list.
Definition listrightsjob.cpp:94
KIMAP::ListRightsJob::setIdentifier
void setIdentifier(const QByteArray &identifier)
Sets the identifier that should be looked up.
Definition listrightsjob.cpp:82
KIMAP::Acl::rightsFromString
Rights rightsFromString(const QByteArray &string)
Convert the text form of a set of rights into a Rights bitflag.
Definition acl.cpp:67
rfccodecs.h
This file is part of the IMAP support library and defines the RfcCodecs class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIMAP Library

Skip menu "KIMAP Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal