summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/pop3wrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 3cfd1ee..2d66fc9 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -1,32 +1,35 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include "pop3wrapper.h" 2#include "pop3wrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "logindialog.h" 4#include "logindialog.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6 6
7#include <opie2/odebug.h> 7#include <opie2/odebug.h>
8#include <qpe/global.h> 8#include <qpe/global.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qmessagebox.h>
10 11
11/* we don't fetch messages larger than 5 MB */ 12/* we don't fetch messages larger than 5 MB */
12#define HARD_MSG_SIZE_LIMIT 5242880 13#define HARD_MSG_SIZE_LIMIT 5242880
13 14
14using namespace Opie::Core; 15using namespace Opie::Core;
15POP3wrapper::POP3wrapper( POP3account *a ) 16POP3wrapper::POP3wrapper( POP3account *a )
16: Genericwrapper() { 17: Genericwrapper() {
17 account = a; 18 account = a;
18 m_pop3 = NULL; 19 m_pop3 = NULL;
19 msgTempName = a->getFileName()+"_msg_cache"; 20 msgTempName = a->getFileName()+"_msg_cache";
20 last_msg_id = 0; 21 last_msg_id = 0;
22 m_maxsize = account->getMaxSize();
23 m_checksize = account->getCheckMaxSize();
21} 24}
22 25
23POP3wrapper::~POP3wrapper() { 26POP3wrapper::~POP3wrapper() {
24 logout(); 27 logout();
25 QFile msg_cache(msgTempName); 28 QFile msg_cache(msgTempName);
26 if (msg_cache.exists()) { 29 if (msg_cache.exists()) {
27 msg_cache.remove(); 30 msg_cache.remove();
28 } 31 }
29} 32}
30 33
31void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 34void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
32 odebug << "POP3: " << current << " of " << maximum << "" << oendl; 35 odebug << "POP3: " << current << " of " << maximum << "" << oendl;
@@ -36,26 +39,30 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
36 int err = MAILPOP3_NO_ERROR; 39 int err = MAILPOP3_NO_ERROR;
37 char *message = 0; 40 char *message = 0;
38 size_t length = 0; 41 size_t length = 0;
39 42
40 RecBodyP body = new RecBody(); 43 RecBodyP body = new RecBody();
41 44
42 login(); 45 login();
43 if ( !m_pop3 ) { 46 if ( !m_pop3 ) {
44 return body; 47 return body;
45 } 48 }
46 49
47 mailmessage * mailmsg; 50 mailmessage * mailmsg;
48 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 51 if (mail->Msgsize()/1024>m_maxsize && m_checksize && mail->getNumber()!=last_msg_id) {
52 QString quest = QString(tr("Download mail?\nIt is %1 kByte but your limit is %2 kByte")).arg(mail->Msgsize()/1024).arg(m_maxsize);
53 int yesno = QMessageBox::warning(0,tr("Download message"),
54 quest,tr("Yes"),tr("No"),QString::null,0,1);
49 odebug << "Message to large: " << mail->Msgsize() << "" << oendl; 55 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
56 if (yesno==1)
50 return body; 57 return body;
51 } 58 }
52 59
53 QFile msg_cache(msgTempName); 60 QFile msg_cache(msgTempName);
54 61
55 cleanMimeCache(); 62 cleanMimeCache();
56 63
57 if (mail->getNumber()!=last_msg_id) { 64 if (mail->getNumber()!=last_msg_id) {
58 if (msg_cache.exists()) { 65 if (msg_cache.exists()) {
59 msg_cache.remove(); 66 msg_cache.remove();
60 } 67 }
61 msg_cache.open(IO_ReadWrite|IO_Truncate); 68 msg_cache.open(IO_ReadWrite|IO_Truncate);