summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp12
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp4
2 files changed, 7 insertions, 9 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 673f288..2d7533c 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -1,202 +1,200 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "abstractmail.h" 2#include "abstractmail.h"
3#include "imapwrapper.h" 3#include "imapwrapper.h"
4#include "pop3wrapper.h" 4#include "pop3wrapper.h"
5#include "nntpwrapper.h" 5#include "nntpwrapper.h"
6#include "mhwrapper.h" 6#include "mhwrapper.h"
7#include "mailtypes.h" 7#include "mailtypes.h"
8#include <qpe/global.h> 8#include <qpe/global.h>
9 9
10 10
11#include <qprogressbar.h> 11#include <qprogressbar.h>
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14 14
15#include <kdecore/kstandarddirs.h> 15#include <kdecore/kstandarddirs.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <stdlib.h> 18#include <stdlib.h>
19#include <libetpan/mailmime_content.h> 19#include <libetpan/mailmime_content.h>
20#include <libetpan/mailmime.h> 20#include <libetpan/mailmime.h>
21 21
22using namespace Opie::Core; 22using namespace Opie::Core;
23AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) 23AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
24{ 24{
25 return new IMAPwrapper(a); 25 return new IMAPwrapper(a);
26} 26}
27 27
28AbstractMail* AbstractMail::getWrapper(POP3account *a) 28AbstractMail* AbstractMail::getWrapper(POP3account *a)
29{ 29{
30 return new POP3wrapper(a); 30 return new POP3wrapper(a);
31} 31}
32 32
33AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) 33AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
34{ 34{
35 return new NNTPwrapper(a); 35 return new NNTPwrapper(a);
36} 36}
37 37
38AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) 38AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
39{ 39{
40 return new MHwrapper(a,name); 40 return new MHwrapper(a,name);
41} 41}
42 42
43AbstractMail* AbstractMail::getWrapper(Account*a) 43AbstractMail* AbstractMail::getWrapper(Account*a)
44{ 44{
45 if (!a) return 0; 45 if (!a) return 0;
46 switch (a->getType()) { 46 switch (a->getType()) {
47 case MAILLIB::A_IMAP: 47 case MAILLIB::A_IMAP:
48 return new IMAPwrapper((IMAPaccount*)a); 48 return new IMAPwrapper((IMAPaccount*)a);
49 break; 49 break;
50 case MAILLIB::A_POP3: 50 case MAILLIB::A_POP3:
51 return new POP3wrapper((POP3account*)a); 51 return new POP3wrapper((POP3account*)a);
52 break; 52 break;
53 case MAILLIB::A_NNTP: 53 case MAILLIB::A_NNTP:
54 return new NNTPwrapper((NNTPaccount*)a); 54 return new NNTPwrapper((NNTPaccount*)a);
55 break; 55 break;
56 default: 56 default:
57 return 0; 57 return 0;
58 } 58 }
59} 59}
60 60
61encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 61encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
62{ 62{
63 // odebug << "Decode string start" << oendl; 63 // odebug << "Decode string start" << oendl;
64 char*result_text; 64 char*result_text;
65 size_t index = 0; 65 size_t index = 0;
66 /* reset for recursive use! */ 66 /* reset for recursive use! */
67 size_t target_length = 0; 67 size_t target_length = 0;
68 result_text = 0; 68 result_text = 0;
69 int mimetype = MAILMIME_MECHANISM_7BIT; 69 int mimetype = MAILMIME_MECHANISM_7BIT;
70 if (enc.lower()=="quoted-printable") { 70 if (enc.lower()=="quoted-printable") {
71 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 71 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
72 } else if (enc.lower()=="base64") { 72 } else if (enc.lower()=="base64") {
73 mimetype = MAILMIME_MECHANISM_BASE64; 73 mimetype = MAILMIME_MECHANISM_BASE64;
74 } else if (enc.lower()=="8bit") { 74 } else if (enc.lower()=="8bit") {
75 mimetype = MAILMIME_MECHANISM_8BIT; 75 mimetype = MAILMIME_MECHANISM_8BIT;
76 } else if (enc.lower()=="binary") { 76 } else if (enc.lower()=="binary") {
77 mimetype = MAILMIME_MECHANISM_BINARY; 77 mimetype = MAILMIME_MECHANISM_BINARY;
78 } 78 }
79 79
80 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 80 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
81 &result_text,&target_length); 81 &result_text,&target_length);
82 82
83 encodedString* result = new encodedString(); 83 encodedString* result = new encodedString();
84 if (err == MAILIMF_NO_ERROR) { 84 if (err == MAILIMF_NO_ERROR) {
85 result->setContent(result_text,target_length); 85 result->setContent(result_text,target_length);
86 } 86 }
87 //odebug << "Decode string finished" << oendl; 87 //odebug << "Decode string finished" << oendl;
88 return result; 88 return result;
89} 89}
90 90
91QString AbstractMail::convert_String(const char*text) 91QString AbstractMail::convert_String(const char*text)
92{ 92{
93 //size_t index = 0; 93 size_t index = 0;
94 char*res = 0; 94 char*res = 0;
95 int err = MAILIMF_NO_ERROR; 95 int err = MAILIMF_NO_ERROR;
96 96
97 QString result(text); 97 QString result(text);
98 98
99 /* due a bug in libetpan it isn't usable this moment */ 99 err = mailmime_encoded_phrase_parse("iso-8859-1",
100/* int err = mailmime_encoded_phrase_parse("iso-8859-1", 100 text, strlen(text),&index, "iso-8859-1",&res);
101 text, strlen(text),&index, "iso-8859-1",&res);*/
102 //odebug << "Input: " << text << "" << oendl;
103 if (err == MAILIMF_NO_ERROR && res && strlen(res)) { 101 if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
104// result = QString(res); 102 result = QString(res);
105// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl;
106 } 103 }
104 //qDebug("convert_String:%s ",result.latin1() );
107 if (res) free(res); 105 if (res) free(res);
108 return result; 106 return result;
109} 107}
110 108
111/* cp & paste from launcher */ 109/* cp & paste from launcher */
112QString AbstractMail::gen_attachment_id() 110QString AbstractMail::gen_attachment_id()
113{ 111{
114 QFile file( "/proc/sys/kernel/random/uuid" ); 112 QFile file( "/proc/sys/kernel/random/uuid" );
115 if (!file.open(IO_ReadOnly ) ) 113 if (!file.open(IO_ReadOnly ) )
116 return QString::null; 114 return QString::null;
117 115
118 QTextStream stream(&file); 116 QTextStream stream(&file);
119 117
120 return "{" + stream.read().stripWhiteSpace() + "}"; 118 return "{" + stream.read().stripWhiteSpace() + "}";
121} 119}
122 120
123int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) 121int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
124{ 122{
125 return 0; 123 return 0;
126} 124}
127 125
128QString AbstractMail::defaultLocalfolder() 126QString AbstractMail::defaultLocalfolder()
129{ 127{
130 // QString f = getenv( "HOME" ); 128 // QString f = getenv( "HOME" );
131 QString f = locateLocal( "data", "kopiemail/localmail"); 129 QString f = locateLocal( "data", "kopiemail/localmail");
132 // f += "/Applications/opiemail/localmail"; 130 // f += "/Applications/opiemail/localmail";
133 return f; 131 return f;
134} 132}
135 133
136QString AbstractMail::draftFolder() 134QString AbstractMail::draftFolder()
137{ 135{
138 return QString("Drafts"); 136 return QString("Drafts");
139} 137}
140 138
141/* temporary - will be removed when implemented in all classes */ 139/* temporary - will be removed when implemented in all classes */
142void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) 140void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
143{ 141{
144} 142}
145void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) 143void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
146{ 144{
147 //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); 145 //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
148 // this is currently re-implemented in pop3wrapper and imapwrapper 146 // this is currently re-implemented in pop3wrapper and imapwrapper
149 int iii = 0; 147 int iii = 0;
150 int count = target.count(); 148 int count = target.count();
151 QProgressBar wid ( count ); 149 QProgressBar wid ( count );
152 wid.setCaption( tr("Deleting ...")); 150 wid.setCaption( tr("Deleting ..."));
153 wid.show(); 151 wid.show();
154 while (iii < count ) { 152 while (iii < count ) {
155 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 153 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
156 wid.setProgress( iii ); 154 wid.setProgress( iii );
157 wid.raise(); 155 wid.raise();
158 qApp->processEvents(); 156 qApp->processEvents();
159 RecMailP mail = (*target.at( iii )); 157 RecMailP mail = (*target.at( iii ));
160 deleteMail(mail); 158 deleteMail(mail);
161 ++iii; 159 ++iii;
162 } 160 }
163} 161}
164 162
165void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) 163void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
166{ 164{
167 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); 165 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
168 // get local folder 166 // get local folder
169 Account * acc = getAccount(); 167 Account * acc = getAccount();
170 if ( !acc ) return; 168 if ( !acc ) return;
171 QString lfName = acc->getLocalFolder(); 169 QString lfName = acc->getLocalFolder();
172 if ( lfName.isEmpty() ) 170 if ( lfName.isEmpty() )
173 lfName = acc->getAccountName(); 171 lfName = acc->getAccountName();
174 // create local folder 172 // create local folder
175 if ( !targetMail->createMbox(lfName)) 173 if ( !targetMail->createMbox(lfName))
176 { 174 {
177 QMessageBox::critical(0,tr("Error creating new Folder"), 175 QMessageBox::critical(0,tr("Error creating new Folder"),
178 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); 176 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
179 return; 177 return;
180 } 178 }
181 QValueList<RecMailP> t; 179 QValueList<RecMailP> t;
182 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); 180 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
183 if ( t.count() == 0 ) { 181 if ( t.count() == 0 ) {
184 qDebug("There are no new messages %s", fromFolder->getName().latin1()); 182 qDebug("There are no new messages %s", fromFolder->getName().latin1());
185 Global::statusMessage(tr("There are no new messages")); 183 Global::statusMessage(tr("There are no new messages"));
186 return; 184 return;
187 } 185 }
188 QValueList<RecMailP> e; 186 QValueList<RecMailP> e;
189 targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); 187 targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
190 //qDebug("target has mails %d ", e.count()); 188 //qDebug("target has mails %d ", e.count());
191 QValueList<RecMailP> n; 189 QValueList<RecMailP> n;
192 int iii = 0; 190 int iii = 0;
193 int count = t.count(); 191 int count = t.count();
194 while (iii < count ) { 192 while (iii < count ) {
195 RecMailP r = (*t.at( iii )); 193 RecMailP r = (*t.at( iii ));
196 bool found = false; 194 bool found = false;
197 int jjj = 0; 195 int jjj = 0;
198 int countE = e.count(); 196 int countE = e.count();
199 while (jjj < countE ) { 197 while (jjj < countE ) {
200 RecMailP re = (*e.at( jjj )); 198 RecMailP re = (*e.at( jjj ));
201 if ( re->isEqual(r) ) { 199 if ( re->isEqual(r) ) {
202 found = true; 200 found = true;
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index e691082..d89a5f9 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -185,197 +185,197 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) 185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
186{ 186{
187 if (current_rec >= 10) { 187 if (current_rec >= 10) {
188 ; // odebug << "too deep recursion!" << oendl; 188 ; // odebug << "too deep recursion!" << oendl;
189 } 189 }
190 if (!message || !mime) { 190 if (!message || !mime) {
191 return; 191 return;
192 } 192 }
193 int r; 193 int r;
194 char*data = 0; 194 char*data = 0;
195 size_t len; 195 size_t len;
196 clistiter * cur = 0; 196 clistiter * cur = 0;
197 QString b; 197 QString b;
198 RecPartP part = new RecPart(); 198 RecPartP part = new RecPart();
199 199
200 switch (mime->mm_type) { 200 switch (mime->mm_type) {
201 case MAILMIME_SINGLE: 201 case MAILMIME_SINGLE:
202 { 202 {
203 QValueList<int>countlist = recList; 203 QValueList<int>countlist = recList;
204 countlist.append(current_count); 204 countlist.append(current_count);
205 r = mailmessage_fetch_section(message,mime,&data,&len); 205 r = mailmessage_fetch_section(message,mime,&data,&len);
206 part->setSize(len); 206 part->setSize(len);
207 part->setPositionlist(countlist); 207 part->setPositionlist(countlist);
208 b = gen_attachment_id(); 208 b = gen_attachment_id();
209 part->setIdentifier(b); 209 part->setIdentifier(b);
210 fillSingleBody(part,message,mime); 210 fillSingleBody(part,message,mime);
211 if (part->Type()=="text" && target->Bodytext().isNull()) { 211 if (part->Type()=="text" && target->Bodytext().isNull()) {
212 encodedString*rs = new encodedString(); 212 encodedString*rs = new encodedString();
213 rs->setContent(data,len); 213 rs->setContent(data,len);
214 encodedString*res = decode_String(rs,part->Encoding()); 214 encodedString*res = decode_String(rs,part->Encoding());
215 if (countlist.count()>2) { 215 if (countlist.count()>2) {
216 bodyCache[b]=rs; 216 bodyCache[b]=rs;
217 target->addPart(part); 217 target->addPart(part);
218 } else { 218 } else {
219 delete rs; 219 delete rs;
220 } 220 }
221 b = QString(res->Content()); 221 b = QString(res->Content());
222 delete res; 222 delete res;
223 target->setBodytext(b); 223 target->setBodytext(b);
224 target->setDescription(part); 224 target->setDescription(part);
225 } else { 225 } else {
226 bodyCache[b]=new encodedString(data,len); 226 bodyCache[b]=new encodedString(data,len);
227 target->addPart(part); 227 target->addPart(part);
228 } 228 }
229 } 229 }
230 break; 230 break;
231 case MAILMIME_MULTIPLE: 231 case MAILMIME_MULTIPLE:
232 { 232 {
233 unsigned int ccount = 1; 233 unsigned int ccount = 1;
234 mailmime*cbody=0; 234 mailmime*cbody=0;
235 QValueList<int>countlist = recList; 235 QValueList<int>countlist = recList;
236 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 236 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
237 cbody = (mailmime*)clist_content(cur); 237 cbody = (mailmime*)clist_content(cur);
238 if (cbody->mm_type==MAILMIME_MULTIPLE) { 238 if (cbody->mm_type==MAILMIME_MULTIPLE) {
239 RecPartP targetPart = new RecPart(); 239 RecPartP targetPart = new RecPart();
240 targetPart->setType("multipart"); 240 targetPart->setType("multipart");
241 countlist.append(current_count); 241 countlist.append(current_count);
242 targetPart->setPositionlist(countlist); 242 targetPart->setPositionlist(countlist);
243 target->addPart(targetPart); 243 target->addPart(targetPart);
244 } 244 }
245 traverseBody(target,message, cbody,countlist,current_rec+1,ccount); 245 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
246 if (cbody->mm_type==MAILMIME_MULTIPLE) { 246 if (cbody->mm_type==MAILMIME_MULTIPLE) {
247 countlist = recList; 247 countlist = recList;
248 } 248 }
249 ++ccount; 249 ++ccount;
250 } 250 }
251 } 251 }
252 break; 252 break;
253 case MAILMIME_MESSAGE: 253 case MAILMIME_MESSAGE:
254 { 254 {
255 QValueList<int>countlist = recList; 255 QValueList<int>countlist = recList;
256 countlist.append(current_count); 256 countlist.append(current_count);
257 /* the own header is always at recursion 0 - we don't need that */ 257 /* the own header is always at recursion 0 - we don't need that */
258 if (current_rec > 0) { 258 if (current_rec > 0) {
259 part->setPositionlist(countlist); 259 part->setPositionlist(countlist);
260 r = mailmessage_fetch_section(message,mime,&data,&len); 260 r = mailmessage_fetch_section(message,mime,&data,&len);
261 part->setSize(len); 261 part->setSize(len);
262 part->setPositionlist(countlist); 262 part->setPositionlist(countlist);
263 b = gen_attachment_id(); 263 b = gen_attachment_id();
264 part->setIdentifier(b); 264 part->setIdentifier(b);
265 part->setType("message"); 265 part->setType("message");
266 part->setSubtype("rfc822"); 266 part->setSubtype("rfc822");
267 bodyCache[b]=new encodedString(data,len); 267 bodyCache[b]=new encodedString(data,len);
268 target->addPart(part); 268 target->addPart(part);
269 } 269 }
270 if (mime->mm_data.mm_message.mm_msg_mime != NULL) { 270 if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
271 traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); 271 traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
272 } 272 }
273 } 273 }
274 break; 274 break;
275 } 275 }
276} 276}
277 277
278RecBodyP Genericwrapper::parseMail( mailmessage * msg ) 278RecBodyP Genericwrapper::parseMail( mailmessage * msg )
279{ 279{
280 int err = MAILIMF_NO_ERROR; 280 int err = MAILIMF_NO_ERROR;
281 mailmime_single_fields fields; 281 //mailmime_single_fields fields;
282 /* is bound to msg and will be freed there */ 282 /* is bound to msg and will be freed there */
283 mailmime * mime=0; 283 mailmime * mime=0;
284 RecBodyP body = new RecBody(); 284 RecBodyP body = new RecBody();
285 memset(&fields, 0, sizeof(struct mailmime_single_fields)); 285 //memset(&fields, 0, sizeof(struct mailmime_single_fields));
286 err = mailmessage_get_bodystructure(msg,&mime); 286 err = mailmessage_get_bodystructure(msg,&mime);
287 QValueList<int>recList; 287 QValueList<int>recList;
288 traverseBody(body,msg,mime,recList); 288 traverseBody(body,msg,mime,recList);
289 return body; 289 return body;
290} 290}
291 291
292 292
293QString Genericwrapper::parseAddressList( mailimf_address_list *list ) 293QString Genericwrapper::parseAddressList( mailimf_address_list *list )
294{ 294{
295 QString result( "" ); 295 QString result( "" );
296 296
297 bool first = true; 297 bool first = true;
298 if (list == 0) return result; 298 if (list == 0) return result;
299 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { 299 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
300 mailimf_address *addr = (mailimf_address *) current->data; 300 mailimf_address *addr = (mailimf_address *) current->data;
301 301
302 if ( !first ) { 302 if ( !first ) {
303 result.append( "," ); 303 result.append( "," );
304 } else { 304 } else {
305 first = false; 305 first = false;
306 } 306 }
307 307
308 switch ( addr->ad_type ) { 308 switch ( addr->ad_type ) {
309 case MAILIMF_ADDRESS_MAILBOX: 309 case MAILIMF_ADDRESS_MAILBOX:
310 result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); 310 result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
311 break; 311 break;
312 case MAILIMF_ADDRESS_GROUP: 312 case MAILIMF_ADDRESS_GROUP:
313 result.append( parseGroup( addr->ad_data.ad_group ) ); 313 result.append( parseGroup( addr->ad_data.ad_group ) );
314 break; 314 break;
315 default: 315 default:
316 ; // odebug << "Generic: unkown mailimf address type" << oendl; 316 ; // odebug << "Generic: unkown mailimf address type" << oendl;
317 break; 317 break;
318 } 318 }
319 } 319 }
320 320
321 return result; 321 return result;
322} 322}
323 323
324QString Genericwrapper::parseGroup( mailimf_group *group ) 324QString Genericwrapper::parseGroup( mailimf_group *group )
325{ 325{
326 QString result( "" ); 326 QString result( "" );
327 327
328 result.append( group->grp_display_name ); 328 result.append( group->grp_display_name );
329 result.append( ": " ); 329 result.append( ": " );
330 330
331 if ( group->grp_mb_list != NULL ) { 331 if ( group->grp_mb_list != NULL ) {
332 result.append( parseMailboxList( group->grp_mb_list ) ); 332 result.append( parseMailboxList( group->grp_mb_list ) );
333 } 333 }
334 334
335 result.append( ";" ); 335 result.append( ";" );
336 336
337 return result; 337 return result;
338} 338}
339 339
340QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) 340QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
341{ 341{
342 QString result( "" ); 342 QString result( "" );
343 343
344 if ( box->mb_display_name == NULL ) { 344 if ( box->mb_display_name == NULL ) {
345 result.append( box->mb_addr_spec ); 345 result.append( box->mb_addr_spec );
346 } else { 346 } else {
347 result.append( convert_String(box->mb_display_name).latin1() ); 347 result.append( convert_String(box->mb_display_name).latin1() );
348 result.append( " <" ); 348 result.append( " <" );
349 result.append( box->mb_addr_spec ); 349 result.append( box->mb_addr_spec );
350 result.append( ">" ); 350 result.append( ">" );
351 } 351 }
352 352
353 return result; 353 return result;
354} 354}
355 355
356QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) 356QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list )
357{ 357{
358 QString result( "" ); 358 QString result( "" );
359 359
360 bool first = true; 360 bool first = true;
361 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { 361 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) {
362 mailimf_mailbox *box = (mailimf_mailbox *) current->data; 362 mailimf_mailbox *box = (mailimf_mailbox *) current->data;
363 363
364 if ( !first ) { 364 if ( !first ) {
365 result.append( "," ); 365 result.append( "," );
366 } else { 366 } else {
367 first = false; 367 first = false;
368 } 368 }
369 369
370 result.append( parseMailbox( box ) ); 370 result.append( parseMailbox( box ) );
371 } 371 }
372 372
373 return result; 373 return result;
374} 374}
375 375
376encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) 376encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part)
377{ 377{
378 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); 378 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
379 if (it==bodyCache.end()) return new encodedString(); 379 if (it==bodyCache.end()) return new encodedString();
380 encodedString*t = decode_String(it.data(),part->Encoding()); 380 encodedString*t = decode_String(it.data(),part->Encoding());
381 return t; 381 return t;