kmail

popaccount.h
1 // -*- c++ -*-
2 #ifndef KMAcctExpPop_h
3 #define KMAcctExpPop_h
4 
5 #include "networkaccount.h"
6 
7 #include <tqvaluelist.h>
8 #include <tqstringlist.h>
9 #include <tqvaluevector.h>
10 #include <tqtimer.h>
11 #include <tqdict.h>
12 
13 class KMPopHeaders;
14 class KMMessage;
15 class TQDataStream;
16 namespace TDEIO {
17  class MetaData;
18  class Slave;
19  class SimpleJob;
20  class Job;
21 }
22 
24 namespace KMail {
28 class PopAccount: public NetworkAccount {
29  Q_OBJECT
30 
31 
32 public:
33  virtual ~PopAccount();
34  virtual void init(void);
35 
36  virtual TDEIO::MetaData slaveConfig() const;
37 
39  virtual void pseudoAssign( const KMAccount * a );
40 
41  virtual TQString protocol() const;
42  virtual unsigned short int defaultPort() const;
43 
47  bool usePipelining(void) const { return mUsePipelining; }
48  virtual void setUsePipelining(bool);
49 
54  bool leaveOnServer(void) const { return mLeaveOnServer; }
55  virtual void setLeaveOnServer(bool);
56 
60  int leaveOnServerDays(void) const { return mLeaveOnServerDays; }
61  virtual void setLeaveOnServerDays(int);
62 
66  int leaveOnServerCount(void) const { return mLeaveOnServerCount; }
67  virtual void setLeaveOnServerCount(int);
68 
72  int leaveOnServerSize(void) const { return mLeaveOnServerSize; }
73  virtual void setLeaveOnServerSize(int);
74 
79  bool filterOnServer(void) const { return mFilterOnServer; }
80  virtual void setFilterOnServer(bool);
81 
86  unsigned int filterOnServerCheckSize(void) const { return mFilterOnServerCheckSize; }
87  virtual void setFilterOnServerCheckSize(unsigned int);
88 
92  virtual TQString type(void) const;
93  virtual void readConfig(TDEConfig&);
94  virtual void writeConfig(TDEConfig&);
95  virtual void processNewMail(bool _interactive);
96 
97  virtual void killAllJobs( bool disconnectSlave=false ); // NOOP currently
98 
99 protected:
100  enum Stage { Idle, List, Uidl, Head, Retr, Dele, Quit };
101  friend class ::AccountManager;
102  PopAccount(AccountManager* owner, const TQString& accountName, uint id);
103 
107  void startJob();
108 
112  void connectJob();
113 
117  void processRemainingQueuedMessages();
118 
122  void saveUidList();
123 
124  bool mUsePipelining;
125  bool mLeaveOnServer;
126  int mLeaveOnServerDays;
127  int mLeaveOnServerCount;
128  int mLeaveOnServerSize;
129  bool gotMsgs;
130  bool mFilterOnServer;
131  unsigned int mFilterOnServerCheckSize;
132 
133  TDEIO::SimpleJob *job;
134  //Map of ID's vs. sizes of messages which should be downloaded
135  TQMap<TQString, int> mMsgsPendingDownload;
136 
137  TQPtrList<KMPopHeaders> headersOnServer;
138  TQPtrListIterator<KMPopHeaders> headerIt;
139  bool headers;
140 
141  TQMap<TQString, bool> mHeaderDeleteUids;
142  TQMap<TQString, bool> mHeaderDownUids;
143  TQMap<TQString, bool> mHeaderLaterUids;
144 
145  TQStringList idsOfMsgs; //used for ids and for count
146  TQValueList<int> lensOfMsgs;
147  TQMap<TQString, TQString> mUidForIdMap; // maps message ID (i.e. index on the server) to UID
148  TQDict<int> mUidsOfSeenMsgsDict; // set of UIDs of previously seen messages (for fast lookup)
149  TQDict<int> mUidsOfNextSeenMsgsDict; // set of UIDs of seen messages (for the next check)
150  TQValueVector<int> mTimeOfSeenMsgsVector; // list of times of previously seen messages
151  TQMap<TQString, int> mTimeOfNextSeenMsgsMap; // map of uid to times of seen messages
152  TQDict<int> mSizeOfNextSeenMsgsDict;
153  TQStringList idsOfMsgsToDelete;
154  TQStringList idsOfForcedDeletes;
155  int indexOfCurrentMsg;
156 
157  TQValueList<KMMessage*> msgsAwaitingProcessing;
158  TQStringList msgIdsAwaitingProcessing;
159  TQStringList msgUidsAwaitingProcessing;
160 
161  TQByteArray curMsgData;
162  TQDataStream *curMsgStrm;
163 
164  int curMsgLen;
165  Stage stage;
166  TQTimer processMsgsTimer;
167  int processingDelay;
168  int numMsgs, numBytes, numBytesToRead, numBytesRead, numMsgBytesRead;
169  bool interactive;
170  bool mProcessing;
171  bool mUidlFinished;
172  int dataCounter;
173 
174 protected slots:
185  void slotProcessPendingMsgs();
186 
191  void slotGetNextMsg();
192 
197  void slotMsgRetrieved(TDEIO::Job*, const TQString &);
198 
202  void slotData( TDEIO::Job*, const TQByteArray &);
203 
209  void slotResult( TDEIO::Job* );
210 
214  void slotCancel();
215 
219  void slotAbortRequested();
220 
225  void slotJobFinished();
226 
230  void slotSlaveError(TDEIO::Slave *, int, const TQString &);
231 
236  void slotGetNextHdr();
237 };
238 
239 } // namespace KMail
240 
241 
242 
243 #endif /*KMAcctExpPop_h*/
int leaveOnServerCount(void) const
If value is positive, leave so many messages on the server.
Definition: popaccount.h:66
Definition: composer.h:22
unsigned int filterOnServerCheckSize(void) const
Size of messages which should be check on the pop server before download.
Definition: popaccount.h:86
bool filterOnServer(void) const
Shall messages be filter on the server (TRUE) or not (FALSE).
Definition: popaccount.h:79
folderdiaquotatab.h
Definition: aboutdata.cpp:40
bool leaveOnServer(void) const
Shall messages be left on the server upon retreival (TRUE) or deleted (FALSE).
Definition: popaccount.h:54
The account manager is responsible for creating accounts of various types via the factory method crea...
This is a Mime Message.
Definition: kmmessage.h:68
KMail account for pop mail account.
Definition: popaccount.h:28
int leaveOnServerSize(void) const
If value is positive, leave so many MBs on the server.
Definition: popaccount.h:72
bool usePipelining(void) const
Sending of several commands at once.
Definition: popaccount.h:47
int leaveOnServerDays(void) const
If value is positive, leave mail on the server for so many days.
Definition: popaccount.h:60