20 #include "namespacejob.h"
23 #include <KDE/KLocalizedString>
27 #include "message_p.h"
29 #include "session_p.h"
30 #include "imapstreamparser.h"
34 class NamespaceJobPrivate :
public JobPrivate
37 NamespaceJobPrivate( Session *session,
const QString& name ) : JobPrivate( session, name ) { }
38 ~NamespaceJobPrivate() { }
44 foreach (
const QByteArray &namespaceItem, namespaceList ) {
46 parser.setData( namespaceItem );
50 if ( parts.
size() < 2 ) {
53 MailBoxDescriptor descriptor;
58 }
catch ( KIMAP::ImapParserException e ) {
59 qWarning() <<
"The stream parser raised an exception during namespace list parsing:" << e.what();
60 qWarning() <<
"namespacelist:" << namespaceList;
74 using namespace KIMAP;
76 NamespaceJob::NamespaceJob( Session *session )
77 : Job( *new NamespaceJobPrivate( session, i18n(
"Namespace" ) ) )
81 NamespaceJob::~NamespaceJob()
87 Q_D(
const NamespaceJob );
88 return d->personalNamespaces;
93 Q_D(
const NamespaceJob );
94 return d->userNamespaces;
99 Q_D(
const NamespaceJob );
100 return d->sharedNamespaces;
103 bool NamespaceJob::containsEmptyNamespace()
const
105 Q_D(
const NamespaceJob );
108 + d->sharedNamespaces;
110 foreach (
const MailBoxDescriptor &descriptor, completeList ) {
111 if ( descriptor.name.isEmpty() ) {
119 void NamespaceJob::doStart()
122 d->tags << d->sessionInternal()->sendCommand(
"NAMESPACE" );
125 void NamespaceJob::handleResponse(
const Message &response )
128 if ( handleErrorReplies( response ) == NotHandled ) {
129 if ( response.content.size() >= 5 &&
130 response.content[1].toString() ==
"NAMESPACE" ) {
132 d->personalNamespaces = d->processNamespaceList( response.content[2].toList() );
135 d->userNamespaces = d->processNamespaceList( response.content[3].toList() );
138 d->sharedNamespaces = d->processNamespaceList( response.content[4].toList() );
This file is part of the IMAP support library and defines the RfcCodecs class.
Parser for IMAP messages that operates on a local socket stream.
QString fromUtf8(const char *str, int size)