author | alwin <alwin> | 2004-03-18 18:00:18 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-18 18:00:18 (UTC) |
commit | fef9cec046fcf21a4f762c36454b8f253dd3e25e (patch) (unidiff) | |
tree | b87ee38164e1e9ce635dde34c13677f09388c058 | |
parent | 69fa0e7b5cab5f4cdfdac736e31ff0fd0fbf4312 (diff) | |
download | opie-fef9cec046fcf21a4f762c36454b8f253dd3e25e.zip opie-fef9cec046fcf21a4f762c36454b8f253dd3e25e.tar.gz opie-fef9cec046fcf21a4f762c36454b8f253dd3e25e.tar.bz2 |
some (hopeful) improvements
23 files changed, 230 insertions, 196 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index e4bb6c5..54d2da2 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -76,7 +76,7 @@ void POP3viewItem::refresh() | |||
76 | delete folders; | 76 | delete folders; |
77 | } | 77 | } |
78 | 78 | ||
79 | RecBody POP3viewItem::fetchBody( const RecMailP &mail ) | 79 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
80 | { | 80 | { |
81 | qDebug( "POP3 fetchBody" ); | 81 | qDebug( "POP3 fetchBody" ); |
82 | return wrapper->fetchBody( mail ); | 82 | return wrapper->fetchBody( mail ); |
@@ -161,7 +161,7 @@ void POP3folderItem::refresh(QValueList<RecMailP>&target) | |||
161 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 161 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
162 | } | 162 | } |
163 | 163 | ||
164 | RecBody POP3folderItem::fetchBody(const RecMailP&aMail) | 164 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
165 | { | 165 | { |
166 | return pop3->getWrapper()->fetchBody(aMail); | 166 | return pop3->getWrapper()->fetchBody(aMail); |
167 | } | 167 | } |
@@ -267,7 +267,7 @@ void NNTPviewItem::refresh() | |||
267 | delete folders; | 267 | delete folders; |
268 | } | 268 | } |
269 | 269 | ||
270 | RecBody NNTPviewItem::fetchBody( const RecMailP &mail ) | 270 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
271 | { | 271 | { |
272 | qDebug( "NNTP fetchBody" ); | 272 | qDebug( "NNTP fetchBody" ); |
273 | return wrapper->fetchBody( mail ); | 273 | return wrapper->fetchBody( mail ); |
@@ -365,7 +365,7 @@ void NNTPfolderItem::refresh(QValueList<RecMailP>&target) | |||
365 | nntp->getWrapper()->listMessages( folder->getName(),target ); | 365 | nntp->getWrapper()->listMessages( folder->getName(),target ); |
366 | } | 366 | } |
367 | 367 | ||
368 | RecBody NNTPfolderItem::fetchBody(const RecMailP&aMail) | 368 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) |
369 | { | 369 | { |
370 | return nntp->getWrapper()->fetchBody(aMail); | 370 | return nntp->getWrapper()->fetchBody(aMail); |
371 | } | 371 | } |
@@ -562,9 +562,9 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | RecBody IMAPviewItem::fetchBody(const RecMailP&) | 565 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
566 | { | 566 | { |
567 | return RecBody(); | 567 | return new RecBody(); |
568 | } | 568 | } |
569 | 569 | ||
570 | bool IMAPviewItem::offline() | 570 | bool IMAPviewItem::offline() |
@@ -622,7 +622,7 @@ void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | |||
622 | } | 622 | } |
623 | } | 623 | } |
624 | 624 | ||
625 | RecBody IMAPfolderItem::fetchBody(const RecMailP&aMail) | 625 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
626 | { | 626 | { |
627 | return imap->getWrapper()->fetchBody(aMail); | 627 | return imap->getWrapper()->fetchBody(aMail); |
628 | } | 628 | } |
@@ -800,7 +800,7 @@ void MHviewItem::refresh(bool force) | |||
800 | delete folders; | 800 | delete folders; |
801 | } | 801 | } |
802 | 802 | ||
803 | RecBody MHviewItem::fetchBody( const RecMailP &mail ) | 803 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
804 | { | 804 | { |
805 | qDebug( "MH fetchBody" ); | 805 | qDebug( "MH fetchBody" ); |
806 | return wrapper->fetchBody( mail ); | 806 | return wrapper->fetchBody( mail ); |
@@ -921,7 +921,7 @@ void MHfolderItem::refresh(QValueList<RecMailP>&target) | |||
921 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 921 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
922 | } | 922 | } |
923 | 923 | ||
924 | RecBody MHfolderItem::fetchBody(const RecMailP&aMail) | 924 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
925 | { | 925 | { |
926 | return mbox->getWrapper()->fetchBody(aMail); | 926 | return mbox->getWrapper()->fetchBody(aMail); |
927 | } | 927 | } |
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index 6cdb260..f125eeb 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -17,6 +17,8 @@ class IMAPaccount; | |||
17 | class AbstractMail; | 17 | class AbstractMail; |
18 | class Folder; | 18 | class Folder; |
19 | 19 | ||
20 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> | ||
21 | |||
20 | class AccountViewItem : public QListViewItem | 22 | class AccountViewItem : public QListViewItem |
21 | { | 23 | { |
22 | 24 | ||
@@ -28,7 +30,7 @@ public: | |||
28 | 30 | ||
29 | virtual ~AccountViewItem(); | 31 | virtual ~AccountViewItem(); |
30 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; | 32 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; |
31 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; | 33 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; |
32 | virtual QPopupMenu * getContextMenu(){return 0;}; | 34 | virtual QPopupMenu * getContextMenu(){return 0;}; |
33 | virtual void contextMenuSelected(int){} | 35 | virtual void contextMenuSelected(int){} |
34 | virtual AccountView*accountView(); | 36 | virtual AccountView*accountView(); |
@@ -52,7 +54,7 @@ public: | |||
52 | POP3viewItem( POP3account *a, AccountView *parent ); | 54 | POP3viewItem( POP3account *a, AccountView *parent ); |
53 | virtual ~POP3viewItem(); | 55 | virtual ~POP3viewItem(); |
54 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 56 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
55 | virtual RecBody fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 57 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
56 | AbstractMail *getWrapper(); | 58 | AbstractMail *getWrapper(); |
57 | virtual QPopupMenu * getContextMenu(); | 59 | virtual QPopupMenu * getContextMenu(); |
58 | virtual void contextMenuSelected(int); | 60 | virtual void contextMenuSelected(int); |
@@ -72,7 +74,7 @@ public: | |||
72 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); | 74 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); |
73 | virtual ~POP3folderItem(); | 75 | virtual ~POP3folderItem(); |
74 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 76 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
75 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 77 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
76 | virtual QPopupMenu * getContextMenu(); | 78 | virtual QPopupMenu * getContextMenu(); |
77 | virtual void contextMenuSelected(int); | 79 | virtual void contextMenuSelected(int); |
78 | 80 | ||
@@ -89,7 +91,7 @@ public: | |||
89 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | 91 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); |
90 | virtual ~NNTPviewItem(); | 92 | virtual ~NNTPviewItem(); |
91 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 93 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
92 | virtual RecBody fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 94 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
93 | AbstractMail *getWrapper(); | 95 | AbstractMail *getWrapper(); |
94 | virtual QPopupMenu * getContextMenu(); | 96 | virtual QPopupMenu * getContextMenu(); |
95 | virtual void contextMenuSelected(int); | 97 | virtual void contextMenuSelected(int); |
@@ -110,7 +112,7 @@ public: | |||
110 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); | 112 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); |
111 | virtual ~NNTPfolderItem(); | 113 | virtual ~NNTPfolderItem(); |
112 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 114 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
113 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 115 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
114 | virtual QPopupMenu * getContextMenu(); | 116 | virtual QPopupMenu * getContextMenu(); |
115 | virtual void contextMenuSelected(int); | 117 | virtual void contextMenuSelected(int); |
116 | 118 | ||
@@ -128,7 +130,7 @@ public: | |||
128 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | 130 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
129 | virtual ~IMAPviewItem(); | 131 | virtual ~IMAPviewItem(); |
130 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 132 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
131 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 133 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
132 | AbstractMail *getWrapper(); | 134 | AbstractMail *getWrapper(); |
133 | virtual QPopupMenu * getContextMenu(); | 135 | virtual QPopupMenu * getContextMenu(); |
134 | virtual void contextMenuSelected(int); | 136 | virtual void contextMenuSelected(int); |
@@ -151,7 +153,7 @@ public: | |||
151 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 153 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
152 | virtual ~IMAPfolderItem(); | 154 | virtual ~IMAPfolderItem(); |
153 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 155 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
154 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 156 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
155 | virtual QPopupMenu * getContextMenu(); | 157 | virtual QPopupMenu * getContextMenu(); |
156 | virtual void contextMenuSelected(int); | 158 | virtual void contextMenuSelected(int); |
157 | virtual const QString& Delemiter()const; | 159 | virtual const QString& Delemiter()const; |
@@ -170,7 +172,7 @@ public: | |||
170 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | 172 | MHviewItem( const QString&aMboxPath, AccountView *parent ); |
171 | virtual ~MHviewItem(); | 173 | virtual ~MHviewItem(); |
172 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 174 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); |
173 | virtual RecBody fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | 175 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); |
174 | AbstractMail *getWrapper(); | 176 | AbstractMail *getWrapper(); |
175 | virtual QPopupMenu * getContextMenu(); | 177 | virtual QPopupMenu * getContextMenu(); |
176 | virtual void contextMenuSelected(int); | 178 | virtual void contextMenuSelected(int); |
@@ -193,7 +195,7 @@ public: | |||
193 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | 195 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); |
194 | virtual ~MHfolderItem(); | 196 | virtual ~MHfolderItem(); |
195 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | 197 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); |
196 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | 198 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); |
197 | virtual QPopupMenu * getContextMenu(); | 199 | virtual QPopupMenu * getContextMenu(); |
198 | virtual void contextMenuSelected(int); | 200 | virtual void contextMenuSelected(int); |
199 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; | 201 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 811e57a..f0a163e 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -114,10 +114,10 @@ void AccountView::refreshAll() | |||
114 | { | 114 | { |
115 | } | 115 | } |
116 | 116 | ||
117 | RecBody AccountView::fetchBody(const RecMailP&aMail) | 117 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
118 | { | 118 | { |
119 | QListViewItem*item = selectedItem (); | 119 | QListViewItem*item = selectedItem (); |
120 | if (!item) return RecBody(); | 120 | if (!item) return new RecBody(); |
121 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 121 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
122 | return view->fetchBody(aMail); | 122 | return view->fetchBody(aMail); |
123 | } | 123 | } |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index b082b1f..787b0b0 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -21,7 +21,7 @@ public: | |||
21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
22 | virtual ~AccountView(); | 22 | virtual ~AccountView(); |
23 | virtual void populate( QList<Account> list ); | 23 | virtual void populate( QList<Account> list ); |
24 | virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); | 24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); |
25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
26 | virtual bool currentisDraft(); | 26 | virtual bool currentisDraft(); |
27 | 27 | ||
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 5bc2883..988a1d9 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -280,7 +280,7 @@ ComposeMail::~ComposeMail() | |||
280 | void ComposeMail::reEditMail(const RecMailP¤t) | 280 | void ComposeMail::reEditMail(const RecMailP¤t) |
281 | { | 281 | { |
282 | RecMailP data = current; | 282 | RecMailP data = current; |
283 | message->setText(data->Wrapper()->fetchBody(current).Bodytext()); | 283 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
284 | subjectLine->setText( data->getSubject()); | 284 | subjectLine->setText( data->getSubject()); |
285 | toLine->setText(data->To().join(",")); | 285 | toLine->setText(data->To().join(",")); |
286 | ccLine->setText(data->CC().join(",")); | 286 | ccLine->setText(data->CC().join(",")); |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 2d55c83..e5d64a6 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -24,10 +24,10 @@ public: | |||
24 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; | 24 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; |
25 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0; | 25 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0; |
26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
27 | virtual RecBody fetchBody(const RecMailP&mail)=0; | 27 | virtual RecBodyP fetchBody(const RecMailP&mail)=0; |
28 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part)=0; | 28 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; |
29 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part)=0; | 29 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; |
30 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part)=0; | 30 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; |
31 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; | 31 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; |
32 | 32 | ||
33 | virtual void deleteMail(const RecMailP&mail)=0; | 33 | virtual void deleteMail(const RecMailP&mail)=0; |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index f428415..0c68280 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -22,7 +22,7 @@ Genericwrapper::~Genericwrapper() | |||
22 | cleanMimeCache(); | 22 | cleanMimeCache(); |
23 | } | 23 | } |
24 | 24 | ||
25 | void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | 25 | void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) |
26 | { | 26 | { |
27 | if (!mime) { | 27 | if (!mime) { |
28 | return; | 28 | return; |
@@ -38,30 +38,30 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | |||
38 | mailmime_content*type = fields.fld_content; | 38 | mailmime_content*type = fields.fld_content; |
39 | clistcell*current; | 39 | clistcell*current; |
40 | if (!type) { | 40 | if (!type) { |
41 | target.setType("text"); | 41 | target->setType("text"); |
42 | target.setSubtype("plain"); | 42 | target->setSubtype("plain"); |
43 | } else { | 43 | } else { |
44 | target.setSubtype(type->ct_subtype); | 44 | target->setSubtype(type->ct_subtype); |
45 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { | 45 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { |
46 | case MAILMIME_DISCRETE_TYPE_TEXT: | 46 | case MAILMIME_DISCRETE_TYPE_TEXT: |
47 | target.setType("text"); | 47 | target->setType("text"); |
48 | break; | 48 | break; |
49 | case MAILMIME_DISCRETE_TYPE_IMAGE: | 49 | case MAILMIME_DISCRETE_TYPE_IMAGE: |
50 | target.setType("image"); | 50 | target->setType("image"); |
51 | break; | 51 | break; |
52 | case MAILMIME_DISCRETE_TYPE_AUDIO: | 52 | case MAILMIME_DISCRETE_TYPE_AUDIO: |
53 | target.setType("audio"); | 53 | target->setType("audio"); |
54 | break; | 54 | break; |
55 | case MAILMIME_DISCRETE_TYPE_VIDEO: | 55 | case MAILMIME_DISCRETE_TYPE_VIDEO: |
56 | target.setType("video"); | 56 | target->setType("video"); |
57 | break; | 57 | break; |
58 | case MAILMIME_DISCRETE_TYPE_APPLICATION: | 58 | case MAILMIME_DISCRETE_TYPE_APPLICATION: |
59 | target.setType("application"); | 59 | target->setType("application"); |
60 | break; | 60 | break; |
61 | case MAILMIME_DISCRETE_TYPE_EXTENSION: | 61 | case MAILMIME_DISCRETE_TYPE_EXTENSION: |
62 | default: | 62 | default: |
63 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { | 63 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { |
64 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); | 64 | target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); |
65 | } | 65 | } |
66 | break; | 66 | break; |
67 | } | 67 | } |
@@ -74,13 +74,13 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | |||
74 | field = (mailmime_field*)current->data; | 74 | field = (mailmime_field*)current->data; |
75 | switch(field->fld_type) { | 75 | switch(field->fld_type) { |
76 | case MAILMIME_FIELD_TRANSFER_ENCODING: | 76 | case MAILMIME_FIELD_TRANSFER_ENCODING: |
77 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); | 77 | target->setEncoding(getencoding(field->fld_data.fld_encoding)); |
78 | break; | 78 | break; |
79 | case MAILMIME_FIELD_ID: | 79 | case MAILMIME_FIELD_ID: |
80 | target.setIdentifier(field->fld_data.fld_id); | 80 | target->setIdentifier(field->fld_data.fld_id); |
81 | break; | 81 | break; |
82 | case MAILMIME_FIELD_DESCRIPTION: | 82 | case MAILMIME_FIELD_DESCRIPTION: |
83 | target.setDescription(field->fld_data.fld_description); | 83 | target->setDescription(field->fld_data.fld_description); |
84 | break; | 84 | break; |
85 | default: | 85 | default: |
86 | break; | 86 | break; |
@@ -89,7 +89,7 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | void Genericwrapper::fillParameters(RecPart&target,clist*parameters) | 92 | void Genericwrapper::fillParameters(RecPartP&target,clist*parameters) |
93 | { | 93 | { |
94 | if (!parameters) {return;} | 94 | if (!parameters) {return;} |
95 | clistcell*current=0; | 95 | clistcell*current=0; |
@@ -97,7 +97,7 @@ void Genericwrapper::fillParameters(RecPart&target,clist*parameters) | |||
97 | for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { | 97 | for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { |
98 | param = (mailmime_parameter*)current->data; | 98 | param = (mailmime_parameter*)current->data; |
99 | if (param) { | 99 | if (param) { |
100 | target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 100 | target->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | } | 103 | } |
@@ -132,7 +132,7 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) | |||
132 | return enc; | 132 | return enc; |
133 | } | 133 | } |
134 | 134 | ||
135 | void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) | 135 | void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) |
136 | { | 136 | { |
137 | if (current_rec >= 10) { | 137 | if (current_rec >= 10) { |
138 | qDebug("too deep recursion!"); | 138 | qDebug("too deep recursion!"); |
@@ -145,7 +145,7 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
145 | size_t len; | 145 | size_t len; |
146 | clistiter * cur = 0; | 146 | clistiter * cur = 0; |
147 | QString b; | 147 | QString b; |
148 | RecPart part; | 148 | RecPartP part = new RecPart(); |
149 | 149 | ||
150 | switch (mime->mm_type) { | 150 | switch (mime->mm_type) { |
151 | case MAILMIME_SINGLE: | 151 | case MAILMIME_SINGLE: |
@@ -153,28 +153,28 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
153 | QValueList<int>countlist = recList; | 153 | QValueList<int>countlist = recList; |
154 | countlist.append(current_count); | 154 | countlist.append(current_count); |
155 | r = mailmessage_fetch_section(message,mime,&data,&len); | 155 | r = mailmessage_fetch_section(message,mime,&data,&len); |
156 | part.setSize(len); | 156 | part->setSize(len); |
157 | part.setPositionlist(countlist); | 157 | part->setPositionlist(countlist); |
158 | b = gen_attachment_id(); | 158 | b = gen_attachment_id(); |
159 | part.setIdentifier(b); | 159 | part->setIdentifier(b); |
160 | fillSingleBody(part,message,mime); | 160 | fillSingleBody(part,message,mime); |
161 | if (part.Type()=="text" && target.Bodytext().isNull()) { | 161 | if (part->Type()=="text" && target->Bodytext().isNull()) { |
162 | encodedString*rs = new encodedString(); | 162 | encodedString*rs = new encodedString(); |
163 | rs->setContent(data,len); | 163 | rs->setContent(data,len); |
164 | encodedString*res = decode_String(rs,part.Encoding()); | 164 | encodedString*res = decode_String(rs,part->Encoding()); |
165 | if (countlist.count()>2) { | 165 | if (countlist.count()>2) { |
166 | bodyCache[b]=rs; | 166 | bodyCache[b]=rs; |
167 | target.addPart(part); | 167 | target->addPart(part); |
168 | } else { | 168 | } else { |
169 | delete rs; | 169 | delete rs; |
170 | } | 170 | } |
171 | b = QString(res->Content()); | 171 | b = QString(res->Content()); |
172 | delete res; | 172 | delete res; |
173 | target.setBodytext(b); | 173 | target->setBodytext(b); |
174 | target.setDescription(part); | 174 | target->setDescription(part); |
175 | } else { | 175 | } else { |
176 | bodyCache[b]=new encodedString(data,len); | 176 | bodyCache[b]=new encodedString(data,len); |
177 | target.addPart(part); | 177 | target->addPart(part); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | break; | 180 | break; |
@@ -186,11 +186,11 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
186 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 186 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
187 | cbody = (mailmime*)clist_content(cur); | 187 | cbody = (mailmime*)clist_content(cur); |
188 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | 188 | if (cbody->mm_type==MAILMIME_MULTIPLE) { |
189 | RecPart targetPart; | 189 | RecPartP targetPart = new RecPart(); |
190 | targetPart.setType("multipart"); | 190 | targetPart->setType("multipart"); |
191 | countlist.append(current_count); | 191 | countlist.append(current_count); |
192 | targetPart.setPositionlist(countlist); | 192 | targetPart->setPositionlist(countlist); |
193 | target.addPart(targetPart); | 193 | target->addPart(targetPart); |
194 | } | 194 | } |
195 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); | 195 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); |
196 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | 196 | if (cbody->mm_type==MAILMIME_MULTIPLE) { |
@@ -206,16 +206,16 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
206 | countlist.append(current_count); | 206 | countlist.append(current_count); |
207 | /* the own header is always at recursion 0 - we don't need that */ | 207 | /* the own header is always at recursion 0 - we don't need that */ |
208 | if (current_rec > 0) { | 208 | if (current_rec > 0) { |
209 | part.setPositionlist(countlist); | 209 | part->setPositionlist(countlist); |
210 | r = mailmessage_fetch_section(message,mime,&data,&len); | 210 | r = mailmessage_fetch_section(message,mime,&data,&len); |
211 | part.setSize(len); | 211 | part->setSize(len); |
212 | part.setPositionlist(countlist); | 212 | part->setPositionlist(countlist); |
213 | b = gen_attachment_id(); | 213 | b = gen_attachment_id(); |
214 | part.setIdentifier(b); | 214 | part->setIdentifier(b); |
215 | part.setType("message"); | 215 | part->setType("message"); |
216 | part.setSubtype("rfc822"); | 216 | part->setSubtype("rfc822"); |
217 | bodyCache[b]=new encodedString(data,len); | 217 | bodyCache[b]=new encodedString(data,len); |
218 | target.addPart(part); | 218 | target->addPart(part); |
219 | } | 219 | } |
220 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 220 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
221 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); | 221 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
@@ -225,13 +225,13 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | RecBody Genericwrapper::parseMail( mailmessage * msg ) | 228 | RecBodyP Genericwrapper::parseMail( mailmessage * msg ) |
229 | { | 229 | { |
230 | int err = MAILIMF_NO_ERROR; | 230 | int err = MAILIMF_NO_ERROR; |
231 | mailmime_single_fields fields; | 231 | mailmime_single_fields fields; |
232 | /* is bound to msg and will be freed there */ | 232 | /* is bound to msg and will be freed there */ |
233 | mailmime * mime=0; | 233 | mailmime * mime=0; |
234 | RecBody body; | 234 | RecBodyP body = new RecBody(); |
235 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 235 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
236 | err = mailmessage_get_bodystructure(msg,&mime); | 236 | err = mailmessage_get_bodystructure(msg,&mime); |
237 | QValueList<int>recList; | 237 | QValueList<int>recList; |
@@ -332,23 +332,23 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | |||
332 | return result; | 332 | return result; |
333 | } | 333 | } |
334 | 334 | ||
335 | encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPart&part) | 335 | encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) |
336 | { | 336 | { |
337 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 337 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); |
338 | if (it==bodyCache.end()) return new encodedString(); | 338 | if (it==bodyCache.end()) return new encodedString(); |
339 | encodedString*t = decode_String(it.data(),part.Encoding()); | 339 | encodedString*t = decode_String(it.data(),part->Encoding()); |
340 | return t; | 340 | return t; |
341 | } | 341 | } |
342 | 342 | ||
343 | encodedString* Genericwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) | 343 | encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part) |
344 | { | 344 | { |
345 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 345 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); |
346 | if (it==bodyCache.end()) return new encodedString(); | 346 | if (it==bodyCache.end()) return new encodedString(); |
347 | encodedString*t = it.data(); | 347 | encodedString*t = it.data(); |
348 | return t; | 348 | return t; |
349 | } | 349 | } |
350 | 350 | ||
351 | QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) | 351 | QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) |
352 | { | 352 | { |
353 | encodedString*t = fetchDecodedPart(mail,part); | 353 | encodedString*t = fetchDecodedPart(mail,part); |
354 | QString text=t->Content(); | 354 | QString text=t->Content(); |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index f5b9504..8be9212 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -34,25 +34,25 @@ public: | |||
34 | Genericwrapper(); | 34 | Genericwrapper(); |
35 | virtual ~Genericwrapper(); | 35 | virtual ~Genericwrapper(); |
36 | 36 | ||
37 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); | 37 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
38 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); | 38 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); | 39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
40 | virtual void cleanMimeCache(); | 40 | virtual void cleanMimeCache(); |
41 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} | 41 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} |
42 | virtual void logout(){}; | 42 | virtual void logout(){}; |
43 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; | 43 | virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; |
44 | 44 | ||
45 | protected: | 45 | protected: |
46 | RecBody parseMail( mailmessage * msg ); | 46 | RecBodyP parseMail( mailmessage * msg ); |
47 | QString parseMailboxList( mailimf_mailbox_list *list ); | 47 | QString parseMailboxList( mailimf_mailbox_list *list ); |
48 | QString parseMailbox( mailimf_mailbox *box ); | 48 | QString parseMailbox( mailimf_mailbox *box ); |
49 | QString parseGroup( mailimf_group *group ); | 49 | QString parseGroup( mailimf_group *group ); |
50 | QString parseAddressList( mailimf_address_list *list ); | 50 | QString parseAddressList( mailimf_address_list *list ); |
51 | QString parseDateTime( mailimf_date_time *date ); | 51 | QString parseDateTime( mailimf_date_time *date ); |
52 | 52 | ||
53 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 53 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
54 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 54 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); |
55 | static void fillParameters(RecPart&target,clist*parameters); | 55 | static void fillParameters(RecPartP&target,clist*parameters); |
56 | static QString getencoding(mailmime_mechanism*aEnc); | 56 | static QString getencoding(mailmime_mechanism*aEnc); |
57 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); | 57 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); |
58 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); | 58 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 56e7df9..230cf53 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -483,9 +483,9 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
483 | return m; | 483 | return m; |
484 | } | 484 | } |
485 | 485 | ||
486 | RecBody IMAPwrapper::fetchBody(const RecMailP&mail) | 486 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) |
487 | { | 487 | { |
488 | RecBody body; | 488 | RecBodyP body = new RecBody(); |
489 | const char *mb; | 489 | const char *mb; |
490 | int err = MAILIMAP_NO_ERROR; | 490 | int err = MAILIMAP_NO_ERROR; |
491 | clist *result = 0; | 491 | clist *result = 0; |
@@ -642,7 +642,7 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int | |||
642 | 642 | ||
643 | /* current_recursion is for recursive calls. | 643 | /* current_recursion is for recursive calls. |
644 | current_count means the position inside the internal loop! */ | 644 | current_count means the position inside the internal loop! */ |
645 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body, | 645 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
646 | int current_recursion,QValueList<int>recList,int current_count) | 646 | int current_recursion,QValueList<int>recList,int current_count) |
647 | { | 647 | { |
648 | if (!body || current_recursion>=10) { | 648 | if (!body || current_recursion>=10) { |
@@ -653,28 +653,28 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta | |||
653 | { | 653 | { |
654 | QValueList<int>countlist = recList; | 654 | QValueList<int>countlist = recList; |
655 | countlist.append(current_count); | 655 | countlist.append(current_count); |
656 | RecPart currentPart; | 656 | RecPartP currentPart = new RecPart(); |
657 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 657 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
658 | QString id(""); | 658 | QString id(""); |
659 | currentPart.setPositionlist(countlist); | 659 | currentPart->setPositionlist(countlist); |
660 | for (unsigned int j = 0; j < countlist.count();++j) { | 660 | for (unsigned int j = 0; j < countlist.count();++j) { |
661 | id+=(j>0?" ":""); | 661 | id+=(j>0?" ":""); |
662 | id+=QString("%1").arg(countlist[j]); | 662 | id+=QString("%1").arg(countlist[j]); |
663 | } | 663 | } |
664 | qDebug("ID = %s",id.latin1()); | 664 | qDebug("ID = %s",id.latin1()); |
665 | currentPart.setIdentifier(id); | 665 | currentPart->setIdentifier(id); |
666 | fillSinglePart(currentPart,part1); | 666 | fillSinglePart(currentPart,part1); |
667 | /* important: Check for is NULL 'cause a body can be empty! | 667 | /* important: Check for is NULL 'cause a body can be empty! |
668 | And we put it only into the mail if it is the FIRST part */ | 668 | And we put it only into the mail if it is the FIRST part */ |
669 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body.Bodytext().isNull() && countlist[0]==1) { | 669 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
670 | QString body_text = fetchTextPart(mail,countlist,true,currentPart.Encoding()); | 670 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
671 | target_body.setDescription(currentPart); | 671 | target_body->setDescription(currentPart); |
672 | target_body.setBodytext(body_text); | 672 | target_body->setBodytext(body_text); |
673 | if (countlist.count()>1) { | 673 | if (countlist.count()>1) { |
674 | target_body.addPart(currentPart); | 674 | target_body->addPart(currentPart); |
675 | } | 675 | } |
676 | } else { | 676 | } else { |
677 | target_body.addPart(currentPart); | 677 | target_body->addPart(currentPart); |
678 | } | 678 | } |
679 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { | 679 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { |
680 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); | 680 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); |
@@ -691,12 +691,12 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta | |||
691 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 691 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
692 | current_body = (mailimap_body*)current->data; | 692 | current_body = (mailimap_body*)current->data; |
693 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 693 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
694 | RecPart targetPart; | 694 | RecPartP targetPart = new RecPart(); |
695 | targetPart.setType("multipart"); | 695 | targetPart->setType("multipart"); |
696 | fillMultiPart(targetPart,mailDescription); | 696 | fillMultiPart(targetPart,mailDescription); |
697 | countlist.append(current_count); | 697 | countlist.append(current_count); |
698 | targetPart.setPositionlist(countlist); | 698 | targetPart->setPositionlist(countlist); |
699 | target_body.addPart(targetPart); | 699 | target_body->addPart(targetPart); |
700 | QString id(""); | 700 | QString id(""); |
701 | for (unsigned int j = 0; j < countlist.count();++j) { | 701 | for (unsigned int j = 0; j < countlist.count();++j) { |
702 | id+=(j>0?" ":""); | 702 | id+=(j>0?" ":""); |
@@ -717,21 +717,21 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta | |||
717 | } | 717 | } |
718 | } | 718 | } |
719 | 719 | ||
720 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | 720 | void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) |
721 | { | 721 | { |
722 | if (!Description) { | 722 | if (!Description) { |
723 | return; | 723 | return; |
724 | } | 724 | } |
725 | switch (Description->bd_type) { | 725 | switch (Description->bd_type) { |
726 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 726 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
727 | target_part.setType("text"); | 727 | target_part->setType("text"); |
728 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | 728 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); |
729 | break; | 729 | break; |
730 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 730 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
731 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | 731 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); |
732 | break; | 732 | break; |
733 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 733 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
734 | target_part.setType("message"); | 734 | target_part->setType("message"); |
735 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); | 735 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); |
736 | break; | 736 | break; |
737 | default: | 737 | default: |
@@ -739,7 +739,7 @@ void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*De | |||
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) | 742 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) |
743 | { | 743 | { |
744 | if (!which) { | 744 | if (!which) { |
745 | return; | 745 | return; |
@@ -747,41 +747,41 @@ void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text | |||
747 | QString sub; | 747 | QString sub; |
748 | sub = which->bd_media_text; | 748 | sub = which->bd_media_text; |
749 | qDebug("Type= text/%s",which->bd_media_text); | 749 | qDebug("Type= text/%s",which->bd_media_text); |
750 | target_part.setSubtype(sub.lower()); | 750 | target_part->setSubtype(sub.lower()); |
751 | target_part.setLines(which->bd_lines); | 751 | target_part->setLines(which->bd_lines); |
752 | fillBodyFields(target_part,which->bd_fields); | 752 | fillBodyFields(target_part,which->bd_fields); |
753 | } | 753 | } |
754 | 754 | ||
755 | void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) | 755 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) |
756 | { | 756 | { |
757 | if (!which) { | 757 | if (!which) { |
758 | return; | 758 | return; |
759 | } | 759 | } |
760 | target_part.setSubtype("rfc822"); | 760 | target_part->setSubtype("rfc822"); |
761 | qDebug("Message part"); | 761 | qDebug("Message part"); |
762 | /* we set this type to text/plain */ | 762 | /* we set this type to text/plain */ |
763 | target_part.setLines(which->bd_lines); | 763 | target_part->setLines(which->bd_lines); |
764 | fillBodyFields(target_part,which->bd_fields); | 764 | fillBodyFields(target_part,which->bd_fields); |
765 | } | 765 | } |
766 | 766 | ||
767 | void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which) | 767 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) |
768 | { | 768 | { |
769 | if (!which) return; | 769 | if (!which) return; |
770 | QString sub = which->bd_media_subtype; | 770 | QString sub = which->bd_media_subtype; |
771 | target_part.setSubtype(sub.lower()); | 771 | target_part->setSubtype(sub.lower()); |
772 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { | 772 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { |
773 | clistcell*cur = 0; | 773 | clistcell*cur = 0; |
774 | mailimap_single_body_fld_param*param=0; | 774 | mailimap_single_body_fld_param*param=0; |
775 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 775 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
776 | param = (mailimap_single_body_fld_param*)cur->data; | 776 | param = (mailimap_single_body_fld_param*)cur->data; |
777 | if (param) { | 777 | if (param) { |
778 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 778 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
779 | } | 779 | } |
780 | } | 780 | } |
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) | 784 | void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) |
785 | { | 785 | { |
786 | if (!which) { | 786 | if (!which) { |
787 | return; | 787 | return; |
@@ -818,12 +818,12 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas | |||
818 | sub = ""; | 818 | sub = ""; |
819 | } | 819 | } |
820 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 820 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); |
821 | target_part.setType(type.lower()); | 821 | target_part->setType(type.lower()); |
822 | target_part.setSubtype(sub.lower()); | 822 | target_part->setSubtype(sub.lower()); |
823 | fillBodyFields(target_part,which->bd_fields); | 823 | fillBodyFields(target_part,which->bd_fields); |
824 | } | 824 | } |
825 | 825 | ||
826 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 826 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) |
827 | { | 827 | { |
828 | if (!which) return; | 828 | if (!which) return; |
829 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 829 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
@@ -832,7 +832,7 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
832 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 832 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
833 | param = (mailimap_single_body_fld_param*)cur->data; | 833 | param = (mailimap_single_body_fld_param*)cur->data; |
834 | if (param) { | 834 | if (param) { |
835 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 835 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
836 | } | 836 | } |
837 | } | 837 | } |
838 | } | 838 | } |
@@ -864,10 +864,10 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
864 | } | 864 | } |
865 | } | 865 | } |
866 | if (which->bd_description) { | 866 | if (which->bd_description) { |
867 | target_part.setDescription(QString(which->bd_description)); | 867 | target_part->setDescription(QString(which->bd_description)); |
868 | } | 868 | } |
869 | target_part.setEncoding(encoding); | 869 | target_part->setEncoding(encoding); |
870 | target_part.setSize(which->bd_size); | 870 | target_part->setSize(which->bd_size); |
871 | } | 871 | } |
872 | 872 | ||
873 | void IMAPwrapper::deleteMail(const RecMailP&mail) | 873 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
@@ -948,22 +948,22 @@ QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&pat | |||
948 | return body; | 948 | return body; |
949 | } | 949 | } |
950 | 950 | ||
951 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) | 951 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) |
952 | { | 952 | { |
953 | return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); | 953 | return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); |
954 | } | 954 | } |
955 | 955 | ||
956 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part) | 956 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) |
957 | { | 957 | { |
958 | encodedString*res = fetchRawPart(mail,part.Positionlist(),false); | 958 | encodedString*res = fetchRawPart(mail,part->Positionlist(),false); |
959 | encodedString*r = decode_String(res,part.Encoding()); | 959 | encodedString*r = decode_String(res,part->Encoding()); |
960 | delete res; | 960 | delete res; |
961 | return r; | 961 | return r; |
962 | } | 962 | } |
963 | 963 | ||
964 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) | 964 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) |
965 | { | 965 | { |
966 | return fetchRawPart(mail,part.Positionlist(),false); | 966 | return fetchRawPart(mail,part->Positionlist(),false); |
967 | } | 967 | } |
968 | 968 | ||
969 | int IMAPwrapper::deleteAllMail(const FolderP&folder) | 969 | int IMAPwrapper::deleteAllMail(const FolderP&folder) |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 7448acb..e56605a 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -35,10 +35,10 @@ public: | |||
35 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 35 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
36 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 36 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
37 | 37 | ||
38 | virtual RecBody fetchBody(const RecMailP&mail); | 38 | virtual RecBodyP fetchBody(const RecMailP&mail); |
39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); | 39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
40 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); | 40 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
41 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); | 41 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
42 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 42 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
43 | 43 | ||
44 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, | 44 | virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, |
@@ -60,15 +60,15 @@ protected: | |||
60 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); | 60 | virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); |
61 | int selectMbox(const QString&mbox); | 61 | int selectMbox(const QString&mbox); |
62 | 62 | ||
63 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 63 | void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); |
64 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 64 | void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); |
65 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 65 | void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which); |
66 | void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); | 66 | void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which); |
67 | void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); | 67 | void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which); |
68 | void traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); | 68 | void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1); |
69 | 69 | ||
70 | /* just helpers */ | 70 | /* just helpers */ |
71 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | 71 | static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which); |
72 | static QStringList address_list_to_stringlist(clist*list); | 72 | static QStringList address_list_to_stringlist(clist*list); |
73 | 73 | ||
74 | 74 | ||
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index fd91fe5..90b8865 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -111,12 +111,29 @@ const QStringList& RecMail::References()const | |||
111 | } | 111 | } |
112 | 112 | ||
113 | RecPart::RecPart() | 113 | RecPart::RecPart() |
114 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 114 | : Opie::Core::ORefCount(), |
115 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | ||
115 | { | 116 | { |
116 | m_Parameters.clear(); | 117 | m_Parameters.clear(); |
117 | m_poslist.clear(); | 118 | m_poslist.clear(); |
118 | } | 119 | } |
119 | 120 | ||
121 | RecPart::RecPart(const RecPart&old) | ||
122 | : Opie::Core::ORefCount(), | ||
123 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | ||
124 | { | ||
125 | m_type = old.m_type; | ||
126 | m_subtype = old.m_subtype; | ||
127 | m_identifier = old.m_identifier; | ||
128 | m_encoding = old.m_encoding; | ||
129 | m_description = old.m_description; | ||
130 | m_lines = old.m_lines; | ||
131 | m_size = old.m_size; | ||
132 | m_Parameters = old.m_Parameters; | ||
133 | m_poslist = old.m_poslist; | ||
134 | qDebug("RecPart copy constructor"); | ||
135 | } | ||
136 | |||
120 | RecPart::~RecPart() | 137 | RecPart::~RecPart() |
121 | { | 138 | { |
122 | } | 139 | } |
@@ -227,11 +244,20 @@ const QValueList<int>& RecPart::Positionlist()const | |||
227 | } | 244 | } |
228 | 245 | ||
229 | RecBody::RecBody() | 246 | RecBody::RecBody() |
230 | : m_BodyText(),m_PartsList(),m_description() | 247 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
231 | { | 248 | { |
232 | m_PartsList.clear(); | 249 | m_PartsList.clear(); |
233 | } | 250 | } |
234 | 251 | ||
252 | RecBody::RecBody(const RecBody&old) | ||
253 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | ||
254 | { | ||
255 | m_BodyText = old.m_BodyText; | ||
256 | m_PartsList = old.m_PartsList; | ||
257 | m_description = old.m_description; | ||
258 | qDebug("Recbody copy constructor"); | ||
259 | } | ||
260 | |||
235 | RecBody::~RecBody() | 261 | RecBody::~RecBody() |
236 | { | 262 | { |
237 | } | 263 | } |
@@ -246,28 +272,28 @@ const QString& RecBody::Bodytext()const | |||
246 | return m_BodyText; | 272 | return m_BodyText; |
247 | } | 273 | } |
248 | 274 | ||
249 | void RecBody::setParts(const QValueList<RecPart>&parts) | 275 | void RecBody::setParts(const QValueList<RecPartP>&parts) |
250 | { | 276 | { |
251 | m_PartsList.clear(); | 277 | m_PartsList.clear(); |
252 | m_PartsList = parts; | 278 | m_PartsList = parts; |
253 | } | 279 | } |
254 | 280 | ||
255 | const QValueList<RecPart>& RecBody::Parts()const | 281 | const QValueList<RecPartP>& RecBody::Parts()const |
256 | { | 282 | { |
257 | return m_PartsList; | 283 | return m_PartsList; |
258 | } | 284 | } |
259 | 285 | ||
260 | void RecBody::addPart(const RecPart& part) | 286 | void RecBody::addPart(const RecPartP& part) |
261 | { | 287 | { |
262 | m_PartsList.append(part); | 288 | m_PartsList.append(part); |
263 | } | 289 | } |
264 | 290 | ||
265 | void RecBody::setDescription(const RecPart&des) | 291 | void RecBody::setDescription(const RecPartP&des) |
266 | { | 292 | { |
267 | m_description = des; | 293 | m_description = des; |
268 | } | 294 | } |
269 | 295 | ||
270 | const RecPart& RecBody::Description()const | 296 | const RecPartP& RecBody::Description()const |
271 | { | 297 | { |
272 | return m_description; | 298 | return m_description; |
273 | } | 299 | } |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index 941556a..c317880 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -84,7 +84,7 @@ protected: | |||
84 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 84 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
85 | typedef QMap<QString,QString> part_plist_t; | 85 | typedef QMap<QString,QString> part_plist_t; |
86 | 86 | ||
87 | class RecPart | 87 | class RecPart:public Opie::Core::ORefCount |
88 | { | 88 | { |
89 | protected: | 89 | protected: |
90 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; | 90 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; |
@@ -95,6 +95,7 @@ protected: | |||
95 | 95 | ||
96 | public: | 96 | public: |
97 | RecPart(); | 97 | RecPart(); |
98 | RecPart(const RecPart&); | ||
98 | virtual ~RecPart(); | 99 | virtual ~RecPart(); |
99 | 100 | ||
100 | const QString&Type()const; | 101 | const QString&Type()const; |
@@ -121,27 +122,32 @@ public: | |||
121 | const QValueList<int>& Positionlist()const; | 122 | const QValueList<int>& Positionlist()const; |
122 | }; | 123 | }; |
123 | 124 | ||
124 | class RecBody | 125 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; |
126 | |||
127 | class RecBody:public Opie::Core::ORefCount | ||
125 | { | 128 | { |
126 | protected: | 129 | protected: |
127 | QString m_BodyText; | 130 | QString m_BodyText; |
128 | QValueList<RecPart> m_PartsList; | 131 | QValueList<RecPartP> m_PartsList; |
129 | RecPart m_description; | 132 | RecPartP m_description; |
130 | 133 | ||
131 | public: | 134 | public: |
132 | RecBody(); | 135 | RecBody(); |
136 | RecBody(const RecBody&old); | ||
133 | virtual ~RecBody(); | 137 | virtual ~RecBody(); |
134 | void setBodytext(const QString&); | 138 | void setBodytext(const QString&); |
135 | const QString& Bodytext()const; | 139 | const QString& Bodytext()const; |
136 | 140 | ||
137 | void setDescription(const RecPart&des); | 141 | void setDescription(const RecPartP&des); |
138 | const RecPart& Description()const; | 142 | const RecPartP& Description()const; |
139 | 143 | ||
140 | void setParts(const QValueList<RecPart>&parts); | 144 | void setParts(const QValueList<RecPartP>&parts); |
141 | const QValueList<RecPart>& Parts()const; | 145 | const QValueList<RecPartP>& Parts()const; |
142 | void addPart(const RecPart&part); | 146 | void addPart(const RecPartP&part); |
143 | }; | 147 | }; |
144 | 148 | ||
149 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; | ||
150 | |||
145 | class encodedString | 151 | class encodedString |
146 | { | 152 | { |
147 | public: | 153 | public: |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 4aee0be..e3c75f3 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -87,9 +87,9 @@ void MBOXwrapper::answeredMail(const RecMailP&) | |||
87 | { | 87 | { |
88 | } | 88 | } |
89 | 89 | ||
90 | RecBody MBOXwrapper::fetchBody( const RecMailP &mail ) | 90 | RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) |
91 | { | 91 | { |
92 | RecBody body; | 92 | RecBodyP body = new RecBody(); |
93 | mailstorage*storage = mailstorage_new(NULL); | 93 | mailstorage*storage = mailstorage_new(NULL); |
94 | QString p = MBOXPath+"/"; | 94 | QString p = MBOXPath+"/"; |
95 | p+=mail->getMbox(); | 95 | p+=mail->getMbox(); |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index a2ecfee..9731b85 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -28,7 +28,7 @@ public: | |||
28 | 28 | ||
29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 29 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
30 | 30 | ||
31 | virtual RecBody fetchBody( const RecMailP &mail ); | 31 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
32 | static void mbox_progress( size_t current, size_t maximum ); | 32 | static void mbox_progress( size_t current, size_t maximum ); |
33 | 33 | ||
34 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 34 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 5eae31f..12472e9 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -123,9 +123,9 @@ void MHwrapper::answeredMail(const RecMailP&) | |||
123 | { | 123 | { |
124 | } | 124 | } |
125 | 125 | ||
126 | RecBody MHwrapper::fetchBody( const RecMailP &mail ) | 126 | RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) |
127 | { | 127 | { |
128 | RecBody body; | 128 | RecBodyP body = new RecBody(); |
129 | init_storage(); | 129 | init_storage(); |
130 | if (!m_storage) { | 130 | if (!m_storage) { |
131 | return body; | 131 | return body; |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index 0846ec3..4310c84 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h | |||
@@ -33,7 +33,7 @@ public: | |||
33 | 33 | ||
34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 34 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
35 | 35 | ||
36 | virtual RecBody fetchBody( const RecMailP &mail ); | 36 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
37 | static void mbox_progress( size_t current, size_t maximum ); | 37 | static void mbox_progress( size_t current, size_t maximum ); |
38 | 38 | ||
39 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 39 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 9de958d..cc36f32 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -33,17 +33,17 @@ void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
36 | RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) { | 36 | RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { |
37 | int err = NEWSNNTP_NO_ERROR; | 37 | int err = NEWSNNTP_NO_ERROR; |
38 | char *message = 0; | 38 | char *message = 0; |
39 | size_t length = 0; | 39 | size_t length = 0; |
40 | 40 | ||
41 | RecBodyP body = new RecBody(); | ||
41 | login(); | 42 | login(); |
42 | if ( !m_nntp ) { | 43 | if ( !m_nntp ) { |
43 | return RecBody(); | 44 | return body; |
44 | } | 45 | } |
45 | 46 | ||
46 | RecBody body; | ||
47 | mailmessage * mailmsg; | 47 | mailmessage * mailmsg; |
48 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 48 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
49 | qDebug("Message to large: %i",mail->Msgsize()); | 49 | qDebug("Message to large: %i",mail->Msgsize()); |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index a87a8e8..2fb82f2 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h | |||
@@ -30,7 +30,7 @@ public: | |||
30 | virtual void answeredMail(const RecMailP&mail); | 30 | virtual void answeredMail(const RecMailP&mail); |
31 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 31 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
32 | 32 | ||
33 | virtual RecBody fetchBody( const RecMailP &mail ); | 33 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
34 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 34 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
35 | virtual void logout(); | 35 | virtual void logout(); |
36 | virtual MAILLIB::ATYPE getType()const; | 36 | virtual MAILLIB::ATYPE getType()const; |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index f5694fe..1b7a1b4 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -31,17 +31,18 @@ void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { | |||
31 | qDebug( "POP3: %i of %i", current, maximum ); | 31 | qDebug( "POP3: %i of %i", current, maximum ); |
32 | } | 32 | } |
33 | 33 | ||
34 | RecBody POP3wrapper::fetchBody( const RecMailP &mail ) { | 34 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { |
35 | int err = MAILPOP3_NO_ERROR; | 35 | int err = MAILPOP3_NO_ERROR; |
36 | char *message = 0; | 36 | char *message = 0; |
37 | size_t length = 0; | 37 | size_t length = 0; |
38 | 38 | ||
39 | RecBodyP body = new RecBody(); | ||
40 | |||
39 | login(); | 41 | login(); |
40 | if ( !m_pop3 ) { | 42 | if ( !m_pop3 ) { |
41 | return RecBody(); | 43 | return body; |
42 | } | 44 | } |
43 | 45 | ||
44 | RecBody body; | ||
45 | mailmessage * mailmsg; | 46 | mailmessage * mailmsg; |
46 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 47 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
47 | qDebug("Message to large: %i",mail->Msgsize()); | 48 | qDebug("Message to large: %i",mail->Msgsize()); |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index c46b941..5101fa5 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -26,7 +26,7 @@ public: | |||
26 | virtual void answeredMail(const RecMailP&mail); | 26 | virtual void answeredMail(const RecMailP&mail); |
27 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 27 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
28 | 28 | ||
29 | virtual RecBody fetchBody( const RecMailP &mail ); | 29 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
30 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 30 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
31 | virtual void logout(); | 31 | virtual void logout(); |
32 | virtual MAILLIB::ATYPE getType()const; | 32 | virtual MAILLIB::ATYPE getType()const; |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index dd305df..5da2161 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -146,7 +146,7 @@ void OpieMail::displayMail() | |||
146 | QListViewItem*item = mailView->currentItem(); | 146 | QListViewItem*item = mailView->currentItem(); |
147 | if (!item) return; | 147 | if (!item) return; |
148 | RecMailP mail = ((MailListViewItem*)item)->data(); | 148 | RecMailP mail = ((MailListViewItem*)item)->data(); |
149 | RecBody body = folderView->fetchBody(mail); | 149 | RecBodyP body = folderView->fetchBody(mail); |
150 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 150 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
151 | readMail.setBody( body ); | 151 | readMail.setBody( body ); |
152 | readMail.setMail( mail ); | 152 | readMail.setMail( mail ); |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index f00d2cb..156e11d 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -78,22 +78,22 @@ AttachItem* ViewMail::lastChild(AttachItem*parent) | |||
78 | return item; | 78 | return item; |
79 | } | 79 | } |
80 | 80 | ||
81 | void ViewMail::setBody( RecBody body ) | 81 | void ViewMail::setBody(const RecBodyP&body ) |
82 | { | 82 | { |
83 | 83 | ||
84 | m_body = body; | 84 | m_body = body; |
85 | m_mail[2] = body.Bodytext(); | 85 | m_mail[2] = body->Bodytext(); |
86 | attachbutton->setEnabled(body.Parts().count()>0); | 86 | attachbutton->setEnabled(body->Parts().count()>0); |
87 | attachments->setEnabled(body.Parts().count()>0); | 87 | attachments->setEnabled(body->Parts().count()>0); |
88 | if (body.Parts().count()==0) | 88 | if (body->Parts().count()==0) |
89 | { | 89 | { |
90 | return; | 90 | return; |
91 | } | 91 | } |
92 | AttachItem * curItem=0; | 92 | AttachItem * curItem=0; |
93 | AttachItem * parentItem = 0; | 93 | AttachItem * parentItem = 0; |
94 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); | 94 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
95 | QString desc,fsize; | 95 | QString desc,fsize; |
96 | double s = body.Description().Size(); | 96 | double s = body->Description()->Size(); |
97 | int w; | 97 | int w; |
98 | w=0; | 98 | w=0; |
99 | 99 | ||
@@ -129,15 +129,15 @@ void ViewMail::setBody( RecBody body ) | |||
129 | o << s << " " << q << "Byte"; | 129 | o << s << " " << q << "Byte"; |
130 | } | 130 | } |
131 | 131 | ||
132 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body.Description().Positionlist()); | 132 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
133 | QString filename = ""; | 133 | QString filename = ""; |
134 | 134 | ||
135 | for (unsigned int i = 0; i < body.Parts().count();++i) | 135 | for (unsigned int i = 0; i < body->Parts().count();++i) |
136 | { | 136 | { |
137 | filename = ""; | 137 | filename = ""; |
138 | type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); | 138 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
139 | part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); | 139 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
140 | for (;it!=body.Parts()[i].Parameters().end();++it) | 140 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
141 | { | 141 | { |
142 | qDebug(it.key()); | 142 | qDebug(it.key()); |
143 | if (it.key().lower()=="name") | 143 | if (it.key().lower()=="name") |
@@ -145,7 +145,7 @@ void ViewMail::setBody( RecBody body ) | |||
145 | filename=it.data(); | 145 | filename=it.data(); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | s = body.Parts()[i].Size(); | 148 | s = body->Parts()[i]->Size(); |
149 | w = 0; | 149 | w = 0; |
150 | while (s>1024) | 150 | while (s>1024) |
151 | { | 151 | { |
@@ -169,19 +169,19 @@ void ViewMail::setBody( RecBody body ) | |||
169 | if (w>0) o.precision(2); else o.precision(0); | 169 | if (w>0) o.precision(2); else o.precision(0); |
170 | o.setf(QTextStream::fixed); | 170 | o.setf(QTextStream::fixed); |
171 | o << s << " " << q << "Byte"; | 171 | o << s << " " << q << "Byte"; |
172 | desc = body.Parts()[i].Description(); | 172 | desc = body->Parts()[i]->Description(); |
173 | parentItem = searchParent(body.Parts()[i].Positionlist()); | 173 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
174 | if (parentItem) | 174 | if (parentItem) |
175 | { | 175 | { |
176 | AttachItem*temp = lastChild(parentItem); | 176 | AttachItem*temp = lastChild(parentItem); |
177 | if (temp) curItem = temp; | 177 | if (temp) curItem = temp; |
178 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); | 178 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
179 | attachments->setRootIsDecorated(true); | 179 | attachments->setRootIsDecorated(true); |
180 | curItem = parentItem; | 180 | curItem = parentItem; |
181 | } | 181 | } |
182 | else | 182 | else |
183 | { | 183 | { |
184 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); | 184 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | } | 187 | } |
@@ -226,7 +226,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
226 | 226 | ||
227 | if( !str.isEmpty() ) | 227 | if( !str.isEmpty() ) |
228 | { | 228 | { |
229 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 229 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
230 | if (content) | 230 | if (content) |
231 | { | 231 | { |
232 | QFile output(str); | 232 | QFile output(str); |
@@ -248,7 +248,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
248 | { | 248 | { |
249 | if ( m_recMail->Wrapper() != 0l ) | 249 | if ( m_recMail->Wrapper() != 0l ) |
250 | { // make sure that there is a wrapper , even after delete or simular actions | 250 | { // make sure that there is a wrapper , even after delete or simular actions |
251 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 251 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | break; | 254 | break; |
@@ -257,7 +257,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
257 | } | 257 | } |
258 | 258 | ||
259 | 259 | ||
260 | void ViewMail::setMail( RecMailP mail ) | 260 | void ViewMail::setMail(const RecMailP&mail ) |
261 | { | 261 | { |
262 | 262 | ||
263 | m_recMail = mail; | 263 | m_recMail = mail; |
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index 6875e3c..b60fb8e 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h | |||
@@ -36,9 +36,9 @@ public: | |||
36 | 36 | ||
37 | void hide(); | 37 | void hide(); |
38 | void exec(); | 38 | void exec(); |
39 | void setMail( RecMailP mail ); | 39 | void setMail(const RecMailP&mail ); |
40 | void setBody( RecBody body ); | 40 | void setBody(const RecBodyP&body); |
41 | bool deleted; | 41 | bool deleted; |
42 | 42 | ||
43 | protected: | 43 | protected: |
44 | QString deHtml(const QString &string); | 44 | QString deHtml(const QString &string); |
@@ -48,9 +48,9 @@ protected: | |||
48 | protected slots: | 48 | protected slots: |
49 | void slotReply(); | 49 | void slotReply(); |
50 | void slotForward(); | 50 | void slotForward(); |
51 | void setText(); | 51 | void setText(); |
52 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | 52 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); |
53 | void slotDeleteMail( ); | 53 | void slotDeleteMail( ); |
54 | void slotShowHtml( bool ); | 54 | void slotShowHtml( bool ); |
55 | 55 | ||
56 | private: | 56 | private: |
@@ -59,15 +59,14 @@ private: | |||
59 | bool _inLoop; | 59 | bool _inLoop; |
60 | QString m_mailHtml; | 60 | QString m_mailHtml; |
61 | bool m_gotBody; | 61 | bool m_gotBody; |
62 | RecBody m_body; | 62 | RecBodyP m_body; |
63 | RecMailP m_recMail; | 63 | RecMailP m_recMail; |
64 | bool m_showHtml; | 64 | bool m_showHtml; |
65 | 65 | ||
66 | // 0 from 1 subject 2 bodytext 3 date | 66 | // 0 from 1 subject 2 bodytext 3 date |
67 | QMap <int,QString> m_mail; | 67 | QMap <int,QString> m_mail; |
68 | // 0 to 1 cc 2 bcc | 68 | // 0 to 1 cc 2 bcc |
69 | QMap <int,QStringList> m_mail2; | 69 | QMap <int,QStringList> m_mail2; |
70 | |||
71 | }; | 70 | }; |
72 | 71 | ||
73 | #endif | 72 | #endif |