summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
authorzautrix <zautrix>2004-09-16 23:05:56 (UTC)
committer zautrix <zautrix>2004-09-16 23:05:56 (UTC)
commitaf411746b1480e7b331ea7d163f39d2507cf7264 (patch) (side-by-side diff)
treebc839893f0bd002a34368987bdda3e71aad630c4 /kmicromail/libmailwrapper
parentb44edfb21be0eee91c4f47401e3fe6ff37e4c16c (diff)
downloadkdepimpi-af411746b1480e7b331ea7d163f39d2507cf7264.zip
kdepimpi-af411746b1480e7b331ea7d163f39d2507cf7264.tar.gz
kdepimpi-af411746b1480e7b331ea7d163f39d2507cf7264.tar.bz2
Fixed timezone problems in ompi
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp1
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp35
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.h2
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp17
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp20
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h4
6 files changed, 56 insertions, 23 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
@@ -206,2 +206,3 @@ void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targe
if ( !found ) {
+ //qDebug("AAAdate *%s* ", r->isodate.latin1() );
n.append( r );
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
@@ -29,3 +29,3 @@ Genericwrapper::~Genericwrapper()
}
-QString Genericwrapper::parseDateTime( mailimf_date_time *date )
+const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
{
@@ -53,7 +53,14 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
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);
@@ -62,2 +69,3 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
}
+#endif
#if 0
@@ -81,3 +89,3 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
#endif
- return ret;
+ //return ret;
}
@@ -497,7 +505,14 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &
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 ) );
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
@@ -44,3 +44,3 @@ public:
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 );
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
@@ -10,2 +10,3 @@
#include "genericwrapper.h"
+#include <kglobal.h>
@@ -467,6 +468,14 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
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 ) );
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
@@ -35,12 +35,18 @@ bool RecMail::isEqual( RecMail* r1 )
if ( !stringCompareRec( isodate, r1->isodate ) ) {
- // qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
+ //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 ");
- return false;
+
+ //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;
+ }
+ }
}
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
@@ -75,5 +75,7 @@ public:
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;