summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-31 18:40:14 (UTC)
committer zautrix <zautrix>2004-10-31 18:40:14 (UTC)
commit16292c7f13b40a07b51b41c701cd106ccfd2f37b (patch) (unidiff)
treef3e2dfe11b00f1d910eaeaafd28b0d97aa717ce1
parent043e2d256df36945779bf4568df46b6e4ae51e0e (diff)
downloadkdepimpi-16292c7f13b40a07b51b41c701cd106ccfd2f37b.zip
kdepimpi-16292c7f13b40a07b51b41c701cd106ccfd2f37b.tar.gz
kdepimpi-16292c7f13b40a07b51b41c701cd106ccfd2f37b.tar.bz2
hope it works..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--desktop/rpm/kdepim_rpm2
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp6
-rw-r--r--version2
3 files changed, 5 insertions, 5 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm
index b663918..cead6bb 100644
--- a/desktop/rpm/kdepim_rpm
+++ b/desktop/rpm/kdepim_rpm
@@ -1,81 +1,81 @@
1Summary: A collection of PIM programs 1Summary: A collection of PIM programs
2Name: KDE-Pim-Pi 2Name: KDE-Pim-Pi
3Version: 1.9.11 3Version: 1.9.13
4Release: SuSE_9.1 4Release: SuSE_9.1
5Copyright:GPL 5Copyright:GPL
6Group: Productivity/Pim 6Group: Productivity/Pim
7Source:http://sourceforge.net/projects/kdepimpi/ 7Source:http://sourceforge.net/projects/kdepimpi/
8URL:http://sourceforge.net/projects/kdepimpi/ 8URL:http://sourceforge.net/projects/kdepimpi/
9Packager: zautrix 9Packager: zautrix
10 10
11%description 11%description
12This package contains the platform-independent PIM programs from 12This package contains the platform-independent PIM programs from
13www.pi-sync.net, compiled for SuSE 9.1: 13www.pi-sync.net, compiled for SuSE 9.1:
14KTimeTacker/Pi 14KTimeTacker/Pi
15KPhone/Pi 15KPhone/Pi
16KAddressbook/Pi 16KAddressbook/Pi
17KOrganizer/Pi 17KOrganizer/Pi
18PasswordManager/Pi 18PasswordManager/Pi
19 19
20These applications do not need anything from the KDE-desktop 20These applications do not need anything from the KDE-desktop
21at all to run on Linux. However, there is a dependency from 21at all to run on Linux. However, there is a dependency from
22two KDE libs, because a small command line program is included 22two KDE libs, because a small command line program is included
23to make it possible to sync with the KDE-desktop applications. 23to make it possible to sync with the KDE-desktop applications.
24 24
25These applications are independent from the KDE-desktop 25These applications are independent from the KDE-desktop
26environment. That means, nothing of your existing 26environment. That means, nothing of your existing
27KDE-desktop setup will be changed, or any data 27KDE-desktop setup will be changed, or any data
28(calendar-addressbook) used by the KDE-desktop 28(calendar-addressbook) used by the KDE-desktop
29applications will be changed or accessed. 29applications will be changed or accessed.
30These applications stores their data and config in 30These applications stores their data and config in
31$HOME/kdepim/ 31$HOME/kdepim/
32However, because the same file format is used, 32However, because the same file format is used,
33an easy exchange of data with the KDE-desktop 33an easy exchange of data with the KDE-desktop
34is possible. 34is possible.
35A small command line program is included 35A small command line program is included
36to make it possible to sync with the KDE-desktop applications. 36to make it possible to sync with the KDE-desktop applications.
37You do not need to call this program from the commandline, 37You do not need to call this program from the commandline,
38it is called from the KDE-Pim/Pi apps when you choose there: 38it is called from the KDE-Pim/Pi apps when you choose there:
39Sync with KDE_Desktop. 39Sync with KDE_Desktop.
40If something is going wrong, please start the 40If something is going wrong, please start the
41KDE-Pim/Pi program itself from the console to get detailed output. 41KDE-Pim/Pi program itself from the console to get detailed output.
42 42
43After installation, you should have a 43After installation, you should have a
44PIM-pi 44PIM-pi
45folder in your KDE start menu, where you can 45folder in your KDE start menu, where you can
46start the applications from. 46start the applications from.
47 47
48These programs makes it possible to sync your Zaurus easily 48These programs makes it possible to sync your Zaurus easily
49(with the KDE-Pim/Pi programs running on the Zaurus) 49(with the KDE-Pim/Pi programs running on the Zaurus)
50with the KDE-desktop calendar/addressbook data. 50with the KDE-desktop calendar/addressbook data.
51If you want to use that, you have to update your 51If you want to use that, you have to update your
52KDE-desktop to version 3.3.0 or higher. 52KDE-desktop to version 3.3.0 or higher.
53Actually - after the (non difficult) configuration is set up - 53Actually - after the (non difficult) configuration is set up -
54with two mouseklicks on the Zaurus, 54with two mouseklicks on the Zaurus,
55the Zaurus syncs with the corresponding KDE-Pim/Pi 55the Zaurus syncs with the corresponding KDE-Pim/Pi
56program on the Linux Desktop which syncs automatically 56program on the Linux Desktop which syncs automatically
57with the KDE-desktop data. 57with the KDE-desktop data.
58 58
59If you want to use the KDE-desktop calendar/addressbook applications, 59If you want to use the KDE-desktop calendar/addressbook applications,
60just install these apps in this package and use them as a syncing tool for the 60just install these apps in this package and use them as a syncing tool for the
61Zaurus <-> KDE-desktop sync. 61Zaurus <-> KDE-desktop sync.
62The sync requires a network connection from your Zaurus to 62The sync requires a network connection from your Zaurus to
63the PC. A detailed Sync HowTo is available in the 63the PC. A detailed Sync HowTo is available in the
64Help menu of the applications. 64Help menu of the applications.
65 65
66These applications makes it also possible, that you can sync 66These applications makes it also possible, that you can sync
67(or just export the data to) your mobile phone with your 67(or just export the data to) your mobile phone with your
68data of the KDE-desktop calendar/addressbook applications. 68data of the KDE-desktop calendar/addressbook applications.
69This is tested and working for Nokia mobile phones, 69This is tested and working for Nokia mobile phones,
70it may work with others as well. 70it may work with others as well.
71(More info about that: -> Sync HowTo) 71(More info about that: -> Sync HowTo)
72 72
73NOTE: 73NOTE:
74You have to make an online update in SuSE 9.1 to make it 74You have to make an online update in SuSE 9.1 to make it
75possible to get the infrared connection working, such that 75possible to get the infrared connection working, such that
76you can sync your (Nokia) mobile phone via infrared. 76you can sync your (Nokia) mobile phone via infrared.
77 77
78%files 78%files
79/opt/kde3/share/applnk/PIM-pi/ 79/opt/kde3/share/applnk/PIM-pi/
80/opt/kdepimpi/ 80/opt/kdepimpi/
81/usr/lib/libmicro* 81/usr/lib/libmicro*
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index eb07ef1..f54fe2b 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -1,263 +1,263 @@
1#include "smtpwrapper.h" 1#include "smtpwrapper.h"
2#include "mailwrapper.h" 2#include "mailwrapper.h"
3#include "abstractmail.h" 3#include "abstractmail.h"
4#include "logindialog.h" 4#include "logindialog.h"
5#include "mailtypes.h" 5#include "mailtypes.h"
6#include "sendmailprogress.h" 6#include "sendmailprogress.h"
7 7
8//#include <opie2/odebug.h> 8//#include <opie2/odebug.h>
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", "kopiemail" ) ); 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 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
46 env << queued; 46 env << queued;
47#endif 47#endif
48} 48}
49 49
50QString SMTPwrapper::mailsmtpError( int errnum ) { 50QString SMTPwrapper::mailsmtpError( int errnum ) {
51 switch ( errnum ) { 51 switch ( errnum ) {
52 case MAILSMTP_NO_ERROR: 52 case MAILSMTP_NO_ERROR:
53 return i18n( "No error" ); 53 return i18n( "No error" );
54 case MAILSMTP_ERROR_UNEXPECTED_CODE: 54 case MAILSMTP_ERROR_UNEXPECTED_CODE:
55 return i18n( "Unexpected error code" ); 55 return i18n( "Unexpected error code" );
56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
57 return i18n( "Service not available" ); 57 return i18n( "Service not available" );
58 case MAILSMTP_ERROR_STREAM: 58 case MAILSMTP_ERROR_STREAM:
59 return i18n( "Stream error" ); 59 return i18n( "Stream error" );
60 case MAILSMTP_ERROR_HOSTNAME: 60 case MAILSMTP_ERROR_HOSTNAME:
61 return i18n( "gethostname() failed" ); 61 return i18n( "gethostname() failed" );
62 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 62 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
63 return i18n( "Not implemented" ); 63 return i18n( "Not implemented" );
64 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 64 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
65 return i18n( "Error, action not taken" ); 65 return i18n( "Error, action not taken" );
66 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 66 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
67 return i18n( "Data exceeds storage allocation" ); 67 return i18n( "Data exceeds storage allocation" );
68 case MAILSMTP_ERROR_IN_PROCESSING: 68 case MAILSMTP_ERROR_IN_PROCESSING:
69 return i18n( "Error in processing" ); 69 return i18n( "Error in processing" );
70 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 70 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
71 return i18n( "Starttls not supported" ); 71 return i18n( "Starttls not supported" );
72 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: 72 // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
73 // return i18n( "Insufficient system storage" ); 73 // return i18n( "Insufficient system storage" );
74 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: 74 case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
75 return i18n( "Mailbox unavailable" ); 75 return i18n( "Mailbox unavailable" );
76 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: 76 case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
77 return i18n( "Mailbox name not allowed" ); 77 return i18n( "Mailbox name not allowed" );
78 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: 78 case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
79 return i18n( "Bad command sequence" ); 79 return i18n( "Bad command sequence" );
80 case MAILSMTP_ERROR_USER_NOT_LOCAL: 80 case MAILSMTP_ERROR_USER_NOT_LOCAL:
81 return i18n( "User not local" ); 81 return i18n( "User not local" );
82 case MAILSMTP_ERROR_TRANSACTION_FAILED: 82 case MAILSMTP_ERROR_TRANSACTION_FAILED:
83 return i18n( "Transaction failed" ); 83 return i18n( "Transaction failed" );
84 case MAILSMTP_ERROR_MEMORY: 84 case MAILSMTP_ERROR_MEMORY:
85 return i18n( "Memory error" ); 85 return i18n( "Memory error" );
86 case MAILSMTP_ERROR_CONNECTION_REFUSED: 86 case MAILSMTP_ERROR_CONNECTION_REFUSED:
87 return i18n( "Connection refused" ); 87 return i18n( "Connection refused" );
88 default: 88 default:
89 return i18n( "Unknown error code" ); 89 return i18n( "Unknown error code" );
90 } 90 }
91} 91}
92 92
93 93
94void SMTPwrapper::progress( size_t current, size_t maximum ) { 94void SMTPwrapper::progress( size_t current, size_t maximum ) {
95 if (SMTPwrapper::sendProgress) { 95 if (SMTPwrapper::sendProgress) {
96 SMTPwrapper::sendProgress->setSingleMail(current, maximum ); 96 SMTPwrapper::sendProgress->setSingleMail(current, maximum );
97 qApp->processEvents(); 97 qApp->processEvents();
98 } 98 }
99} 99}
100 100
101void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { 101void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
102 if (!mail) 102 if (!mail)
103 return; 103 return;
104 QString localfolders = AbstractMail::defaultLocalfolder(); 104 QString localfolders = AbstractMail::defaultLocalfolder();
105 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 105 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
106 wrap->createMbox(box); 106 wrap->createMbox(box);
107 wrap->storeMessage(mail,length,box); 107 wrap->storeMessage(mail,length,box);
108 delete wrap; 108 delete wrap;
109} 109}
110 110
111bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { 111bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
112 clist *rcpts = 0; 112 clist *rcpts = 0;
113 char *from, *data; 113 char *from, *data;
114 size_t size; 114 size_t size;
115 115
116 from = data = 0; 116 from = data = 0;
117 117
118 mailmessage * msg = 0; 118 mailmessage * msg = 0;
119 msg = mime_message_init(mail); 119 msg = mime_message_init(mail);
120 mime_message_set_tmpdir(msg,getenv( "HOME" )); 120 mime_message_set_tmpdir(msg,getenv( "HOME" ));
121 int r = mailmessage_fetch(msg,&data,&size); 121 int r = mailmessage_fetch(msg,&data,&size);
122 mime_message_detach_mime(msg); 122 mime_message_detach_mime(msg);
123 mailmessage_free(msg); 123 mailmessage_free(msg);
124 if (r != MAIL_NO_ERROR || !data) { 124 if (r != MAIL_NO_ERROR || !data) {
125 if (data) 125 if (data)
126 free(data); 126 free(data);
127 qDebug("Error fetching mime... "); 127 qDebug("Error fetching mime... ");
128 return false; 128 return false;
129 } 129 }
130 msg = 0; 130 msg = 0;
131 if (later) { 131 if (later) {
132 storeMail(data,size,"Outgoing"); 132 storeMail(data,size,"Outgoing");
133 if (data) 133 if (data)
134 free( data ); 134 free( data );
135 KConfig cfg( locateLocal("config", "kopiemail" ) ); 135 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
136 cfg.setGroup( "Status" ); 136 cfg.setGroup( "Status" );
137 cfg.writeEntry( "outgoing", ++m_queuedMail ); 137 cfg.writeEntry( "outgoing", ++m_queuedMail );
138 emit queuedMails( m_queuedMail ); 138 emit queuedMails( m_queuedMail );
139 return true; 139 return true;
140 } 140 }
141 from = getFrom( mail ); 141 from = getFrom( mail );
142 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 142 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
143 bool result = smtpSend(from,rcpts,data,size); 143 bool result = smtpSend(from,rcpts,data,size);
144 if (data) { 144 if (data) {
145 free(data); 145 free(data);
146 } 146 }
147 if (from) { 147 if (from) {
148 free(from); 148 free(from);
149 } 149 }
150 if (rcpts) 150 if (rcpts)
151 smtp_address_list_free( rcpts ); 151 smtp_address_list_free( rcpts );
152 return result; 152 return result;
153} 153}
154 154
155void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 155void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
156{ 156{
157 if (data) { 157 if (data) {
158 storeMail(data,size,"Sendfailed"); 158 storeMail(data,size,"Sendfailed");
159 } 159 }
160 if (failuremessage) { 160 if (failuremessage) {
161 QMessageBox::critical(0,i18n("Error sending mail"), 161 QMessageBox::critical(0,i18n("Error sending mail"),
162 i18n("<center>%1</center>").arg(failuremessage)); 162 i18n("<center>%1</center>").arg(failuremessage));
163 } 163 }
164} 164}
165 165
166int SMTPwrapper::start_smtp_tls() 166int SMTPwrapper::start_smtp_tls()
167{ 167{
168 if (!m_smtp) { 168 if (!m_smtp) {
169 return MAILSMTP_ERROR_IN_PROCESSING; 169 return MAILSMTP_ERROR_IN_PROCESSING;
170 } 170 }
171 int err = mailesmtp_starttls(m_smtp); 171 int err = mailesmtp_starttls(m_smtp);
172 if (err != MAILSMTP_NO_ERROR) return err; 172 if (err != MAILSMTP_NO_ERROR) return err;
173 mailstream_low * low; 173 mailstream_low * low;
174 mailstream_low * new_low; 174 mailstream_low * new_low;
175 low = mailstream_get_low(m_smtp->stream); 175 low = mailstream_get_low(m_smtp->stream);
176 if (!low) { 176 if (!low) {
177 return MAILSMTP_ERROR_IN_PROCESSING; 177 return MAILSMTP_ERROR_IN_PROCESSING;
178 } 178 }
179 int fd = mailstream_low_get_fd(low); 179 int fd = mailstream_low_get_fd(low);
180 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 180 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
181 mailstream_low_free(low); 181 mailstream_low_free(low);
182 mailstream_set_low(m_smtp->stream, new_low); 182 mailstream_set_low(m_smtp->stream, new_low);
183 } else { 183 } else {
184 return MAILSMTP_ERROR_IN_PROCESSING; 184 return MAILSMTP_ERROR_IN_PROCESSING;
185 } 185 }
186 return err; 186 return err;
187} 187}
188 188
189void SMTPwrapper::connect_server() 189void SMTPwrapper::connect_server()
190{ 190{
191 QString server, user, pass; 191 QString server, user, pass;
192 bool ssl; 192 bool ssl;
193 uint16_t port; 193 uint16_t port;
194 ssl = false; 194 ssl = false;
195 bool try_tls = true; 195 bool try_tls = true;
196 bool force_tls=false; 196 bool force_tls=false;
197 QString failuretext = ""; 197 QString failuretext = "";
198 198
199 if (m_smtp || !m_SmtpAccount) { 199 if (m_smtp || !m_SmtpAccount) {
200 return; 200 return;
201 } 201 }
202 server = m_SmtpAccount->getServer(); 202 server = m_SmtpAccount->getServer();
203 if ( m_SmtpAccount->ConnectionType() == 2 ) { 203 if ( m_SmtpAccount->ConnectionType() == 2 ) {
204 ssl = true; 204 ssl = true;
205 try_tls = false; 205 try_tls = false;
206 } else if (m_SmtpAccount->ConnectionType() == 1) { 206 } else if (m_SmtpAccount->ConnectionType() == 1) {
207 force_tls = true; 207 force_tls = true;
208 } 208 }
209 int result = 1; 209 int result = 1;
210 port = m_SmtpAccount->getPort().toUInt(); 210 port = m_SmtpAccount->getPort().toUInt();
211 211
212 m_smtp = mailsmtp_new( 20, &progress ); 212 m_smtp = mailsmtp_new( 20, &progress );
213 if ( m_smtp == NULL ) { 213 if ( m_smtp == NULL ) {
214 /* no failure message cause this happens when problems with memory - than we 214 /* no failure message cause this happens when problems with memory - than we
215 we can not display any messagebox */ 215 we can not display any messagebox */
216 return; 216 return;
217 } 217 }
218 218
219 int err = MAILSMTP_NO_ERROR; 219 int err = MAILSMTP_NO_ERROR;
220 ; // odebug << "Servername " << server << " at port " << port << "" << oendl; 220 ; // odebug << "Servername " << server << " at port " << port << "" << oendl;
221 if ( ssl ) { 221 if ( ssl ) {
222 ; // odebug << "SSL session" << oendl; 222 ; // odebug << "SSL session" << oendl;
223 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); 223 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
224 } else { 224 } else {
225 ; // odebug << "No SSL session" << oendl; 225 ; // odebug << "No SSL session" << oendl;
226 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); 226 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
227 } 227 }
228 if ( err != MAILSMTP_NO_ERROR ) { 228 if ( err != MAILSMTP_NO_ERROR ) {
229 ; // odebug << "Error init connection" << oendl; 229 ; // odebug << "Error init connection" << oendl;
230 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); 230 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
231 result = 0; 231 result = 0;
232 } 232 }
233 233
234 /* switch to tls after init 'cause there it will send the ehlo */ 234 /* switch to tls after init 'cause there it will send the ehlo */
235 if (result) { 235 if (result) {
236 err = mailsmtp_init( m_smtp ); 236 err = mailsmtp_init( m_smtp );
237 if (err != MAILSMTP_NO_ERROR) { 237 if (err != MAILSMTP_NO_ERROR) {
238 result = 0; 238 result = 0;
239 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); 239 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
240 } 240 }
241 } 241 }
242 242
243 if (try_tls) { 243 if (try_tls) {
244 err = start_smtp_tls(); 244 err = start_smtp_tls();
245 if (err != MAILSMTP_NO_ERROR) { 245 if (err != MAILSMTP_NO_ERROR) {
246 try_tls = false; 246 try_tls = false;
247 } else { 247 } else {
248 err = mailesmtp_ehlo(m_smtp); 248 err = mailesmtp_ehlo(m_smtp);
249 } 249 }
250 } 250 }
251 251
252 if (!try_tls && force_tls) { 252 if (!try_tls && force_tls) {
253 result = 0; 253 result = 0;
254 failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err)); 254 failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err));
255 } 255 }
256 256
257 if (result==1 && m_SmtpAccount->getLogin() ) { 257 if (result==1 && m_SmtpAccount->getLogin() ) {
258 ; // odebug << "smtp with auth" << oendl; 258 ; // odebug << "smtp with auth" << oendl;
259 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 259 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
260 // get'em 260 // get'em
261 LoginDialog login( m_SmtpAccount->getUser(), 261 LoginDialog login( m_SmtpAccount->getUser(),
262 m_SmtpAccount->getPassword(), NULL, 0, true ); 262 m_SmtpAccount->getPassword(), NULL, 0, true );
263 login.show(); 263 login.show();
@@ -327,140 +327,140 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later
327 mailmime * mimeMail; 327 mailmime * mimeMail;
328 bool result = true; 328 bool result = true;
329 mimeMail = createMimeMail(mail ); 329 mimeMail = createMimeMail(mail );
330 if ( mimeMail == 0 ) { 330 if ( mimeMail == 0 ) {
331 qDebug("SMTP wrapper:Error creating mail! "); 331 qDebug("SMTP wrapper:Error creating mail! ");
332 return false; 332 return false;
333 } else { 333 } else {
334 sendProgress = new progressMailSend(); 334 sendProgress = new progressMailSend();
335 sendProgress->show(); 335 sendProgress->show();
336 sendProgress->setMaxMails(1); 336 sendProgress->setMaxMails(1);
337 result = smtpSend( mimeMail,later); 337 result = smtpSend( mimeMail,later);
338 ; // odebug << "Clean up done" << oendl; 338 ; // odebug << "Clean up done" << oendl;
339 sendProgress->hide(); 339 sendProgress->hide();
340 delete sendProgress; 340 delete sendProgress;
341 sendProgress = 0; 341 sendProgress = 0;
342 mailmime_free( mimeMail ); 342 mailmime_free( mimeMail );
343 } 343 }
344 return result; 344 return result;
345} 345}
346 346
347int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 347int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
348 size_t curTok = 0; 348 size_t curTok = 0;
349 mailimf_fields *fields = 0; 349 mailimf_fields *fields = 0;
350 mailimf_field*ffrom = 0; 350 mailimf_field*ffrom = 0;
351 clist *rcpts = 0; 351 clist *rcpts = 0;
352 char*from = 0; 352 char*from = 0;
353 int res = 0; 353 int res = 0;
354 354
355 encodedString * data = wrap->fetchRawBody(which); 355 encodedString * data = wrap->fetchRawBody(which);
356 if (!data) 356 if (!data)
357 return 0; 357 return 0;
358 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 358 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
359 if (err != MAILIMF_NO_ERROR) { 359 if (err != MAILIMF_NO_ERROR) {
360 delete data; 360 delete data;
361 delete wrap; 361 delete wrap;
362 return 0; 362 return 0;
363 } 363 }
364 364
365 rcpts = createRcptList( fields ); 365 rcpts = createRcptList( fields );
366 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 366 ffrom = getField(fields, MAILIMF_FIELD_FROM );
367 from = getFrom(ffrom); 367 from = getFrom(ffrom);
368 368
369 if (rcpts && from) { 369 if (rcpts && from) {
370 res = smtpSend(from,rcpts,data->Content(),data->Length()); 370 res = smtpSend(from,rcpts,data->Content(),data->Length());
371 } 371 }
372 if (fields) { 372 if (fields) {
373 mailimf_fields_free(fields); 373 mailimf_fields_free(fields);
374 fields = 0; 374 fields = 0;
375 } 375 }
376 if (data) { 376 if (data) {
377 delete data; 377 delete data;
378 } 378 }
379 if (from) { 379 if (from) {
380 free(from); 380 free(from);
381 } 381 }
382 if (rcpts) { 382 if (rcpts) {
383 smtp_address_list_free( rcpts ); 383 smtp_address_list_free( rcpts );
384 } 384 }
385 return res; 385 return res;
386} 386}
387 387
388/* this is a special fun */ 388/* this is a special fun */
389bool SMTPwrapper::flushOutbox() { 389bool SMTPwrapper::flushOutbox() {
390 bool returnValue = true; 390 bool returnValue = true;
391 391
392 ; // odebug << "Sending the queue" << oendl; 392 ; // odebug << "Sending the queue" << oendl;
393 if (!m_SmtpAccount) { 393 if (!m_SmtpAccount) {
394 ; // odebug << "No smtp account given" << oendl; 394 ; // odebug << "No smtp account given" << oendl;
395 return false; 395 return false;
396 } 396 }
397 397
398 bool reset_user_value = false; 398 bool reset_user_value = false;
399 QString localfolders = AbstractMail::defaultLocalfolder(); 399 QString localfolders = AbstractMail::defaultLocalfolder();
400 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 400 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
401 if (!wrap) { 401 if (!wrap) {
402 ; // odebug << "memory error" << oendl; 402 ; // odebug << "memory error" << oendl;
403 return false; 403 return false;
404 } 404 }
405 QString oldPw, oldUser; 405 QString oldPw, oldUser;
406 QValueList<RecMailP> mailsToSend; 406 QValueList<RecMailP> mailsToSend;
407 QValueList<RecMailP> mailsToRemove; 407 QValueList<RecMailP> mailsToRemove;
408 QString mbox("Outgoing"); 408 QString mbox("Outgoing");
409 wrap->listMessages(mbox,mailsToSend); 409 wrap->listMessages(mbox,mailsToSend);
410 if (mailsToSend.count()==0) { 410 if (mailsToSend.count()==0) {
411 delete wrap; 411 delete wrap;
412 ; // odebug << "No mails to send" << oendl; 412 ; // odebug << "No mails to send" << oendl;
413 return false; 413 return false;
414 } 414 }
415 415
416 oldPw = m_SmtpAccount->getPassword(); 416 oldPw = m_SmtpAccount->getPassword();
417 oldUser = m_SmtpAccount->getUser(); 417 oldUser = m_SmtpAccount->getUser();
418 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 418 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
419 // get'em 419 // get'em
420 QString user,pass; 420 QString user,pass;
421 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 421 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
422 login.show(); 422 login.show();
423 if ( QDialog::Accepted == login.exec() ) { 423 if ( QDialog::Accepted == login.exec() ) {
424 // ok 424 // ok
425 user = login.getUser().latin1(); 425 user = login.getUser().latin1();
426 pass = login.getPassword().latin1(); 426 pass = login.getPassword().latin1();
427 reset_user_value = true; 427 reset_user_value = true;
428 m_SmtpAccount->setUser(user); 428 m_SmtpAccount->setUser(user);
429 m_SmtpAccount->setPassword(pass); 429 m_SmtpAccount->setPassword(pass);
430 } else { 430 } else {
431 return true; 431 return true;
432 } 432 }
433 } 433 }
434 434
435 435
436 sendProgress = new progressMailSend(); 436 sendProgress = new progressMailSend();
437 sendProgress->show(); 437 sendProgress->show();
438 sendProgress->setMaxMails(mailsToSend.count()); 438 sendProgress->setMaxMails(mailsToSend.count());
439 439
440 while (mailsToSend.count()>0) { 440 while (mailsToSend.count()>0) {
441 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 441 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
442 QMessageBox::critical(0,i18n("Error sending mail"), 442 QMessageBox::critical(0,i18n("Error sending mail"),
443 i18n("Error sending queued mail - breaking")); 443 i18n("Error sending queued mail - breaking"));
444 returnValue = false; 444 returnValue = false;
445 break; 445 break;
446 } 446 }
447 mailsToRemove.append((*mailsToSend.begin())); 447 mailsToRemove.append((*mailsToSend.begin()));
448 mailsToSend.remove(mailsToSend.begin()); 448 mailsToSend.remove(mailsToSend.begin());
449 sendProgress->setCurrentMails(mailsToRemove.count()); 449 sendProgress->setCurrentMails(mailsToRemove.count());
450 } 450 }
451 if (reset_user_value) { 451 if (reset_user_value) {
452 m_SmtpAccount->setUser(oldUser); 452 m_SmtpAccount->setUser(oldUser);
453 m_SmtpAccount->setPassword(oldPw); 453 m_SmtpAccount->setPassword(oldPw);
454 } 454 }
455 KConfig cfg( locateLocal("config", "kopiemail" ) ); 455 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
456 cfg.setGroup( "Status" ); 456 cfg.setGroup( "Status" );
457 m_queuedMail = 0; 457 m_queuedMail = 0;
458 cfg.writeEntry( "outgoing", m_queuedMail ); 458 cfg.writeEntry( "outgoing", m_queuedMail );
459 emit queuedMails( m_queuedMail ); 459 emit queuedMails( m_queuedMail );
460 sendProgress->hide(); 460 sendProgress->hide();
461 delete sendProgress; 461 delete sendProgress;
462 sendProgress = 0; 462 sendProgress = 0;
463 wrap->deleteMails(mbox,mailsToRemove); 463 wrap->deleteMails(mbox,mailsToRemove);
464 delete wrap; 464 delete wrap;
465 return returnValue; 465 return returnValue;
466} 466}
diff --git a/version b/version
index 4368d49..c4fe6e2 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.12"; version = "1.9.13";