summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/genericwrapper.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/genericwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp13
1 files changed, 7 insertions, 6 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
@@ -1,29 +1,31 @@
#include "genericwrapper.h"
#include <libetpan/libetpan.h>
#include "mailtypes.h"
#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+#include <qdatetime.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();
}
void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
{
if (!mime) {
@@ -222,54 +224,53 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
}
}
break;
}
}
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 );
-
- 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;
}
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( "," );
} else {
first = false;
}
switch ( addr->ad_type ) {
case MAILIMF_ADDRESS_MAILBOX:
result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
break;
case MAILIMF_ADDRESS_GROUP:
result.append( parseGroup( addr->ad_data.ad_group ) );
break;