summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/genericwrapper.cpp26
-rw-r--r--noncore/net/mail/genericwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp26
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h2
4 files changed, 44 insertions, 12 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp
index 62116ba..714396b 100644
--- a/noncore/net/mail/genericwrapper.cpp
+++ b/noncore/net/mail/genericwrapper.cpp
@@ -129,57 +129,73 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
129 qDebug("too deep recursion!"); 129 qDebug("too deep recursion!");
130 } 130 }
131 if (!message || !mime) { 131 if (!message || !mime) {
132 return; 132 return;
133 } 133 }
134 int r; 134 int r;
135 char*data = 0; 135 char*data = 0;
136 size_t len; 136 size_t len;
137 clistiter * cur = 0; 137 clistiter * cur = 0;
138 QString b; 138 QString b;
139 RecPart part; 139 RecPart part;
140 140
141 //current_count;
142
143 switch (mime->mm_type) { 141 switch (mime->mm_type) {
144 case MAILMIME_SINGLE: 142 case MAILMIME_SINGLE:
145 { 143 {
146 QValueList<int>countlist = recList; 144 QValueList<int>countlist = recList;
147 countlist.append(current_count); 145 countlist.append(current_count);
148 r = mailmessage_fetch_section(message,mime,&data,&len); 146 r = mailmessage_fetch_section(message,mime,&data,&len);
149 part.setSize(len); 147 part.setSize(len);
150 part.setPositionlist(countlist); 148 part.setPositionlist(countlist);
151 b = gen_attachment_id(); 149 b = gen_attachment_id();
152 part.setIdentifier(b); 150 part.setIdentifier(b);
153 fillSingleBody(part,message,mime); 151 fillSingleBody(part,message,mime);
154 if (part.Type()=="text" && target.Bodytext().isNull()) { 152 if (part.Type()=="text" && target.Bodytext().isNull()) {
155 encodedString*r = new encodedString(); 153 encodedString*r = new encodedString();
156 r->setContent(data,len); 154 r->setContent(data,len);
157 encodedString*res = decode_String(r,part.Encoding()); 155 encodedString*res = decode_String(r,part.Encoding());
156 if (countlist.count()>2) {
157 bodyCache[b]=r;
158 target.addPart(part);
159 } else {
160 delete r;
161 }
158 b = QString(res->Content()); 162 b = QString(res->Content());
159 delete r;
160 delete res; 163 delete res;
161 target.setBodytext(b); 164 target.setBodytext(b);
162 target.setDescription(part); 165 target.setDescription(part);
163 } else { 166 } else {
164 bodyCache[b]=new encodedString(data,len); 167 bodyCache[b]=new encodedString(data,len);
165 target.addPart(part); 168 target.addPart(part);
166 } 169 }
167 } 170 }
168 break; 171 break;
169 case MAILMIME_MULTIPLE: 172 case MAILMIME_MULTIPLE:
170 { 173 {
171 unsigned int ccount = current_count; 174 unsigned int ccount = 1;
175 mailmime*cbody=0;
176 QValueList<int>countlist = recList;
172 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 177 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
173 traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount); 178 cbody = (mailmime*)clist_content(cur);
179 if (cbody->mm_type==MAILMIME_MULTIPLE) {
180 RecPart targetPart;
181 targetPart.setType("multipart");
182 countlist.append(current_count);
183 targetPart.setPositionlist(countlist);
184 target.addPart(targetPart);
185 }
186 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
187 if (cbody->mm_type==MAILMIME_MULTIPLE) {
188 countlist = recList;
189 }
174 ++ccount; 190 ++ccount;
175 } 191 }
176 } 192 }
177 break; 193 break;
178 case MAILMIME_MESSAGE: 194 case MAILMIME_MESSAGE:
179 { 195 {
180 QValueList<int>countlist = recList; 196 QValueList<int>countlist = recList;
181 countlist.append(current_count); 197 countlist.append(current_count);
182 /* the own header is always at recursion 0 - we don't need that */ 198 /* the own header is always at recursion 0 - we don't need that */
183 if (current_rec > 0) { 199 if (current_rec > 0) {
184 part.setPositionlist(countlist); 200 part.setPositionlist(countlist);
185 r = mailmessage_fetch_section(message,mime,&data,&len); 201 r = mailmessage_fetch_section(message,mime,&data,&len);
diff --git a/noncore/net/mail/genericwrapper.h b/noncore/net/mail/genericwrapper.h
index c00d864..32b75c8 100644
--- a/noncore/net/mail/genericwrapper.h
+++ b/noncore/net/mail/genericwrapper.h
@@ -36,24 +36,24 @@ public:
36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
37 virtual void cleanMimeCache(); 37 virtual void cleanMimeCache();
38 38
39protected: 39protected:
40 RecMail *parseHeader( const char *header ); 40 RecMail *parseHeader( const char *header );
41 RecBody parseMail( mailmessage * msg ); 41 RecBody parseMail( mailmessage * msg );
42 QString parseMailboxList( mailimf_mailbox_list *list ); 42 QString parseMailboxList( mailimf_mailbox_list *list );
43 QString parseMailbox( mailimf_mailbox *box ); 43 QString parseMailbox( mailimf_mailbox *box );
44 QString parseGroup( mailimf_group *group ); 44 QString parseGroup( mailimf_group *group );
45 QString parseAddressList( mailimf_address_list *list ); 45 QString parseAddressList( mailimf_address_list *list );
46 QString parseDateTime( mailimf_date_time *date ); 46 QString parseDateTime( mailimf_date_time *date );
47 47
48 void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=0); 48 void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
49 static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); 49 static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);
50 static void fillParameters(RecPart&target,clist*parameters); 50 static void fillParameters(RecPart&target,clist*parameters);
51 static QString getencoding(mailmime_mechanism*aEnc); 51 static QString getencoding(mailmime_mechanism*aEnc);
52 virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox); 52 virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox);
53 53
54 QString msgTempName; 54 QString msgTempName;
55 unsigned int last_msg_id; 55 unsigned int last_msg_id;
56 QMap<QString,encodedString*> bodyCache; 56 QMap<QString,encodedString*> bodyCache;
57}; 57};
58 58
59#endif 59#endif
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 62116ba..714396b 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -129,57 +129,73 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
129 qDebug("too deep recursion!"); 129 qDebug("too deep recursion!");
130 } 130 }
131 if (!message || !mime) { 131 if (!message || !mime) {
132 return; 132 return;
133 } 133 }
134 int r; 134 int r;
135 char*data = 0; 135 char*data = 0;
136 size_t len; 136 size_t len;
137 clistiter * cur = 0; 137 clistiter * cur = 0;
138 QString b; 138 QString b;
139 RecPart part; 139 RecPart part;
140 140
141 //current_count;
142
143 switch (mime->mm_type) { 141 switch (mime->mm_type) {
144 case MAILMIME_SINGLE: 142 case MAILMIME_SINGLE:
145 { 143 {
146 QValueList<int>countlist = recList; 144 QValueList<int>countlist = recList;
147 countlist.append(current_count); 145 countlist.append(current_count);
148 r = mailmessage_fetch_section(message,mime,&data,&len); 146 r = mailmessage_fetch_section(message,mime,&data,&len);
149 part.setSize(len); 147 part.setSize(len);
150 part.setPositionlist(countlist); 148 part.setPositionlist(countlist);
151 b = gen_attachment_id(); 149 b = gen_attachment_id();
152 part.setIdentifier(b); 150 part.setIdentifier(b);
153 fillSingleBody(part,message,mime); 151 fillSingleBody(part,message,mime);
154 if (part.Type()=="text" && target.Bodytext().isNull()) { 152 if (part.Type()=="text" && target.Bodytext().isNull()) {
155 encodedString*r = new encodedString(); 153 encodedString*r = new encodedString();
156 r->setContent(data,len); 154 r->setContent(data,len);
157 encodedString*res = decode_String(r,part.Encoding()); 155 encodedString*res = decode_String(r,part.Encoding());
156 if (countlist.count()>2) {
157 bodyCache[b]=r;
158 target.addPart(part);
159 } else {
160 delete r;
161 }
158 b = QString(res->Content()); 162 b = QString(res->Content());
159 delete r;
160 delete res; 163 delete res;
161 target.setBodytext(b); 164 target.setBodytext(b);
162 target.setDescription(part); 165 target.setDescription(part);
163 } else { 166 } else {
164 bodyCache[b]=new encodedString(data,len); 167 bodyCache[b]=new encodedString(data,len);
165 target.addPart(part); 168 target.addPart(part);
166 } 169 }
167 } 170 }
168 break; 171 break;
169 case MAILMIME_MULTIPLE: 172 case MAILMIME_MULTIPLE:
170 { 173 {
171 unsigned int ccount = current_count; 174 unsigned int ccount = 1;
175 mailmime*cbody=0;
176 QValueList<int>countlist = recList;
172 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 177 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
173 traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount); 178 cbody = (mailmime*)clist_content(cur);
179 if (cbody->mm_type==MAILMIME_MULTIPLE) {
180 RecPart targetPart;
181 targetPart.setType("multipart");
182 countlist.append(current_count);
183 targetPart.setPositionlist(countlist);
184 target.addPart(targetPart);
185 }
186 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
187 if (cbody->mm_type==MAILMIME_MULTIPLE) {
188 countlist = recList;
189 }
174 ++ccount; 190 ++ccount;
175 } 191 }
176 } 192 }
177 break; 193 break;
178 case MAILMIME_MESSAGE: 194 case MAILMIME_MESSAGE:
179 { 195 {
180 QValueList<int>countlist = recList; 196 QValueList<int>countlist = recList;
181 countlist.append(current_count); 197 countlist.append(current_count);
182 /* the own header is always at recursion 0 - we don't need that */ 198 /* the own header is always at recursion 0 - we don't need that */
183 if (current_rec > 0) { 199 if (current_rec > 0) {
184 part.setPositionlist(countlist); 200 part.setPositionlist(countlist);
185 r = mailmessage_fetch_section(message,mime,&data,&len); 201 r = mailmessage_fetch_section(message,mime,&data,&len);
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h
index c00d864..32b75c8 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.h
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.h
@@ -36,24 +36,24 @@ public:
36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 36 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
37 virtual void cleanMimeCache(); 37 virtual void cleanMimeCache();
38 38
39protected: 39protected:
40 RecMail *parseHeader( const char *header ); 40 RecMail *parseHeader( const char *header );
41 RecBody parseMail( mailmessage * msg ); 41 RecBody parseMail( mailmessage * msg );
42 QString parseMailboxList( mailimf_mailbox_list *list ); 42 QString parseMailboxList( mailimf_mailbox_list *list );
43 QString parseMailbox( mailimf_mailbox *box ); 43 QString parseMailbox( mailimf_mailbox *box );
44 QString parseGroup( mailimf_group *group ); 44 QString parseGroup( mailimf_group *group );
45 QString parseAddressList( mailimf_address_list *list ); 45 QString parseAddressList( mailimf_address_list *list );
46 QString parseDateTime( mailimf_date_time *date ); 46 QString parseDateTime( mailimf_date_time *date );
47 47
48 void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=0); 48 void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
49 static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); 49 static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);
50 static void fillParameters(RecPart&target,clist*parameters); 50 static void fillParameters(RecPart&target,clist*parameters);
51 static QString getencoding(mailmime_mechanism*aEnc); 51 static QString getencoding(mailmime_mechanism*aEnc);
52 virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox); 52 virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox);
53 53
54 QString msgTempName; 54 QString msgTempName;
55 unsigned int last_msg_id; 55 unsigned int last_msg_id;
56 QMap<QString,encodedString*> bodyCache; 56 QMap<QString,encodedString*> bodyCache;
57}; 57};
58 58
59#endif 59#endif