Diffstat (limited to 'noncore/net/mail/libmailwrapper/genericwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 13 |
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 @@ | |||
1 | #include "genericwrapper.h" | 1 | #include "genericwrapper.h" |
2 | #include <libetpan/libetpan.h> | 2 | #include <libetpan/libetpan.h> |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | 4 | ||
5 | #include <opie2/odebug.h> | 5 | #include <opie2/odebug.h> |
6 | #include <qpe/timestring.h> | ||
7 | #include <qdatetime.h> | ||
6 | 8 | ||
7 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
8 | Genericwrapper::Genericwrapper() | 10 | Genericwrapper::Genericwrapper() |
9 | : AbstractMail() | 11 | : AbstractMail() |
10 | { | 12 | { |
11 | bodyCache.clear(); | 13 | bodyCache.clear(); |
12 | m_storage = 0; | 14 | m_storage = 0; |
13 | m_folder = 0; | 15 | m_folder = 0; |
14 | } | 16 | } |
15 | 17 | ||
16 | Genericwrapper::~Genericwrapper() | 18 | Genericwrapper::~Genericwrapper() |
17 | { | 19 | { |
18 | if (m_folder) { | 20 | if (m_folder) { |
19 | mailfolder_free(m_folder); | 21 | mailfolder_free(m_folder); |
20 | } | 22 | } |
21 | if (m_storage) { | 23 | if (m_storage) { |
22 | mailstorage_free(m_storage); | 24 | mailstorage_free(m_storage); |
23 | } | 25 | } |
24 | cleanMimeCache(); | 26 | cleanMimeCache(); |
25 | } | 27 | } |
26 | 28 | ||
27 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) | 29 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) |
28 | { | 30 | { |
29 | if (!mime) { | 31 | if (!mime) { |
@@ -222,54 +224,53 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
222 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 224 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
223 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); | 225 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
224 | } | 226 | } |
225 | } | 227 | } |
226 | break; | 228 | break; |
227 | } | 229 | } |
228 | } | 230 | } |
229 | 231 | ||
230 | RecBodyP Genericwrapper::parseMail( mailmessage * msg ) | 232 | RecBodyP Genericwrapper::parseMail( mailmessage * msg ) |
231 | { | 233 | { |
232 | int err = MAILIMF_NO_ERROR; | 234 | int err = MAILIMF_NO_ERROR; |
233 | mailmime_single_fields fields; | 235 | mailmime_single_fields fields; |
234 | /* is bound to msg and will be freed there */ | 236 | /* is bound to msg and will be freed there */ |
235 | mailmime * mime=0; | 237 | mailmime * mime=0; |
236 | RecBodyP body = new RecBody(); | 238 | RecBodyP body = new RecBody(); |
237 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 239 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
238 | err = mailmessage_get_bodystructure(msg,&mime); | 240 | err = mailmessage_get_bodystructure(msg,&mime); |
239 | QValueList<int>recList; | 241 | QValueList<int>recList; |
240 | traverseBody(body,msg,mime,recList); | 242 | traverseBody(body,msg,mime,recList); |
241 | return body; | 243 | return body; |
242 | } | 244 | } |
243 | 245 | ||
244 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | 246 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) |
245 | { | 247 | { |
246 | char tmp[23]; | 248 | QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); |
247 | 249 | QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" "; | |
248 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | 250 | timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" "; |
249 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 251 | timestring.sprintf(timestring+" %+05i",date->dt_zone); |
250 | 252 | return timestring; | |
251 | return QString( tmp ); | ||
252 | } | 253 | } |
253 | 254 | ||
254 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | 255 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) |
255 | { | 256 | { |
256 | QString result( "" ); | 257 | QString result( "" ); |
257 | 258 | ||
258 | bool first = true; | 259 | bool first = true; |
259 | if (list == 0) return result; | 260 | if (list == 0) return result; |
260 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | 261 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { |
261 | mailimf_address *addr = (mailimf_address *) current->data; | 262 | mailimf_address *addr = (mailimf_address *) current->data; |
262 | 263 | ||
263 | if ( !first ) { | 264 | if ( !first ) { |
264 | result.append( "," ); | 265 | result.append( "," ); |
265 | } else { | 266 | } else { |
266 | first = false; | 267 | first = false; |
267 | } | 268 | } |
268 | 269 | ||
269 | switch ( addr->ad_type ) { | 270 | switch ( addr->ad_type ) { |
270 | case MAILIMF_ADDRESS_MAILBOX: | 271 | case MAILIMF_ADDRESS_MAILBOX: |
271 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | 272 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); |
272 | break; | 273 | break; |
273 | case MAILIMF_ADDRESS_GROUP: | 274 | case MAILIMF_ADDRESS_GROUP: |
274 | result.append( parseGroup( addr->ad_data.ad_group ) ); | 275 | result.append( parseGroup( addr->ad_data.ad_group ) ); |
275 | break; | 276 | break; |