kmail

popaccount.h
1 #ifndef KMAcctExpPop_h
2 #define KMAcctExpPop_h
3 
4 #include "networkaccount.h"
5 
6 #include <tqvaluelist.h>
7 #include <tqstringlist.h>
8 #include <tqvaluevector.h>
9 #include <tqtimer.h>
10 #include <tqdict.h>
11 
12 class KMPopHeaders;
13 class KMMessage;
14 class TQDataStream;
15 namespace TDEIO {
16  class MetaData;
17  class Slave;
18  class SimpleJob;
19  class Job;
20 }
21 
23 namespace KMail {
27 class PopAccount: public NetworkAccount {
28  TQ_OBJECT
29 
30 
31 public:
32  virtual ~PopAccount();
33  virtual void init(void);
34 
35  virtual TDEIO::MetaData slaveConfig() const;
36 
38  virtual void pseudoAssign( const KMAccount * a );
39 
40  virtual TQString protocol() const;
41  virtual unsigned short int defaultPort() const;
42 
46  bool usePipelining(void) const { return mUsePipelining; }
47  virtual void setUsePipelining(bool);
48 
53  bool leaveOnServer(void) const { return mLeaveOnServer; }
54  virtual void setLeaveOnServer(bool);
55 
59  int leaveOnServerDays(void) const { return mLeaveOnServerDays; }
60  virtual void setLeaveOnServerDays(int);
61 
65  int leaveOnServerCount(void) const { return mLeaveOnServerCount; }
66  virtual void setLeaveOnServerCount(int);
67 
71  int leaveOnServerSize(void) const { return mLeaveOnServerSize; }
72  virtual void setLeaveOnServerSize(int);
73 
78  bool filterOnServer(void) const { return mFilterOnServer; }
79  virtual void setFilterOnServer(bool);
80 
85  unsigned int filterOnServerCheckSize(void) const { return mFilterOnServerCheckSize; }
86  virtual void setFilterOnServerCheckSize(unsigned int);
87 
91  virtual TQString type(void) const;
92  virtual void readConfig(TDEConfig&);
93  virtual void writeConfig(TDEConfig&);
94  virtual void processNewMail(bool _interactive);
95 
96  virtual void killAllJobs( bool disconnectSlave=false ); // NOOP currently
97 
98 protected:
99  enum Stage { Idle, List, Uidl, Head, Retr, Dele, Quit };
100  friend class ::AccountManager;
101  PopAccount(AccountManager* owner, const TQString& accountName, uint id);
102 
106  void startJob();
107 
111  void connectJob();
112 
117 
121  void saveUidList();
122 
123  bool mUsePipelining;
124  bool mLeaveOnServer;
125  int mLeaveOnServerDays;
126  int mLeaveOnServerCount;
127  int mLeaveOnServerSize;
128  bool gotMsgs;
129  bool mFilterOnServer;
130  unsigned int mFilterOnServerCheckSize;
131 
132  TDEIO::SimpleJob *job;
133  //Map of ID's vs. sizes of messages which should be downloaded
134  TQMap<TQString, int> mMsgsPendingDownload;
135 
136  TQPtrList<KMPopHeaders> headersOnServer;
137  TQPtrListIterator<KMPopHeaders> headerIt;
138  bool headers;
139 
140  TQMap<TQString, bool> mHeaderDeleteUids;
141  TQMap<TQString, bool> mHeaderDownUids;
142  TQMap<TQString, bool> mHeaderLaterUids;
143 
144  TQStringList idsOfMsgs; //used for ids and for count
145  TQValueList<int> lensOfMsgs;
146  TQMap<TQString, TQString> mUidForIdMap; // maps message ID (i.e. index on the server) to UID
147  TQDict<int> mUidsOfSeenMsgsDict; // set of UIDs of previously seen messages (for fast lookup)
148  TQDict<int> mUidsOfNextSeenMsgsDict; // set of UIDs of seen messages (for the next check)
149  TQValueVector<int> mTimeOfSeenMsgsVector; // list of times of previously seen messages
150  TQMap<TQString, int> mTimeOfNextSeenMsgsMap; // map of uid to times of seen messages
151  TQDict<int> mSizeOfNextSeenMsgsDict;
152  TQStringList idsOfMsgsToDelete;
153  TQStringList idsOfForcedDeletes;
154  int indexOfCurrentMsg;
155 
156  TQValueList<KMMessage*> msgsAwaitingProcessing;
157  TQStringList msgIdsAwaitingProcessing;
158  TQStringList msgUidsAwaitingProcessing;
159 
160  TQByteArray curMsgData;
161  TQDataStream *curMsgStrm;
162 
163  int curMsgLen;
164  Stage stage;
165  TQTimer processMsgsTimer;
166  int processingDelay;
167  int numMsgs, numBytes, numBytesToRead, numBytesRead, numMsgBytesRead;
168  bool interactive;
169  bool mProcessing;
170  bool mUidlFinished;
171  int dataCounter;
172 
173 protected slots:
184  void slotProcessPendingMsgs();
185 
190  void slotGetNextMsg();
191 
196  void slotMsgRetrieved(TDEIO::Job*, const TQString &);
197 
201  void slotData( TDEIO::Job*, const TQByteArray &);
202 
208  void slotResult( TDEIO::Job* );
209 
213  void slotCancel();
214 
218  void slotAbortRequested();
219 
224  void slotJobFinished();
225 
229  void slotSlaveError(TDEIO::Slave *, int, const TQString &);
230 
235  void slotGetNextHdr();
236 };
237 
238 } // namespace KMail
239 
240 
241 
242 #endif /*KMAcctExpPop_h*/
This is a Mime Message.
Definition: kmmessage.h:68
The account manager is responsible for creating accounts of various types via the factory method crea...
KMail account for pop mail account.
Definition: popaccount.h:27
void slotProcessPendingMsgs()
Messages are downloaded in the background and then once every x seconds a batch of messages are proce...
Definition: popaccount.cpp:309
void slotSlaveError(TDEIO::Slave *, int, const TQString &)
Slave error handling.
virtual TQString type(void) const
Inherited methods.
Definition: popaccount.cpp:99
void slotCancel()
Cleans up after a user cancels the current job.
Definition: popaccount.cpp:299
void processRemainingQueuedMessages()
Process any queued messages.
Definition: popaccount.cpp:815
bool filterOnServer(void) const
Shall messages be filter on the server (TRUE) or not (FALSE).
Definition: popaccount.h:78
virtual void pseudoAssign(const KMAccount *a)
A weak assignment operator.
Definition: popaccount.cpp:128
void connectJob()
Connect up the standard signals/slots for the TDEIO Jobs.
Definition: popaccount.cpp:287
void slotMsgRetrieved(TDEIO::Job *, const TQString &)
A messages has been retrieved successfully.
Definition: popaccount.cpp:444
void slotResult(TDEIO::Job *)
Finished downloading the current tdeio job, either due to an error or because the job has been cancel...
bool usePipelining(void) const
Sending of several commands at once.
Definition: popaccount.h:46
void saveUidList()
Save the list of seen uids for this user/server.
Definition: popaccount.cpp:829
void slotAbortRequested()
Kills the job if still stage == List.
Definition: popaccount.cpp:352
void startJob()
Start a TDEIO Job to get a list of messages on the pop server.
Definition: popaccount.cpp:367
void slotData(TDEIO::Job *, const TQByteArray &)
New data has arrived append it to the end of the current message.
Definition: popaccount.cpp:877
int leaveOnServerDays(void) const
If value is positive, leave mail on the server for so many days.
Definition: popaccount.h:59
int leaveOnServerSize(void) const
If value is positive, leave so many MBs on the server.
Definition: popaccount.h:71
void slotGetNextHdr()
If there are more headers to be downloaded then start a new tdeio job to get the next header.
bool leaveOnServer(void) const
Shall messages be left on the server upon retreival (TRUE) or deleted (FALSE).
Definition: popaccount.h:53
int leaveOnServerCount(void) const
If value is positive, leave so many messages on the server.
Definition: popaccount.h:65
unsigned int filterOnServerCheckSize(void) const
Size of messages which should be check on the pop server before download.
Definition: popaccount.h:85
void slotJobFinished()
Called when a job is finished.
Definition: popaccount.cpp:476
void slotGetNextMsg()
If there are more messages to be downloaded then start a new tdeio job to get the message whose id is...
Definition: popaccount.cpp:854
folderdiaquotatab.h
Definition: aboutdata.cpp:40