summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp86
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp60
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp21
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp47
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h7
7 files changed, 144 insertions, 92 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 1caa375..5ec9415 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -4,4 +4,6 @@
#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+#include <qdatetime.h>
using namespace Opie::Core;
@@ -244,10 +246,9 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg )
QString Genericwrapper::parseDateTime( mailimf_date_time *date )
{
- char tmp[23];
-
- snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i",
- date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
-
- return QString( tmp );
+ QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
+ QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
+ timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
+ timestring.sprintf(timestring+" %+05i",date->dt_zone);
+ return timestring;
}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 9b7c0e0..fe75a15 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -32,5 +32,5 @@ int IMAPwrapper::selectMbox(const QString&mbox)
int err = mailimap_select( m_imap, (char*)mbox.latin1());
if ( err != MAILIMAP_NO_ERROR ) {
- odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
+ odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
m_Lastmbox = "";
return err;
@@ -43,5 +43,5 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum )
{
qApp->processEvents();
- odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
+ odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
}
@@ -55,5 +55,5 @@ bool IMAPwrapper::start_tls(bool force_tls)
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage("error getting capabilities!");
- odebug << "error getting capabilities!" << oendl;
+ odebug << "error getting capabilities!" << oendl;
return false;
}
@@ -76,5 +76,5 @@ bool IMAPwrapper::start_tls(bool force_tls)
if (err != MAILIMAP_NO_ERROR && force_tls) {
Global::statusMessage(tr("Server has no TLS support!"));
- odebug << "Server has no TLS support!" << oendl;
+ odebug << "Server has no TLS support!" << oendl;
try_tls = false;
} else {
@@ -127,5 +127,5 @@ void IMAPwrapper::login()
} else {
// cancel
- odebug << "IMAP: Login canceled" << oendl;
+ odebug << "IMAP: Login canceled" << oendl;
return;
}
@@ -150,5 +150,5 @@ void IMAPwrapper::login()
if ( ssl ) {
- odebug << "using ssl" << oendl;
+ odebug << "using ssl" << oendl;
err = mailimap_ssl_connect( m_imap, (char*)server, port );
} else {
@@ -178,5 +178,5 @@ void IMAPwrapper::login()
if (force_tls && !try_tls) {
Global::statusMessage(tr("Server has no TLS support!"));
- odebug << "Server has no TLS support!" << oendl;
+ odebug << "Server has no TLS support!" << oendl;
ok = false;
}
@@ -238,4 +238,8 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( 1, last );
+
+
+ fetchType = mailimap_fetch_type_new_all();
+/*
fetchType = mailimap_fetch_type_new_fetch_att_list_empty();
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope());
@@ -243,5 +247,5 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate());
mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size());
-
+*/
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
@@ -319,5 +323,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
}
} else {
- odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
}
mailimap_list_result_free( result );
@@ -329,5 +333,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
path = account->getPrefix().latin1();
if (!path) path = "";
- odebug << path << oendl;
+ odebug << path << oendl;
err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
if ( err == MAILIMAP_NO_ERROR ) {
@@ -356,5 +360,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
}
} else {
- odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_list_result_free( result );
@@ -376,8 +380,8 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
return m;
}
+ size = 0;
m = new RecMail();
for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
current = c;
- size = 0;
item = (mailimap_msg_att_item*)current->data;
if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
@@ -466,11 +470,18 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
#if 0
- mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
+ mailimap_date_time*date = item->att_data.att_static->att_data.att_internal_date;
+ if (date->dt_sec>60 || date->dt_sec<0) date->dt_sec=0;
+ //QDateTime da(QDate(d->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
+ QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
+ timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
+ timestring.sprintf(timestring+" %+05i",date->dt_zone);
+ m->setDate(timestring);
QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
- odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
- odebug << da.toString() << oendl;
+ odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
+ odebug << da.toString() << oendl;
#endif
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
- size = item->att_data.att_static->att_data.att_rfc822_size;
+ //size = item->att_data.att_static->att_data.att_rfc822_size;
+ m->setMsgsize(item->att_data.att_static->att_data.att_rfc822_size);
}
}
@@ -482,5 +493,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
if (m) {
m->setFlags(mFlags);
- m->setMsgsize(size);
}
return m;
@@ -526,5 +536,5 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
traverseBody(mail,body_desc,body,0,path);
} else {
- odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
@@ -638,5 +648,5 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
}
} else {
- odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
+ odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
@@ -665,5 +675,5 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
id+=QString("%1").arg(countlist[j]);
}
- odebug << "ID = " << id.latin1() << "" << oendl;
+ odebug << "ID = " << id.latin1() << "" << oendl;
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
@@ -706,5 +716,5 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
id+=QString("%1").arg(countlist[j]);
}
- odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
+ odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
}
traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
@@ -750,5 +760,5 @@ void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_tex
QString sub;
sub = which->bd_media_text;
- odebug << "Type= text/" << which->bd_media_text << "" << oendl;
+ odebug << "Type= text/" << which->bd_media_text << "" << oendl;
target_part->setSubtype(sub.lower());
target_part->setLines(which->bd_lines);
@@ -762,5 +772,5 @@ void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*
}
target_part->setSubtype("rfc822");
- odebug << "Message part" << oendl;
+ odebug << "Message part" << oendl;
/* we set this type to text/plain */
target_part->setLines(which->bd_lines);
@@ -821,5 +831,5 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
sub = "";
}
- odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
+ odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
target_part->setType(type.lower());
target_part->setSubtype(sub.lower());
@@ -897,14 +907,14 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
if (err != MAILIMAP_NO_ERROR) {
- odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
return;
}
- odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
- odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
}
- odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
+ odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
}
@@ -932,5 +942,5 @@ void IMAPwrapper::answeredMail(const RecMailP&mail)
if (err != MAILIMAP_NO_ERROR) {
- odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
return;
}
@@ -1000,5 +1010,5 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
return 0;
}
- odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
+ odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
@@ -1007,5 +1017,5 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
return 0;
}
- odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
+ odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
return 1;
}
@@ -1032,5 +1042,5 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons
}
}
- odebug << "Creating " << pre.latin1() << "" << oendl;
+ odebug << "Creating " << pre.latin1() << "" << oendl;
int res = mailimap_create(m_imap,pre.latin1());
if (res != MAILIMAP_NO_ERROR) {
@@ -1091,5 +1101,5 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
}
} else {
- odebug << "Error retrieving status" << oendl;
+ odebug << "Error retrieving status" << oendl;
}
if (status) mailimap_mailbox_data_status_free(status);
@@ -1115,5 +1125,5 @@ MAILLIB::ATYPE IMAPwrapper::getType()const
const QString&IMAPwrapper::getName()const
{
- odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
+ odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
return account->getAccountName();
}
@@ -1131,5 +1141,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
if (targetWrapper != this) {
AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
return;
}
@@ -1150,5 +1160,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
- odebug << error_msg << oendl;
+ odebug << error_msg << oendl;
return;
}
@@ -1161,5 +1171,5 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra
{
if (targetWrapper != this) {
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
return;
@@ -1180,5 +1190,5 @@ void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstra
QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
- odebug << error_msg << oendl;
+ odebug << error_msg << oendl;
return;
}
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index 403afcf..765a21c 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -18,5 +18,5 @@ MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
MHPath=MHPath.left(MHPath.length()-1);
}
- odebug << MHPath << oendl;
+ odebug << MHPath << oendl;
QDir dir(MHPath);
if (!dir.exists()) {
@@ -35,5 +35,5 @@ void MHwrapper::init_storage()
r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
- odebug << "error initializing storage" << oendl;
+ odebug << "error initializing storage" << oendl;
mailstorage_free(m_storage);
m_storage = 0;
@@ -43,5 +43,5 @@ void MHwrapper::init_storage()
r = mailstorage_connect(m_storage);
if (r!=MAIL_NO_ERROR) {
- odebug << "error connecting storage" << oendl;
+ odebug << "error connecting storage" << oendl;
mailstorage_free(m_storage);
m_storage = 0;
@@ -72,5 +72,5 @@ void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSm
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "listMessages: error selecting folder!" << oendl;
+ odebug << "listMessages: error selecting folder!" << oendl;
return;
}
@@ -92,5 +92,5 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
if (r != MAIL_NO_ERROR || !flist) {
- odebug << "error getting folder list" << oendl;
+ odebug << "error getting folder list" << oendl;
return folders;
}
@@ -112,10 +112,10 @@ void MHwrapper::deleteMail(const RecMailP&mail)
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return;
}
r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
- odebug << "error deleting mail" << oendl;
+ odebug << "error deleting mail" << oendl;
}
}
@@ -142,5 +142,5 @@ RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
+ odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
return body;
}
@@ -152,5 +152,5 @@ RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
void MHwrapper::mbox_progress( size_t current, size_t maximum )
{
- odebug << "MH " << current << " von " << maximum << "" << oendl;
+ odebug << "MH " << current << " von " << maximum << "" << oendl;
}
@@ -185,11 +185,11 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri
f+=folder;
}
- odebug << f << oendl;
+ odebug << f << oendl;
int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
if (r != MAIL_NO_ERROR) {
- odebug << "error creating folder " << r << "" << oendl;
+ odebug << "error creating folder " << r << "" << oendl;
return 0;
}
- odebug << "Folder created" << oendl;
+ odebug << "Folder created" << oendl;
return 1;
}
@@ -204,10 +204,10 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return;
}
r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
if (r!=MAIL_NO_ERROR) {
- odebug << "error storing mail" << oendl;
+ odebug << "error storing mail" << oendl;
}
return;
@@ -226,5 +226,5 @@ encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return result;
}
@@ -250,5 +250,5 @@ void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "deleteMails: error selecting folder!" << oendl;
+ odebug << "deleteMails: error selecting folder!" << oendl;
return;
}
@@ -257,5 +257,5 @@ void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &
r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
if (r != MAIL_NO_ERROR) {
- odebug << "error deleting mail" << oendl;
+ odebug << "error deleting mail" << oendl;
break;
}
@@ -273,5 +273,5 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder)
int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting folder!" << oendl;
+ odebug << "error selecting folder!" << oendl;
return 0;
}
@@ -279,5 +279,5 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder)
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
- odebug << "Error message list" << oendl;
+ odebug << "Error message list" << oendl;
res = 0;
}
@@ -310,5 +310,5 @@ int MHwrapper::deleteMbox(const FolderP&tfolder)
if (r != MAIL_NO_ERROR) {
- odebug << "error deleting mail box" << oendl;
+ odebug << "error deleting mail box" << oendl;
return 0;
}
@@ -328,8 +328,8 @@ int MHwrapper::deleteMbox(const FolderP&tfolder)
removeMboxfailed = false;
if(!process->start(OProcess::Block, OProcess::All) ) {
- odebug << "could not start process" << oendl;
+ odebug << "could not start process" << oendl;
return 0;
}
- odebug << "mail box deleted" << oendl;
+ odebug << "mail box deleted" << oendl;
return 1;
}
@@ -380,13 +380,13 @@ void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstract
}
if (targetWrapper != this) {
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
return;
}
- odebug << "Using internal routines for move/copy" << oendl;
+ odebug << "Using internal routines for move/copy" << oendl;
QString tf = buildPath(targetFolder);
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
- odebug << "Error selecting source mailbox" << oendl;
+ odebug << "Error selecting source mailbox" << oendl;
return;
}
@@ -397,5 +397,5 @@ void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,Abstract
}
if (r != MAIL_NO_ERROR) {
- odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
+ odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
}
}
@@ -409,5 +409,5 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
}
if (targetWrapper != this) {
- odebug << "Using generic" << oendl;
+ odebug << "Using generic" << oendl;
Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
return;
@@ -416,5 +416,5 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
- odebug << "error selecting source folder!" << oendl;
+ odebug << "error selecting source folder!" << oendl;
return;
}
@@ -423,5 +423,5 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
- odebug << "Error message list" << oendl;
+ odebug << "Error message list" << oendl;
}
unsigned j = 0;
@@ -436,5 +436,5 @@ void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
}
if (r != MAIL_NO_ERROR) {
- odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
+ odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
break;
}
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
@@ -8,4 +8,5 @@
#include <qpe/global.h>
#include <qfile.h>
+#include <qmessagebox.h>
/* we don't fetch messages larger than 5 MB */
@@ -19,4 +20,6 @@ POP3wrapper::POP3wrapper( POP3account *a )
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
+ m_maxsize = account->getMaxSize();
+ m_checksize = account->getCheckMaxSize();
}
@@ -30,5 +33,5 @@ POP3wrapper::~POP3wrapper() {
void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
- odebug << "POP3: " << current << " of " << maximum << "" << oendl;
+ odebug << "POP3: " << current << " of " << maximum << "" << oendl;
}
@@ -46,7 +49,11 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
mailmessage * mailmsg;
- if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
- odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
- return body;
+ if (mail->Msgsize()/1024>m_maxsize && m_checksize && mail->getNumber()!=last_msg_id) {
+ QString quest = QString(tr("Download mail?\nIt is %1 kByte but your limit is %2 kByte")).arg(mail->Msgsize()/1024).arg(m_maxsize);
+ int yesno = QMessageBox::warning(0,tr("Download message"),
+ quest,tr("Yes"),tr("No"),QString::null,0,1);
+ odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
+ if (yesno==1)
+ return body;
}
@@ -132,5 +139,5 @@ void POP3wrapper::login()
} else {
// cancel
- odebug << "POP3: Login canceled" << oendl;
+ odebug << "POP3: Login canceled" << oendl;
return;
}
@@ -164,5 +171,5 @@ void POP3wrapper::login()
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
- odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
+ odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_pop3);
@@ -238,5 +245,5 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
&target_stat.message_recent,&target_stat.message_unseen);
if (r != MAIL_NO_ERROR) {
- odebug << "error getting folter status." << oendl;
+ odebug << "error getting folter status." << oendl;
}
}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index 5101fa5..8c36cf9 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -38,4 +38,6 @@ protected:
POP3account *account;
mailstorage*m_pop3;
+ int m_maxsize;
+ bool m_checksize;
};
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 3c9b25c..09be91b 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -17,5 +17,4 @@
#define NNTP_SSL_PORT "563"
-
Settings::Settings()
: QObject()
@@ -28,5 +27,5 @@ void Settings::checkDirectory()
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
- odebug << "$HOME/Applications/opiemail created" << oendl;
+ odebug << "$HOME/Applications/opiemail created" << oendl;
}
}
@@ -56,5 +55,5 @@ void Settings::updateAccounts()
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
- odebug << "Added IMAP account" << oendl;
+ odebug << "Added IMAP account" << oendl;
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
@@ -63,5 +62,5 @@ void Settings::updateAccounts()
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
- odebug << "Added POP account" << oendl;
+ odebug << "Added POP account" << oendl;
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
@@ -70,5 +69,5 @@ void Settings::updateAccounts()
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
- odebug << "Added SMTP account" << oendl;
+ odebug << "Added SMTP account" << oendl;
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
@@ -77,5 +76,5 @@ void Settings::updateAccounts()
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
- odebug << "Added NNTP account" << oendl;
+ odebug << "Added NNTP account" << oendl;
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
@@ -181,5 +180,5 @@ void IMAPaccount::read()
void IMAPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
@@ -214,4 +213,6 @@ POP3account::POP3account()
type = MAILLIB::A_POP3;
port = POP3_PORT;
+ m_CheckSize = true;
+ m_MaxSize = 1024;
}
@@ -225,4 +226,6 @@ POP3account::POP3account( QString filename )
type = MAILLIB::A_POP3;
port = POP3_PORT;
+ m_CheckSize = true;
+ m_MaxSize = 1024;
}
@@ -254,4 +257,6 @@ void POP3account::read()
password = conf->readEntryCrypt( "Password" );
offline = conf->readBoolEntry("Offline",false);
+ m_CheckSize = conf->readBoolEntry("Checkmaxsize",true);
+ m_MaxSize = conf->readNumEntry("Maxsize",1024);
delete conf;
}
@@ -259,5 +264,5 @@ void POP3account::read()
void POP3account::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
@@ -272,4 +277,6 @@ void POP3account::save()
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Offline",offline);
+ conf->writeEntry("Checkmaxsize",m_CheckSize);
+ conf->writeEntry("Maxsize",m_MaxSize);
conf->write();
delete conf;
@@ -282,4 +289,24 @@ QString POP3account::getFileName()
}
+bool POP3account::getCheckMaxSize()const
+{
+ return m_CheckSize;
+}
+
+void POP3account::setCheckMaxSize(bool aValue)
+{
+ m_CheckSize = aValue;
+}
+
+int POP3account::getMaxSize()const
+{
+ return m_MaxSize;
+}
+
+void POP3account::setMaxSize(int aValue)
+{
+ m_MaxSize = aValue;
+}
+
SMTPaccount::SMTPaccount()
: Account()
@@ -341,5 +368,5 @@ void SMTPaccount::read()
void SMTPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
@@ -418,5 +445,5 @@ void NNTPaccount::read()
void NNTPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index bf27b97..8683a05 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -90,8 +90,13 @@ public:
virtual void save();
virtual QString getFileName();
+ virtual bool getCheckMaxSize()const;
+ virtual void setCheckMaxSize(bool);
+ virtual int getMaxSize()const;
+ virtual void setMaxSize(int);
private:
QString file;
-
+ bool m_CheckSize;
+ int m_MaxSize;
};