Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailstatics.cpp | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailstatics.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 28 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 11 |
6 files changed, 51 insertions, 32 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 703235d..0ac842d 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -375,25 +375,25 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | |||
375 | while (h.length()>0 && h[h.length()-1]=='>') { | 375 | while (h.length()>0 && h[h.length()-1]=='>') { |
376 | h.remove(h.length()-1,1); | 376 | h.remove(h.length()-1,1); |
377 | } | 377 | } |
378 | if (h.length()>0) { | 378 | if (h.length()>0) { |
379 | res.append(h); | 379 | res.append(h); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | return res; | 382 | return res; |
383 | } | 383 | } |
384 | 384 | ||
385 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 385 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
386 | { | 386 | { |
387 | int r; | 387 | int r,toffset; |
388 | mailmessage_list * env_list = 0; | 388 | mailmessage_list * env_list = 0; |
389 | r = mailsession_get_messages_list(session,&env_list); | 389 | r = mailsession_get_messages_list(session,&env_list); |
390 | if (r != MAIL_NO_ERROR) { | 390 | if (r != MAIL_NO_ERROR) { |
391 | odebug << "Error message list" << oendl; | 391 | odebug << "Error message list" << oendl; |
392 | return; | 392 | return; |
393 | } | 393 | } |
394 | r = mailsession_get_envelopes_list(session, env_list); | 394 | r = mailsession_get_envelopes_list(session, env_list); |
395 | if (r != MAIL_NO_ERROR) { | 395 | if (r != MAIL_NO_ERROR) { |
396 | odebug << "Error filling message list" << oendl; | 396 | odebug << "Error filling message list" << oendl; |
397 | if (env_list) { | 397 | if (env_list) { |
398 | mailmessage_list_free(env_list); | 398 | mailmessage_list_free(env_list); |
399 | } | 399 | } |
@@ -428,31 +428,31 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
428 | if (single_fields.fld_from) | 428 | if (single_fields.fld_from) |
429 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 429 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
430 | if (!mbox_as_to) { | 430 | if (!mbox_as_to) { |
431 | if (single_fields.fld_to) | 431 | if (single_fields.fld_to) |
432 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 432 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
433 | } else { | 433 | } else { |
434 | mail->setTo(mailbox); | 434 | mail->setTo(mailbox); |
435 | } | 435 | } |
436 | if (single_fields.fld_cc) | 436 | if (single_fields.fld_cc) |
437 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 437 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
438 | if (single_fields.fld_bcc) | 438 | if (single_fields.fld_bcc) |
439 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 439 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
440 | if (single_fields.fld_orig_date) | 440 | if (single_fields.fld_orig_date) { |
441 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 441 | QDateTime d = parseDateTime( single_fields.fld_orig_date->dt_date_time,toffset); |
442 | // crashes when accessing pop3 account? | 442 | mail->setDate( d,toffset ); |
443 | } | ||
443 | if (single_fields.fld_message_id && single_fields.fld_message_id->mid_value) { | 444 | if (single_fields.fld_message_id && single_fields.fld_message_id->mid_value) { |
444 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 445 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
445 | } | 446 | } |
446 | |||
447 | if (single_fields.fld_reply_to) { | 447 | if (single_fields.fld_reply_to) { |
448 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | 448 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); |
449 | if (t.count()>0) { | 449 | if (t.count()>0) { |
450 | mail->setReplyto(t[0]); | 450 | mail->setReplyto(t[0]); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | #if 0 | 453 | #if 0 |
454 | refs = single_fields.fld_references; | 454 | refs = single_fields.fld_references; |
455 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 455 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
456 | char * text = (char*)refs->mid_list->first->data; | 456 | char * text = (char*)refs->mid_list->first->data; |
457 | mail->setReplyto(QString(text)); | 457 | mail->setReplyto(QString(text)); |
458 | } | 458 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 56efa0b..8e5212b 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -363,25 +363,25 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
363 | } | 363 | } |
364 | if (result) mailimap_list_result_free( result ); | 364 | if (result) mailimap_list_result_free( result ); |
365 | return folders; | 365 | return folders; |
366 | } | 366 | } |
367 | 367 | ||
368 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 368 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
369 | { | 369 | { |
370 | RecMail * m = 0; | 370 | RecMail * m = 0; |
371 | mailimap_msg_att_item *item=0; | 371 | mailimap_msg_att_item *item=0; |
372 | clistcell *current,*c,*cf; | 372 | clistcell *current,*c,*cf; |
373 | mailimap_msg_att_dynamic*flist; | 373 | mailimap_msg_att_dynamic*flist; |
374 | mailimap_flag_fetch*cflag; | 374 | mailimap_flag_fetch*cflag; |
375 | int size; | 375 | int size,toffset; |
376 | QBitArray mFlags(7); | 376 | QBitArray mFlags(7); |
377 | QStringList addresslist; | 377 | QStringList addresslist; |
378 | 378 | ||
379 | if (!m_att) { | 379 | if (!m_att) { |
380 | return m; | 380 | return m; |
381 | } | 381 | } |
382 | size = 0; | 382 | size = 0; |
383 | m = new RecMail(); | 383 | m = new RecMail(); |
384 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { | 384 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
385 | current = c; | 385 | current = c; |
386 | item = (mailimap_msg_att_item*)current->data; | 386 | item = (mailimap_msg_att_item*)current->data; |
387 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 387 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
@@ -415,25 +415,26 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
415 | break; | 415 | break; |
416 | default: | 416 | default: |
417 | break; | 417 | break; |
418 | } | 418 | } |
419 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 419 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
420 | mFlags.setBit(FLAG_RECENT); | 420 | mFlags.setBit(FLAG_RECENT); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | continue; | 423 | continue; |
424 | } | 424 | } |
425 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 425 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
426 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 426 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
427 | m->setDate(parseDateTime(head->env_date)); | 427 | QDateTime d = parseDateTime(head->env_date,toffset); |
428 | m->setDate(d,toffset); | ||
428 | m->setSubject(convert_String((const char*)head->env_subject)); | 429 | m->setSubject(convert_String((const char*)head->env_subject)); |
429 | if (head->env_from!=NULL) { | 430 | if (head->env_from!=NULL) { |
430 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 431 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
431 | if (addresslist.count()) { | 432 | if (addresslist.count()) { |
432 | m->setFrom(addresslist.first()); | 433 | m->setFrom(addresslist.first()); |
433 | } | 434 | } |
434 | } | 435 | } |
435 | if (head->env_to!=NULL) { | 436 | if (head->env_to!=NULL) { |
436 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 437 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
437 | m->setTo(addresslist); | 438 | m->setTo(addresslist); |
438 | } | 439 | } |
439 | if (head->env_cc!=NULL) { | 440 | if (head->env_cc!=NULL) { |
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.cpp b/noncore/net/mail/libmailwrapper/mailstatics.cpp index 4878dc9..033ec28 100644 --- a/noncore/net/mail/libmailwrapper/mailstatics.cpp +++ b/noncore/net/mail/libmailwrapper/mailstatics.cpp | |||
@@ -1,29 +1,30 @@ | |||
1 | #include "mailstatics.h" | 1 | #include "mailstatics.h" |
2 | #include <libetpan/libetpan.h> | 2 | #include <libetpan/libetpan.h> |
3 | #include <qpe/timestring.h> | 3 | //#include <qpe/timestring.h> |
4 | 4 | ||
5 | QString MailStatics::parseDateTime(const mailimf_date_time *date ) | 5 | QDateTime MailStatics::parseDateTime(const mailimf_date_time *date,int&offset ) |
6 | { | 6 | { |
7 | if (!date) return ""; | 7 | offset = 0; |
8 | if (!date) { | ||
9 | return QDateTime(); | ||
10 | } | ||
8 | QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); | 11 | QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); |
9 | QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" "; | 12 | offset = date->dt_zone; |
10 | timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" "; | 13 | return da; |
11 | timestring.sprintf(timestring+" %+05i",date->dt_zone); | ||
12 | return timestring; | ||
13 | } | 14 | } |
14 | 15 | ||
15 | QString MailStatics::parseDateTime(const char*date) | 16 | QDateTime MailStatics::parseDateTime(const char*date,int&offset) |
16 | { | 17 | { |
17 | mailimf_date_time * date_time; | 18 | mailimf_date_time * date_time=0; |
18 | QString d = ""; | 19 | QDateTime d; |
19 | size_t cur_tok = 0; | 20 | size_t cur_tok = 0; |
20 | if (!date) return d; | 21 | if (!date) return d; |
21 | int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time); | 22 | int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time); |
22 | if (r==MAILIMF_NO_ERROR) { | 23 | if (r==MAILIMF_NO_ERROR) { |
23 | d = parseDateTime(date_time); | 24 | d = parseDateTime(date_time,offset); |
24 | } | 25 | } |
25 | if (date_time) { | 26 | if (date_time) { |
26 | mailimf_date_time_free(date_time); | 27 | mailimf_date_time_free(date_time); |
27 | } | 28 | } |
28 | return d; | 29 | return d; |
29 | } \ No newline at end of file | 30 | } |
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.h b/noncore/net/mail/libmailwrapper/mailstatics.h index 841d14d..c714ead 100644 --- a/noncore/net/mail/libmailwrapper/mailstatics.h +++ b/noncore/net/mail/libmailwrapper/mailstatics.h | |||
@@ -1,19 +1,19 @@ | |||
1 | #ifndef __MAIL_STATICS_H | 1 | #ifndef __MAIL_STATICS_H |
2 | #define __MAIL_STATICS_H | 2 | #define __MAIL_STATICS_H |
3 | 3 | ||
4 | #include <qdatetime.h> | 4 | #include <qdatetime.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | struct mailimf_date_time; | 7 | struct mailimf_date_time; |
8 | 8 | ||
9 | class MailStatics | 9 | class MailStatics |
10 | { | 10 | { |
11 | protected: | 11 | protected: |
12 | static QString parseDateTime(const mailimf_date_time * date); | 12 | static QDateTime parseDateTime(const mailimf_date_time * date,int&offset); |
13 | static QString parseDateTime(const char*date); | 13 | static QDateTime parseDateTime(const char*date,int&offset); |
14 | MailStatics(){}; | 14 | MailStatics(){}; |
15 | virtual ~MailStatics(){}; | 15 | virtual ~MailStatics(){}; |
16 | public: | 16 | public: |
17 | }; | 17 | }; |
18 | 18 | ||
19 | #endif | 19 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index d4395a2..b009b75 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -1,41 +1,43 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <qpe/timestring.h> | ||
4 | 5 | ||
5 | #include <stdlib.h> | 6 | #include <stdlib.h> |
6 | 7 | ||
7 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 9 | RecMail::RecMail() |
9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 10 | :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7),maildate(),date("") |
10 | { | 11 | { |
11 | init(); | 12 | init(); |
12 | } | 13 | } |
13 | 14 | ||
14 | RecMail::RecMail(const RecMail&old) | 15 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 16 | :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7),maildate(),date("") |
16 | { | 17 | { |
17 | init(); | 18 | init(); |
18 | copy_old(old); | 19 | copy_old(old); |
19 | odebug << "Copy constructor RecMail" << oendl; | 20 | odebug << "Copy constructor RecMail" << oendl; |
20 | } | 21 | } |
21 | 22 | ||
22 | RecMail::~RecMail() | 23 | RecMail::~RecMail() |
23 | { | 24 | { |
24 | wrapper = 0; | 25 | wrapper = 0; |
25 | } | 26 | } |
26 | 27 | ||
27 | void RecMail::copy_old(const RecMail&old) | 28 | void RecMail::copy_old(const RecMail&old) |
28 | { | 29 | { |
29 | subject = old.subject; | 30 | subject = old.subject; |
31 | maildate = old.maildate; | ||
30 | date = old.date; | 32 | date = old.date; |
31 | mbox = old.mbox; | 33 | mbox = old.mbox; |
32 | msg_id = old.msg_id; | 34 | msg_id = old.msg_id; |
33 | msg_size = old.msg_size; | 35 | msg_size = old.msg_size; |
34 | msg_number = old.msg_number; | 36 | msg_number = old.msg_number; |
35 | from = old.from; | 37 | from = old.from; |
36 | msg_flags = old.msg_flags; | 38 | msg_flags = old.msg_flags; |
37 | to = old.to; | 39 | to = old.to; |
38 | cc = old.cc; | 40 | cc = old.cc; |
39 | bcc = old.bcc; | 41 | bcc = old.bcc; |
40 | wrapper = old.wrapper; | 42 | wrapper = old.wrapper; |
41 | in_reply_to = old.in_reply_to; | 43 | in_reply_to = old.in_reply_to; |
@@ -44,24 +46,35 @@ void RecMail::copy_old(const RecMail&old) | |||
44 | } | 46 | } |
45 | 47 | ||
46 | void RecMail::init() | 48 | void RecMail::init() |
47 | { | 49 | { |
48 | to.clear(); | 50 | to.clear(); |
49 | cc.clear(); | 51 | cc.clear(); |
50 | bcc.clear(); | 52 | bcc.clear(); |
51 | in_reply_to.clear(); | 53 | in_reply_to.clear(); |
52 | references.clear(); | 54 | references.clear(); |
53 | wrapper = 0; | 55 | wrapper = 0; |
54 | } | 56 | } |
55 | 57 | ||
58 | void RecMail::setDate( const QDateTime&a,int offset) | ||
59 | { | ||
60 | QString timestring = TimeString::numberDateString(a.date())+" "; | ||
61 | timestring+=TimeString::timeString(a.time()); | ||
62 | if (offset > 0) { | ||
63 | timestring.sprintf(timestring+" %+05i",offset); | ||
64 | } | ||
65 | date = timestring; | ||
66 | maildate = a; | ||
67 | } | ||
68 | |||
56 | void RecMail::setWrapper(AbstractMail*awrapper) | 69 | void RecMail::setWrapper(AbstractMail*awrapper) |
57 | { | 70 | { |
58 | wrapper = awrapper; | 71 | wrapper = awrapper; |
59 | } | 72 | } |
60 | 73 | ||
61 | AbstractMail* RecMail::Wrapper() | 74 | AbstractMail* RecMail::Wrapper() |
62 | { | 75 | { |
63 | return wrapper; | 76 | return wrapper; |
64 | } | 77 | } |
65 | 78 | ||
66 | void RecMail::setTo(const QStringList&list) | 79 | void RecMail::setTo(const QStringList&list) |
67 | { | 80 | { |
@@ -125,25 +138,25 @@ RecPart::RecPart(const RecPart&old) | |||
125 | : Opie::Core::ORefCount(), | 138 | : Opie::Core::ORefCount(), |
126 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 139 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
127 | { | 140 | { |
128 | m_type = old.m_type; | 141 | m_type = old.m_type; |
129 | m_subtype = old.m_subtype; | 142 | m_subtype = old.m_subtype; |
130 | m_identifier = old.m_identifier; | 143 | m_identifier = old.m_identifier; |
131 | m_encoding = old.m_encoding; | 144 | m_encoding = old.m_encoding; |
132 | m_description = old.m_description; | 145 | m_description = old.m_description; |
133 | m_lines = old.m_lines; | 146 | m_lines = old.m_lines; |
134 | m_size = old.m_size; | 147 | m_size = old.m_size; |
135 | m_Parameters = old.m_Parameters; | 148 | m_Parameters = old.m_Parameters; |
136 | m_poslist = old.m_poslist; | 149 | m_poslist = old.m_poslist; |
137 | odebug << "RecPart copy constructor" << oendl; | 150 | odebug << "RecPart copy constructor" << oendl; |
138 | } | 151 | } |
139 | 152 | ||
140 | RecPart::~RecPart() | 153 | RecPart::~RecPart() |
141 | { | 154 | { |
142 | } | 155 | } |
143 | 156 | ||
144 | void RecPart::setSize(unsigned int size) | 157 | void RecPart::setSize(unsigned int size) |
145 | { | 158 | { |
146 | m_size = size; | 159 | m_size = size; |
147 | } | 160 | } |
148 | 161 | ||
149 | const unsigned int RecPart::Size()const | 162 | const unsigned int RecPart::Size()const |
@@ -249,25 +262,25 @@ const QValueList<int>& RecPart::Positionlist()const | |||
249 | RecBody::RecBody() | 262 | RecBody::RecBody() |
250 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 263 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
251 | { | 264 | { |
252 | m_PartsList.clear(); | 265 | m_PartsList.clear(); |
253 | } | 266 | } |
254 | 267 | ||
255 | RecBody::RecBody(const RecBody&old) | 268 | RecBody::RecBody(const RecBody&old) |
256 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 269 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
257 | { | 270 | { |
258 | m_BodyText = old.m_BodyText; | 271 | m_BodyText = old.m_BodyText; |
259 | m_PartsList = old.m_PartsList; | 272 | m_PartsList = old.m_PartsList; |
260 | m_description = old.m_description; | 273 | m_description = old.m_description; |
261 | odebug << "Recbody copy constructor" << oendl; | 274 | odebug << "Recbody copy constructor" << oendl; |
262 | } | 275 | } |
263 | 276 | ||
264 | RecBody::~RecBody() | 277 | RecBody::~RecBody() |
265 | { | 278 | { |
266 | } | 279 | } |
267 | 280 | ||
268 | void RecBody::setBodytext(const QString&bodyText) | 281 | void RecBody::setBodytext(const QString&bodyText) |
269 | { | 282 | { |
270 | m_BodyText = bodyText; | 283 | m_BodyText = bodyText; |
271 | } | 284 | } |
272 | 285 | ||
273 | const QString& RecBody::Bodytext()const | 286 | const QString& RecBody::Bodytext()const |
@@ -314,32 +327,32 @@ encodedString::encodedString(const char*nContent,unsigned int nSize) | |||
314 | } | 327 | } |
315 | 328 | ||
316 | encodedString::encodedString(char*nContent,unsigned int nSize) | 329 | encodedString::encodedString(char*nContent,unsigned int nSize) |
317 | { | 330 | { |
318 | init(); | 331 | init(); |
319 | setContent(nContent,nSize); | 332 | setContent(nContent,nSize); |
320 | } | 333 | } |
321 | 334 | ||
322 | encodedString::encodedString(const encodedString&old) | 335 | encodedString::encodedString(const encodedString&old) |
323 | { | 336 | { |
324 | init(); | 337 | init(); |
325 | copy_old(old); | 338 | copy_old(old); |
326 | odebug << "encodedeString: copy constructor!" << oendl; | 339 | odebug << "encodedeString: copy constructor!" << oendl; |
327 | } | 340 | } |
328 | 341 | ||
329 | encodedString& encodedString::operator=(const encodedString&old) | 342 | encodedString& encodedString::operator=(const encodedString&old) |
330 | { | 343 | { |
331 | init(); | 344 | init(); |
332 | copy_old(old); | 345 | copy_old(old); |
333 | odebug << "encodedString: assign operator!" << oendl; | 346 | odebug << "encodedString: assign operator!" << oendl; |
334 | return *this; | 347 | return *this; |
335 | } | 348 | } |
336 | 349 | ||
337 | encodedString::~encodedString() | 350 | encodedString::~encodedString() |
338 | { | 351 | { |
339 | clean(); | 352 | clean(); |
340 | } | 353 | } |
341 | 354 | ||
342 | void encodedString::init() | 355 | void encodedString::init() |
343 | { | 356 | { |
344 | content = 0; | 357 | content = 0; |
345 | size = 0; | 358 | size = 0; |
@@ -387,13 +400,12 @@ void encodedString::setContent(char*nContent,int nSize) | |||
387 | { | 400 | { |
388 | content = nContent; | 401 | content = nContent; |
389 | size = nSize; | 402 | size = nSize; |
390 | } | 403 | } |
391 | 404 | ||
392 | folderStat&folderStat::operator=(const folderStat&old) | 405 | folderStat&folderStat::operator=(const folderStat&old) |
393 | { | 406 | { |
394 | message_count = old.message_count; | 407 | message_count = old.message_count; |
395 | message_unseen = old.message_unseen; | 408 | message_unseen = old.message_unseen; |
396 | message_recent = old.message_recent; | 409 | message_recent = old.message_recent; |
397 | return *this; | 410 | return *this; |
398 | } | 411 | } |
399 | |||
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index c317880..272514c 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -6,49 +6,48 @@ | |||
6 | #define FLAG_DELETED 2 | 6 | #define FLAG_DELETED 2 |
7 | #define FLAG_SEEN 3 | 7 | #define FLAG_SEEN 3 |
8 | #define FLAG_DRAFT 4 | 8 | #define FLAG_DRAFT 4 |
9 | #define FLAG_RECENT 5 | 9 | #define FLAG_RECENT 5 |
10 | 10 | ||
11 | #include <opie2/osmartpointer.h> | 11 | #include <opie2/osmartpointer.h> |
12 | 12 | ||
13 | #include <qbitarray.h> | 13 | #include <qbitarray.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qstringlist.h> | 15 | #include <qstringlist.h> |
16 | #include <qmap.h> | 16 | #include <qmap.h> |
17 | #include <qvaluelist.h> | 17 | #include <qvaluelist.h> |
18 | #include <qdatetime.h> | ||
18 | 19 | ||
19 | class AbstractMail; | 20 | class AbstractMail; |
20 | /* a class to describe mails in a mailbox */ | 21 | /* a class to describe mails in a mailbox */ |
21 | /* Attention! | 22 | /* Attention! |
22 | From programmers point of view it would make sense to | 23 | From programmers point of view it would make sense to |
23 | store the mail body into this class, too. | 24 | store the mail body into this class, too. |
24 | But: not from the point of view of the device. | 25 | But: not from the point of view of the device. |
25 | Mailbodies can be real large. So we request them when | 26 | Mailbodies can be real large. So we request them when |
26 | needed from the mail-wrapper class direct from the server itself | 27 | needed from the mail-wrapper class direct from the server itself |
27 | (imap) or from a file-based cache (pop3?) | 28 | (imap) or from a file-based cache (pop3?) |
28 | So there is no interface "const QString&body()" but you should | 29 | So there is no interface "const QString&body()" but you should |
29 | make a request to the mailwrapper with this class as parameter to | 30 | make a request to the mailwrapper with this class as parameter to |
30 | get the body. Same words for the attachments. | 31 | get the body. Same words for the attachments. |
31 | */ | 32 | */ |
32 | class RecMail:public Opie::Core::ORefCount | 33 | class RecMail:public Opie::Core::ORefCount |
33 | { | 34 | { |
34 | public: | 35 | public: |
35 | RecMail(); | 36 | RecMail(); |
36 | RecMail(const RecMail&old); | 37 | RecMail(const RecMail&old); |
37 | virtual ~RecMail(); | 38 | virtual ~RecMail(); |
38 | 39 | ||
39 | const unsigned int getNumber()const{return msg_number;} | 40 | const unsigned int getNumber()const{return msg_number;} |
40 | void setNumber(unsigned int number){msg_number=number;} | 41 | void setNumber(unsigned int number){msg_number=number;} |
41 | const QString&getDate()const{ return date; } | ||
42 | void setDate( const QString&a ) { date = a; } | ||
43 | const QString&getFrom()const{ return from; } | 42 | const QString&getFrom()const{ return from; } |
44 | void setFrom( const QString&a ) { from = a; } | 43 | void setFrom( const QString&a ) { from = a; } |
45 | const QString&getSubject()const { return subject; } | 44 | const QString&getSubject()const { return subject; } |
46 | void setSubject( const QString&s ) { subject = s; } | 45 | void setSubject( const QString&s ) { subject = s; } |
47 | const QString&getMbox()const{return mbox;} | 46 | const QString&getMbox()const{return mbox;} |
48 | void setMbox(const QString&box){mbox = box;} | 47 | void setMbox(const QString&box){mbox = box;} |
49 | void setMsgid(const QString&id){msg_id=id;} | 48 | void setMsgid(const QString&id){msg_id=id;} |
50 | const QString&Msgid()const{return msg_id;} | 49 | const QString&Msgid()const{return msg_id;} |
51 | void setReplyto(const QString&reply){replyto=reply;} | 50 | void setReplyto(const QString&reply){replyto=reply;} |
52 | const QString&Replyto()const{return replyto;} | 51 | const QString&Replyto()const{return replyto;} |
53 | void setMsgsize(unsigned int size){msg_size = size;} | 52 | void setMsgsize(unsigned int size){msg_size = size;} |
54 | const unsigned int Msgsize()const{return msg_size;} | 53 | const unsigned int Msgsize()const{return msg_size;} |
@@ -62,32 +61,38 @@ public: | |||
62 | const QStringList&Bcc()const; | 61 | const QStringList&Bcc()const; |
63 | void setInreply(const QStringList&list); | 62 | void setInreply(const QStringList&list); |
64 | const QStringList&Inreply()const; | 63 | const QStringList&Inreply()const; |
65 | void setReferences(const QStringList&list); | 64 | void setReferences(const QStringList&list); |
66 | const QStringList&References()const; | 65 | const QStringList&References()const; |
67 | 66 | ||
68 | const QBitArray&getFlags()const{return msg_flags;} | 67 | const QBitArray&getFlags()const{return msg_flags;} |
69 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 68 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
70 | 69 | ||
71 | void setWrapper(AbstractMail*wrapper); | 70 | void setWrapper(AbstractMail*wrapper); |
72 | AbstractMail* Wrapper(); | 71 | AbstractMail* Wrapper(); |
73 | 72 | ||
73 | const QDateTime&getDate()const{ return maildate; } | ||
74 | const QString&getStringDate()const{return date;} | ||
75 | void setDate( const QDateTime&a,int offset=0 ); | ||
76 | |||
74 | protected: | 77 | protected: |
75 | QString subject,date,from,mbox,msg_id,replyto; | 78 | QString subject,from,mbox,msg_id,replyto; |
76 | unsigned int msg_number,msg_size; | 79 | unsigned int msg_number,msg_size; |
77 | QBitArray msg_flags; | 80 | QBitArray msg_flags; |
78 | QStringList to,cc,bcc,in_reply_to,references; | 81 | QStringList to,cc,bcc,in_reply_to,references; |
79 | AbstractMail*wrapper; | 82 | AbstractMail*wrapper; |
80 | void init(); | 83 | void init(); |
81 | void copy_old(const RecMail&old); | 84 | void copy_old(const RecMail&old); |
85 | QDateTime maildate; | ||
86 | QString date; | ||
82 | }; | 87 | }; |
83 | 88 | ||
84 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 89 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
85 | typedef QMap<QString,QString> part_plist_t; | 90 | typedef QMap<QString,QString> part_plist_t; |
86 | 91 | ||
87 | class RecPart:public Opie::Core::ORefCount | 92 | class RecPart:public Opie::Core::ORefCount |
88 | { | 93 | { |
89 | protected: | 94 | protected: |
90 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; | 95 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; |
91 | unsigned int m_lines,m_size; | 96 | unsigned int m_lines,m_size; |
92 | part_plist_t m_Parameters; | 97 | part_plist_t m_Parameters; |
93 | /* describes the position in the mail */ | 98 | /* describes the position in the mail */ |