author | alwin <alwin> | 2004-02-12 22:24:30 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-02-12 22:24:30 (UTC) |
commit | c7f102b944a5172ca330dfc3c0f83cf0b9c65100 (patch) (unidiff) | |
tree | b4bdfea3a7eeb6a46f949cfdaa7052ac25e1c128 | |
parent | 596d87e16d593cbc52d510973ece99ffe26cd4c4 (diff) | |
download | opie-c7f102b944a5172ca330dfc3c0f83cf0b9c65100.zip opie-c7f102b944a5172ca330dfc3c0f83cf0b9c65100.tar.gz opie-c7f102b944a5172ca330dfc3c0f83cf0b9c65100.tar.bz2 |
TLS support for SMTP
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 55 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 13 |
2 files changed, 60 insertions, 8 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index e8db9ca..3ab6b77 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,812 +1,861 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | 10 | ||
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include <qpe/qcopenvelope_qws.h> | 12 | #include <qpe/qcopenvelope_qws.h> |
13 | 13 | ||
14 | #include <libetpan/libetpan.h> | 14 | #include <libetpan/libetpan.h> |
15 | 15 | ||
16 | #include "smtpwrapper.h" | 16 | #include "smtpwrapper.h" |
17 | #include "mailwrapper.h" | 17 | #include "mailwrapper.h" |
18 | #include "abstractmail.h" | 18 | #include "abstractmail.h" |
19 | #include "logindialog.h" | 19 | #include "logindialog.h" |
20 | #include "mailtypes.h" | 20 | #include "mailtypes.h" |
21 | #include "sendmailprogress.h" | 21 | #include "sendmailprogress.h" |
22 | 22 | ||
23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; | 23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; |
24 | 24 | ||
25 | progressMailSend*SMTPwrapper::sendProgress = 0; | 25 | progressMailSend*SMTPwrapper::sendProgress = 0; |
26 | 26 | ||
27 | SMTPwrapper::SMTPwrapper( Settings *s ) | 27 | SMTPwrapper::SMTPwrapper( Settings *s ) |
28 | : QObject() { | 28 | : QObject() { |
29 | settings = s; | 29 | settings = s; |
30 | Config cfg( "mail" ); | 30 | Config cfg( "mail" ); |
31 | cfg.setGroup( "Status" ); | 31 | cfg.setGroup( "Status" ); |
32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
33 | emit queuedMails( m_queuedMail ); | 33 | emit queuedMails( m_queuedMail ); |
34 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | 34 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); |
35 | } | 35 | } |
36 | 36 | ||
37 | void SMTPwrapper::emitQCop( int queued ) { | 37 | void SMTPwrapper::emitQCop( int queued ) { |
38 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | 38 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); |
39 | env << queued; | 39 | env << queued; |
40 | } | 40 | } |
41 | 41 | ||
42 | QString SMTPwrapper::mailsmtpError( int errnum ) { | 42 | QString SMTPwrapper::mailsmtpError( int errnum ) { |
43 | switch ( errnum ) { | 43 | switch ( errnum ) { |
44 | case MAILSMTP_NO_ERROR: | 44 | case MAILSMTP_NO_ERROR: |
45 | return tr( "No error" ); | 45 | return tr( "No error" ); |
46 | case MAILSMTP_ERROR_UNEXPECTED_CODE: | 46 | case MAILSMTP_ERROR_UNEXPECTED_CODE: |
47 | return tr( "Unexpected error code" ); | 47 | return tr( "Unexpected error code" ); |
48 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: | 48 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: |
49 | return tr( "Service not available" ); | 49 | return tr( "Service not available" ); |
50 | case MAILSMTP_ERROR_STREAM: | 50 | case MAILSMTP_ERROR_STREAM: |
51 | return tr( "Stream error" ); | 51 | return tr( "Stream error" ); |
52 | case MAILSMTP_ERROR_HOSTNAME: | 52 | case MAILSMTP_ERROR_HOSTNAME: |
53 | return tr( "gethostname() failed" ); | 53 | return tr( "gethostname() failed" ); |
54 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: | 54 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: |
55 | return tr( "Not implemented" ); | 55 | return tr( "Not implemented" ); |
56 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: | 56 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: |
57 | return tr( "Error, action not taken" ); | 57 | return tr( "Error, action not taken" ); |
58 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: | 58 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: |
59 | return tr( "Data exceeds storage allocation" ); | 59 | return tr( "Data exceeds storage allocation" ); |
60 | case MAILSMTP_ERROR_IN_PROCESSING: | 60 | case MAILSMTP_ERROR_IN_PROCESSING: |
61 | return tr( "Error in processing" ); | 61 | return tr( "Error in processing" ); |
62 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: | ||
63 | return tr( "Starttls not supported" ); | ||
62 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: | 64 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: |
63 | // return tr( "Insufficient system storage" ); | 65 | // return tr( "Insufficient system storage" ); |
64 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: | 66 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: |
65 | return tr( "Mailbox unavailable" ); | 67 | return tr( "Mailbox unavailable" ); |
66 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: | 68 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: |
67 | return tr( "Mailbox name not allowed" ); | 69 | return tr( "Mailbox name not allowed" ); |
68 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: | 70 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: |
69 | return tr( "Bad command sequence" ); | 71 | return tr( "Bad command sequence" ); |
70 | case MAILSMTP_ERROR_USER_NOT_LOCAL: | 72 | case MAILSMTP_ERROR_USER_NOT_LOCAL: |
71 | return tr( "User not local" ); | 73 | return tr( "User not local" ); |
72 | case MAILSMTP_ERROR_TRANSACTION_FAILED: | 74 | case MAILSMTP_ERROR_TRANSACTION_FAILED: |
73 | return tr( "Transaction failed" ); | 75 | return tr( "Transaction failed" ); |
74 | case MAILSMTP_ERROR_MEMORY: | 76 | case MAILSMTP_ERROR_MEMORY: |
75 | return tr( "Memory error" ); | 77 | return tr( "Memory error" ); |
76 | case MAILSMTP_ERROR_CONNECTION_REFUSED: | 78 | case MAILSMTP_ERROR_CONNECTION_REFUSED: |
77 | return tr( "Connection refused" ); | 79 | return tr( "Connection refused" ); |
78 | default: | 80 | default: |
79 | return tr( "Unknown error code" ); | 81 | return tr( "Unknown error code" ); |
80 | } | 82 | } |
81 | } | 83 | } |
82 | 84 | ||
83 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { | 85 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { |
84 | return mailimf_mailbox_new( strdup( name.latin1() ), | 86 | return mailimf_mailbox_new( strdup( name.latin1() ), |
85 | strdup( mail.latin1() ) ); | 87 | strdup( mail.latin1() ) ); |
86 | } | 88 | } |
87 | 89 | ||
88 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { | 90 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { |
89 | mailimf_address_list *addresses; | 91 | mailimf_address_list *addresses; |
90 | 92 | ||
91 | if ( addr.isEmpty() ) | 93 | if ( addr.isEmpty() ) |
92 | return NULL; | 94 | return NULL; |
93 | 95 | ||
94 | addresses = mailimf_address_list_new_empty(); | 96 | addresses = mailimf_address_list_new_empty(); |
95 | 97 | ||
96 | bool literal_open = false; | 98 | bool literal_open = false; |
97 | unsigned int startpos = 0; | 99 | unsigned int startpos = 0; |
98 | QStringList list; | 100 | QStringList list; |
99 | QString s; | 101 | QString s; |
100 | unsigned int i = 0; | 102 | unsigned int i = 0; |
101 | for (; i < addr.length();++i) { | 103 | for (; i < addr.length();++i) { |
102 | switch (addr[i]) { | 104 | switch (addr[i]) { |
103 | case '\"': | 105 | case '\"': |
104 | literal_open = !literal_open; | 106 | literal_open = !literal_open; |
105 | break; | 107 | break; |
106 | case ',': | 108 | case ',': |
107 | if (!literal_open) { | 109 | if (!literal_open) { |
108 | s = addr.mid(startpos,i-startpos); | 110 | s = addr.mid(startpos,i-startpos); |
109 | if (!s.isEmpty()) { | 111 | if (!s.isEmpty()) { |
110 | list.append(s); | 112 | list.append(s); |
111 | qDebug("Appended %s",s.latin1()); | 113 | qDebug("Appended %s",s.latin1()); |
112 | } | 114 | } |
113 | // !!!! this is a MUST BE! | 115 | // !!!! this is a MUST BE! |
114 | startpos = ++i; | 116 | startpos = ++i; |
115 | } | 117 | } |
116 | break; | 118 | break; |
117 | default: | 119 | default: |
118 | break; | 120 | break; |
119 | } | 121 | } |
120 | } | 122 | } |
121 | s = addr.mid(startpos,i-startpos); | 123 | s = addr.mid(startpos,i-startpos); |
122 | if (!s.isEmpty()) { | 124 | if (!s.isEmpty()) { |
123 | list.append(s); | 125 | list.append(s); |
124 | qDebug("Appended %s",s.latin1()); | 126 | qDebug("Appended %s",s.latin1()); |
125 | } | 127 | } |
126 | QStringList::Iterator it; | 128 | QStringList::Iterator it; |
127 | for ( it = list.begin(); it != list.end(); it++ ) { | 129 | for ( it = list.begin(); it != list.end(); it++ ) { |
128 | int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); | 130 | int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); |
129 | if ( err != MAILIMF_NO_ERROR ) { | 131 | if ( err != MAILIMF_NO_ERROR ) { |
130 | qDebug( "Error parsing" ); | 132 | qDebug( "Error parsing" ); |
131 | qDebug( *it ); | 133 | qDebug( *it ); |
132 | } else { | 134 | } else { |
133 | qDebug( "Parse success! %s",(*it).latin1()); | 135 | qDebug( "Parse success! %s",(*it).latin1()); |
134 | } | 136 | } |
135 | } | 137 | } |
136 | return addresses; | 138 | return addresses; |
137 | } | 139 | } |
138 | 140 | ||
139 | mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) { | 141 | mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) { |
140 | mailimf_fields *fields; | 142 | mailimf_fields *fields; |
141 | mailimf_field *xmailer; | 143 | mailimf_field *xmailer; |
142 | mailimf_mailbox *sender=0,*fromBox=0; | 144 | mailimf_mailbox *sender=0,*fromBox=0; |
143 | mailimf_mailbox_list *from=0; | 145 | mailimf_mailbox_list *from=0; |
144 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; | 146 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; |
145 | char *subject = strdup( mail.getSubject().latin1() ); | 147 | char *subject = strdup( mail.getSubject().latin1() ); |
146 | int err; | 148 | int err; |
147 | 149 | ||
148 | sender = newMailbox( mail.getName(), mail.getMail() ); | 150 | sender = newMailbox( mail.getName(), mail.getMail() ); |
149 | if ( sender == NULL ) | 151 | if ( sender == NULL ) |
150 | goto err_free; | 152 | goto err_free; |
151 | 153 | ||
152 | fromBox = newMailbox( mail.getName(), mail.getMail() ); | 154 | fromBox = newMailbox( mail.getName(), mail.getMail() ); |
153 | if ( fromBox == NULL ) | 155 | if ( fromBox == NULL ) |
154 | goto err_free_sender; | 156 | goto err_free_sender; |
155 | 157 | ||
156 | from = mailimf_mailbox_list_new_empty(); | 158 | from = mailimf_mailbox_list_new_empty(); |
157 | if ( from == NULL ) | 159 | if ( from == NULL ) |
158 | goto err_free_fromBox; | 160 | goto err_free_fromBox; |
159 | 161 | ||
160 | err = mailimf_mailbox_list_add( from, fromBox ); | 162 | err = mailimf_mailbox_list_add( from, fromBox ); |
161 | if ( err != MAILIMF_NO_ERROR ) | 163 | if ( err != MAILIMF_NO_ERROR ) |
162 | goto err_free_from; | 164 | goto err_free_from; |
163 | 165 | ||
164 | to = parseAddresses( mail.getTo() ); | 166 | to = parseAddresses( mail.getTo() ); |
165 | if ( to == NULL ) | 167 | if ( to == NULL ) |
166 | goto err_free_from; | 168 | goto err_free_from; |
167 | 169 | ||
168 | cc = parseAddresses( mail.getCC() ); | 170 | cc = parseAddresses( mail.getCC() ); |
169 | bcc = parseAddresses( mail.getBCC() ); | 171 | bcc = parseAddresses( mail.getBCC() ); |
170 | reply = parseAddresses( mail.getReply() ); | 172 | reply = parseAddresses( mail.getReply() ); |
171 | 173 | ||
172 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, | 174 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, |
173 | NULL, NULL, subject ); | 175 | NULL, NULL, subject ); |
174 | if ( fields == NULL ) | 176 | if ( fields == NULL ) |
175 | goto err_free_reply; | 177 | goto err_free_reply; |
176 | 178 | ||
177 | xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), | 179 | xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), |
178 | strdup( USER_AGENT ) ); | 180 | strdup( USER_AGENT ) ); |
179 | if ( xmailer == NULL ) | 181 | if ( xmailer == NULL ) |
180 | goto err_free_fields; | 182 | goto err_free_fields; |
181 | 183 | ||
182 | err = mailimf_fields_add( fields, xmailer ); | 184 | err = mailimf_fields_add( fields, xmailer ); |
183 | if ( err != MAILIMF_NO_ERROR ) | 185 | if ( err != MAILIMF_NO_ERROR ) |
184 | goto err_free_xmailer; | 186 | goto err_free_xmailer; |
185 | 187 | ||
186 | return fields; // Success :) | 188 | return fields; // Success :) |
187 | 189 | ||
188 | err_free_xmailer: | 190 | err_free_xmailer: |
189 | if (xmailer) | 191 | if (xmailer) |
190 | mailimf_field_free( xmailer ); | 192 | mailimf_field_free( xmailer ); |
191 | err_free_fields: | 193 | err_free_fields: |
192 | if (fields) | 194 | if (fields) |
193 | mailimf_fields_free( fields ); | 195 | mailimf_fields_free( fields ); |
194 | err_free_reply: | 196 | err_free_reply: |
195 | if (reply) | 197 | if (reply) |
196 | mailimf_address_list_free( reply ); | 198 | mailimf_address_list_free( reply ); |
197 | if (bcc) | 199 | if (bcc) |
198 | mailimf_address_list_free( bcc ); | 200 | mailimf_address_list_free( bcc ); |
199 | if (cc) | 201 | if (cc) |
200 | mailimf_address_list_free( cc ); | 202 | mailimf_address_list_free( cc ); |
201 | if (to) | 203 | if (to) |
202 | mailimf_address_list_free( to ); | 204 | mailimf_address_list_free( to ); |
203 | err_free_from: | 205 | err_free_from: |
204 | if (from) | 206 | if (from) |
205 | mailimf_mailbox_list_free( from ); | 207 | mailimf_mailbox_list_free( from ); |
206 | err_free_fromBox: | 208 | err_free_fromBox: |
207 | mailimf_mailbox_free( fromBox ); | 209 | mailimf_mailbox_free( fromBox ); |
208 | err_free_sender: | 210 | err_free_sender: |
209 | if (sender) | 211 | if (sender) |
210 | mailimf_mailbox_free( sender ); | 212 | mailimf_mailbox_free( sender ); |
211 | err_free: | 213 | err_free: |
212 | if (subject) | 214 | if (subject) |
213 | free( subject ); | 215 | free( subject ); |
214 | qDebug( "createImfFields - error" ); | 216 | qDebug( "createImfFields - error" ); |
215 | 217 | ||
216 | return NULL; // Error :( | 218 | return NULL; // Error :( |
217 | } | 219 | } |
218 | 220 | ||
219 | mailmime *SMTPwrapper::buildTxtPart(const QString&str ) { | 221 | mailmime *SMTPwrapper::buildTxtPart(const QString&str ) { |
220 | mailmime *txtPart; | 222 | mailmime *txtPart; |
221 | mailmime_fields *fields; | 223 | mailmime_fields *fields; |
222 | mailmime_content *content; | 224 | mailmime_content *content; |
223 | mailmime_parameter *param; | 225 | mailmime_parameter *param; |
224 | int err; | 226 | int err; |
225 | 227 | ||
226 | param = mailmime_parameter_new( strdup( "charset" ), | 228 | param = mailmime_parameter_new( strdup( "charset" ), |
227 | strdup( "iso-8859-1" ) ); | 229 | strdup( "iso-8859-1" ) ); |
228 | if ( param == NULL ) | 230 | if ( param == NULL ) |
229 | goto err_free; | 231 | goto err_free; |
230 | 232 | ||
231 | content = mailmime_content_new_with_str( "text/plain" ); | 233 | content = mailmime_content_new_with_str( "text/plain" ); |
232 | if ( content == NULL ) | 234 | if ( content == NULL ) |
233 | goto err_free_param; | 235 | goto err_free_param; |
234 | 236 | ||
235 | err = clist_append( content->ct_parameters, param ); | 237 | err = clist_append( content->ct_parameters, param ); |
236 | if ( err != MAILIMF_NO_ERROR ) | 238 | if ( err != MAILIMF_NO_ERROR ) |
237 | goto err_free_content; | 239 | goto err_free_content; |
238 | 240 | ||
239 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); | 241 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
240 | if ( fields == NULL ) | 242 | if ( fields == NULL ) |
241 | goto err_free_content; | 243 | goto err_free_content; |
242 | 244 | ||
243 | txtPart = mailmime_new_empty( content, fields ); | 245 | txtPart = mailmime_new_empty( content, fields ); |
244 | if ( txtPart == NULL ) | 246 | if ( txtPart == NULL ) |
245 | goto err_free_fields; | 247 | goto err_free_fields; |
246 | 248 | ||
247 | err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() ); | 249 | err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() ); |
248 | if ( err != MAILIMF_NO_ERROR ) | 250 | if ( err != MAILIMF_NO_ERROR ) |
249 | goto err_free_txtPart; | 251 | goto err_free_txtPart; |
250 | 252 | ||
251 | return txtPart; // Success :) | 253 | return txtPart; // Success :) |
252 | 254 | ||
253 | err_free_txtPart: | 255 | err_free_txtPart: |
254 | mailmime_free( txtPart ); | 256 | mailmime_free( txtPart ); |
255 | err_free_fields: | 257 | err_free_fields: |
256 | mailmime_fields_free( fields ); | 258 | mailmime_fields_free( fields ); |
257 | err_free_content: | 259 | err_free_content: |
258 | mailmime_content_free( content ); | 260 | mailmime_content_free( content ); |
259 | err_free_param: | 261 | err_free_param: |
260 | mailmime_parameter_free( param ); | 262 | mailmime_parameter_free( param ); |
261 | err_free: | 263 | err_free: |
262 | qDebug( "buildTxtPart - error" ); | 264 | qDebug( "buildTxtPart - error" ); |
263 | 265 | ||
264 | return NULL; // Error :( | 266 | return NULL; // Error :( |
265 | } | 267 | } |
266 | 268 | ||
267 | mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { | 269 | mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { |
268 | mailmime * filePart = 0; | 270 | mailmime * filePart = 0; |
269 | mailmime_fields * fields = 0; | 271 | mailmime_fields * fields = 0; |
270 | mailmime_content * content = 0; | 272 | mailmime_content * content = 0; |
271 | mailmime_parameter * param = 0; | 273 | mailmime_parameter * param = 0; |
272 | char*name = 0; | 274 | char*name = 0; |
273 | char*file = 0; | 275 | char*file = 0; |
274 | int err; | 276 | int err; |
275 | 277 | ||
276 | int pos = filename.findRev( '/' ); | 278 | int pos = filename.findRev( '/' ); |
277 | 279 | ||
278 | if (filename.length()>0) { | 280 | if (filename.length()>0) { |
279 | QString tmp = filename.right( filename.length() - ( pos + 1 ) ); | 281 | QString tmp = filename.right( filename.length() - ( pos + 1 ) ); |
280 | name = strdup( tmp.latin1() ); // just filename | 282 | name = strdup( tmp.latin1() ); // just filename |
281 | file = strdup( filename.latin1() ); // full name with path | 283 | file = strdup( filename.latin1() ); // full name with path |
282 | } | 284 | } |
283 | 285 | ||
284 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; | 286 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; |
285 | int mechanism = MAILMIME_MECHANISM_BASE64; | 287 | int mechanism = MAILMIME_MECHANISM_BASE64; |
286 | 288 | ||
287 | if ( mimetype.startsWith( "text/" ) ) { | 289 | if ( mimetype.startsWith( "text/" ) ) { |
288 | param = mailmime_parameter_new( strdup( "charset" ), | 290 | param = mailmime_parameter_new( strdup( "charset" ), |
289 | strdup( "iso-8859-1" ) ); | 291 | strdup( "iso-8859-1" ) ); |
290 | mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 292 | mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
291 | } | 293 | } |
292 | 294 | ||
293 | fields = mailmime_fields_new_filename( | 295 | fields = mailmime_fields_new_filename( |
294 | disptype, name, | 296 | disptype, name, |
295 | mechanism ); | 297 | mechanism ); |
296 | content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); | 298 | content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); |
297 | if (content!=0 && fields != 0) { | 299 | if (content!=0 && fields != 0) { |
298 | if (param) { | 300 | if (param) { |
299 | clist_append(content->ct_parameters,param); | 301 | clist_append(content->ct_parameters,param); |
300 | param = 0; | 302 | param = 0; |
301 | } | 303 | } |
302 | if (filename.length()>0) { | 304 | if (filename.length()>0) { |
303 | QFileInfo f(filename); | 305 | QFileInfo f(filename); |
304 | param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); | 306 | param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); |
305 | clist_append(content->ct_parameters,param); | 307 | clist_append(content->ct_parameters,param); |
306 | param = 0; | 308 | param = 0; |
307 | } | 309 | } |
308 | filePart = mailmime_new_empty( content, fields ); | 310 | filePart = mailmime_new_empty( content, fields ); |
309 | } | 311 | } |
310 | if (filePart) { | 312 | if (filePart) { |
311 | if (filename.length()>0) { | 313 | if (filename.length()>0) { |
312 | err = mailmime_set_body_file( filePart, file ); | 314 | err = mailmime_set_body_file( filePart, file ); |
313 | } else { | 315 | } else { |
314 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); | 316 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); |
315 | } | 317 | } |
316 | if (err != MAILIMF_NO_ERROR) { | 318 | if (err != MAILIMF_NO_ERROR) { |
317 | qDebug("Error setting body with file %s",file); | 319 | qDebug("Error setting body with file %s",file); |
318 | mailmime_free( filePart ); | 320 | mailmime_free( filePart ); |
319 | filePart = 0; | 321 | filePart = 0; |
320 | } | 322 | } |
321 | } | 323 | } |
322 | 324 | ||
323 | if (!filePart) { | 325 | if (!filePart) { |
324 | if ( param != NULL ) { | 326 | if ( param != NULL ) { |
325 | mailmime_parameter_free( param ); | 327 | mailmime_parameter_free( param ); |
326 | } | 328 | } |
327 | if (content) { | 329 | if (content) { |
328 | mailmime_content_free( content ); | 330 | mailmime_content_free( content ); |
329 | } | 331 | } |
330 | if (fields) { | 332 | if (fields) { |
331 | mailmime_fields_free( fields ); | 333 | mailmime_fields_free( fields ); |
332 | } else { | 334 | } else { |
333 | if (name) { | 335 | if (name) { |
334 | free( name ); | 336 | free( name ); |
335 | } | 337 | } |
336 | if (file) { | 338 | if (file) { |
337 | free( file ); | 339 | free( file ); |
338 | } | 340 | } |
339 | } | 341 | } |
340 | } | 342 | } |
341 | return filePart; // Success :) | 343 | return filePart; // Success :) |
342 | 344 | ||
343 | } | 345 | } |
344 | 346 | ||
345 | void SMTPwrapper::addFileParts( mailmime *message,const QList<Attachment>&files ) { | 347 | void SMTPwrapper::addFileParts( mailmime *message,const QList<Attachment>&files ) { |
346 | const Attachment *it; | 348 | const Attachment *it; |
347 | unsigned int count = files.count(); | 349 | unsigned int count = files.count(); |
348 | qDebug("List contains %i values",count); | 350 | qDebug("List contains %i values",count); |
349 | for ( unsigned int i = 0; i < count; ++i ) { | 351 | for ( unsigned int i = 0; i < count; ++i ) { |
350 | qDebug( "Adding file" ); | 352 | qDebug( "Adding file" ); |
351 | mailmime *filePart; | 353 | mailmime *filePart; |
352 | int err; | 354 | int err; |
353 | it = ((QList<Attachment>)files).at(i); | 355 | it = ((QList<Attachment>)files).at(i); |
354 | 356 | ||
355 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); | 357 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); |
356 | if ( filePart == NULL ) { | 358 | if ( filePart == NULL ) { |
357 | qDebug( "addFileParts: error adding file:" ); | 359 | qDebug( "addFileParts: error adding file:" ); |
358 | qDebug( it->getFileName() ); | 360 | qDebug( it->getFileName() ); |
359 | continue; | 361 | continue; |
360 | } | 362 | } |
361 | err = mailmime_smart_add_part( message, filePart ); | 363 | err = mailmime_smart_add_part( message, filePart ); |
362 | if ( err != MAILIMF_NO_ERROR ) { | 364 | if ( err != MAILIMF_NO_ERROR ) { |
363 | mailmime_free( filePart ); | 365 | mailmime_free( filePart ); |
364 | qDebug("error smart add"); | 366 | qDebug("error smart add"); |
365 | } | 367 | } |
366 | } | 368 | } |
367 | } | 369 | } |
368 | 370 | ||
369 | mailmime *SMTPwrapper::createMimeMail(const Mail &mail ) { | 371 | mailmime *SMTPwrapper::createMimeMail(const Mail &mail ) { |
370 | mailmime *message, *txtPart; | 372 | mailmime *message, *txtPart; |
371 | mailimf_fields *fields; | 373 | mailimf_fields *fields; |
372 | int err; | 374 | int err; |
373 | 375 | ||
374 | fields = createImfFields( mail ); | 376 | fields = createImfFields( mail ); |
375 | if ( fields == NULL ) | 377 | if ( fields == NULL ) |
376 | goto err_free; | 378 | goto err_free; |
377 | 379 | ||
378 | message = mailmime_new_message_data( NULL ); | 380 | message = mailmime_new_message_data( NULL ); |
379 | if ( message == NULL ) | 381 | if ( message == NULL ) |
380 | goto err_free_fields; | 382 | goto err_free_fields; |
381 | 383 | ||
382 | mailmime_set_imf_fields( message, fields ); | 384 | mailmime_set_imf_fields( message, fields ); |
383 | 385 | ||
384 | txtPart = buildTxtPart( mail.getMessage() ); | 386 | txtPart = buildTxtPart( mail.getMessage() ); |
385 | 387 | ||
386 | if ( txtPart == NULL ) | 388 | if ( txtPart == NULL ) |
387 | goto err_free_message; | 389 | goto err_free_message; |
388 | 390 | ||
389 | err = mailmime_smart_add_part( message, txtPart ); | 391 | err = mailmime_smart_add_part( message, txtPart ); |
390 | if ( err != MAILIMF_NO_ERROR ) | 392 | if ( err != MAILIMF_NO_ERROR ) |
391 | goto err_free_txtPart; | 393 | goto err_free_txtPart; |
392 | 394 | ||
393 | addFileParts( message, mail.getAttachments() ); | 395 | addFileParts( message, mail.getAttachments() ); |
394 | 396 | ||
395 | return message; // Success :) | 397 | return message; // Success :) |
396 | 398 | ||
397 | err_free_txtPart: | 399 | err_free_txtPart: |
398 | mailmime_free( txtPart ); | 400 | mailmime_free( txtPart ); |
399 | err_free_message: | 401 | err_free_message: |
400 | mailmime_free( message ); | 402 | mailmime_free( message ); |
401 | err_free_fields: | 403 | err_free_fields: |
402 | mailimf_fields_free( fields ); | 404 | mailimf_fields_free( fields ); |
403 | err_free: | 405 | err_free: |
404 | qDebug( "createMimeMail: error" ); | 406 | qDebug( "createMimeMail: error" ); |
405 | 407 | ||
406 | return NULL; // Error :( | 408 | return NULL; // Error :( |
407 | } | 409 | } |
408 | 410 | ||
409 | mailimf_field *SMTPwrapper::getField( mailimf_fields *fields, int type ) { | 411 | mailimf_field *SMTPwrapper::getField( mailimf_fields *fields, int type ) { |
410 | mailimf_field *field; | 412 | mailimf_field *field; |
411 | clistiter *it; | 413 | clistiter *it; |
412 | 414 | ||
413 | it = clist_begin( fields->fld_list ); | 415 | it = clist_begin( fields->fld_list ); |
414 | while ( it ) { | 416 | while ( it ) { |
415 | field = (mailimf_field *) it->data; | 417 | field = (mailimf_field *) it->data; |
416 | if ( field->fld_type == type ) { | 418 | if ( field->fld_type == type ) { |
417 | return field; | 419 | return field; |
418 | } | 420 | } |
419 | it = it->next; | 421 | it = it->next; |
420 | } | 422 | } |
421 | 423 | ||
422 | return NULL; | 424 | return NULL; |
423 | } | 425 | } |
424 | 426 | ||
425 | void SMTPwrapper::addRcpts( clist *list, mailimf_address_list *addr_list ) { | 427 | void SMTPwrapper::addRcpts( clist *list, mailimf_address_list *addr_list ) { |
426 | clistiter *it, *it2; | 428 | clistiter *it, *it2; |
427 | 429 | ||
428 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { | 430 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { |
429 | mailimf_address *addr; | 431 | mailimf_address *addr; |
430 | addr = (mailimf_address *) it->data; | 432 | addr = (mailimf_address *) it->data; |
431 | 433 | ||
432 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { | 434 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { |
433 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); | 435 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); |
434 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { | 436 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { |
435 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; | 437 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; |
436 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { | 438 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { |
437 | mailimf_mailbox *mbox; | 439 | mailimf_mailbox *mbox; |
438 | mbox = (mailimf_mailbox *) it2->data; | 440 | mbox = (mailimf_mailbox *) it2->data; |
439 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); | 441 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); |
440 | } | 442 | } |
441 | } | 443 | } |
442 | } | 444 | } |
443 | } | 445 | } |
444 | 446 | ||
445 | clist *SMTPwrapper::createRcptList( mailimf_fields *fields ) { | 447 | clist *SMTPwrapper::createRcptList( mailimf_fields *fields ) { |
446 | clist *rcptList; | 448 | clist *rcptList; |
447 | mailimf_field *field; | 449 | mailimf_field *field; |
448 | 450 | ||
449 | rcptList = esmtp_address_list_new(); | 451 | rcptList = esmtp_address_list_new(); |
450 | 452 | ||
451 | field = getField( fields, MAILIMF_FIELD_TO ); | 453 | field = getField( fields, MAILIMF_FIELD_TO ); |
452 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) | 454 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) |
453 | && field->fld_data.fld_to->to_addr_list ) { | 455 | && field->fld_data.fld_to->to_addr_list ) { |
454 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); | 456 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); |
455 | } | 457 | } |
456 | 458 | ||
457 | field = getField( fields, MAILIMF_FIELD_CC ); | 459 | field = getField( fields, MAILIMF_FIELD_CC ); |
458 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) | 460 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) |
459 | && field->fld_data.fld_cc->cc_addr_list ) { | 461 | && field->fld_data.fld_cc->cc_addr_list ) { |
460 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); | 462 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); |
461 | } | 463 | } |
462 | 464 | ||
463 | field = getField( fields, MAILIMF_FIELD_BCC ); | 465 | field = getField( fields, MAILIMF_FIELD_BCC ); |
464 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) | 466 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) |
465 | && field->fld_data.fld_bcc->bcc_addr_list ) { | 467 | && field->fld_data.fld_bcc->bcc_addr_list ) { |
466 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); | 468 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); |
467 | } | 469 | } |
468 | 470 | ||
469 | return rcptList; | 471 | return rcptList; |
470 | } | 472 | } |
471 | 473 | ||
472 | char *SMTPwrapper::getFrom( mailimf_field *ffrom) { | 474 | char *SMTPwrapper::getFrom( mailimf_field *ffrom) { |
473 | char *from = NULL; | 475 | char *from = NULL; |
474 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) | 476 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) |
475 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { | 477 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { |
476 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; | 478 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; |
477 | clistiter *it; | 479 | clistiter *it; |
478 | for ( it = clist_begin( cl ); it; it = it->next ) { | 480 | for ( it = clist_begin( cl ); it; it = it->next ) { |
479 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; | 481 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; |
480 | from = strdup( mb->mb_addr_spec ); | 482 | from = strdup( mb->mb_addr_spec ); |
481 | } | 483 | } |
482 | } | 484 | } |
483 | 485 | ||
484 | return from; | 486 | return from; |
485 | } | 487 | } |
486 | 488 | ||
487 | char *SMTPwrapper::getFrom( mailmime *mail ) { | 489 | char *SMTPwrapper::getFrom( mailmime *mail ) { |
488 | /* no need to delete - its just a pointer to structure content */ | 490 | /* no need to delete - its just a pointer to structure content */ |
489 | mailimf_field *ffrom = 0; | 491 | mailimf_field *ffrom = 0; |
490 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 492 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); |
491 | return getFrom(ffrom); | 493 | return getFrom(ffrom); |
492 | } | 494 | } |
493 | 495 | ||
494 | void SMTPwrapper::progress( size_t current, size_t maximum ) { | 496 | void SMTPwrapper::progress( size_t current, size_t maximum ) { |
495 | if (SMTPwrapper::sendProgress) { | 497 | if (SMTPwrapper::sendProgress) { |
496 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 498 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
497 | qApp->processEvents(); | 499 | qApp->processEvents(); |
498 | } | 500 | } |
499 | } | 501 | } |
500 | 502 | ||
501 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { | 503 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { |
502 | if (!mail) | 504 | if (!mail) |
503 | return; | 505 | return; |
504 | QString localfolders = AbstractMail::defaultLocalfolder(); | 506 | QString localfolders = AbstractMail::defaultLocalfolder(); |
505 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 507 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
506 | wrap->createMbox(box); | 508 | wrap->createMbox(box); |
507 | wrap->storeMessage(mail,length,box); | 509 | wrap->storeMessage(mail,length,box); |
508 | delete wrap; | 510 | delete wrap; |
509 | } | 511 | } |
510 | 512 | ||
511 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) { | 513 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) { |
512 | clist *rcpts = 0; | 514 | clist *rcpts = 0; |
513 | char *from, *data; | 515 | char *from, *data; |
514 | size_t size; | 516 | size_t size; |
515 | 517 | ||
516 | if ( smtp == NULL ) { | 518 | if ( smtp == NULL ) { |
517 | return; | 519 | return; |
518 | } | 520 | } |
519 | from = data = 0; | 521 | from = data = 0; |
520 | 522 | ||
521 | mailmessage * msg = 0; | 523 | mailmessage * msg = 0; |
522 | msg = mime_message_init(mail); | 524 | msg = mime_message_init(mail); |
523 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 525 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
524 | int r = mailmessage_fetch(msg,&data,&size); | 526 | int r = mailmessage_fetch(msg,&data,&size); |
525 | mime_message_detach_mime(msg); | 527 | mime_message_detach_mime(msg); |
526 | mailmessage_free(msg); | 528 | mailmessage_free(msg); |
527 | if (r != MAIL_NO_ERROR || !data) { | 529 | if (r != MAIL_NO_ERROR || !data) { |
528 | if (data) | 530 | if (data) |
529 | free(data); | 531 | free(data); |
530 | qDebug("Error fetching mime..."); | 532 | qDebug("Error fetching mime..."); |
531 | return; | 533 | return; |
532 | } | 534 | } |
533 | msg = 0; | 535 | msg = 0; |
534 | if (later) { | 536 | if (later) { |
535 | storeMail(data,size,"Outgoing"); | 537 | storeMail(data,size,"Outgoing"); |
536 | if (data) | 538 | if (data) |
537 | free( data ); | 539 | free( data ); |
538 | Config cfg( "mail" ); | 540 | Config cfg( "mail" ); |
539 | cfg.setGroup( "Status" ); | 541 | cfg.setGroup( "Status" ); |
540 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 542 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
541 | emit queuedMails( m_queuedMail ); | 543 | emit queuedMails( m_queuedMail ); |
542 | return; | 544 | return; |
543 | } | 545 | } |
544 | from = getFrom( mail ); | 546 | from = getFrom( mail ); |
545 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 547 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
546 | smtpSend(from,rcpts,data,size,smtp); | 548 | smtpSend(from,rcpts,data,size,smtp); |
547 | if (data) { | 549 | if (data) { |
548 | free(data); | 550 | free(data); |
549 | } | 551 | } |
550 | if (from) { | 552 | if (from) { |
551 | free(from); | 553 | free(from); |
552 | } | 554 | } |
553 | if (rcpts) | 555 | if (rcpts) |
554 | smtp_address_list_free( rcpts ); | 556 | smtp_address_list_free( rcpts ); |
555 | } | 557 | } |
556 | 558 | ||
557 | void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) | 559 | void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) |
558 | { | 560 | { |
559 | if (data) { | 561 | if (data) { |
560 | storeMail(data,size,"Sendfailed"); | 562 | storeMail(data,size,"Sendfailed"); |
561 | } | 563 | } |
562 | if (failuremessage) { | 564 | if (failuremessage) { |
563 | QMessageBox::critical(0,tr("Error sending mail"), | 565 | QMessageBox::critical(0,tr("Error sending mail"), |
564 | tr("<center>%1</center>").arg(failuremessage)); | 566 | tr("<center>%1</center>").arg(failuremessage)); |
565 | } | 567 | } |
566 | } | 568 | } |
567 | 569 | ||
570 | int SMTPwrapper::start_smtp_tls(mailsmtp *session) | ||
571 | { | ||
572 | if (!session) { | ||
573 | return MAILSMTP_ERROR_IN_PROCESSING; | ||
574 | } | ||
575 | int err = mailesmtp_starttls(session); | ||
576 | if (err != MAILSMTP_NO_ERROR) return err; | ||
577 | mailstream_low * low; | ||
578 | mailstream_low * new_low; | ||
579 | low = mailstream_get_low(session->stream); | ||
580 | if (!low) { | ||
581 | return MAILSMTP_ERROR_IN_PROCESSING; | ||
582 | } | ||
583 | int fd = mailstream_low_get_fd(low); | ||
584 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { | ||
585 | mailstream_low_free(low); | ||
586 | mailstream_set_low(session->stream, new_low); | ||
587 | } else { | ||
588 | return MAILSMTP_ERROR_IN_PROCESSING; | ||
589 | } | ||
590 | return err; | ||
591 | } | ||
592 | |||
568 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) { | 593 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) { |
569 | const char *server, *user, *pass; | 594 | const char *server, *user, *pass; |
570 | bool ssl; | 595 | bool ssl; |
571 | uint16_t port; | 596 | uint16_t port; |
572 | mailsmtp *session; | 597 | mailsmtp *session; |
573 | int err,result; | 598 | int err,result; |
574 | QString failuretext = ""; | 599 | QString failuretext = ""; |
575 | 600 | ||
576 | result = 1; | 601 | result = 1; |
577 | server = user = pass = 0; | 602 | server = user = pass = 0; |
578 | server = smtp->getServer().latin1(); | 603 | server = smtp->getServer().latin1(); |
579 | 604 | ||
580 | // FIXME: currently only TLS and Plain work. | 605 | // FIXME: currently only TLS and Plain work. |
581 | 606 | ||
582 | ssl = false; | 607 | ssl = false; |
608 | bool try_tls = true; | ||
609 | bool force_tls=false; | ||
583 | 610 | ||
584 | if ( smtp->ConnectionType() == 2 ) { | 611 | if ( smtp->ConnectionType() == 2 ) { |
585 | ssl = true; | 612 | ssl = true; |
613 | try_tls = false; | ||
614 | } else if (smtp->ConnectionType() == 1) { | ||
615 | force_tls = true; | ||
586 | } | 616 | } |
587 | 617 | ||
588 | port = smtp->getPort().toUInt(); | 618 | port = smtp->getPort().toUInt(); |
589 | 619 | ||
590 | session = mailsmtp_new( 20, &progress ); | 620 | session = mailsmtp_new( 20, &progress ); |
591 | if ( session == NULL ) { | 621 | if ( session == NULL ) { |
592 | /* no failure message cause this happens when problems with memory - than we | 622 | /* no failure message cause this happens when problems with memory - than we |
593 | we can not display any messagebox */ | 623 | we can not display any messagebox */ |
594 | return 0; | 624 | return 0; |
595 | } | 625 | } |
596 | 626 | ||
597 | qDebug( "Servername %s at port %i", server, port ); | 627 | qDebug( "Servername %s at port %i", server, port ); |
598 | if ( ssl ) { | 628 | if ( ssl ) { |
599 | qDebug( "SSL session" ); | 629 | qDebug( "SSL session" ); |
600 | err = mailsmtp_ssl_connect( session, server, port ); | 630 | err = mailsmtp_ssl_connect( session, server, port ); |
601 | } else { | 631 | } else { |
602 | qDebug( "No SSL session" ); | 632 | qDebug( "No SSL session" ); |
603 | err = mailsmtp_socket_connect( session, server, port ); | 633 | err = mailsmtp_socket_connect( session, server, port ); |
604 | } | 634 | } |
605 | if ( err != MAILSMTP_NO_ERROR ) { | 635 | if ( err != MAILSMTP_NO_ERROR ) { |
606 | qDebug("Error init connection"); | 636 | qDebug("Error init connection"); |
607 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); | 637 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); |
608 | result = 0; | 638 | result = 0; |
609 | } | 639 | } |
610 | 640 | ||
641 | /* switch to tls after init 'cause there it will send the ehlo */ | ||
611 | if (result) { | 642 | if (result) { |
612 | err = mailsmtp_init( session ); | 643 | err = mailsmtp_init( session ); |
613 | if (err != MAILSMTP_NO_ERROR) { | 644 | if (err != MAILSMTP_NO_ERROR) { |
614 | result = 0; | 645 | result = 0; |
615 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); | 646 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); |
616 | } | 647 | } |
617 | } | 648 | } |
618 | 649 | ||
650 | if (try_tls) { | ||
651 | err = start_smtp_tls(session); | ||
652 | if (err != MAILSMTP_NO_ERROR) { | ||
653 | try_tls = false; | ||
654 | } else { | ||
655 | err = mailesmtp_ehlo(session); | ||
656 | } | ||
657 | } | ||
658 | |||
659 | if (!try_tls && force_tls) { | ||
660 | result = 0; | ||
661 | failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); | ||
662 | } | ||
663 | |||
619 | if (result==1 && smtp->getLogin() ) { | 664 | if (result==1 && smtp->getLogin() ) { |
620 | qDebug("smtp with auth"); | 665 | qDebug("smtp with auth"); |
621 | if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { | 666 | if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { |
622 | // get'em | 667 | // get'em |
623 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); | 668 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); |
624 | login.show(); | 669 | login.show(); |
625 | if ( QDialog::Accepted == login.exec() ) { | 670 | if ( QDialog::Accepted == login.exec() ) { |
626 | // ok | 671 | // ok |
627 | user = login.getUser().latin1(); | 672 | user = login.getUser().latin1(); |
628 | pass = login.getPassword().latin1(); | 673 | pass = login.getPassword().latin1(); |
629 | } else { | 674 | } else { |
630 | result = 0; | 675 | result = 0; |
631 | failuretext=tr("Login aborted - storing mail to localfolder"); | 676 | failuretext=tr("Login aborted - storing mail to localfolder"); |
632 | } | 677 | } |
633 | } else { | 678 | } else { |
634 | user = smtp->getUser().latin1(); | 679 | user = smtp->getUser().latin1(); |
635 | pass = smtp->getPassword().latin1(); | 680 | pass = smtp->getPassword().latin1(); |
636 | } | 681 | } |
637 | qDebug( "session->auth: %i", session->auth); | 682 | qDebug( "session->auth: %i", session->auth); |
638 | if (result) { | 683 | if (result) { |
639 | err = mailsmtp_auth( session, (char*)user, (char*)pass ); | 684 | err = mailsmtp_auth( session, (char*)user, (char*)pass ); |
640 | if ( err == MAILSMTP_NO_ERROR ) { | 685 | if ( err == MAILSMTP_NO_ERROR ) { |
641 | qDebug("auth ok"); | 686 | qDebug("auth ok"); |
642 | } else { | 687 | } else { |
643 | failuretext = tr("Authentification failed"); | 688 | failuretext = tr("Authentification failed"); |
644 | result = 0; | 689 | result = 0; |
645 | } | 690 | } |
646 | } | 691 | } |
647 | } | 692 | } |
648 | 693 | ||
649 | if (result) { | 694 | if (result) { |
650 | err = mailsmtp_send( session, from, rcpts, data, size ); | 695 | err = mailsmtp_send( session, from, rcpts, data, size ); |
651 | if ( err != MAILSMTP_NO_ERROR ) { | 696 | if ( err != MAILSMTP_NO_ERROR ) { |
652 | failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); | 697 | failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); |
653 | result = 0; | 698 | result = 0; |
654 | } | 699 | } |
655 | } | 700 | } |
656 | 701 | ||
657 | if (!result) { | 702 | if (!result) { |
658 | storeFailedMail(data,size,failuretext); | 703 | storeFailedMail(data,size,failuretext); |
659 | } else { | 704 | } else { |
660 | qDebug( "Mail sent." ); | 705 | qDebug( "Mail sent." ); |
661 | storeMail(data,size,"Sent"); | 706 | storeMail(data,size,"Sent"); |
662 | } | 707 | } |
663 | if (session) { | 708 | if (session) { |
664 | mailsmtp_quit( session ); | 709 | mailsmtp_quit( session ); |
665 | mailsmtp_free( session ); | 710 | mailsmtp_free( session ); |
666 | } | 711 | } |
667 | return result; | 712 | return result; |
668 | } | 713 | } |
669 | 714 | ||
670 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) { | 715 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) { |
671 | mailmime * mimeMail; | 716 | mailmime * mimeMail; |
672 | 717 | ||
673 | SMTPaccount *smtp = aSmtp; | 718 | SMTPaccount *smtp = aSmtp; |
674 | 719 | ||
675 | if (!later && !smtp) { | 720 | if (!later && !smtp) { |
676 | qDebug("Didn't get any send method - giving up"); | 721 | qDebug("Didn't get any send method - giving up"); |
677 | return; | 722 | return; |
678 | } | 723 | } |
679 | mimeMail = createMimeMail(mail ); | 724 | mimeMail = createMimeMail(mail ); |
680 | if ( mimeMail == NULL ) { | 725 | if ( mimeMail == NULL ) { |
681 | qDebug( "sendMail: error creating mime mail" ); | 726 | qDebug( "sendMail: error creating mime mail" ); |
682 | } else { | 727 | } else { |
683 | sendProgress = new progressMailSend(); | 728 | sendProgress = new progressMailSend(); |
684 | sendProgress->show(); | 729 | sendProgress->show(); |
685 | sendProgress->setMaxMails(1); | 730 | sendProgress->setMaxMails(1); |
686 | smtpSend( mimeMail,later,smtp); | 731 | smtpSend( mimeMail,later,smtp); |
687 | qDebug("Clean up done"); | 732 | qDebug("Clean up done"); |
688 | sendProgress->hide(); | 733 | sendProgress->hide(); |
689 | delete sendProgress; | 734 | delete sendProgress; |
690 | sendProgress = 0; | 735 | sendProgress = 0; |
691 | mailmime_free( mimeMail ); | 736 | mailmime_free( mimeMail ); |
692 | } | 737 | } |
693 | } | 738 | } |
694 | 739 | ||
695 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) { | 740 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) { |
696 | size_t curTok = 0; | 741 | size_t curTok = 0; |
697 | mailimf_fields *fields = 0; | 742 | mailimf_fields *fields = 0; |
698 | mailimf_field*ffrom = 0; | 743 | mailimf_field*ffrom = 0; |
699 | clist *rcpts = 0; | 744 | clist *rcpts = 0; |
700 | char*from = 0; | 745 | char*from = 0; |
701 | int res = 0; | 746 | int res = 0; |
702 | 747 | ||
703 | encodedString * data = wrap->fetchRawBody(*which); | 748 | encodedString * data = wrap->fetchRawBody(*which); |
704 | if (!data) | 749 | if (!data) |
705 | return 0; | 750 | return 0; |
706 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); | 751 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); |
707 | if (err != MAILIMF_NO_ERROR) { | 752 | if (err != MAILIMF_NO_ERROR) { |
708 | delete data; | 753 | delete data; |
709 | delete wrap; | 754 | delete wrap; |
710 | return 0; | 755 | return 0; |
711 | } | 756 | } |
712 | 757 | ||
713 | rcpts = createRcptList( fields ); | 758 | rcpts = createRcptList( fields ); |
714 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); | 759 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); |
715 | from = getFrom(ffrom); | 760 | from = getFrom(ffrom); |
716 | 761 | ||
717 | if (rcpts && from) { | 762 | if (rcpts && from) { |
718 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); | 763 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); |
719 | } | 764 | } |
720 | if (fields) { | 765 | if (fields) { |
721 | mailimf_fields_free(fields); | 766 | mailimf_fields_free(fields); |
722 | fields = 0; | 767 | fields = 0; |
723 | } | 768 | } |
724 | if (data) { | 769 | if (data) { |
725 | delete data; | 770 | delete data; |
726 | } | 771 | } |
727 | if (from) { | 772 | if (from) { |
728 | free(from); | 773 | free(from); |
729 | } | 774 | } |
730 | if (rcpts) { | 775 | if (rcpts) { |
731 | smtp_address_list_free( rcpts ); | 776 | smtp_address_list_free( rcpts ); |
732 | } | 777 | } |
733 | return res; | 778 | return res; |
734 | } | 779 | } |
735 | 780 | ||
736 | /* this is a special fun */ | 781 | /* this is a special fun */ |
737 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { | 782 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { |
738 | bool returnValue = true; | 783 | bool returnValue = true; |
739 | 784 | ||
740 | if (!smtp) | 785 | qDebug("Sending the queue"); |
786 | if (!smtp) { | ||
787 | qDebug("No smtp account given"); | ||
741 | return false; | 788 | return false; |
789 | } | ||
742 | 790 | ||
743 | bool reset_user_value = false; | 791 | bool reset_user_value = false; |
744 | QString localfolders = AbstractMail::defaultLocalfolder(); | 792 | QString localfolders = AbstractMail::defaultLocalfolder(); |
745 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 793 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
746 | if (!wrap) { | 794 | if (!wrap) { |
747 | qDebug("memory error"); | 795 | qDebug("memory error"); |
748 | return false; | 796 | return false; |
749 | } | 797 | } |
750 | QString oldPw, oldUser; | 798 | QString oldPw, oldUser; |
751 | QList<RecMail> mailsToSend; | 799 | QList<RecMail> mailsToSend; |
752 | QList<RecMail> mailsToRemove; | 800 | QList<RecMail> mailsToRemove; |
753 | QString mbox("Outgoing"); | 801 | QString mbox("Outgoing"); |
754 | wrap->listMessages(mbox,mailsToSend); | 802 | wrap->listMessages(mbox,mailsToSend); |
755 | if (mailsToSend.count()==0) { | 803 | if (mailsToSend.count()==0) { |
756 | delete wrap; | 804 | delete wrap; |
805 | qDebug("No mails to send"); | ||
757 | return false; | 806 | return false; |
758 | } | 807 | } |
759 | 808 | ||
760 | oldPw = smtp->getPassword(); | 809 | oldPw = smtp->getPassword(); |
761 | oldUser = smtp->getUser(); | 810 | oldUser = smtp->getUser(); |
762 | if (smtp->getLogin() && (smtp->getUser().isEmpty() || smtp->getPassword().isEmpty()) ) { | 811 | if (smtp->getLogin() && (smtp->getUser().isEmpty() || smtp->getPassword().isEmpty()) ) { |
763 | // get'em | 812 | // get'em |
764 | QString user,pass; | 813 | QString user,pass; |
765 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); | 814 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); |
766 | login.show(); | 815 | login.show(); |
767 | if ( QDialog::Accepted == login.exec() ) { | 816 | if ( QDialog::Accepted == login.exec() ) { |
768 | // ok | 817 | // ok |
769 | user = login.getUser().latin1(); | 818 | user = login.getUser().latin1(); |
770 | pass = login.getPassword().latin1(); | 819 | pass = login.getPassword().latin1(); |
771 | reset_user_value = true; | 820 | reset_user_value = true; |
772 | smtp->setUser(user); | 821 | smtp->setUser(user); |
773 | smtp->setPassword(pass); | 822 | smtp->setPassword(pass); |
774 | } else { | 823 | } else { |
775 | return true; | 824 | return true; |
776 | } | 825 | } |
777 | } | 826 | } |
778 | 827 | ||
779 | 828 | ||
780 | mailsToSend.setAutoDelete(false); | 829 | mailsToSend.setAutoDelete(false); |
781 | sendProgress = new progressMailSend(); | 830 | sendProgress = new progressMailSend(); |
782 | sendProgress->show(); | 831 | sendProgress->show(); |
783 | sendProgress->setMaxMails(mailsToSend.count()); | 832 | sendProgress->setMaxMails(mailsToSend.count()); |
784 | 833 | ||
785 | while (mailsToSend.count()>0) { | 834 | while (mailsToSend.count()>0) { |
786 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 835 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
787 | QMessageBox::critical(0,tr("Error sending mail"), | 836 | QMessageBox::critical(0,tr("Error sending mail"), |
788 | tr("Error sending queued mail - breaking")); | 837 | tr("Error sending queued mail - breaking")); |
789 | returnValue = false; | 838 | returnValue = false; |
790 | break; | 839 | break; |
791 | } | 840 | } |
792 | mailsToRemove.append(mailsToSend.at(0)); | 841 | mailsToRemove.append(mailsToSend.at(0)); |
793 | mailsToSend.removeFirst(); | 842 | mailsToSend.removeFirst(); |
794 | sendProgress->setCurrentMails(mailsToRemove.count()); | 843 | sendProgress->setCurrentMails(mailsToRemove.count()); |
795 | } | 844 | } |
796 | if (reset_user_value) { | 845 | if (reset_user_value) { |
797 | smtp->setUser(oldUser); | 846 | smtp->setUser(oldUser); |
798 | smtp->setPassword(oldPw); | 847 | smtp->setPassword(oldPw); |
799 | } | 848 | } |
800 | Config cfg( "mail" ); | 849 | Config cfg( "mail" ); |
801 | cfg.setGroup( "Status" ); | 850 | cfg.setGroup( "Status" ); |
802 | m_queuedMail = 0; | 851 | m_queuedMail = 0; |
803 | cfg.writeEntry( "outgoing", m_queuedMail ); | 852 | cfg.writeEntry( "outgoing", m_queuedMail ); |
804 | emit queuedMails( m_queuedMail ); | 853 | emit queuedMails( m_queuedMail ); |
805 | sendProgress->hide(); | 854 | sendProgress->hide(); |
806 | delete sendProgress; | 855 | delete sendProgress; |
807 | sendProgress = 0; | 856 | sendProgress = 0; |
808 | wrap->deleteMails(mbox,mailsToRemove); | 857 | wrap->deleteMails(mbox,mailsToRemove); |
809 | mailsToSend.setAutoDelete(true); | 858 | mailsToSend.setAutoDelete(true); |
810 | delete wrap; | 859 | delete wrap; |
811 | return returnValue; | 860 | return returnValue; |
812 | } | 861 | } |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 89826d9..75e4891 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h | |||
@@ -1,73 +1,76 @@ | |||
1 | #ifndef SMTPwrapper_H | 1 | #ifndef SMTPwrapper_H |
2 | #define SMTPwrapper_H | 2 | #define SMTPwrapper_H |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | 5 | ||
6 | #include <qbitarray.h> | 6 | #include <qbitarray.h> |
7 | #include <qdatetime.h> | 7 | #include <qdatetime.h> |
8 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
9 | 9 | ||
10 | #include "settings.h" | 10 | #include "settings.h" |
11 | 11 | ||
12 | class Mail; | 12 | class Mail; |
13 | class AbstractMail; | 13 | class AbstractMail; |
14 | class RecMail; | 14 | class RecMail; |
15 | class Attachment; | 15 | class Attachment; |
16 | struct mailimf_fields; | 16 | struct mailimf_fields; |
17 | struct mailimf_field; | 17 | struct mailimf_field; |
18 | struct mailimf_mailbox; | 18 | struct mailimf_mailbox; |
19 | struct mailmime; | 19 | struct mailmime; |
20 | struct mailimf_address_list; | 20 | struct mailimf_address_list; |
21 | class progressMailSend; | 21 | class progressMailSend; |
22 | struct mailsmtp; | ||
22 | 23 | ||
23 | class SMTPwrapper : public QObject | 24 | class SMTPwrapper : public QObject |
24 | { | 25 | { |
25 | Q_OBJECT | 26 | Q_OBJECT |
26 | 27 | ||
27 | public: | 28 | public: |
28 | SMTPwrapper( Settings *s ); | 29 | SMTPwrapper( Settings *s ); |
29 | virtual ~SMTPwrapper(){} | 30 | virtual ~SMTPwrapper(){} |
30 | void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); | 31 | void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); |
31 | bool flushOutbox(SMTPaccount*smtp); | 32 | bool flushOutbox(SMTPaccount*smtp); |
32 | 33 | ||
33 | static progressMailSend*sendProgress; | 34 | static progressMailSend*sendProgress; |
34 | 35 | ||
35 | signals: | 36 | signals: |
36 | void queuedMails( int ); | 37 | void queuedMails( int ); |
37 | 38 | ||
38 | protected: | 39 | protected: |
39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); | 40 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |
40 | mailimf_fields *createImfFields(const Mail &mail ); | 41 | mailimf_fields *createImfFields(const Mail &mail ); |
41 | mailmime *createMimeMail(const Mail&mail ); | 42 | mailmime *createMimeMail(const Mail&mail ); |
42 | 43 | ||
43 | mailimf_address_list *parseAddresses(const QString&addr ); | 44 | mailimf_address_list *parseAddresses(const QString&addr ); |
44 | void addFileParts( mailmime *message,const QList<Attachment>&files ); | 45 | void addFileParts( mailmime *message,const QList<Attachment>&files ); |
45 | mailmime *buildTxtPart(const QString&str ); | 46 | mailmime *buildTxtPart(const QString&str ); |
46 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); | 47 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); |
47 | void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); | 48 | void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); |
48 | clist *createRcptList( mailimf_fields *fields ); | 49 | clist *createRcptList( mailimf_fields *fields ); |
49 | 50 | ||
50 | static void storeMail(const char*mail, size_t length, const QString&box); | 51 | static void storeMail(const char*mail, size_t length, const QString&box); |
51 | static QString mailsmtpError( int err ); | 52 | static QString mailsmtpError( int err ); |
52 | static void progress( size_t current, size_t maximum ); | 53 | static void progress( size_t current, size_t maximum ); |
53 | static void addRcpts( clist *list, mailimf_address_list *addr_list ); | 54 | static void addRcpts( clist *list, mailimf_address_list *addr_list ); |
54 | static char *getFrom( mailmime *mail ); | 55 | static char *getFrom( mailmime *mail ); |
55 | static char *getFrom( mailimf_field *ffrom); | 56 | static char *getFrom( mailimf_field *ffrom); |
56 | static mailimf_field *getField( mailimf_fields *fields, int type ); | 57 | static mailimf_field *getField( mailimf_fields *fields, int type ); |
58 | static int start_smtp_tls(mailsmtp *session); | ||
59 | |||
57 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); | 60 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); |
58 | 61 | ||
59 | void storeMail(mailmime*mail, const QString&box); | 62 | void storeMail(mailmime*mail, const QString&box); |
60 | Settings *settings; | 63 | Settings *settings; |
61 | 64 | ||
62 | int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); | 65 | int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); |
63 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); | 66 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); |
64 | 67 | ||
65 | int m_queuedMail; | 68 | int m_queuedMail; |
66 | static const char* USER_AGENT; | 69 | static const char* USER_AGENT; |
67 | 70 | ||
68 | protected slots: | 71 | protected slots: |
69 | void emitQCop( int queued ); | 72 | void emitQCop( int queued ); |
70 | 73 | ||
71 | }; | 74 | }; |
72 | 75 | ||
73 | #endif | 76 | #endif |