summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/pop3wrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 5467547..c586c29 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -19,42 +19,42 @@ POP3wrapper::POP3wrapper( POP3account *a )
19 last_msg_id = 0; 19 last_msg_id = 0;
20} 20}
21 21
22POP3wrapper::~POP3wrapper() { 22POP3wrapper::~POP3wrapper() {
23 logout(); 23 logout();
24 QFile msg_cache(msgTempName); 24 QFile msg_cache(msgTempName);
25 if (msg_cache.exists()) { 25 if (msg_cache.exists()) {
26 msg_cache.remove(); 26 msg_cache.remove();
27 } 27 }
28} 28}
29 29
30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
31 qDebug( "POP3: %i of %i", current, maximum ); 31 odebug << "POP3: " << current << " of " << maximum << "" << oendl;
32} 32}
33 33
34RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { 34RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
35 int err = MAILPOP3_NO_ERROR; 35 int err = MAILPOP3_NO_ERROR;
36 char *message = 0; 36 char *message = 0;
37 size_t length = 0; 37 size_t length = 0;
38 38
39 RecBodyP body = new RecBody(); 39 RecBodyP body = new RecBody();
40 40
41 login(); 41 login();
42 if ( !m_pop3 ) { 42 if ( !m_pop3 ) {
43 return body; 43 return body;
44 } 44 }
45 45
46 mailmessage * mailmsg; 46 mailmessage * mailmsg;
47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
48 qDebug("Message to large: %i",mail->Msgsize()); 48 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
49 return body; 49 return body;
50 } 50 }
51 51
52 QFile msg_cache(msgTempName); 52 QFile msg_cache(msgTempName);
53 53
54 cleanMimeCache(); 54 cleanMimeCache();
55 55
56 if (mail->getNumber()!=last_msg_id) { 56 if (mail->getNumber()!=last_msg_id) {
57 if (msg_cache.exists()) { 57 if (msg_cache.exists()) {
58 msg_cache.remove(); 58 msg_cache.remove();
59 } 59 }
60 msg_cache.open(IO_ReadWrite|IO_Truncate); 60 msg_cache.open(IO_ReadWrite|IO_Truncate);
@@ -121,25 +121,25 @@ void POP3wrapper::login()
121 server = account->getServer().latin1(); 121 server = account->getServer().latin1();
122 port = account->getPort().toUInt(); 122 port = account->getPort().toUInt();
123 123
124 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 124 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
125 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 125 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
126 login.show(); 126 login.show();
127 if ( QDialog::Accepted == login.exec() ) { 127 if ( QDialog::Accepted == login.exec() ) {
128 // ok 128 // ok
129 user = login.getUser().latin1(); 129 user = login.getUser().latin1();
130 pass = login.getPassword().latin1(); 130 pass = login.getPassword().latin1();
131 } else { 131 } else {
132 // cancel 132 // cancel
133 qDebug( "POP3: Login canceled" ); 133 odebug << "POP3: Login canceled" << oendl;
134 return; 134 return;
135 } 135 }
136 } else { 136 } else {
137 user = account->getUser().latin1(); 137 user = account->getUser().latin1();
138 pass = account->getPassword().latin1(); 138 pass = account->getPassword().latin1();
139 } 139 }
140 140
141 // bool ssl = account->getSSL(); 141 // bool ssl = account->getSSL();
142 142
143 m_pop3=mailstorage_new(NULL); 143 m_pop3=mailstorage_new(NULL);
144 144
145 int conntypeset = account->ConnectionType(); 145 int conntypeset = account->ConnectionType();
@@ -153,25 +153,25 @@ void POP3wrapper::login()
153 } else if ( conntypeset == 0 ) { 153 } else if ( conntypeset == 0 ) {
154 conntype = CONNECTION_TYPE_TRY_STARTTLS; 154 conntype = CONNECTION_TYPE_TRY_STARTTLS;
155 } 155 }
156 156
157 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); 157 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
158 158
159 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 159 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
160 (char*)user,(char*)pass,0,0,0); 160 (char*)user,(char*)pass,0,0,0);
161 161
162 162
163 err = mailstorage_connect(m_pop3); 163 err = mailstorage_connect(m_pop3);
164 if (err != MAIL_NO_ERROR) { 164 if (err != MAIL_NO_ERROR) {
165 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 165 odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
166 Global::statusMessage(tr("Error initializing folder")); 166 Global::statusMessage(tr("Error initializing folder"));
167 mailstorage_free(m_pop3); 167 mailstorage_free(m_pop3);
168 m_pop3 = 0; 168 m_pop3 = 0;
169 } else { 169 } else {
170 mailsession * session = m_pop3->sto_session; 170 mailsession * session = m_pop3->sto_session;
171 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; 171 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
172 if (mail) { 172 if (mail) {
173 mail->pop3_progr_fun = &pop3_progress; 173 mail->pop3_progr_fun = &pop3_progress;
174 } 174 }
175 } 175 }
176} 176}
177 177
@@ -227,25 +227,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
227} 227}
228 228
229void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { 229void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
230 login(); 230 login();
231 target_stat.message_count = 0; 231 target_stat.message_count = 0;
232 target_stat.message_unseen = 0; 232 target_stat.message_unseen = 0;
233 target_stat.message_recent = 0; 233 target_stat.message_recent = 0;
234 if (!m_pop3) 234 if (!m_pop3)
235 return; 235 return;
236 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, 236 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
237 &target_stat.message_recent,&target_stat.message_unseen); 237 &target_stat.message_recent,&target_stat.message_unseen);
238 if (r != MAIL_NO_ERROR) { 238 if (r != MAIL_NO_ERROR) {
239 qDebug("error getting folter status."); 239 odebug << "error getting folter status." << oendl;
240 } 240 }
241} 241}
242 242
243encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { 243encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
244 char*target=0; 244 char*target=0;
245 size_t length=0; 245 size_t length=0;
246 encodedString*res = 0; 246 encodedString*res = 0;
247 mailmessage * mailmsg = 0; 247 mailmessage * mailmsg = 0;
248 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); 248 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
249 err = mailmessage_fetch(mailmsg,&target,&length); 249 err = mailmessage_fetch(mailmsg,&target,&length);
250 if (mailmsg) 250 if (mailmsg)
251 mailmessage_free(mailmsg); 251 mailmessage_free(mailmsg);