• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 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 
39 enum 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 
49 class IMAP4Protocol:public
50  KIO::TCPSlaveBase,
51  public
52  imapParser,
53  public
54  mimeIO
55 {
56 
57 public:
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);
74  virtual void get (const KUrl & _url);
78  virtual void stat (const KUrl & _url);
79  virtual void slave_status ();
83  virtual void del (const KUrl & _url, bool isFile);
88  virtual void special (const QByteArray & data);
92  virtual void listDir (const KUrl & _url);
93  virtual void setSubURL (const KUrl & _url);
94  virtual void dispatch (int command, const QByteArray & data);
98  virtual void mkdir (const KUrl & url, int permissions);
99  virtual void put (const KUrl & url, int permissions, KIO::JobFlags flags);
100  virtual void rename (const KUrl & src, const KUrl & dest, KIO::JobFlags flags);
101  virtual void copy (const KUrl & src, const KUrl & dest, int permissions,
102  KIO::JobFlags flags);
103 
107  virtual void parseRelay (const QByteArray & buffer);
108 
112  virtual void parseRelay (ulong);
113 
116  virtual bool parseRead (QByteArray &buffer, long len, long relay=0);
117 
120  virtual bool parseReadLine (QByteArray & buffer, long relay = 0);
121 
124  virtual void parseWriteLine (const QString &);
125 
127  virtual int outputLine (const QByteArray & _str, int len = -1);
128 
130  virtual void flushOutput(const QString &contentEncoding = QString());
131 
132 protected:
133 
134  // select or examine the box if needed
135  bool assureBox (const QString & aBox, bool readonly);
136 
137  ssize_t myRead(void *data, ssize_t len);
138 
146  enum IMAP_TYPE
147  parseURL (const KUrl & _url, QString & _box, QString & _section,
148  QString & _type, QString & _uid, QString & _validity,
149  QString & _hierarchyDelimiter, QString & _info,
150  bool cache = false);
151  QString getMimeType (enum IMAP_TYPE);
152 
153  bool makeLogin ();
154 
155  void outputLineStr (const QString & _str)
156  {
157  outputLine( _str.toLatin1 (), _str.length() );
158  }
159  void doListEntry (const KUrl & _url, int stretch, imapCache * cache = NULL,
160  bool withFlags = false, bool withSubject = false);
161 
167  void doListEntry (const KUrl & url, const QString & myBox,
168  const imapList & item, bool appendPath = true);
169 
171  void specialACLCommand( int command, QDataStream& stream );
172 
174  void specialAnnotateMoreCommand( int command, QDataStream& stream );
175  void specialQuotaCommand( int command, QDataStream& stream );
176 
178  void specialSearchCommand( QDataStream& );
179 
181  void specialCustomCommand( QDataStream& );
182 
183 private:
184 
185  // This method behaves like the above method but takes an already encoded url,
186  // so you don't have to call KUrl::url() for every mail.
187  void doListEntry (const QString & encodedUrl, int stretch, imapCache * cache = NULL,
188  bool withFlags = false, bool withSubject = false);
189 
190  QString myHost, myUser, myPass, myAuth, myTLS;
191  int myPort;
192  bool mySSL;
193 
194  bool relayEnabled, cacheOutput, decodeContent;
195  QByteArray outputCache;
196  QBuffer outputBuffer;
197  int outputBufferIndex;
198  KIO::filesize_t mProcessedSize;
199 
200  char readBuffer[IMAP_BUFFER];
201  ssize_t readBufferLen;
202  int readSize;
203  QDateTime mTimeOfLastNoop;
204 };
205 
206 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:25:27 by doxygen 1.8.3.1 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.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 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