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

kioslave/imap4

  • kioslave
  • imap4
imap4.h
1#ifndef _IMAP4_H
2#define _IMAP4_H
3/**********************************************************************
4 *
5 * imap4.h - IMAP4rev1 KIOSlave
6 * Copyright (C) 2001-2002 Michael Haeckel <haeckel@kde.org>
7 * Copyright (C) 1999 John Corey <jcorey@fruity.ath.cx>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 *
23 * Send comments and bug fixes to jcorey@fruity.ath.cx
24 *
25 *********************************************************************/
26
27#include "imap4-config.h"
28#include "imapparser.h"
29#include "mimeio.h"
30
31#include <kio/tcpslavebase.h>
32#include <QBuffer>
33#include <QDateTime>
34#include <QByteArray>
35
36#define IMAP_BUFFER 8192
37
39enum IMAP_TYPE {
40 ITYPE_UNKNOWN, /*< unknown type */
41 ITYPE_DIR, /*< Object is a directory. i.e. does not contain message, just mailboxes */
42 ITYPE_BOX, /*< Object is a mailbox. i.e. contains mails */
43 ITYPE_DIR_AND_BOX, /*< Object contains both mails and mailboxes */
44 ITYPE_MSG, /*< Object is a mail */
45 ITYPE_ATTACH /*< Object is an attachment */
46};
47
49class IMAP4Protocol:public
50 KIO::TCPSlaveBase,
51 public
52 imapParser,
53 public
54 mimeIO
55{
56
57public:
58
59 // reimplement the TCPSlave
60 IMAP4Protocol (const QByteArray & pool, const QByteArray & app, bool isSSL);
61 virtual ~IMAP4Protocol ();
62
63 virtual void openConnection();
64 virtual void closeConnection();
65
66 virtual void setHost (const QString & _host, quint16 _port, const QString & _user,
67 const QString & _pass);
75 virtual void get (const KUrl & _url);
79 virtual void stat (const KUrl & _url);
80 virtual void slave_status ();
84 virtual void del (const KUrl & _url, bool isFile);
89 virtual void special (const QByteArray & data);
93 virtual void listDir (const KUrl & _url);
94 virtual void setSubURL (const KUrl & _url);
95 virtual void dispatch (int command, const QByteArray & data);
99 virtual void mkdir (const KUrl & url, int permissions);
100 virtual void put (const KUrl & url, int permissions, KIO::JobFlags flags);
101 virtual void rename (const KUrl & src, const KUrl & dest, KIO::JobFlags flags);
102 virtual void copy (const KUrl & src, const KUrl & dest, int permissions,
103 KIO::JobFlags flags);
104
108 virtual void parseRelay (const QByteArray & buffer);
109
113 virtual void parseRelay (ulong);
114
117 virtual bool parseRead (QByteArray &buffer, long len, long relay=0);
118
121 virtual bool parseReadLine (QByteArray & buffer, long relay = 0);
122
125 virtual void parseWriteLine (const QString &);
126
128 virtual int outputLine (const QByteArray & _str, int len = -1);
129
131 virtual void flushOutput(const QString &contentEncoding = QString());
132
133protected:
134
135 // select or examine the box if needed
136 bool assureBox (const QString & aBox, bool readonly);
137
138 ssize_t myRead(void *data, ssize_t len);
139
147 enum IMAP_TYPE
148 parseURL (const KUrl & _url, QString & _box, QString & _section,
149 QString & _type, QString & _uid, QString & _validity,
150 QString & _hierarchyDelimiter, QString & _info,
151 bool cache = false);
152 QString getMimeType (enum IMAP_TYPE);
153
154 bool makeLogin ();
155
156 void outputLineStr (const QString & _str)
157 {
158 outputLine( _str.toLatin1 (), _str.length() );
159 }
160 void doListEntry (const KUrl & _url, int stretch, imapCache * cache = NULL,
161 bool withFlags = false, bool withSubject = false);
162
168 void doListEntry (const KUrl & url, const QString & myBox,
169 const imapList & item, bool appendPath = true);
170
172 void specialACLCommand( int command, QDataStream& stream );
173
175 void specialAnnotateMoreCommand( int command, QDataStream& stream );
176 void specialQuotaCommand( int command, QDataStream& stream );
177
179 void specialSearchCommand( QDataStream& );
180
182 void specialCustomCommand( QDataStream& );
183
184private:
185
186 // This method behaves like the above method but takes an already encoded url,
187 // so you don't have to call KUrl::url() for every mail.
188 void doListEntry (const QString & encodedUrl, int stretch, imapCache * cache = NULL,
189 bool withFlags = false, bool withSubject = false);
190
191 QString myHost, myUser, myPass, myAuth, myTLS;
192 int myPort;
193 bool mySSL;
194
195 bool relayEnabled, cacheOutput, decodeContent;
196 QByteArray outputCache;
197 QBuffer outputBuffer;
198 int outputBufferIndex;
199 KIO::filesize_t mProcessedSize;
200
201 char readBuffer[IMAP_BUFFER];
202 ssize_t readBufferLen;
203 int readSize;
204 QDateTime mTimeOfLastNoop;
205};
206
207#endif
IMAP4Protocol
IOSlave derived class.
Definition imap4.h:55
IMAP4Protocol::special
virtual void special(const QByteArray &data)
Capabilities, NOOP, (Un)subscribe, Change status, Change ACL.
Definition imap4.cpp:1177
IMAP4Protocol::parseURL
enum IMAP_TYPE parseURL(const KUrl &_url, QString &_box, QString &_section, QString &_type, QString &_uid, QString &_validity, QString &_hierarchyDelimiter, QString &_info, bool cache=false)
Parses the given URL The return values are set by parsing the URL and querying the server.
Definition imap4.cpp:2289
IMAP4Protocol::del
virtual void del(const KUrl &_url, bool isFile)
delete a mailbox
Definition imap4.cpp:1038
IMAP4Protocol::mkdir
virtual void mkdir(const KUrl &url, int permissions)
create a mailbox
Definition imap4.cpp:896
IMAP4Protocol::parseReadLine
virtual bool parseReadLine(QByteArray &buffer, long relay=0)
reimplement the parser
Definition imap4.cpp:702
IMAP4Protocol::specialSearchCommand
void specialSearchCommand(QDataStream &)
Search current folder, the search string is passed as SECTION.
Definition imap4.cpp:1489
IMAP4Protocol::stat
virtual void stat(const KUrl &_url)
stat a mailbox, message, attachment
Definition imap4.cpp:1762
IMAP4Protocol::specialAnnotateMoreCommand
void specialAnnotateMoreCommand(int command, QDataStream &stream)
Send an annotation command which is identified by command.
Definition imap4.cpp:1591
IMAP4Protocol::parseRelay
virtual void parseRelay(const QByteArray &buffer)
reimplement the parser relay hook to send the fetched data directly to an upper level
Definition imap4.cpp:643
IMAP4Protocol::parseWriteLine
virtual void parseWriteLine(const QString &)
reimplement the parser
Definition imap4.cpp:2091
IMAP4Protocol::specialACLCommand
void specialACLCommand(int command, QDataStream &stream)
Send an ACL command which is identified by command.
Definition imap4.cpp:1397
IMAP4Protocol::listDir
virtual void listDir(const KUrl &_url)
list a directory/mailbox
Definition imap4.cpp:400
IMAP4Protocol::flushOutput
virtual void flushOutput(const QString &contentEncoding=QString())
send out cached data to the application
Definition imap4.cpp:2429
IMAP4Protocol::get
virtual void get(const KUrl &_url)
get a message or part of a message the data is normally sent as we get it from the server if you want...
Definition imap4.cpp:186
IMAP4Protocol::outputLine
virtual int outputLine(const QByteArray &_str, int len=-1)
reimplement the mimeIO
Definition imap4.cpp:2401
IMAP4Protocol::specialCustomCommand
void specialCustomCommand(QDataStream &)
Send a custom command to the server.
Definition imap4.cpp:1517
IMAP4Protocol::parseRead
virtual bool parseRead(QByteArray &buffer, long len, long relay=0)
reimplement the parser read at least len bytes
Definition imap4.cpp:669
mimeIO
Definition mimeio.h:29
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.

kioslave/imap4

Skip menu "kioslave/imap4"
  • Main Page
  • 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