summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-22 14:36:31 (UTC)
committer zautrix <zautrix>2005-10-22 14:36:31 (UTC)
commit2e5c0a288f7c54cce7e0327ddbbd160f242758f1 (patch) (unidiff)
tree91a3d3092d71645b1f9f6a6147825d3b27ae006b
parenta72d70beb381b9cd6f2af301b52ca82cdcafb299 (diff)
downloadkdepimpi-2e5c0a288f7c54cce7e0327ddbbd160f242758f1.zip
kdepimpi-2e5c0a288f7c54cce7e0327ddbbd160f242758f1.tar.gz
kdepimpi-2e5c0a288f7c54cce7e0327ddbbd160f242758f1.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt7
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp13
2 files changed, 14 insertions, 6 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index b44d6d1..6c1f664 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,74 +1,81 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.2.5 ************
4
5Bugfixes in KO/Pi, KA/Pi and OM/Pi.
6Added possibility to disable auto saving in KO/Pi.
7How to disable it? Good question! Next question, please?
8
9
3********** VERSION 2.2.4 ************ 10********** VERSION 2.2.4 ************
4 11
5KO/Pi alarm applet: Made font smaller and added a dealy before starting KO/Pi to avoid problems accessing data storage when an alarm did wake up the Z. 12KO/Pi alarm applet: Made font smaller and added a dealy before starting KO/Pi to avoid problems accessing data storage when an alarm did wake up the Z.
6Added 3 sec notification about a started timer. 13Added 3 sec notification about a started timer.
7 14
8KO/Pi: 15KO/Pi:
9Added export option for all data to File->Export menu. 16Added export option for all data to File->Export menu.
10Better management if a save error occours. 17Better management if a save error occours.
11Added 15 sec delay in automatic saving when Z wake up from suspend and the automatic save timer did expire - to avoid problems accessing data storage directly after wake up. 18Added 15 sec delay in automatic saving when Z wake up from suspend and the automatic save timer did expire - to avoid problems accessing data storage directly after wake up.
12Fix for displaying month names of an utf8 translated language (like Russian). I hope a Russian version of KO/Pi will be available soon. 19Fix for displaying month names of an utf8 translated language (like Russian). I hope a Russian version of KO/Pi will be available soon.
13 20
14Added duration info about multiday events. 21Added duration info about multiday events.
15Changed behaviour of "Set complete" in Todo viewer: Now Todo viewer closes not automatically. 22Changed behaviour of "Set complete" in Todo viewer: Now Todo viewer closes not automatically.
16 23
17KA/Pi: 24KA/Pi:
18Added for vCard import the option to import contact data in Latin1 format. 25Added for vCard import the option to import contact data in Latin1 format.
19 26
20********** VERSION 2.2.3 ************ 27********** VERSION 2.2.3 ************
21 28
22KO/Pi: 29KO/Pi:
23Fixed a problem with (non empty) exception dates in the exception date edit dialog of recurring events for newly created events. 30Fixed a problem with (non empty) exception dates in the exception date edit dialog of recurring events for newly created events.
24 31
25Fixed usability problem in KA/Pi: 32Fixed usability problem in KA/Pi:
26Now searching works for "all phone numbers and all addresses" if "all fields" is selected as search option. 33Now searching works for "all phone numbers and all addresses" if "all fields" is selected as search option.
27 34
28Changed some behaviour in OM/Pi mail management to make it more usable. 35Changed some behaviour in OM/Pi mail management to make it more usable.
29 36
30 37
31********** VERSION 2.2.2 ************ 38********** VERSION 2.2.2 ************
32 39
33KO/Pi: 40KO/Pi:
34Fixed a problem with the sort order of last modified date in list view. 41Fixed a problem with the sort order of last modified date in list view.
35KA/Pi: 42KA/Pi:
36Fixed a resource config read problem on windows. 43Fixed a resource config read problem on windows.
37 44
38 45
39********** VERSION 2.2.1 ************ 46********** VERSION 2.2.1 ************
40 47
41KO/Pi: 48KO/Pi:
42Fixed a problem displaying very long allday events in agenda view in single day mode. 49Fixed a problem displaying very long allday events in agenda view in single day mode.
43Fixed a problem with the default settings for new todos. 50Fixed a problem with the default settings for new todos.
44Added an error message dialog if saving of calendar files is not possible. 51Added an error message dialog if saving of calendar files is not possible.
45Made it impossible to close KO/Pi if saving fails. 52Made it impossible to close KO/Pi if saving fails.
46Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. 53Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick.
47Added config options for conflict detection. 54Added config options for conflict detection.
48 55
49KA/Pi: 56KA/Pi:
50Added a config option to turn on asking before a contact is deleted. 57Added a config option to turn on asking before a contact is deleted.
51Fixed a problem with the default view and view selection at startup. 58Fixed a problem with the default view and view selection at startup.
52Formatted name is now set on import, if formatted name is empty. 59Formatted name is now set on import, if formatted name is empty.
53Fixed a problem of displaying images in the contact details view: 60Fixed a problem of displaying images in the contact details view:
54Now the wid/hei ratio is not changed. 61Now the wid/hei ratio is not changed.
55I a picture is larger than 128 pixels in wid or hei it is downscaled to 62I a picture is larger than 128 pixels in wid or hei it is downscaled to
56max 128 pixels wid/hei. 63max 128 pixels wid/hei.
57 64
58********** VERSION 2.2.0 ************ 65********** VERSION 2.2.0 ************
59 66
60New stable release! 67New stable release!
61Fixed some minor usability problems. 68Fixed some minor usability problems.
62Added writing of next alarm to a file for usage on pdaXrom. 69Added writing of next alarm to a file for usage on pdaXrom.
63 70
64 71
65************************************* 72*************************************
66 73
67You can find the complete changelog 74You can find the complete changelog
68from version 1.7.7 to 2.2.0 75from version 1.7.7 to 2.2.0
69in the source package or on 76in the source package or on
70 77
71http://www.pi-sync.net/html/changelog.html 78http://www.pi-sync.net/html/changelog.html
72 79
73 80
74 81
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index a6c12e4..7c813cc 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -9,492 +9,493 @@
9//#include <qt.h> 9//#include <qt.h>
10#include <qapplication.h> 10#include <qapplication.h>
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12#include <stdlib.h> 12#include <stdlib.h>
13#ifndef DESKTOP_VERSION 13#ifndef DESKTOP_VERSION
14//#include <qpe/config.h> 14//#include <qpe/config.h>
15#include <qpe/qcopenvelope_qws.h> 15#include <qpe/qcopenvelope_qws.h>
16#endif 16#endif
17#include <libetpan/libetpan.h> 17#include <libetpan/libetpan.h>
18#include <klocale.h> 18#include <klocale.h>
19#include <kglobal.h> 19#include <kglobal.h>
20#include <kconfig.h> 20#include <kconfig.h>
21 21
22 22
23using namespace Opie::Core; 23using namespace Opie::Core;
24progressMailSend*SMTPwrapper::sendProgress = 0; 24progressMailSend*SMTPwrapper::sendProgress = 0;
25 25
26SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 26SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
27 : Generatemail() 27 : Generatemail()
28{ 28{
29 m_SmtpAccount = aSmtp; 29 m_SmtpAccount = aSmtp;
30 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 30 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
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 m_smtp = 0; 35 m_smtp = 0;
36} 36}
37 37
38SMTPwrapper::~SMTPwrapper() 38SMTPwrapper::~SMTPwrapper()
39{ 39{
40 disc_server(); 40 disc_server();
41} 41}
42 42
43void SMTPwrapper::emitQCop( int queued ) { 43void SMTPwrapper::emitQCop( int queued ) {
44#ifndef DESKTOP_VERSION 44#ifndef DESKTOP_VERSION
45 // LR : not used in kde-pim 45 // LR : not used in kde-pim
46 //QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 46 //QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
47 //env << queued; 47 //env << queued;
48#endif 48#endif
49} 49}
50 50
51QString SMTPwrapper::mailsmtpError( int errnum ) { 51QString SMTPwrapper::mailsmtpError( int errnum ) {
52 switch ( errnum ) { 52 switch ( errnum ) {
53 case MAILSMTP_NO_ERROR: 53 case MAILSMTP_NO_ERROR:
54 return i18n( "No error" ); 54 return i18n( "No error" );
55 case MAILSMTP_ERROR_UNEXPECTED_CODE: 55 case MAILSMTP_ERROR_UNEXPECTED_CODE:
56 return i18n( "Unexpected error code" ); 56 return i18n( "Unexpected error code" );
57 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 57 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
58 return i18n( "Service not available" ); 58 return i18n( "Service not available" );
59 case MAILSMTP_ERROR_STREAM: 59 case MAILSMTP_ERROR_STREAM:
60 return i18n( "Stream error" ); 60 return i18n( "Stream error" );
61 case MAILSMTP_ERROR_HOSTNAME: 61 case MAILSMTP_ERROR_HOSTNAME:
62 return i18n( "gethostname() failed" ); 62 return i18n( "gethostname() failed" );
63 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 63 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
64 return i18n( "Not implemented" ); 64 return i18n( "Not implemented" );
65 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 65 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
66 return i18n( "Error, action not taken" ); 66 return i18n( "Error, action not taken" );
67 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 67 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
68 return i18n( "Data exceeds storage allocation" ); 68 return i18n( "Data exceeds storage allocation" );
69 case MAILSMTP_ERROR_IN_PROCESSING: 69 case MAILSMTP_ERROR_IN_PROCESSING:
70 return i18n( "Error in processing" ); 70 return i18n( "Error in processing" );
71 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 71 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
72 return i18n( "Starttls not supported" ); 72 return i18n( "Starttls not supported" );
73 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 73 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
74 // return i18n( "Insufficient system storage" ); 74 // return i18n( "Insufficient system storage" );
75 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 75 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
76 return i18n( "Mailbox unavailable" ); 76 return i18n( "Mailbox unavailable" );
77 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 77 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
78 return i18n( "Mailbox name not allowed" ); 78 return i18n( "Mailbox name not allowed" );
79 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 79 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
80 return i18n( "Bad command sequence" ); 80 return i18n( "Bad command sequence" );
81 case MAILSMTP_ERROR_USER_NOT_LOCAL: 81 case MAILSMTP_ERROR_USER_NOT_LOCAL:
82 return i18n( "User not local" ); 82 return i18n( "User not local" );
83 case MAILSMTP_ERROR_TRANSACTION_FAILED: 83 case MAILSMTP_ERROR_TRANSACTION_FAILED:
84 return i18n( "Transaction failed" ); 84 return i18n( "Transaction failed" );
85 case MAILSMTP_ERROR_MEMORY: 85 case MAILSMTP_ERROR_MEMORY:
86 return i18n( "Memory error" ); 86 return i18n( "Memory error" );
87 case MAILSMTP_ERROR_CONNECTION_REFUSED: 87 case MAILSMTP_ERROR_CONNECTION_REFUSED:
88 return i18n( "Connection refused" ); 88 return i18n( "Connection refused" );
89 default: 89 default:
90 return i18n( "Unknown error code" ); 90 return i18n( "Unknown error code" );
91 } 91 }
92} 92}
93 93
94 94
95void SMTPwrapper::progress( size_t current, size_t maximum ) { 95void SMTPwrapper::progress( size_t current, size_t maximum ) {
96 if (SMTPwrapper::sendProgress) { 96 if (SMTPwrapper::sendProgress) {
97 SMTPwrapper::sendProgress->setSingleMail(current, maximum ); 97 SMTPwrapper::sendProgress->setSingleMail(current, maximum );
98 qApp->processEvents(); 98 qApp->processEvents();
99 } 99 }
100} 100}
101 101
102void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { 102void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
103 if (!mail) 103 if (!mail)
104 return; 104 return;
105 QString localfolders = AbstractMail::defaultLocalfolder(); 105 QString localfolders = AbstractMail::defaultLocalfolder();
106 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 106 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
107 wrap->createMbox(box); 107 wrap->createMbox(box);
108 wrap->storeMessage(mail,length,box); 108 wrap->storeMessage(mail,length,box);
109 delete wrap; 109 delete wrap;
110} 110}
111 111
112bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { 112bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
113 clist *rcpts = 0; 113 clist *rcpts = 0;
114 char *from, *data; 114 char *from, *data;
115 size_t size; 115 size_t size;
116 116
117 from = data = 0; 117 from = data = 0;
118 118
119 mailmessage * msg = 0; 119 mailmessage * msg = 0;
120 msg = mime_message_init(mail); 120 msg = mime_message_init(mail);
121 mime_message_set_tmpdir(msg,getenv( "HOME" )); 121 mime_message_set_tmpdir(msg,getenv( "HOME" ));
122 int r = mailmessage_fetch(msg,&data,&size); 122 int r = mailmessage_fetch(msg,&data,&size);
123 mime_message_detach_mime(msg); 123 mime_message_detach_mime(msg);
124 mailmessage_free(msg); 124 mailmessage_free(msg);
125 if (r != MAIL_NO_ERROR || !data) { 125 if (r != MAIL_NO_ERROR || !data) {
126 if (data) 126 if (data)
127 free(data); 127 free(data);
128 qDebug("Error fetching mime... "); 128 qDebug("Error fetching mime... ");
129 return false; 129 return false;
130 } 130 }
131 msg = 0; 131 msg = 0;
132 if (later) { 132 if (later) {
133 storeMail(data,size,"Outgoing"); 133 storeMail(data,size,"Outgoing");
134 if (data) 134 if (data)
135 free( data ); 135 free( data );
136 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 136 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
137 cfg.setGroup( "Status" ); 137 cfg.setGroup( "Status" );
138 cfg.writeEntry( "outgoing", ++m_queuedMail ); 138 cfg.writeEntry( "outgoing", ++m_queuedMail );
139 emit queuedMails( m_queuedMail ); 139 emit queuedMails( m_queuedMail );
140 return true; 140 return true;
141 } 141 }
142 from = getFrom( mail ); 142 from = getFrom( mail );
143 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 143 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
144 bool result = smtpSend(from,rcpts,data,size); 144 bool result = smtpSend(from,rcpts,data,size);
145 if (data) { 145 if (data) {
146 free(data); 146 free(data);
147 } 147 }
148 if (from) { 148 if (from) {
149 free(from); 149 free(from);
150 } 150 }
151 if (rcpts) 151 if (rcpts)
152 smtp_address_list_free( rcpts ); 152 smtp_address_list_free( rcpts );
153 return result; 153 return result;
154} 154}
155 155
156void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 156void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
157{ 157{
158 if (data) { 158 if (data) {
159 storeMail(data,size,"Sendfailed"); 159 storeMail(data,size,"Sendfailed");
160 } 160 }
161 if (failuremessage) { 161 if (failuremessage) {
162 QMessageBox::critical(0,i18n("Error sending mail"), 162 QMessageBox::critical(0,i18n("Error sending mail"),
163 failuremessage); 163 failuremessage);
164 } 164 }
165} 165}
166 166
167int SMTPwrapper::start_smtp_tls() 167int SMTPwrapper::start_smtp_tls()
168{ 168{
169 if (!m_smtp) { 169 if (!m_smtp) {
170 return MAILSMTP_ERROR_IN_PROCESSING; 170 return MAILSMTP_ERROR_IN_PROCESSING;
171 } 171 }
172 int err = mailesmtp_starttls(m_smtp); 172 int err = mailesmtp_starttls(m_smtp);
173 if (err != MAILSMTP_NO_ERROR) return err; 173 if (err != MAILSMTP_NO_ERROR) return err;
174 mailstream_low * low; 174 mailstream_low * low;
175 mailstream_low * new_low; 175 mailstream_low * new_low;
176 low = mailstream_get_low(m_smtp->stream); 176 low = mailstream_get_low(m_smtp->stream);
177 if (!low) { 177 if (!low) {
178 return MAILSMTP_ERROR_IN_PROCESSING; 178 return MAILSMTP_ERROR_IN_PROCESSING;
179 } 179 }
180 int fd = mailstream_low_get_fd(low); 180 int fd = mailstream_low_get_fd(low);
181 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 181 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
182 mailstream_low_free(low); 182 mailstream_low_free(low);
183 mailstream_set_low(m_smtp->stream, new_low); 183 mailstream_set_low(m_smtp->stream, new_low);
184 } else { 184 } else {
185 return MAILSMTP_ERROR_IN_PROCESSING; 185 return MAILSMTP_ERROR_IN_PROCESSING;
186 } 186 }
187 return err; 187 return err;
188} 188}
189 189
190void SMTPwrapper::connect_server() 190void SMTPwrapper::connect_server()
191{ 191{
192 QString server, user, pass; 192 QString server, user, pass;
193 bool ssl; 193 bool ssl;
194 uint16_t port; 194 uint16_t port;
195 ssl = false; 195 ssl = false;
196 bool try_tls = false; 196 bool try_tls = false;
197 bool force_tls=false; 197 bool force_tls=false;
198 QString failuretext = ""; 198 QString failuretext = "";
199 199
200 if (m_smtp || !m_SmtpAccount) { 200 if (m_smtp || !m_SmtpAccount) {
201 return; 201 return;
202 } 202 }
203 server = m_SmtpAccount->getServer(); 203 server = m_SmtpAccount->getServer();
204 if ( m_SmtpAccount->ConnectionType() == 3 ) { 204 if ( m_SmtpAccount->ConnectionType() == 3 ) {
205 ssl = true; 205 ssl = true;
206 try_tls = false; 206 try_tls = false;
207 } else if (m_SmtpAccount->ConnectionType() == 2) { 207 } else if (m_SmtpAccount->ConnectionType() == 2) {
208 force_tls = true; 208 force_tls = true;
209 try_tls = true; 209 try_tls = true;
210 } else if (m_SmtpAccount->ConnectionType() == 1) { 210 } else if (m_SmtpAccount->ConnectionType() == 1) {
211 try_tls = true; 211 try_tls = true;
212 } 212 }
213 int result = 1; 213 int result = 1;
214 port = m_SmtpAccount->getPort().toUInt(); 214 port = m_SmtpAccount->getPort().toUInt();
215 215
216 m_smtp = mailsmtp_new( 20, &progress ); 216 m_smtp = mailsmtp_new( 20, &progress );
217 if ( m_smtp == NULL ) { 217 if ( m_smtp == NULL ) {
218 /* no failure message cause this happens when problems with memory - than we 218 /* no failure message cause this happens when problems with memory - than we
219 we can not display any messagebox */ 219 we can not display any messagebox */
220 return; 220 return;
221 } 221 }
222 //m_smtp->auth = MAILSMTP_AUTH_LOGIN; 222 //m_smtp->auth = MAILSMTP_AUTH_LOGIN;
223 223
224 int err = MAILSMTP_NO_ERROR; 224 int err = MAILSMTP_NO_ERROR;
225 ; // odebug << "Servername " << server << " at port " << port << "" << oendl; 225 ; // odebug << "Servername " << server << " at port " << port << "" << oendl;
226 if ( ssl ) { 226 if ( ssl ) {
227 qDebug("smtp: ssl_connect "); 227 qDebug("smtp: ssl_connect ");
228 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); 228 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
229 } else { 229 } else {
230 ; // odebug << "No SSL session" << oendl; 230 ; // odebug << "No SSL session" << oendl;
231 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); 231 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
232 } 232 }
233 if ( err != MAILSMTP_NO_ERROR ) { 233 if ( err != MAILSMTP_NO_ERROR ) {
234 qDebug("Error init SMTP connection" ); 234 qDebug("Error init SMTP connection" );
235 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); 235 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err));
236 result = 0; 236 result = 0;
237 } 237 }
238 238
239 qDebug("SMTP connection inited "); 239 qDebug("SMTP connection inited ");
240 /* switch to tls after init 'cause there it will send the ehlo */ 240 /* switch to tls after init 'cause there it will send the ehlo */
241 if (result) { 241 if (result) {
242 err = mailsmtp_init( m_smtp ); 242 err = mailsmtp_init( m_smtp );
243 if (err != MAILSMTP_NO_ERROR) { 243 if (err != MAILSMTP_NO_ERROR) {
244 result = 0; 244 result = 0;
245 qDebug("Error init SMTP connection "); 245 qDebug("Error init SMTP connection ");
246 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); 246 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err));
247 } 247 }
248 } 248 }
249 if (result && try_tls) { 249 if (result && try_tls) {
250 qDebug("Smpt: Try TLS... "); 250 qDebug("Smpt: Try TLS... ");
251 err = start_smtp_tls(); 251 err = start_smtp_tls();
252 if (err != MAILSMTP_NO_ERROR) { 252 if (err != MAILSMTP_NO_ERROR) {
253 try_tls = false; 253 try_tls = false;
254 qDebug("Smpt: No TLS possible "); 254 qDebug("Smpt: No TLS possible ");
255 } else { 255 } else {
256 qDebug("Smpt: Using TLS "); 256 qDebug("Smpt: Using TLS ");
257 } 257 }
258 } 258 }
259 259
260 //qDebug("mailesmtp_ehlo %d ",err ); 260 //qDebug("mailesmtp_ehlo %d ",err );
261 if (!try_tls && force_tls) { 261 if (!try_tls && force_tls) {
262 result = 0; 262 result = 0;
263 failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err)); 263 failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err));
264 } 264 }
265 if ( mailesmtp_ehlo(m_smtp) != MAILSMTP_NO_ERROR ) { 265 //LR 05-10-22 : qDebug("no elo any more ");
266 qDebug("Smpt: ehlo failed "); 266 // if ( false /*mailesmtp_ehlo(m_smtp) != MAILSMTP_NO_ERROR */) {
267 result = 0; 267// qDebug("Smpt: ehlo failed ");
268 } 268// result = 0;
269 else { 269// }
270// else {
270 //qDebug("Smpt: auth is %d -- %d %d",m_smtp->auth, MAILSMTP_AUTH_LOGIN, MAILSMTP_AUTH_PLAIN); 271 //qDebug("Smpt: auth is %d -- %d %d",m_smtp->auth, MAILSMTP_AUTH_LOGIN, MAILSMTP_AUTH_PLAIN);
271 if ( m_smtp->auth & MAILSMTP_AUTH_LOGIN && m_smtp->auth & MAILSMTP_AUTH_PLAIN ) { 272 if ( m_smtp->auth & MAILSMTP_AUTH_LOGIN && m_smtp->auth & MAILSMTP_AUTH_PLAIN ) {
272 qDebug("Smpt: Using MAILSMTP_AUTH_LOGIN "); 273 qDebug("Smpt: Using MAILSMTP_AUTH_LOGIN ");
273 m_smtp->auth -= MAILSMTP_AUTH_PLAIN; 274 m_smtp->auth -= MAILSMTP_AUTH_PLAIN;
274 //qDebug("Smpt: auth is %d -- %d %d",m_smtp->auth, MAILSMTP_AUTH_LOGIN, MAILSMTP_AUTH_PLAIN); 275 //qDebug("Smpt: auth is %d -- %d %d",m_smtp->auth, MAILSMTP_AUTH_LOGIN, MAILSMTP_AUTH_PLAIN);
275 } 276 }
276 } 277 // }
277 278
278 if (result==1 && m_SmtpAccount->getLogin() ) { 279 if (result==1 && m_SmtpAccount->getLogin() ) {
279 ; // odebug << "smtp with auth" << oendl; 280 ; // odebug << "smtp with auth" << oendl;
280 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 281 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
281 // get'em 282 // get'em
282 LoginDialog login( m_SmtpAccount->getUser(), 283 LoginDialog login( m_SmtpAccount->getUser(),
283 m_SmtpAccount->getPassword(), NULL, 0, true ); 284 m_SmtpAccount->getPassword(), NULL, 0, true );
284 login.show(); 285 login.show();
285 if ( QDialog::Accepted == login.exec() ) { 286 if ( QDialog::Accepted == login.exec() ) {
286 // ok 287 // ok
287 user = login.getUser(); 288 user = login.getUser();
288 pass = login.getPassword(); 289 pass = login.getPassword();
289 } else { 290 } else {
290 result = 0; 291 result = 0;
291 failuretext=i18n("Login aborted - \nstoring mail to localfolder"); 292 failuretext=i18n("Login aborted - \nstoring mail to localfolder");
292 } 293 }
293 } else { 294 } else {
294 user = m_SmtpAccount->getUser(); 295 user = m_SmtpAccount->getUser();
295 pass = m_SmtpAccount->getPassword(); 296 pass = m_SmtpAccount->getPassword();
296 } 297 }
297 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; 298 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
298 if (result) { 299 if (result) {
299 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); 300 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() );
300 if ( err == MAILSMTP_NO_ERROR ) { 301 if ( err == MAILSMTP_NO_ERROR ) {
301 qDebug("Smtp authentification ok "); 302 qDebug("Smtp authentification ok ");
302 } else { 303 } else {
303 failuretext = i18n("Authentification failed"); 304 failuretext = i18n("Authentification failed");
304 result = 0; 305 result = 0;
305 } 306 }
306 } 307 }
307 } 308 }
308 if ( result == 0 ) { 309 if ( result == 0 ) {
309 mailsmtp_free(m_smtp); 310 mailsmtp_free(m_smtp);
310 m_smtp = 0; 311 m_smtp = 0;
311 } 312 }
312} 313}
313 314
314void SMTPwrapper::disc_server() 315void SMTPwrapper::disc_server()
315{ 316{
316 if (m_smtp) { 317 if (m_smtp) {
317 mailsmtp_quit( m_smtp ); 318 mailsmtp_quit( m_smtp );
318 mailsmtp_free( m_smtp ); 319 mailsmtp_free( m_smtp );
319 m_smtp = 0; 320 m_smtp = 0;
320 } 321 }
321} 322}
322 323
323int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) 324int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
324{ 325{
325 int err,result; 326 int err,result;
326 QString failuretext = ""; 327 QString failuretext = "";
327 328
328 connect_server(); 329 connect_server();
329 330
330 result = 1; 331 result = 1;
331 if (m_smtp) { 332 if (m_smtp) {
332 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 333 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
333 if ( err != MAILSMTP_NO_ERROR ) { 334 if ( err != MAILSMTP_NO_ERROR ) {
334 qDebug("Error sending mail"); 335 qDebug("Error sending mail");
335 failuretext=i18n("Error sending mail:\n%1").arg(mailsmtpError(err)); 336 failuretext=i18n("Error sending mail:\n%1").arg(mailsmtpError(err));
336 result = 0; 337 result = 0;
337 } 338 }
338 } else { 339 } else {
339 result = 0; 340 result = 0;
340 } 341 }
341 342
342 if (!result) { 343 if (!result) {
343 storeFailedMail(data,size,failuretext); 344 storeFailedMail(data,size,failuretext);
344 } else { 345 } else {
345 ; // odebug << "Mail sent." << oendl; 346 ; // odebug << "Mail sent." << oendl;
346 storeMail(data,size,"Sent"); 347 storeMail(data,size,"Sent");
347 } 348 }
348 return result; 349 return result;
349} 350}
350 351
351bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 352bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
352{ 353{
353 mailmime * mimeMail; 354 mailmime * mimeMail;
354 bool result = true; 355 bool result = true;
355 mimeMail = createMimeMail(mail ); 356 mimeMail = createMimeMail(mail );
356 if ( mimeMail == 0 ) { 357 if ( mimeMail == 0 ) {
357 qDebug("SMTP wrapper:Error creating mail! "); 358 qDebug("SMTP wrapper:Error creating mail! ");
358 return false; 359 return false;
359 } else { 360 } else {
360 sendProgress = new progressMailSend(); 361 sendProgress = new progressMailSend();
361 sendProgress->show(); 362 sendProgress->show();
362 sendProgress->setMaxMails(1); 363 sendProgress->setMaxMails(1);
363 result = smtpSend( mimeMail,later); 364 result = smtpSend( mimeMail,later);
364 ; // odebug << "Clean up done" << oendl; 365 ; // odebug << "Clean up done" << oendl;
365 sendProgress->hide(); 366 sendProgress->hide();
366 delete sendProgress; 367 delete sendProgress;
367 sendProgress = 0; 368 sendProgress = 0;
368 mailmime_free( mimeMail ); 369 mailmime_free( mimeMail );
369 if ( m_smtp ) { 370 if ( m_smtp ) {
370 mailsmtp_free(m_smtp); 371 mailsmtp_free(m_smtp);
371 m_smtp = 0; 372 m_smtp = 0;
372 } 373 }
373 } 374 }
374 return result; 375 return result;
375} 376}
376 377
377int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 378int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
378 size_t curTok = 0; 379 size_t curTok = 0;
379 mailimf_fields *fields = 0; 380 mailimf_fields *fields = 0;
380 mailimf_field*ffrom = 0; 381 mailimf_field*ffrom = 0;
381 clist *rcpts = 0; 382 clist *rcpts = 0;
382 char*from = 0; 383 char*from = 0;
383 int res = 0; 384 int res = 0;
384 385
385 encodedString * data = wrap->fetchRawBody(which); 386 encodedString * data = wrap->fetchRawBody(which);
386 if (!data) 387 if (!data)
387 return 0; 388 return 0;
388 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 389 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
389 if (err != MAILIMF_NO_ERROR) { 390 if (err != MAILIMF_NO_ERROR) {
390 delete data; 391 delete data;
391 delete wrap; 392 delete wrap;
392 return 0; 393 return 0;
393 } 394 }
394 395
395 rcpts = createRcptList( fields ); 396 rcpts = createRcptList( fields );
396 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 397 ffrom = getField(fields, MAILIMF_FIELD_FROM );
397 from = getFrom(ffrom); 398 from = getFrom(ffrom);
398 399
399 if (rcpts && from) { 400 if (rcpts && from) {
400 res = smtpSend(from,rcpts,data->Content(),data->Length()); 401 res = smtpSend(from,rcpts,data->Content(),data->Length());
401 } 402 }
402 if (fields) { 403 if (fields) {
403 mailimf_fields_free(fields); 404 mailimf_fields_free(fields);
404 fields = 0; 405 fields = 0;
405 } 406 }
406 if (data) { 407 if (data) {
407 delete data; 408 delete data;
408 } 409 }
409 if (from) { 410 if (from) {
410 free(from); 411 free(from);
411 } 412 }
412 if (rcpts) { 413 if (rcpts) {
413 smtp_address_list_free( rcpts ); 414 smtp_address_list_free( rcpts );
414 } 415 }
415 return res; 416 return res;
416} 417}
417 418
418/* this is a special fun */ 419/* this is a special fun */
419bool SMTPwrapper::flushOutbox() { 420bool SMTPwrapper::flushOutbox() {
420 bool returnValue = true; 421 bool returnValue = true;
421 422
422 ; // odebug << "Sending the queue" << oendl; 423 ; // odebug << "Sending the queue" << oendl;
423 if (!m_SmtpAccount) { 424 if (!m_SmtpAccount) {
424 ; // odebug << "No smtp account given" << oendl; 425 ; // odebug << "No smtp account given" << oendl;
425 return false; 426 return false;
426 } 427 }
427 428
428 bool reset_user_value = false; 429 bool reset_user_value = false;
429 QString localfolders = AbstractMail::defaultLocalfolder(); 430 QString localfolders = AbstractMail::defaultLocalfolder();
430 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 431 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
431 if (!wrap) { 432 if (!wrap) {
432 ; // odebug << "memory error" << oendl; 433 ; // odebug << "memory error" << oendl;
433 return false; 434 return false;
434 } 435 }
435 QString oldPw, oldUser; 436 QString oldPw, oldUser;
436 QValueList<RecMailP> mailsToSend; 437 QValueList<RecMailP> mailsToSend;
437 QValueList<RecMailP> mailsToRemove; 438 QValueList<RecMailP> mailsToRemove;
438 QString mbox("Outgoing"); 439 QString mbox("Outgoing");
439 wrap->listMessages(mbox,mailsToSend); 440 wrap->listMessages(mbox,mailsToSend);
440 if (mailsToSend.count()==0) { 441 if (mailsToSend.count()==0) {
441 delete wrap; 442 delete wrap;
442 ; // odebug << "No mails to send" << oendl; 443 ; // odebug << "No mails to send" << oendl;
443 return false; 444 return false;
444 } 445 }
445 446
446 oldPw = m_SmtpAccount->getPassword(); 447 oldPw = m_SmtpAccount->getPassword();
447 oldUser = m_SmtpAccount->getUser(); 448 oldUser = m_SmtpAccount->getUser();
448 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 449 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
449 // get'em 450 // get'em
450 QString user,pass; 451 QString user,pass;
451 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 452 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
452 login.show(); 453 login.show();
453 if ( QDialog::Accepted == login.exec() ) { 454 if ( QDialog::Accepted == login.exec() ) {
454 // ok 455 // ok
455 user = login.getUser().latin1(); 456 user = login.getUser().latin1();
456 pass = login.getPassword().latin1(); 457 pass = login.getPassword().latin1();
457 reset_user_value = true; 458 reset_user_value = true;
458 m_SmtpAccount->setUser(user); 459 m_SmtpAccount->setUser(user);
459 m_SmtpAccount->setPassword(pass); 460 m_SmtpAccount->setPassword(pass);
460 } else { 461 } else {
461 return true; 462 return true;
462 } 463 }
463 } 464 }
464 465
465 466
466 sendProgress = new progressMailSend(); 467 sendProgress = new progressMailSend();
467 sendProgress->show(); 468 sendProgress->show();
468 sendProgress->setMaxMails(mailsToSend.count()); 469 sendProgress->setMaxMails(mailsToSend.count());
469 470
470 while (returnValue && mailsToSend.count()>0) { 471 while (returnValue && mailsToSend.count()>0) {
471 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 472 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
472 QMessageBox::critical(0,i18n("Error sending mail"), 473 QMessageBox::critical(0,i18n("Error sending mail"),
473 i18n("Error sending queued mail.\nBreaking.")); 474 i18n("Error sending queued mail.\nBreaking."));
474 returnValue = false; 475 returnValue = false;
475 } 476 }
476 mailsToRemove.append((*mailsToSend.begin())); 477 mailsToRemove.append((*mailsToSend.begin()));
477 mailsToSend.remove(mailsToSend.begin()); 478 mailsToSend.remove(mailsToSend.begin());
478 sendProgress->setCurrentMails(mailsToRemove.count()); 479 sendProgress->setCurrentMails(mailsToRemove.count());
479 } 480 }
480 if (reset_user_value) { 481 if (reset_user_value) {
481 m_SmtpAccount->setUser(oldUser); 482 m_SmtpAccount->setUser(oldUser);
482 m_SmtpAccount->setPassword(oldPw); 483 m_SmtpAccount->setPassword(oldPw);
483 } 484 }
484 485
485 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 486 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
486 cfg.setGroup( "Status" ); 487 cfg.setGroup( "Status" );
487 m_queuedMail = mailsToSend.count(); 488 m_queuedMail = mailsToSend.count();
488 cfg.writeEntry( "outgoing", m_queuedMail ); 489 cfg.writeEntry( "outgoing", m_queuedMail );
489 emit queuedMails( m_queuedMail ); 490 emit queuedMails( m_queuedMail );
490 sendProgress->hide(); 491 sendProgress->hide();
491 delete sendProgress; 492 delete sendProgress;
492 sendProgress = 0; 493 sendProgress = 0;
493 wrap->deleteMails(mbox,mailsToRemove); 494 wrap->deleteMails(mbox,mailsToRemove);
494 delete wrap; 495 delete wrap;
495 if ( m_smtp ) { 496 if ( m_smtp ) {
496 mailsmtp_free(m_smtp); 497 mailsmtp_free(m_smtp);
497 m_smtp = 0; 498 m_smtp = 0;
498 } 499 }
499 return returnValue; 500 return returnValue;
500} 501}