1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
/*
* kmail: KDE mail client
* Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef kmsender_h
#define kmsender_h
#include "messagesender.h"
#ifndef KDE_USE_FINAL
# ifndef REALLY_WANT_KMSENDER
# error Do not include kmsender.h, but messagesender.h.
# endif
#endif
#include <tqcstring.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqmap.h>
#include <tqobject.h>
#include <kdeversion.h>
class KMMessage;
class KMFolder;
class KMFolderMgr;
class KConfig;
class KProcess;
class KMSendProc;
class KMSendSendmail;
class KMSendSMTP;
class TQStrList;
class KMTransportInfo;
class KMPrecommand;
namespace KPIM {
class ProgressItem;
}
class KMSender: public TQObject, public KMail::MessageSender
{
Q_OBJECT
TQ_OBJECT
friend class ::KMSendProc;
friend class ::KMSendSendmail;
friend class ::KMSendSMTP;
public:
KMSender();
~KMSender();
protected:
/** Send given message. The message is either queued or sent
immediately. The default behaviour, as selected with
setSendImmediate(), can be overwritten with the parameter
sendNow (by specifying TRUE or FALSE).
The sender takes ownership of the given message on success,
so DO NOT DELETE OR MODIFY the message further.
Returns TRUE on success. */
bool doSend(KMMessage* msg, short sendNow);
/** Send queued messages, using the specified transport or the
* default, if none is given.
*/
bool doSendQueued( const TQString& transport );
private:
/** Returns TRUE if sending is in progress. */
bool sending() const { return mSendInProgress; }
public:
/** Shall messages be sent immediately (TRUE), or shall they be
queued and sent later upon call of sendQueued() ? */
bool sendImmediate() const { return mSendImmediate; }
void setSendImmediate(bool);
/** Shall messages be sent quoted-printable encoded. No encoding
happens otherwise. */
bool sendQuotedPrintable() const { return mSendQuotedPrintable; }
void setSendQuotedPrintable(bool);
private:
/** Get the transport information */
KMTransportInfo * transportInfo() { return mTransportInfo; }
public:
/** Read configuration from global config. */
void readConfig();
/** Write configuration to global config with optional sync() */
void writeConfig(bool withSync=true);
private:
/** sets a status msg and emits statusMsg() */
void seStatusMsg(const TQString&);
/** sets replied/forwarded status in the linked message for @p aMsg. */
void seStatusByLink(const KMMessage *aMsg);
/** Emit progress info - calculates a percent value based on the amount of bytes sent */
void emitProgressInfo( int currentFileProgress );
private slots:
/** Start sending */
void slotPrecommandFinished(bool);
void slotIdle();
/** abort sending of the current message */
void slotAbortSend();
/** initialization sequence has finised */
void sendProcStarted(bool success);
/** note when a msg gets added to outbox during sending */
void outboxMsgAdded(int idx);
private:
/** handle sending of messages */
void doSendMsg();
/** second part of handling sending of messages */
void doSendMsgAux();
/** cleanup after sending */
void cleanup();
/** Test if all required settings are set.
Reports problems to user via dialogs and returns FALSE.
Returns TRUE if everything is Ok. */
bool settingsOk() const;
/** Parse protocol '://' (host port? | mailer) string and
set transport settings */
KMSendProc* createSendProcFromString( const TQString & transport );
bool runPrecommand( const TQString & cmd );
private:
bool mSendImmediate;
bool mSendQuotedPrintable;
KMTransportInfo *mTransportInfo;
KMPrecommand *mPrecommand;
TQString mCustomTransport;
bool mSentOk, mSendAborted;
TQString mErrorMsg;
KMSendProc *mSendProc;
TQString mMethodStr;
bool mSendProcStarted;
bool mSendInProgress;
KMFolder *mOutboxFolder;
KMFolder *mSentFolder;
KMMessage * mCurrentMsg;
KPIM::ProgressItem* mProgressItem;
int mSentMessages, mTotalMessages;
int mSentBytes, mTotalBytes;
int mFailedMessages;
TQMap<TQString,TQString> mPasswdCache;
};
#endif /*kmsender_h*/
|