-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 11 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 11 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/storemail.cpp | 12 |
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 | |||
@@ -217,24 +217,25 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
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); |
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 | |||
@@ -41,25 +41,25 @@ int IMAPwrapper::selectMbox(const QString&mbox) | |||
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 | ||
48 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 48 | void 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 | } |
58 | void IMAPwrapper::progress( QString m ) | 58 | void 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; |
@@ -280,28 +280,28 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
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 ) |
@@ -406,25 +406,25 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
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 | ||
411 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 411 | RecMail*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 ) |
@@ -752,24 +752,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
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); |
@@ -1173,25 +1174,25 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) | |||
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 | ||
1179 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) | 1180 | int 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; |
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 | |||
@@ -278,24 +278,25 @@ const QValueList<int>& RecPart::Positionlist()const | |||
278 | RecBody::RecBody() | 278 | RecBody::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 | ||
284 | RecBody::RecBody(const RecBody&old) | 284 | RecBody::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 | ||
293 | RecBody::~RecBody() | 294 | RecBody::~RecBody() |
294 | { | 295 | { |
295 | } | 296 | } |
296 | 297 | ||
297 | void RecBody::setBodytext(const QString&bodyText) | 298 | void RecBody::setBodytext(const QString&bodyText) |
298 | { | 299 | { |
299 | m_BodyText = bodyText; | 300 | m_BodyText = bodyText; |
300 | } | 301 | } |
301 | 302 | ||
@@ -321,24 +322,34 @@ void RecBody::addPart(const RecPartP& part) | |||
321 | } | 322 | } |
322 | 323 | ||
323 | void RecBody::setDescription(const RecPartP&des) | 324 | void RecBody::setDescription(const RecPartP&des) |
324 | { | 325 | { |
325 | m_description = des; | 326 | m_description = des; |
326 | } | 327 | } |
327 | 328 | ||
328 | const RecPartP& RecBody::Description()const | 329 | const RecPartP& RecBody::Description()const |
329 | { | 330 | { |
330 | return m_description; | 331 | return m_description; |
331 | } | 332 | } |
332 | 333 | ||
334 | void RecBody::setCharset(const QString& str) | ||
335 | { | ||
336 | mCharset = str; | ||
337 | } | ||
338 | |||
339 | QString RecBody::getCharset()const | ||
340 | { | ||
341 | return mCharset; | ||
342 | } | ||
343 | |||
333 | /* handling encoded content */ | 344 | /* handling encoded content */ |
334 | encodedString::encodedString() | 345 | encodedString::encodedString() |
335 | { | 346 | { |
336 | init(); | 347 | init(); |
337 | } | 348 | } |
338 | 349 | ||
339 | encodedString::encodedString(const char*nContent,unsigned int nSize) | 350 | encodedString::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 | ||
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 | |||
@@ -124,33 +124,36 @@ public: | |||
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 | ||
130 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; | 130 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; |
131 | 131 | ||
132 | class RecBody:public Opie::Core::ORefCount | 132 | class RecBody:public Opie::Core::ORefCount |
133 | { | 133 | { |
134 | protected: | 134 | protected: |
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 | ||
139 | public: | 140 | public: |
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 | ||
154 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; | 157 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; |
155 | 158 | ||
156 | class encodedString | 159 | class encodedString |
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 | |||
@@ -73,27 +73,30 @@ public: | |||
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 | |||
85 | private: | 88 | private: |
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 | ||
91 | class Folder:public Opie::Core::ORefCount | 94 | class Folder:public Opie::Core::ORefCount |
92 | { | 95 | { |
93 | public: | 96 | public: |
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;} |
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,21 +1,22 @@ | |||
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 | ||
11 | using namespace Opie::Core; | 12 | using namespace Opie::Core; |
12 | Storemail::Storemail(Account*aAccount,const QString&aFolder) | 13 | Storemail::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 | } |
@@ -56,26 +57,33 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) | |||
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 | } |