Diffstat (limited to 'noncore/net/mail/libmailwrapper/pop3wrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 21 |
1 files changed, 14 insertions, 7 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 | |||
@@ -7,6 +7,7 @@ | |||
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 |
@@ -18,6 +19,8 @@ POP3wrapper::POP3wrapper( POP3account *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 | ||
23 | POP3wrapper::~POP3wrapper() { | 26 | POP3wrapper::~POP3wrapper() { |
@@ -29,7 +32,7 @@ POP3wrapper::~POP3wrapper() { | |||
29 | } | 32 | } |
30 | 33 | ||
31 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { | 34 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { |
32 | odebug << "POP3: " << current << " of " << maximum << "" << oendl; | 35 | odebug << "POP3: " << current << " of " << maximum << "" << oendl; |
33 | } | 36 | } |
34 | 37 | ||
35 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | 38 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { |
@@ -45,9 +48,13 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | |||
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) { |
49 | odebug << "Message to large: " << mail->Msgsize() << "" << oendl; | 52 | QString quest = QString(tr("Download mail?\nIt is %1 kByte but your limit is %2 kByte")).arg(mail->Msgsize()/1024).arg(m_maxsize); |
50 | return body; | 53 | int yesno = QMessageBox::warning(0,tr("Download message"), |
54 | quest,tr("Yes"),tr("No"),QString::null,0,1); | ||
55 | odebug << "Message to large: " << mail->Msgsize() << "" << oendl; | ||
56 | if (yesno==1) | ||
57 | return body; | ||
51 | } | 58 | } |
52 | 59 | ||
53 | QFile msg_cache(msgTempName); | 60 | QFile msg_cache(msgTempName); |
@@ -131,7 +138,7 @@ void POP3wrapper::login() | |||
131 | pass = login.getPassword().latin1(); | 138 | pass = login.getPassword().latin1(); |
132 | } else { | 139 | } else { |
133 | // cancel | 140 | // cancel |
134 | odebug << "POP3: Login canceled" << oendl; | 141 | odebug << "POP3: Login canceled" << oendl; |
135 | return; | 142 | return; |
136 | } | 143 | } |
137 | } else { | 144 | } else { |
@@ -163,7 +170,7 @@ void POP3wrapper::login() | |||
163 | 170 | ||
164 | err = mailstorage_connect(m_pop3); | 171 | err = mailstorage_connect(m_pop3); |
165 | if (err != MAIL_NO_ERROR) { | 172 | if (err != MAIL_NO_ERROR) { |
166 | odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; | 173 | odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
167 | Global::statusMessage(tr("Error initializing folder")); | 174 | Global::statusMessage(tr("Error initializing folder")); |
168 | mailstorage_free(m_pop3); | 175 | mailstorage_free(m_pop3); |
169 | m_pop3 = 0; | 176 | m_pop3 = 0; |
@@ -237,7 +244,7 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { | |||
237 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, | 244 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, |
238 | &target_stat.message_recent,&target_stat.message_unseen); | 245 | &target_stat.message_recent,&target_stat.message_unseen); |
239 | if (r != MAIL_NO_ERROR) { | 246 | if (r != MAIL_NO_ERROR) { |
240 | odebug << "error getting folter status." << oendl; | 247 | odebug << "error getting folter status." << oendl; |
241 | } | 248 | } |
242 | } | 249 | } |
243 | 250 | ||