summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h3
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h5
-rw-r--r--kmicromail/libmailwrapper/storemail.cpp12
6 files changed, 35 insertions, 8 deletions
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 49227dd..28d45ce 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -213,32 +213,33 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
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 size_t index = 0; 223 size_t index = 0;
224 char*resu = 0; 224 char*resu = 0;
225 int err = MAILIMF_NO_ERROR; 225 int err = MAILIMF_NO_ERROR;
226 QString charset = part->searchParamter( "charset"); 226 QString charset = part->searchParamter( "charset");
227 qDebug("CHARSET %s ",charset.latin1() ); 227 qDebug("CHARSET %s ",charset.latin1() );
228 if ( !charset.isEmpty() ) { 228 if ( !charset.isEmpty() ) {
229 target->setCharset( charset );
229 err = mailmime_encoded_phrase_parse(charset.latin1(), 230 err = mailmime_encoded_phrase_parse(charset.latin1(),
230 b.latin1(), b.length(),&index, "utf-8",&resu); 231 b.latin1(), b.length(),&index, "utf-8",&resu);
231 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { 232 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
232 //qDebug("res %d %s ", index, resu); 233 //qDebug("res %d %s ", index, resu);
233 b = QString::fromUtf8(resu); 234 b = QString::fromUtf8(resu);
234 } 235 }
235 if (resu) free(resu); 236 if (resu) free(resu);
236 } 237 }
237 target->setBodytext(b); 238 target->setBodytext(b);
238 target->setDescription(part); 239 target->setDescription(part);
239 } else { 240 } else {
240 bodyCache[b]=new encodedString(data,len); 241 bodyCache[b]=new encodedString(data,len);
241 target->addPart(part); 242 target->addPart(part);
242 } 243 }
243 } 244 }
244 break; 245 break;
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index eb2b47d..2a54381 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -37,33 +37,33 @@ int IMAPwrapper::selectMbox(const QString&mbox)
37 return MAILIMAP_NO_ERROR; 37 return MAILIMAP_NO_ERROR;
38 } 38 }
39 int err = mailimap_select( m_imap, (char*)mbox.latin1()); 39 int err = mailimap_select( m_imap, (char*)mbox.latin1());
40 if ( err != MAILIMAP_NO_ERROR ) { 40 if ( err != MAILIMAP_NO_ERROR ) {
41 m_Lastmbox = ""; 41 m_Lastmbox = "";
42 return err; 42 return err;
43 } 43 }
44 m_Lastmbox = mbox; 44 m_Lastmbox = mbox;
45 return err; 45 return err;
46} 46}
47 47
48void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 48void IMAPwrapper::imap_progress( size_t current, size_t maximum )
49{ 49{
50 //qDebug("imap progress %d of %d ",current,maximum ); 50 //qDebug("imap progress %d of %d ",current,maximum );
51 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); 51 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
52 //qApp->processEvents() 52 //qApp->processEvents()
53 static int last = 0; 53 static unsigned int last = 0;
54 if ( last != current ) 54 if ( last != current )
55 IMAPwrapper::progress(); 55 IMAPwrapper::progress();
56 last = current; 56 last = current;
57} 57}
58void IMAPwrapper::progress( QString m ) 58void IMAPwrapper::progress( QString m )
59{ 59{
60 60
61 static QString mProgrMess; 61 static QString mProgrMess;
62 if ( m != QString::null ) { 62 if ( m != QString::null ) {
63 mProgrMess = m; 63 mProgrMess = m;
64 mCurrent = 1; 64 mCurrent = 1;
65 return; 65 return;
66 } 66 }
67 QString mess; 67 QString mess;
68 //qDebug("progress "); 68 //qDebug("progress ");
69 if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); 69 if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax);
@@ -276,36 +276,36 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
276 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); 276 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate());
277 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); 277 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size());
278 278
279 err = mailimap_fetch( m_imap, set, fetchType, &result ); 279 err = mailimap_fetch( m_imap, set, fetchType, &result );
280 mailimap_set_free( set ); 280 mailimap_set_free( set );
281 mailimap_fetch_type_free( fetchType ); 281 mailimap_fetch_type_free( fetchType );
282 282
283 QString date,subject,from; 283 QString date,subject,from;
284 284
285 if ( err == MAILIMAP_NO_ERROR ) { 285 if ( err == MAILIMAP_NO_ERROR ) {
286 tryAgain = -1; 286 tryAgain = -1;
287 mailimap_msg_att * msg_att; 287 mailimap_msg_att * msg_att;
288 int i = 0; 288 int i = 0;
289 for (current = clist_begin(result); current != 0; current=clist_next(current)) { 289 for (current = clist_begin(result); current != 0; current=clist_next(current)) {
290 ++i; 290 ++i;
291 //qDebug("iii %d ",i); 291 //qDebug("iii %d ",i);
292 msg_att = (mailimap_msg_att*)current->data; 292 msg_att = (mailimap_msg_att*)current->data;
293 RecMail*m = parse_list_result(msg_att); 293 RecMail*m = parse_list_result(msg_att);
294 if (m) { 294 if (m) {
295 if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) { 295 if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) {
296 m->setNumber(i); 296 m->setNumber(i);
297 m->setMbox(mailbox); 297 m->setMbox(mailbox);
298 m->setWrapper(this); 298 m->setWrapper(this);
299 target.append(m); 299 target.append(m);
300 } 300 }
301 } 301 }
302 } 302 }
303 Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); 303 Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count()));
304 } else { 304 } else {
305 --tryAgain; 305 --tryAgain;
306 --tryAgain;//disabled tryagain by adding this line 306 --tryAgain;//disabled tryagain by adding this line
307 if ( tryAgain < 0 ) 307 if ( tryAgain < 0 )
308 Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); 308 Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response));
309 else 309 else
310 qDebug("try again... "); 310 qDebug("try again... ");
311 } 311 }
@@ -402,33 +402,33 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
402 } 402 }
403 } else { 403 } else {
404 qDebug("error fetching folders "); 404 qDebug("error fetching folders ");
405 405
406 } 406 }
407 if (result) mailimap_list_result_free( result ); 407 if (result) mailimap_list_result_free( result );
408 return folders; 408 return folders;
409} 409}
410 410
411RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) 411RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
412{ 412{
413 RecMail * m = 0; 413 RecMail * m = 0;
414 mailimap_msg_att_item *item=0; 414 mailimap_msg_att_item *item=0;
415 clistcell *current,*c,*cf; 415 clistcell *current,*c,*cf;
416 mailimap_msg_att_dynamic*flist; 416 mailimap_msg_att_dynamic*flist;
417 mailimap_flag_fetch*cflag; 417 mailimap_flag_fetch*cflag;
418 int size; 418 int size = 0;
419 QBitArray mFlags(7); 419 QBitArray mFlags(7);
420 QStringList addresslist; 420 QStringList addresslist;
421 421
422 if (!m_att) { 422 if (!m_att) {
423 return m; 423 return m;
424 } 424 }
425 m = new RecMail(); 425 m = new RecMail();
426 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { 426 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
427 current = c; 427 current = c;
428 size = 0; 428 size = 0;
429 item = (mailimap_msg_att_item*)current->data; 429 item = (mailimap_msg_att_item*)current->data;
430 if ( !item ) 430 if ( !item )
431 continue; 431 continue;
432 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { 432 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
433 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; 433 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
434 if (!flist || !flist->att_list) { 434 if (!flist || !flist->att_list) {
@@ -748,32 +748,33 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
748 //odebug << "ID = " << id.latin1() << "" << oendl; 748 //odebug << "ID = " << id.latin1() << "" << oendl;
749 currentPart->setIdentifier(id); 749 currentPart->setIdentifier(id);
750 fillSinglePart(currentPart,part1); 750 fillSinglePart(currentPart,part1);
751 /* important: Check for is NULL 'cause a body can be empty! 751 /* important: Check for is NULL 'cause a body can be empty!
752 And we put it only into the mail if it is the FIRST part */ 752 And we put it only into the mail if it is the FIRST part */
753 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { 753 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
754 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); 754 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
755 755
756 size_t index = 0; 756 size_t index = 0;
757 char*res = 0; 757 char*res = 0;
758 int err = MAILIMF_NO_ERROR; 758 int err = MAILIMF_NO_ERROR;
759 759
760 QString charset = currentPart->searchParamter( "charset"); 760 QString charset = currentPart->searchParamter( "charset");
761 qDebug("CHARSET %s ",charset.latin1() ); 761 qDebug("CHARSET %s ",charset.latin1() );
762 //if ( false ) { 762 //if ( false ) {
763 if ( !charset.isEmpty() ) { 763 if ( !charset.isEmpty() ) {
764 target_body->setCharset( charset );
764 //err = mailmime_encoded_phrase_parse("iso-8859-1", 765 //err = mailmime_encoded_phrase_parse("iso-8859-1",
765 // text, strlen(text),&index, "iso-8859-1",&res); 766 // text, strlen(text),&index, "iso-8859-1",&res);
766 err = mailmime_encoded_phrase_parse(charset.latin1(), 767 err = mailmime_encoded_phrase_parse(charset.latin1(),
767 body_text.latin1(), body_text.length(),&index, "utf-8",&res); 768 body_text.latin1(), body_text.length(),&index, "utf-8",&res);
768 if (err == MAILIMF_NO_ERROR && res && strlen(res)) { 769 if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
769 //qDebug("res %d %s ", index, res); 770 //qDebug("res %d %s ", index, res);
770 body_text = QString::fromUtf8(res); 771 body_text = QString::fromUtf8(res);
771 } 772 }
772 if (res) free(res); 773 if (res) free(res);
773 } 774 }
774 //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); 775 //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
775 target_body->setDescription(currentPart); 776 target_body->setDescription(currentPart);
776 target_body->setBodytext(body_text); 777 target_body->setBodytext(body_text);
777 if (countlist.count()>1) { 778 if (countlist.count()>1) {
778 target_body->addPart(currentPart); 779 target_body->addPart(currentPart);
779 } 780 }
@@ -1169,33 +1170,33 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
1169 /* should we realy do that at this moment? */ 1170 /* should we realy do that at this moment? */
1170 err = mailimap_expunge(m_imap); 1171 err = mailimap_expunge(m_imap);
1171 if (err != MAILIMAP_NO_ERROR) { 1172 if (err != MAILIMAP_NO_ERROR) {
1172 Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response)); 1173 Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response));
1173 return 0; 1174 return 0;
1174 } 1175 }
1175 // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; 1176 // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
1176 return 1; 1177 return 1;
1177} 1178}
1178 1179
1179int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) 1180int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder)
1180{ 1181{
1181 if (folder.length()==0) return 0; 1182 if (folder.length()==0) return 0;
1182 login(); 1183 login();
1183 if (!m_imap) {return 0;} 1184 if (!m_imap) {return 0;}
1184 QString pre = account->getPrefix(); 1185 QString pre = account->getPrefix();
1185 if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { 1186 if (delemiter.length()>0 && pre.findRev(delemiter)!=((int)pre.length())-1) {
1186 pre+=delemiter; 1187 pre+=delemiter;
1187 } 1188 }
1188 if (parentfolder) { 1189 if (parentfolder) {
1189 pre += parentfolder->getDisplayName()+delemiter; 1190 pre += parentfolder->getDisplayName()+delemiter;
1190 } 1191 }
1191 pre+=folder; 1192 pre+=folder;
1192 if (getsubfolder) { 1193 if (getsubfolder) {
1193 if (delemiter.length()>0) { 1194 if (delemiter.length()>0) {
1194 pre+=delemiter; 1195 pre+=delemiter;
1195 } else { 1196 } else {
1196 Global::statusMessage(i18n("Cannot create folder %1 for holding subfolders").arg(pre)); 1197 Global::statusMessage(i18n("Cannot create folder %1 for holding subfolders").arg(pre));
1197 return 0; 1198 return 0;
1198 } 1199 }
1199 } 1200 }
1200 // odebug << "Creating " << pre.latin1() << "" << oendl; 1201 // odebug << "Creating " << pre.latin1() << "" << oendl;
1201 int res = mailimap_create(m_imap,pre.latin1()); 1202 int res = mailimap_create(m_imap,pre.latin1());
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index af3b9d0..89150ad 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -274,32 +274,33 @@ const QValueList<int>& RecPart::Positionlist()const
274{ 274{
275 return m_poslist; 275 return m_poslist;
276} 276}
277 277
278RecBody::RecBody() 278RecBody::RecBody()
279 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) 279 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
280{ 280{
281 m_PartsList.clear(); 281 m_PartsList.clear();
282} 282}
283 283
284RecBody::RecBody(const RecBody&old) 284RecBody::RecBody(const RecBody&old)
285 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) 285 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
286{ 286{
287 m_BodyText = old.m_BodyText; 287 m_BodyText = old.m_BodyText;
288 m_PartsList = old.m_PartsList; 288 m_PartsList = old.m_PartsList;
289 m_description = old.m_description; 289 m_description = old.m_description;
290 mCharset = old.mCharset;
290 // odebug << "Recbody copy constructor" << oendl; 291 // odebug << "Recbody copy constructor" << oendl;
291} 292}
292 293
293RecBody::~RecBody() 294RecBody::~RecBody()
294{ 295{
295} 296}
296 297
297void RecBody::setBodytext(const QString&bodyText) 298void RecBody::setBodytext(const QString&bodyText)
298{ 299{
299 m_BodyText = bodyText; 300 m_BodyText = bodyText;
300} 301}
301 302
302const QString& RecBody::Bodytext()const 303const QString& RecBody::Bodytext()const
303{ 304{
304 return m_BodyText; 305 return m_BodyText;
305} 306}
@@ -317,32 +318,42 @@ const QValueList<RecPartP>& RecBody::Parts()const
317 318
318void RecBody::addPart(const RecPartP& part) 319void RecBody::addPart(const RecPartP& part)
319{ 320{
320 m_PartsList.append(part); 321 m_PartsList.append(part);
321} 322}
322 323
323void RecBody::setDescription(const RecPartP&des) 324void RecBody::setDescription(const RecPartP&des)
324{ 325{
325 m_description = des; 326 m_description = des;
326} 327}
327 328
328const RecPartP& RecBody::Description()const 329const RecPartP& RecBody::Description()const
329{ 330{
330 return m_description; 331 return m_description;
331} 332}
332 333
334void RecBody::setCharset(const QString& str)
335{
336 mCharset = str;
337}
338
339QString RecBody::getCharset()const
340{
341 return mCharset;
342}
343
333/* handling encoded content */ 344/* handling encoded content */
334encodedString::encodedString() 345encodedString::encodedString()
335{ 346{
336 init(); 347 init();
337} 348}
338 349
339encodedString::encodedString(const char*nContent,unsigned int nSize) 350encodedString::encodedString(const char*nContent,unsigned int nSize)
340{ 351{
341 init(); 352 init();
342 setContent(nContent,nSize); 353 setContent(nContent,nSize);
343} 354}
344 355
345encodedString::encodedString(char*nContent,unsigned int nSize) 356encodedString::encodedString(char*nContent,unsigned int nSize)
346{ 357{
347 init(); 358 init();
348 setContent(nContent,nSize); 359 setContent(nContent,nSize);
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index c1c1a74..32d92c0 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -120,41 +120,44 @@ public:
120 120
121 121
122 void setParameters(const part_plist_t&list); 122 void setParameters(const part_plist_t&list);
123 const part_plist_t&Parameters()const; 123 const part_plist_t&Parameters()const;
124 void addParameter(const QString&key,const QString&value); 124 void addParameter(const QString&key,const QString&value);
125 const QString searchParamter(const QString&key)const; 125 const QString searchParamter(const QString&key)const;
126 void setPositionlist(const QValueList<int>&poslist); 126 void setPositionlist(const QValueList<int>&poslist);
127 const QValueList<int>& Positionlist()const; 127 const QValueList<int>& Positionlist()const;
128}; 128};
129 129
130typedef Opie::Core::OSmartPointer<RecPart> RecPartP; 130typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
131 131
132class RecBody:public Opie::Core::ORefCount 132class RecBody:public Opie::Core::ORefCount
133{ 133{
134protected: 134protected:
135 QString m_BodyText; 135 QString m_BodyText;
136 QString mCharset;
136 QValueList<RecPartP> m_PartsList; 137 QValueList<RecPartP> m_PartsList;
137 RecPartP m_description; 138 RecPartP m_description;
138 139
139public: 140public:
140 RecBody(); 141 RecBody();
141 RecBody(const RecBody&old); 142 RecBody(const RecBody&old);
142 virtual ~RecBody(); 143 virtual ~RecBody();
143 void setBodytext(const QString&); 144 void setBodytext(const QString&);
144 const QString& Bodytext()const; 145 const QString& Bodytext()const;
146 void setCharset(const QString&);
147 QString getCharset()const;
145 148
146 void setDescription(const RecPartP&des); 149 void setDescription(const RecPartP&des);
147 const RecPartP& Description()const; 150 const RecPartP& Description()const;
148 151
149 void setParts(const QValueList<RecPartP>&parts); 152 void setParts(const QValueList<RecPartP>&parts);
150 const QValueList<RecPartP>& Parts()const; 153 const QValueList<RecPartP>& Parts()const;
151 void addPart(const RecPartP&part); 154 void addPart(const RecPartP&part);
152}; 155};
153 156
154typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; 157typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
155 158
156class encodedString 159class encodedString
157{ 160{
158public: 161public:
159 encodedString(); 162 encodedString();
160 /* 163 /*
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 88f10da..ea6bf36 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -69,35 +69,38 @@ public:
69 void setMail( const QString&s ) { mail = s; } 69 void setMail( const QString&s ) { mail = s; }
70 const QString&getTo()const{ return to; } 70 const QString&getTo()const{ return to; }
71 void setTo( const QString&s ) { to = s; } 71 void setTo( const QString&s ) { to = s; }
72 const QString&getCC()const{ return cc; } 72 const QString&getCC()const{ return cc; }
73 void setCC( const QString&s ) { cc = s; } 73 void setCC( const QString&s ) { cc = s; }
74 const QString&getBCC()const { return bcc; } 74 const QString&getBCC()const { return bcc; }
75 void setBCC( const QString&s ) { bcc = s; } 75 void setBCC( const QString&s ) { bcc = s; }
76 const QString&getMessage()const { return message; } 76 const QString&getMessage()const { return message; }
77 void setMessage( const QString&s ) { message = s; } 77 void setMessage( const QString&s ) { message = s; }
78 const QString&getSubject()const { return subject; } 78 const QString&getSubject()const { return subject; }
79 void setSubject( const QString&s ) { subject = s; } 79 void setSubject( const QString&s ) { subject = s; }
80 const QString&getReply()const{ return reply; } 80 const QString&getReply()const{ return reply; }
81 void setReply( const QString&a ) { reply = a; } 81 void setReply( const QString&a ) { reply = a; }
82 void setInreply(const QStringList&list){m_in_reply_to = list;} 82 void setInreply(const QStringList&list){m_in_reply_to = list;}
83 const QStringList&Inreply()const{return m_in_reply_to;} 83 const QStringList&Inreply()const{return m_in_reply_to;}
84 84
85 void setCharset( const QString&a ) { charset= a; }
86 const QString& getCharset() { return charset; }
87
85private: 88private:
86 QList<Attachment> attList; 89 QList<Attachment> attList;
87 QString name, mail, to, cc, bcc, reply, subject, message; 90 QString name, mail, to, cc, bcc, reply, subject, message, charset;
88 QStringList m_in_reply_to; 91 QStringList m_in_reply_to;
89}; 92};
90 93
91class Folder:public Opie::Core::ORefCount 94class Folder:public Opie::Core::ORefCount
92{ 95{
93public: 96public:
94 Folder( const QString&init_name,const QString&sep ); 97 Folder( const QString&init_name,const QString&sep );
95 virtual ~Folder(); 98 virtual ~Folder();
96 const QString&getDisplayName()const { return nameDisplay; } 99 const QString&getDisplayName()const { return nameDisplay; }
97 const QString&getName()const { return name; } 100 const QString&getName()const { return name; }
98 const QString&getPrefix()const{return prefix; } 101 const QString&getPrefix()const{return prefix; }
99 virtual bool may_select()const{return true;} 102 virtual bool may_select()const{return true;}
100 virtual bool no_inferior()const{return true;} 103 virtual bool no_inferior()const{return true;}
101 const QString&Separator()const; 104 const QString&Separator()const;
102 105
103protected: 106protected:
diff --git a/kmicromail/libmailwrapper/storemail.cpp b/kmicromail/libmailwrapper/storemail.cpp
index ed1d44a..9d1735f 100644
--- a/kmicromail/libmailwrapper/storemail.cpp
+++ b/kmicromail/libmailwrapper/storemail.cpp
@@ -1,25 +1,26 @@
1#include "storemail.h" 1#include "storemail.h"
2#include "mailwrapper.h" 2#include "mailwrapper.h"
3#include "settings.h" 3#include "settings.h"
4#include "abstractmail.h" 4#include "abstractmail.h"
5 5
6#include <libetpan/libetpan.h> 6#include <libetpan/libetpan.h>
7#include <qstring.h> 7#include <qstring.h>
8 8
9#include <stdlib.h> 9#include <stdlib.h>
10#include <kglobal.h>
10 11
11using namespace Opie::Core; 12using namespace Opie::Core;
12Storemail::Storemail(Account*aAccount,const QString&aFolder) 13Storemail::Storemail(Account*aAccount,const QString&aFolder)
13 : Generatemail() 14 : Generatemail()
14{ 15{
15 wrapper = 0; 16 wrapper = 0;
16 m_Account = aAccount; 17 m_Account = aAccount;
17 m_tfolder = aFolder; 18 m_tfolder = aFolder;
18 wrapper = AbstractMail::getWrapper(m_Account); 19 wrapper = AbstractMail::getWrapper(m_Account);
19 if (wrapper) { 20 if (wrapper) {
20 wrapper->createMbox(m_tfolder); 21 wrapper->createMbox(m_tfolder);
21 } 22 }
22} 23}
23 24
24Storemail::Storemail(const QString&dir,const QString&aFolder) 25Storemail::Storemail(const QString&dir,const QString&aFolder)
25 : Generatemail() 26 : Generatemail()
@@ -52,34 +53,41 @@ Storemail::~Storemail()
52int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) 53int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
53{ 54{
54 if (!wrapper) return 0; 55 if (!wrapper) return 0;
55 int ret = 1; 56 int ret = 1;
56 57
57 mailmime * mimeMail = 0; 58 mailmime * mimeMail = 0;
58 mimeMail = createMimeMail(mail ); 59 mimeMail = createMimeMail(mail );
59 if ( mimeMail == NULL ) { 60 if ( mimeMail == NULL ) {
60 qDebug("storeMail: error creating mime mail "); 61 qDebug("storeMail: error creating mime mail ");
61 return 0; 62 return 0;
62 } 63 }
63 char *data; 64 char *data;
64 size_t size; 65 size_t size;
65 data = 0; 66 data = 0;
66 67
67 mailmessage * msg = 0; 68 mailmessage * msg = 0;
68 msg = mime_message_init(mimeMail); 69 msg = mime_message_init(mimeMail);
69 mime_message_set_tmpdir(msg,getenv( "HOME" )); 70 QString fileName;
71#ifdef DESKTOP_VERSION
72 fileName = locateLocal("tmp", "");
73#else
74 fileName = "/tmp/";
75#endif
76 //mime_message_set_tmpdir(msg,getenv( "HOME" ));
77 mime_message_set_tmpdir(msg,(char*)fileName.latin1());
70 int r = mailmessage_fetch(msg,&data,&size); 78 int r = mailmessage_fetch(msg,&data,&size);
71 mime_message_detach_mime(msg); 79 mime_message_detach_mime(msg);
72 mailmessage_free(msg); 80 mailmessage_free(msg);
73 msg = 0; 81 msg = 0;
74 if (r != MAIL_NO_ERROR || !data) { 82 if (r != MAIL_NO_ERROR || !data) {
75 qDebug("Error fetching mime... "); 83 qDebug("Error fetching mime... ");
76 ret = 0; 84 ret = 0;
77 } 85 }
78 86
79 if (ret) { 87 if (ret) {
80 wrapper->storeMessage(data,size,m_tfolder); 88 wrapper->storeMessage(data,size,m_tfolder);
81 } 89 }
82 90
83 if (data) { 91 if (data) {
84 free(data); 92 free(data);
85 } 93 }