author | zautrix <zautrix> | 2004-09-11 15:41:30 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 15:41:30 (UTC) |
commit | 32f9963a39236d08718a36d5adad2a0c5c4e2602 (patch) (side-by-side diff) | |
tree | 8856a90d505df8dc3afa0d72541f27cb68913a0d /kmicromail/libmailwrapper | |
parent | d7a273f40838f56205c1377ed0bcc5457bd46ea3 (diff) | |
download | kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.zip kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.tar.gz kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.tar.bz2 |
Mail enhancements
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 67 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.h | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 64 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 18 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 23 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mboxwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 1 |
14 files changed, 177 insertions, 17 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index f876235..374d606 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -1,24 +1,25 @@ // CHANGED 2004-09-31 Lutz Rogowski #include "abstractmail.h" #include "imapwrapper.h" #include "pop3wrapper.h" #include "nntpwrapper.h" #include "mhwrapper.h" #include "mailtypes.h" #include <qpe/global.h> #include <qprogressbar.h> #include <qapplication.h> +#include <qmessagebox.h> #include <kdecore/kstandarddirs.h> #include <qfile.h> #include <qtextstream.h> #include <stdlib.h> #include <libetpan/mailmime_content.h> #include <libetpan/mailmime.h> using namespace Opie::Core; AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) { return new IMAPwrapper(a); @@ -149,24 +150,90 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) int count = target.count(); QWidget wid; wid.show(); while (iii < count ) { Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); wid.raise(); qApp->processEvents(); RecMailP mail = (*target.at( iii )); deleteMail(mail); ++iii; } } + +void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) +{ + qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); + // get local folder + Account * acc = getAccount(); + if ( !acc ) return; + QString lfName = acc->getLocalFolder(); + if ( lfName.isEmpty() ) + lfName = acc->getAccountName(); + // create local folder + if ( !targetMail->createMbox(lfName)) + { + QMessageBox::critical(0,tr("Error creating new Folder"), + tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); + return; + } + QValueList<RecMailP> t; + listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); + if ( t.count() == 0 ) { + Global::statusMessage(tr("There are no new messages")); + return; + } + QValueList<RecMailP> e; + targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); + qDebug("target has mails %d ", e.count()); + QValueList<RecMailP> n; + int iii = 0; + int count = t.count(); + while (iii < count ) { + RecMailP r = (*t.at( iii )); + bool found = false; + int jjj = 0; + int countE = e.count(); + while (jjj < countE ) { + RecMailP re = (*e.at( jjj )); + if ( re->isEqual(r) ) { + found = true; + break; + } + ++jjj; + } + if ( found ) + qDebug("found "); + else + qDebug("NOT found "); + + if ( !found ) { + n.append( r ); + } + ++iii; + } + if ( n.count() == 0 ) { + Global::statusMessage(tr("There are no new messages")); + return; + } + mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); + + +#if 0 + QValueList<RecMailP> t; + listMessages(fromFolder->getName(),t, maxSizeInKb); + mvcpMailList( t,targetFolder,targetWrapper,moveit); +#endif + +} void AbstractMail::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) { QValueList<RecMailP> t; listMessages(fromFolder->getName(),t, maxSizeInKb); mvcpMailList( t,targetFolder,targetWrapper,moveit); } void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { encodedString*st = 0; diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h index cae83f4..2069ca1 100644 --- a/kmicromail/libmailwrapper/abstractmail.h +++ b/kmicromail/libmailwrapper/abstractmail.h @@ -1,24 +1,27 @@ // CHANGED 2004-09-31 Lutz Rogowski #ifndef __abstract_mail_ #define __abstract_mail_ #include "maildefines.h" #include "settings.h" #include <qobject.h> #include <opie2/osmartpointer.h> #include "mailtypes.h" + +#include "mailwrapper.h" + class IMAPwrapper; class POP3wrapper; class Folder; class encodedString; struct folderStat; class AbstractMail:public QObject { Q_OBJECT public: AbstractMail(){}; virtual ~AbstractMail(){} @@ -29,41 +32,43 @@ public: virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; virtual encodedString* fetchRawBody(const RecMailP&mail)=0; virtual void deleteMail(const RecMailP&mail)=0; virtual void deleteMailList(const QValueList<RecMailP>&target); virtual void answeredMail(const RecMailP&mail)=0; virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; - + void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper ); virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); virtual void mvcpMailList(const QValueList<RecMailP>& t, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void cleanMimeCache(){}; /* mail box methods */ /* parameter is the box to create. * if the implementing subclass has prefixes, * them has to be appended automatic. */ virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, const QString& delemiter="/",bool getsubfolder=false); virtual void logout()=0; + virtual Account* getAccount() = 0; + static AbstractMail* getWrapper(IMAPaccount *a); static AbstractMail* getWrapper(POP3account *a); static AbstractMail* getWrapper(NNTPaccount *a); /* mbox only! */ static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); static AbstractMail* getWrapper(Account*a); static QString defaultLocalfolder(); static QString draftFolder(); virtual MAILLIB::ATYPE getType()const=0; virtual const QString&getName()const=0; diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 9614d53..2b04847 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -1,38 +1,83 @@ // CHANGED 2004-09-31 Lutz Rogowski #include "genericwrapper.h" #include <libetpan/libetpan.h> #include "mailtypes.h" +#include <kconfig.h> +#include <kglobal.h> +#include <kstandarddirs.h> using namespace Opie::Core; Genericwrapper::Genericwrapper() : AbstractMail() { bodyCache.clear(); m_storage = 0; m_folder = 0; } Genericwrapper::~Genericwrapper() { if (m_folder) { mailfolder_free(m_folder); } if (m_storage) { mailstorage_free(m_storage); } cleanMimeCache(); } +QString Genericwrapper::parseDateTime( mailimf_date_time *date ) +{ + static bool init = false ; + if ( ! init ) { + KConfig kon ( locateLocal( "config", "korganizerrc" ) ); + kon.setGroup("Locale"); + KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); + QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); + KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); + KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); + kon.setGroup("Time & Date"); + KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), + kon.readNumEntry( "DaylightsavingStart", 90), + kon.readNumEntry( "DaylightsavingEnd",304) ); + KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); + + init = true; + + } + QDateTime dt (QDate(date->dt_year,date->dt_month, date->dt_day ),QTime(date->dt_hour, date->dt_min, date->dt_sec ) ); + int off = KGlobal::locale()->localTimeOffset( dt ); + dt = dt.addSecs( off*60 ); + QString ret = KGlobal::locale()->formatDateTime( dt,true,true); + if ( off < 0 ) + ret += " -"; + else + ret += " +"; + ret += QString::number( off / 60 ); + ret += "h"; +#if 0 + 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 ); + snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", + date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + + + return QString( tmp ); +#endif + return ret; +} void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) { if (!mime) { return; } mailmime_field*field = 0; mailmime_single_fields fields; memset(&fields, 0, sizeof(struct mailmime_single_fields)); if (mime->mm_mime_fields != NULL) { mailmime_single_fields_init(&fields, mime->mm_mime_fields, mime->mm_content_type); @@ -233,35 +278,24 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg ) int err = MAILIMF_NO_ERROR; mailmime_single_fields fields; /* is bound to msg and will be freed there */ mailmime * mime=0; RecBodyP body = new RecBody(); memset(&fields, 0, sizeof(struct mailmime_single_fields)); err = mailmessage_get_bodystructure(msg,&mime); QValueList<int>recList; traverseBody(body,msg,mime,recList); return body; } -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 ); - snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", - date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); - - return QString( tmp ); -} QString Genericwrapper::parseAddressList( mailimf_address_list *list ) { QString result( "" ); bool first = true; if (list == 0) return result; for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { mailimf_address *addr = (mailimf_address *) current->data; if ( !first ) { result.append( "," ); @@ -439,26 +473,32 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & if (single_fields.fld_from) mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); if (!mbox_as_to) { if (single_fields.fld_to) mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); } else { mail->setTo(mailbox); } if (single_fields.fld_cc) mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); if (single_fields.fld_bcc) mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); - if (single_fields.fld_orig_date) + if (single_fields.fld_orig_date) { mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); + char tmp[23]; + struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time; + snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", + date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + mail->setIsoDate( QString( tmp ) ); + } // crashes when accessing pop3 account? if (single_fields.fld_message_id) { mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; } if (single_fields.fld_reply_to) { QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); if (t.count()>0) { mail->setReplyto(t[0]); } } #if 0 diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index 235e116..244212f 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h @@ -33,32 +33,32 @@ class Genericwrapper : public AbstractMail Q_OBJECT public: Genericwrapper(); virtual ~Genericwrapper(); virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); virtual void cleanMimeCache(); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} virtual void logout(){}; virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; + static QString parseDateTime( mailimf_date_time *date ); protected: RecBodyP parseMail( mailmessage * msg ); QString parseMailboxList( mailimf_mailbox_list *list ); QString parseMailbox( mailimf_mailbox *box ); QString parseGroup( mailimf_group *group ); QString parseAddressList( mailimf_address_list *list ); - QString parseDateTime( mailimf_date_time *date ); void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); static void fillParameters(RecPartP&target,clist*parameters); static QString getencoding(mailmime_mechanism*aEnc); virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); QStringList parseInreplies(mailimf_in_reply_to * in_replies); QString msgTempName; unsigned int last_msg_id; QMap<QString,encodedString*> bodyCache; mailstorage * m_storage; diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 6faa524..5441a9b 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -1,21 +1,22 @@ // CHANGED 2004-09-31 Lutz Rogowski #include <stdlib.h> #include <libetpan/libetpan.h> #include <qpe/global.h> #include <qapplication.h> #include "imapwrapper.h" #include "mailtypes.h" #include "logindialog.h" #include <qprogressbar.h> +#include "genericwrapper.h" using namespace Opie::Core; int IMAPwrapper::mMax = 0; int IMAPwrapper::mCurrent = 0; IMAPwrapper::IMAPwrapper( IMAPaccount *a ) : AbstractMail() { account = a; m_imap = 0; m_Lastmbox = ""; mCurrent = 0; @@ -447,26 +448,41 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { mFlags.setBit(FLAG_RECENT); } } continue; } if ( item->att_data.att_static == NULL ) continue; if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { mailimap_envelope * head = item->att_data.att_static->att_data.att_env; if ( head == NULL ) continue; - if ( head->env_date != NULL ) + if ( head->env_date != NULL ) { m->setDate(head->env_date); + struct mailimf_date_time result; + struct mailimf_date_time* date = &result; + struct mailimf_date_time **re = &date; + size_t length = m->getDate().length(); + size_t index = 0; + if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { + m->setDate( Genericwrapper::parseDateTime( date ) ); + char tmp[23]; + snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", + date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + m->setIsoDate( QString( tmp ) ); + } else { + m->setIsoDate(head->env_date); + } + } if ( head->env_subject != NULL ) m->setSubject(convert_String((const char*)head->env_subject)); //m->setSubject(head->env_subject); if (head->env_from!=NULL) { addresslist = address_list_to_stringlist(head->env_from->frm_list); if (addresslist.count()) { m->setFrom(addresslist.first()); } } if (head->env_to!=NULL) { addresslist = address_list_to_stringlist(head->env_to->to_list); m->setTo(addresslist); diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index db8ab5b..5535d8d 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h @@ -43,24 +43,25 @@ public: virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, const QString& delemiter="/",bool getsubfolder=false); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); static void imap_progress( size_t current, size_t maximum ); virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; + virtual Account* getAccount() { return account; }; protected: RecMail*parse_list_result(mailimap_msg_att*); void login(); bool start_tls(bool force=true); virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); int selectMbox(const QString&mbox); void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index d43bdc6..1a4ffd1 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp @@ -14,25 +14,48 @@ RecMail::RecMail() RecMail::RecMail(const RecMail&old) :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { init(); copy_old(old); // odebug << "Copy constructor RecMail" << oendl; } RecMail::~RecMail() { wrapper = 0; } +static bool stringCompareRec( const QString& s1, const QString& s2 ) +{ + if ( s1.isEmpty() && s2.isEmpty() ) + return true; + return s1 == s2; +} + +bool RecMail::isEqual( RecMail* r1 ) +{ + if ( !stringCompareRec( isodate, r1->isodate ) ) { + // qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); + return false; + } + if ( !stringCompareRec( from, r1->from ) ) { + //qDebug("from *%s* *%s* ", from.latin1(), r1->from.latin1()); + return false; + } + if ( !stringCompareRec( subject, r1->subject ) ) { + //qDebug("sub "); + return false; + } + return true; +} void RecMail::copy_old(const RecMail&old) { subject = old.subject; date = old.date; mbox = old.mbox; msg_id = old.msg_id; msg_size = old.msg_size; msg_number = old.msg_number; from = old.from; msg_flags = old.msg_flags; to = old.to; cc = old.cc; diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index c317880..020278d 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h @@ -26,29 +26,32 @@ class AbstractMail; needed from the mail-wrapper class direct from the server itself (imap) or from a file-based cache (pop3?) So there is no interface "const QString&body()" but you should make a request to the mailwrapper with this class as parameter to get the body. Same words for the attachments. */ class RecMail:public Opie::Core::ORefCount { public: RecMail(); RecMail(const RecMail&old); virtual ~RecMail(); + bool isEqual( RecMail* r1 ); const unsigned int getNumber()const{return msg_number;} void setNumber(unsigned int number){msg_number=number;} const QString&getDate()const{ return date; } void setDate( const QString&a ) { date = a; } + const QString&getIsoDate()const{ return isodate; } + void setIsoDate( const QString&a ) { isodate = a; } const QString&getFrom()const{ return from; } void setFrom( const QString&a ) { from = a; } const QString&getSubject()const { return subject; } void setSubject( const QString&s ) { subject = s; } const QString&getMbox()const{return mbox;} void setMbox(const QString&box){mbox = box;} void setMsgid(const QString&id){msg_id=id;} const QString&Msgid()const{return msg_id;} void setReplyto(const QString&reply){replyto=reply;} const QString&Replyto()const{return replyto;} void setMsgsize(unsigned int size){msg_size = size;} const unsigned int Msgsize()const{return msg_size;} @@ -63,25 +66,25 @@ public: void setInreply(const QStringList&list); const QStringList&Inreply()const; void setReferences(const QStringList&list); const QStringList&References()const; const QBitArray&getFlags()const{return msg_flags;} void setFlags(const QBitArray&flags){msg_flags = flags;} void setWrapper(AbstractMail*wrapper); AbstractMail* Wrapper(); protected: - QString subject,date,from,mbox,msg_id,replyto; + QString subject,date,isodate,from,mbox,msg_id,replyto; unsigned int msg_number,msg_size; QBitArray msg_flags; QStringList to,cc,bcc,in_reply_to,references; AbstractMail*wrapper; void init(); void copy_old(const RecMail&old); }; typedef Opie::Core::OSmartPointer<RecMail> RecMailP; typedef QMap<QString,QString> part_plist_t; class RecPart:public Opie::Core::ORefCount diff --git a/kmicromail/libmailwrapper/mboxwrapper.h b/kmicromail/libmailwrapper/mboxwrapper.h index 9731b85..d03940f 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.h +++ b/kmicromail/libmailwrapper/mboxwrapper.h @@ -27,20 +27,21 @@ public: virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; + virtual Account* getAccount() { return 0; }; protected: static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); QString MBOXPath; QString MBOXName; }; #endif diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index cbc52d9..962dac0 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp @@ -56,24 +56,25 @@ void MHwrapper::clean_storage() mailstorage_free(m_storage); m_storage = 0; } } MHwrapper::~MHwrapper() { clean_storage(); } void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) { + qDebug("MHwrapper::listMessages "); init_storage(); if (!m_storage) { return; } QString f = buildPath(mailbox); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { qDebug("listMessages: error selecting folder! "); return; } parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h index 550824d..d1b7d1f 100644 --- a/kmicromail/libmailwrapper/mhwrapper.h +++ b/kmicromail/libmailwrapper/mhwrapper.h @@ -33,24 +33,25 @@ public: virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; + virtual Account* getAccount() { return 0; }; public slots: /* for deleting maildirs we are using a system call */ virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int ); virtual void processEnded(Opie::Core::OProcess *); protected: QString buildPath(const QString&p); QString MHPath; QString MHName; void init_storage(); void clean_storage(); diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h index 5d4e5ce..8c54f12 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.h +++ b/kmicromail/libmailwrapper/nntpwrapper.h @@ -28,22 +28,23 @@ public: virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); QStringList listAllNewsgroups(const QString&mask = QString::null); virtual void deleteMail(const RecMailP&mail); virtual void answeredMail(const RecMailP&mail); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual RecBodyP fetchBody( const RecMailP &mail ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; static void nntp_progress( size_t current, size_t maximum ); + virtual Account* getAccount() { return account; }; protected: void login(); NNTPaccount *account; mailstorage* m_nntp; }; #endif diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h index 7c70942..ebc2fc7 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.h +++ b/kmicromail/libmailwrapper/pop3wrapper.h @@ -25,20 +25,20 @@ public: virtual void deleteMail(const RecMailP&mail); virtual void deleteMailList(const QValueList<RecMailP>&target); virtual void answeredMail(const RecMailP&mail); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual RecBodyP fetchBody( const RecMailP &mail ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; static void pop3_progress( size_t current, size_t maximum ); - + virtual Account* getAccount() { return account; }; protected: void login(); POP3account *account; mailstorage*m_pop3; }; #endif diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h index 105cbf5..ec42b56 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.h +++ b/kmicromail/libmailwrapper/smtpwrapper.h @@ -18,24 +18,25 @@ class AbstractMail; class SMTPwrapper : public Generatemail { Q_OBJECT public: SMTPwrapper(SMTPaccount * aSmtp); virtual ~SMTPwrapper(); bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); bool flushOutbox(); static progressMailSend*sendProgress; + virtual Account* getAccount() { return m_SmtpAccount; }; signals: void queuedMails( int ); protected: mailsmtp *m_smtp; SMTPaccount * m_SmtpAccount; void connect_server(); void disc_server(); int start_smtp_tls(); |