-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 35 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 14 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 4 |
6 files changed, 53 insertions, 20 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 8f67566..88545f8 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -159,96 +159,97 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) 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("AAAdate *%s* ", r->isodate.latin1() ); n.append( r ); } ++iii; } if ( n.count() == 0 ) { Global::statusMessage(tr("There are no new messages")); return; } mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); #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; int iii = 0; int count = t.count(); if ( count == 0 ) return; // wel, processevents is qite strange, we need a widget for getting // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye QProgressBar wid ( count ); wid.setCaption( tr("Copying ...")); wid.show(); while (iii < count ) { Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); wid.setProgress( iii ); wid.raise(); qApp->processEvents(); RecMailP r = (*t.at( iii )); st = fetchRawBody(r); if (st) { diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index c3a1627..d99c6a3 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -1,130 +1,138 @@ // 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 ) +const QDateTime 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(",") )); dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); KGlobal::locale()->setDateFormat(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; } QDate da (date->dt_year,date->dt_month, date->dt_day ); QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); QDateTime dt ( da ,ti ); + int addsec = -date->dt_zone*36; + //qDebug("adsec1 %d ",addsec ); + dt = dt.addSecs( addsec ); int off = KGlobal::locale()->localTimeOffset( dt ); - //dt = dt.addSecs( off*60 ); + //qDebug("adsec2 %d ",off*60 ); + + dt = dt.addSecs( off*60 ); + return dt; +#if 0 QString ret; - if ( da == QDate::currentDate () ) - ret = KGlobal::locale()->formatTime( ti,true); + if ( dt.date() == QDate::currentDate () ) + ret = KGlobal::locale()->formatTime( dt.time(),true); else { ret = KGlobal::locale()->formatDateTime( dt,true,true); } +#endif #if 0 if ( off < 0 ) ret += " -"; else ret += " +"; ret += QString::number( off / 60 ); ret += "h"; #endif #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; + //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); } mailmime_content*type = fields.fld_content; clistcell*current; if (!type) { target->setType("text"); target->setSubtype("plain"); } else { target->setSubtype(type->ct_subtype); switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { case MAILMIME_DISCRETE_TYPE_TEXT: target->setType("text"); break; case MAILMIME_DISCRETE_TYPE_IMAGE: target->setType("image"); break; case MAILMIME_DISCRETE_TYPE_AUDIO: target->setType("audio"); break; case MAILMIME_DISCRETE_TYPE_VIDEO: target->setType("video"); break; case MAILMIME_DISCRETE_TYPE_APPLICATION: target->setType("application"); break; case MAILMIME_DISCRETE_TYPE_EXTENSION: default: if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); } break; } if (type->ct_parameters) { fillParameters(target,type->ct_parameters); } @@ -450,84 +458,91 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & } r = mailsession_get_envelopes_list(session, env_list); if (r != MAIL_NO_ERROR) { ; // odebug << "Error filling message list" << oendl; if (env_list) { mailmessage_list_free(env_list); } return; } mailimf_references * refs = 0; mailimf_in_reply_to * in_replies = 0; uint32_t i = 0; for(; i < carray_count(env_list->msg_tab) ; ++i) { mailmessage * msg; QBitArray mFlags(7); msg = (mailmessage*)carray_get(env_list->msg_tab, i); if (msg->msg_fields == NULL) { //; // odebug << "could not fetch envelope of message " << i << "" << oendl; continue; } RecMailP mail = new RecMail(); mail->setWrapper(this); mail_flags * flag_result = 0; r = mailmessage_get_flags(msg,&flag_result); if (r == MAIL_ERROR_NOT_IMPLEMENTED) { mFlags.setBit(FLAG_SEEN); } mailimf_single_fields single_fields; mailimf_single_fields_init(&single_fields, msg->msg_fields); mail->setMsgsize(msg->msg_size); mail->setFlags(mFlags); mail->setMbox(mailbox); mail->setNumber(msg->msg_index); if (single_fields.fld_subject) mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); 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) { - 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 ); + QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time ); + QString ret; + if ( dt.date() == QDate::currentDate () ) + ret = KGlobal::locale()->formatTime( dt.time(),true); + else { + ret = KGlobal::locale()->formatDateTime( dt,true,true); + } + mail->setDate( ret ); + char tmp[20]; + snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", + dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); + //qDebug(" iso %s ", tmp); 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 refs = single_fields.fld_references; if (refs && refs->mid_list && clist_count(refs->mid_list)) { char * text = (char*)refs->mid_list->first->data; mail->setReplyto(QString(text)); } #endif if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && clist_count(single_fields.fld_in_reply_to->mid_list)) { mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); } if ( maxSizeInKb == 0 || mail->Msgsize()<=maxSizeInKb*1024 ) target.append(mail); } if (env_list) { mailmessage_list_free(env_list); } } diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index 244212f..c35a6da 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h @@ -1,68 +1,68 @@ // CHANGED 2004-09-31 Lutz Rogowski #ifndef __GENERIC_WRAPPER_H #define __GENERIC_WRAPPER_H #include "abstractmail.h" #include <qmap.h> #include <qstring.h> #include <libetpan/clist.h> class RecMail; class RecBody; class encodedString; struct mailpop3; struct mailmessage; struct mailmime; struct mailmime_mechanism; struct mailimf_mailbox_list; struct mailimf_mailbox; struct mailimf_date_time; struct mailimf_group; struct mailimf_address_list; struct mailsession; struct mailstorage; struct mailfolder; struct mailimf_in_reply_to; /* this class hold just the funs shared between * mbox and pop3 (later mh, too) mail access. * it is not desigend to make a instance of it! */ 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 ); + static const QDateTime 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 ); 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; mailfolder*m_folder; }; #endif diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d79df4f..b0dd1b8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -1,58 +1,59 @@ // 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" +#include <kglobal.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; mMax = 0; } IMAPwrapper::~IMAPwrapper() { logout(); } /* to avoid to often select statements in loops etc. we trust that we are logged in and connection is established!*/ int IMAPwrapper::selectMbox(const QString&mbox) { if (mbox == m_Lastmbox) { return MAILIMAP_NO_ERROR; } int err = mailimap_select( m_imap, (char*)mbox.latin1()); if ( err != MAILIMAP_NO_ERROR ) { m_Lastmbox = ""; return err; } m_Lastmbox = mbox; return err; } void IMAPwrapper::imap_progress( size_t current, size_t maximum ) { //qDebug("imap progress %d of %d ",current,maximum ); //Global::statusMessage(tr("Downloading message %1 of %2").arg( current).arg(maximum)); //qApp->processEvents() static int last = 0; if ( last != current ) IMAPwrapper::progress(); last = current; } void IMAPwrapper::progress( QString m ) { @@ -420,100 +421,108 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { cflag = (mailimap_flag_fetch*)cf->data; if( ! cflag ) qDebug("imap:not cflag "); if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { switch (cflag->fl_flag->fl_type) { case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ mFlags.setBit(FLAG_ANSWERED); break; case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ mFlags.setBit(FLAG_FLAGGED); break; case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ mFlags.setBit(FLAG_DELETED); break; case MAILIMAP_FLAG_SEEN: /* \Seen flag */ mFlags.setBit(FLAG_SEEN); break; case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ mFlags.setBit(FLAG_DRAFT); break; case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ break; case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ break; default: break; } } 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 ) { 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 ); + QDateTime dt = Genericwrapper::parseDateTime( date ); + QString ret; + if ( dt.date() == QDate::currentDate () ) + ret = KGlobal::locale()->formatTime( dt.time(),true); + else { + ret = KGlobal::locale()->formatDateTime( dt,true,true); + } + m->setDate( ret ); + char tmp[20]; + snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", + dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); + //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); 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); } if (head->env_cc!=NULL) { addresslist = address_list_to_stringlist(head->env_cc->cc_list); m->setCC(addresslist); } if (head->env_bcc!=NULL) { addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); m->setBcc(addresslist); } /* reply to address, eg. email. */ if (head->env_reply_to!=NULL) { addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); if (addresslist.count()) { m->setReplyto(addresslist.first()); } } if (head->env_in_reply_to!=NULL) { QString h(head->env_in_reply_to); while (h.length()>0 && h[0]=='<') { h.remove(0,1); } while (h.length()>0 && h[h.length()-1]=='>') { h.remove(h.length()-1,1); } if (h.length()>0) { m->setInreply(QStringList(h)); } } if (head->env_message_id != NULL) { m->setMsgid(QString(head->env_message_id)); } diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 1a4ffd1..af3b9d0 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp @@ -1,94 +1,100 @@ #include "mailtypes.h" //#include <opie2/odebug.h> #include <stdlib.h> using namespace Opie::Core; RecMail::RecMail() :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) { init(); } 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()); + if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { + //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); return false; } - if ( !stringCompareRec( subject, r1->subject ) ) { - //qDebug("sub "); + + //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); + if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { + if ( r1->from.find ( from ) < 0 ) { + if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { + //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); 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; bcc = old.bcc; wrapper = old.wrapper; in_reply_to = old.in_reply_to; references = old.references; replyto = old.replyto; } void RecMail::init() { to.clear(); cc.clear(); bcc.clear(); in_reply_to.clear(); references.clear(); wrapper = 0; } void RecMail::setWrapper(AbstractMail*awrapper) { wrapper = awrapper; } AbstractMail* RecMail::Wrapper() { return wrapper; } void RecMail::setTo(const QStringList&list) { to = list; } const QStringList&RecMail::To()const diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index 020278d..c1c1a74 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h @@ -28,99 +28,101 @@ class AbstractMail; 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;} void setTo(const QStringList&list); const QStringList&To()const; void setCC(const QStringList&list); const QStringList&CC()const; void setBcc(const QStringList&list); const QStringList&Bcc()const; 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(); + // public for debugging + QString subject,date,isodate,from,mbox,msg_id,replyto; protected: - QString subject,date,isodate,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 { protected: QString m_type,m_subtype,m_identifier,m_encoding,m_description; unsigned int m_lines,m_size; part_plist_t m_Parameters; /* describes the position in the mail */ QValueList<int> m_poslist; public: RecPart(); RecPart(const RecPart&); virtual ~RecPart(); const QString&Type()const; void setType(const QString&type); const QString&Subtype()const; void setSubtype(const QString&subtype); const QString&Identifier()const; void setIdentifier(const QString&identifier); const QString&Encoding()const; void setEncoding(const QString&encoding); const QString&Description()const; void setDescription(const QString&desc); void setLines(unsigned int lines); const unsigned int Lines()const; void setSize(unsigned int size); const unsigned int Size()const; void setParameters(const part_plist_t&list); const part_plist_t&Parameters()const; void addParameter(const QString&key,const QString&value); const QString searchParamter(const QString&key)const; void setPositionlist(const QValueList<int>&poslist); const QValueList<int>& Positionlist()const; }; |